Skip to content

Conversation

@daniel-grumberg
Copy link
Contributor

It seems like _GLOBAL_OFFSET_TABLE_ is defined by the linker without being present in any object file on x86_64.

@daniel-grumberg
Copy link
Contributor Author

@swift-ci please test


package init() {
self.defined = []
self.defined = ["_GLOBAL_OFFSET_TABLE_"]
Copy link
Member

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?

Copy link
Contributor Author

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.

@daniel-grumberg daniel-grumberg force-pushed the dgrumberg/reserved-symbols branch from fe2758b to c60c8ec Compare November 25, 2025 15:45
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
@daniel-grumberg daniel-grumberg force-pushed the dgrumberg/reserved-symbols branch from c60c8ec to d0e8fed Compare November 25, 2025 15:46
@daniel-grumberg
Copy link
Contributor Author

@swift-ci please test

@daniel-grumberg
Copy link
Contributor Author

Errors here seem unrelated...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants