Enable -fvisibility=hidden on static libraries by default.

Only on non-GCC2 for now, as GCC2 does not have -fvisibility.

An opt-out is left as a possibility, and is unfortunately necessary
for libshared and libicon, as these two are used even in WebKit instead
of linking to the .a. However, libcolumnlistview, libagg, and a whole
bunch of others are now no longer exported, so this is already a major
improvement on what symbols we were leaking.

This may provide performance differences for consumers of these APIs,
as GCC and the linker are now free to merge and directly use functions
that previously could have been semantically interposed. AGG usage in
app_server, especially, may benefit.

We can also now remove the addition from libnetservices, so do that.
This commit is contained in:
Augustin Cavalier
2021-09-08 17:32:47 -04:00
parent 03980b1fb0
commit 37ea891aad
7 changed files with 21 additions and 7 deletions
+6
View File
@@ -154,6 +154,12 @@ rule StaticLibrary
InheritPlatform $(objects) : $(lib) ;
if $(TARGET_CC_IS_LEGACY_GCC_$(TARGET_PACKAGING_ARCH)) = 0
&& [ on $(lib) return $(NO_HIDDEN_VISIBILITY) ] != 1 {
CCFLAGS on $(objects) += -fvisibility=hidden ;
C++FLAGS on $(objects) += -fvisibility=hidden ;
}
StaticLibraryFromObjects $(lib) : $(objects) $(otherObjects) ;
Objects $(2) ;
}