build: pass -Bsymbolic to the linker when linking a uspace module - #4603
Merged
Merged
Conversation
db36f0a linked modules with ld -shared -Bsymbolic, for two components that define the same data with extern linkage: each then binds to its own definition. 0e56b26 moved the link to the compiler driver and kept the flag as it was; the driver reads -Bsymbolic as -B with the search prefix "symbolic" and does not pass it on, so since then no module has been linked symbolic: readelf -d shows no SYMBOLIC entry on any of rtlib/*.so. Such a module's calls can bind to another object in scope that exports the same name. Write it as -Wl,-Bsymbolic, in the in-tree rule and in Makefile.modinc for modules built with halcompile.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
db36f0a (2009) linked realtime modules with
ld -shared -Bsymbolic, so that two components defining the same data with extern linkage each bind to their own. 0e56b26 (2010) moved the link to the compiler driver and kept the flag as it was. gcc reads-Bsymbolicas-Bwith the search prefixsymbolicand does not pass it on, so no module has been linked symbolic since:readelf -d rtlib/*.soshows no SYMBOLIC entry on any of them.With gcc 14.2,
gcc -shared -Bsymbolicgives no SYMBOLIC entry andgcc -shared -Wl,-Bsymbolicdoes.This writes it as
-Wl,-Bsymbolicin the in-tree rule and in Makefile.modinc for modules built with halcompile. After a rebuild all 231 modules carry SYMBOLIC.I found it when a module that exports the same names as another one in scope had its own calls bound to the other's definitions. Nothing in master does that today as far as I know, which is why it went unnoticed.