-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Include linker generated symbol in default defined set #9416
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
base: main
Are you sure you want to change the base?
Conversation
|
@swift-ci please test |
|
|
||
| package init() { | ||
| self.defined = [] | ||
| self.defined = ["_GLOBAL_OFFSET_TABLE_"] |
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.
Can we leave a comment here why we include this?
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.
I have since found a bit more information about this. The PR has been updated to point to lld's source code (which provides a list of automatically defined symbols) as well as using the full list to avoid issues in the future hopefully.
fe2758b to
c60c8ec
Compare
It seems like `_GLOBAL_OFFSET_TABLE_` is defined by the linker without being present in any object file on x86_64. There are a few other symbols that the linker automatically defines although we haven't run into issues with them. I am including the full list I gathered from lld's source code [1] by default. [1] https://github.com/llvm/llvm-project/blob/177e38286cd61a7b5a968636e1f147f128dd25a2/lld/ELF/Config.h#L632
c60c8ec to
d0e8fed
Compare
|
@swift-ci please test |
|
Errors here seem unrelated... |
|
What problem is this change solving? This list will also be different on different platforms, compilers, architectures, etc.; how are we accounting for that? |
|
The problem that I ran into is that I build a static library in a
The GTO is not a problematic symbol here since it will get resolved at link time. |
|
Generally there are few well defined symbols that are expected to be inserted in the final binary by the linker, like |
|
@swift-ci please test |
It seems like
_GLOBAL_OFFSET_TABLE_is defined by the linker without being present in any object file on x86_64.