https://sourceware.org/bugzilla/show_bug.cgi?id=18548
Bug ID: 18548 Summary: gold incorrectly exports start/stop symbols (GLOBAL) Product: binutils Version: 2.25 Status: NEW Severity: normal Priority: P2 Component: gold Assignee: ccoutant at gmail dot com Reporter: dh.herrmann at gmail dot com CC: ian at airs dot com Target Milestone: --- Created attachment 8368 --> https://sourceware.org/bugzilla/attachment.cgi?id=8368&action=edit test.c: Example source file Hi Currently, gold incorrectly exports __start_SECTION and __stop_SECTION symbols if they're referenced by some code, even though the version script clearly marks them as local. This only happens with gold, bfd correctly hides them. The example source file test.c was compiled via: gcc -Wall -fvisibility=hidden -Wl,--version-script=test.sym -shared -fPIC -Wl,-fuse-ld=gold -o test.so test.c The symbol file (test.sym) I used is: MY_SYMBOLS { local: *; }; If compiled with gold, I see this: $ readelf --syms test.so | grep _MY_SECTION 6: 00000000000019bc 0 NOTYPE GLOBAL DEFAULT 24 __stop_MY_SECTION 7: 00000000000019b8 0 NOTYPE GLOBAL DEFAULT 24 __start_MY_SECTION 32: 00000000000019bc 0 NOTYPE GLOBAL DEFAULT 24 __stop_MY_SECTION 33: 00000000000019b8 0 NOTYPE GLOBAL DEFAULT 24 __start_MY_SECTION ..even though I expect to see this (as bfd produces): $ readelf --syms test.so | grep _MY_SECTION 41: 00000000002008ec 0 NOTYPE LOCAL DEFAULT 23 __stop_MY_SECTION 46: 00000000002008e8 0 NOTYPE LOCAL DEFAULT 23 __start_MY_SECTION A workaround is to explicitly add __attribute__((__visibility__("hidden"))) to the local declaration of the __start_* and __stop_* variables in the C file. Somehow, gold seems to discard the default visibility option for those symbols. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils