-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[ELF] Reject error-prone meta characters in input section description #84130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,24 +91,31 @@ SECTIONS { | |
.text : { *([.]abc .ab[v-y] ) } | ||
} | ||
|
||
## Test a few non-wildcard meta characters rejected by GNU ld. | ||
## Test a few non-wildcard characters rejected by GNU ld. | ||
|
||
#--- lbrace.lds | ||
# RUN: ld.lld -T lbrace.lds a.o -o out | ||
# RUN: not ld.lld -T lbrace.lds a.o 2>&1 | FileCheck %s --check-prefix=ERR-LBRACE --match-full-lines --strict-whitespace | ||
# ERR-LBRACE:{{.*}}: section pattern is expected | ||
# ERR-LBRACE-NEXT:>>> .text : { *(.a* { ) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it worth adding a case when there is no space between the disallowed character for example From reading the line and the tests all having the character separated by spaces, it made me double check that we could catch more than just a single isolated character.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the suggestion. Updated. Changed |
||
# ERR-LBRACE-NEXT:>>> ^ | ||
SECTIONS { | ||
.text : { *(.a* { ) } | ||
} | ||
|
||
#--- lparen.lds | ||
## ( is recognized as a section name pattern. Note, ( is rejected by GNU ld. | ||
# RUN: ld.lld -T lparen.lds a.o -o out | ||
# RUN: llvm-objdump --section-headers out | FileCheck --check-prefix=SEC-NO %s | ||
# RUN: not ld.lld -T lparen.lds a.o 2>&1 | FileCheck %s --check-prefix=ERR-LPAREN --match-full-lines --strict-whitespace | ||
# ERR-LPAREN:{{.*}}: section pattern is expected | ||
# ERR-LPAREN-NEXT:>>> .text : { *(.a* ( ) } | ||
# ERR-LPAREN-NEXT:>>> ^ | ||
SECTIONS { | ||
.text : { *(.a* ( ) } | ||
.text : { *(.a* ( ) } | ||
} | ||
|
||
#--- rbrace.lds | ||
# RUN: ld.lld -T rbrace.lds a.o -o out | ||
# RUN: not ld.lld -T rbrace.lds a.o 2>&1 | FileCheck %s --check-prefix=ERR-RBRACE --match-full-lines --strict-whitespace | ||
# ERR-RBRACE:{{.*}}: section pattern is expected | ||
# ERR-RBRACE-NEXT:>>> .text : { *(.a* } ) } | ||
# ERR-RBRACE-NEXT:>>> ^ | ||
SECTIONS { | ||
.text : { *(.a* } ) } | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest
// Detect common mistakes when certain non-wildcard meta characters are used without a closing
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated