-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[LLD] [COFF] Fix handling of comdat .drectve sections #68116
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 all commits
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# REQUIRES: x86 | ||
|
||
# RUN: llvm-mc -triple=x86_64-windows-gnu %s -filetype=obj -o %t.obj | ||
|
||
# RUN: lld-link %t.obj -out:%t.exe -debug:symtab -subsystem:console | ||
# RUN: llvm-readobj --coff-exports %t.exe | FileCheck %s | ||
|
||
# CHECK: Name: exportedFunc | ||
|
||
## This assembly snippet has been reduced from what Clang generates from | ||
## this C snippet, with -fsanitize=address. Normally, the .drectve | ||
## section would be a regular section - but when compiled with | ||
## -fsanitize=address, it becomes a comdat section. | ||
## | ||
# void exportedFunc(void) {} | ||
# void mainCRTStartup(void) {} | ||
# static __attribute__((section(".drectve"), used)) const char export_chkstk[] = | ||
# "-export:exportedFunc"; | ||
|
||
.text | ||
.globl exportedFunc | ||
exportedFunc: | ||
retq | ||
|
||
.globl mainCRTStartup | ||
mainCRTStartup: | ||
retq | ||
|
||
.section .drectve,"dr",one_only,export_chkstk | ||
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. Should we leave that many spaces between 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. It's tabs; the whitespace in the test file is exactly as the compiler output it - I've just stripped out parts of the compiler output but not rewritten the whitespace and all that. |
||
export_chkstk: | ||
.asciz "-export:exportedFunc" |
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.
nit: you could also insert at L664:
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.
Thanks, I guess that'd work too.
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 it that way; thanks, that looks even neater!