Skip to content

build: pass -Bsymbolic to the linker when linking a uspace module - #4603

Merged
BsAtHome merged 1 commit into
LinuxCNC:masterfrom
grandixximo:module-bsymbolic
Sep 28, 2026
Merged

BsAtHome merged 1 commit into
LinuxCNC:masterfrom
grandixximo:module-bsymbolic

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

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 -Bsymbolic as -B with the search prefix symbolic and does not pass it on, so no module has been linked symbolic since: readelf -d rtlib/*.so shows no SYMBOLIC entry on any of them.

With gcc 14.2, gcc -shared -Bsymbolic gives no SYMBOLIC entry and gcc -shared -Wl,-Bsymbolic does.

This writes it as -Wl,-Bsymbolic in 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.

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.
@BsAtHome
BsAtHome merged commit 9a240c0 into LinuxCNC:master Sep 28, 2026
17 checks passed
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.

2 participants