keep statically linked libc++ symbols hidden.

This commit is contained in:
xavier 2021-05-23 16:53:47 +02:00
parent 40d8518253
commit a6e65f3a0e
2 changed files with 6 additions and 1 deletions

View File

@ -129,6 +129,8 @@ pub fn buildLibCXX(comp: *Compilation) !void {
try cflags.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS");
try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS");
try cflags.append("-D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS");
try cflags.append("-fvisibility=hidden");
try cflags.append("-fvisibility-inlines-hidden");
if (target.abi.isMusl()) {
try cflags.append("-D_LIBCPP_HAS_MUSL_LIBC");
@ -144,7 +146,6 @@ pub fn buildLibCXX(comp: *Compilation) !void {
try cflags.append("-fPIC");
}
try cflags.append("-nostdinc++");
try cflags.append("-fvisibility-inlines-hidden");
try cflags.append("-std=c++14");
try cflags.append("-Wno-user-defined-literals");
@ -249,6 +250,8 @@ pub fn buildLibCXXABI(comp: *Compilation) !void {
try cflags.append("-D_LIBCXXABI_BUILDING_LIBRARY");
try cflags.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS");
try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS");
try cflags.append("-fvisibility=hidden");
try cflags.append("-fvisibility-inlines-hidden");
if (target.abi.isMusl()) {
try cflags.append("-D_LIBCPP_HAS_MUSL_LIBC");

View File

@ -69,6 +69,8 @@ pub fn buildStaticLib(comp: *Compilation) !void {
}
try cflags.append("-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS");
try cflags.append("-Wa,--noexecstack");
try cflags.append("-fvisibility=hidden");
try cflags.append("-fvisibility-inlines-hidden");
// This is intentionally always defined because the macro definition means, should it only
// build for the target specified by compiler defines. Since we pass -target the compiler