* Kilian Hanich via devel:
Am 02.04.24 um 10:22 schrieb Florian Weimer:
>> - Can some wrappers be developed to make it both easier and safer?
> GCC already provides function multi-versioning/target clones as a
> higher-level interface.
Also, upstreams should by default properly mark their stuffs with
restrictive visibilities.
While we are a few decades to change the defaults, that doesn't mean
that one can't choose the better option. So, by default one should
choose -fvisibility=hidden and mark the public API with
__attribute__((visibility("protected"))) or, if they really want a
function to be interpositionable (by e.g. LD_PRELOAD) as
__attribute__((visibility("default"))).
I think protected visibility is still broken on x86-64. For function
symbols, it's more convenient to use -fno-semantic-interposition and
rely on LTO to do the heavy lifting. For data symbols, it may be a
better longer term investment to add explicit export lists (maybe even
with symbol versioning), and again rely on LTO to make everything else
hidden.
Thanks,
Florian