https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78747

Jan Engelhardt <jengelh at inai dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #4 from Jan Engelhardt <jengelh at inai dot de> ---
>So, are version-scripts with local:* basically incompatible with C++?

Answering myself: yes.

Symbols from library headers (inlines, typeinfos) can be spill-duplicated into
one's own program, such is the nature of contemporary C++ compilation.
Due to ODR, linkers need to collapse duplicate symbols. Only ELF global symbols
participate.

-fvisibility=hidden changes the default symbol visibility. A proper library
header therefore declares __attribute__((visibility("default"))) for its
exports; this way, the visibility of those spilled library symbols will stay
correct even if one's program is built with -fvisibility=hidden.

Version scripts however have the power to force-downgrade the visibility of
symbols in one's program, inhibiting the required collapse. So probably avoid
local:* when linking a C++ lib.

Reply via email to