[haiku-commits] Re: BRANCH waddlesplash-github.libroot-sha256 [e6a3dfe38b01] src/system/libroot/posix/crypt src/kits/shared headers/private/libroot src headers/private/shared
- From: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
- To: haiku-commits@xxxxxxxxxxxxx
- Date: Tue, 3 Oct 2017 23:11:30 +0200
Another way would be to use __attribute__((section)) to move such
symbols to a separate section in the object file, and then make all
symbols from that section hidden from a linker script (if that's
possible).
AFAIK linker scripts can't affect symbol visibility. It is possible to
reduce the visibility of symbols with a version script, but it may not be
easy to capture all symbols in question. I guess its more or less the same
issue as with the asm directives: one would probably have to list all
symbols explicitly.
The version script seems to accept patterns (according to
http://www.scoberlin.de/content/media/http/informatik/gcc_docs/ld_3.html#SEC5),
which means we could use the common prefix for a given class and hide
all of its symbols this way.
I don't know if it's possible to specify all symbols in a section (using the
*(.sectionname) syntax) inside version commands. If that works, it would
be possible to combine it with __attribute__((section)), which would
allow to define symbol visibility inside C++ files (just like attribute
visibility would) - by just moving the private symbols to a separate
section so the linker script can easily find them.
--
Adrien.
Other related posts: