[build] Disable libc++ visibility annotations in our build
When building with -fvisibility=hidden, disable libc++ visibility
annotations to make sure that -fvisibility=hidden takes effect even
on symbols defined in libc++ headers.
Bug: MA-554
Test: manual
Change-Id: Id181cb4c8b5c542898641f788c26a98922a06564
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn
index b086555..aaee03d 100644
--- a/build/config/BUILD.gn
+++ b/build/config/BUILD.gn
@@ -203,6 +203,11 @@
}
config("symbol_visibility_hidden") {
+ # Disable libc++ visibility annotations to make sure that the compiler option
+ # has effect on symbols defined in libc++ headers. Note that we don't want to
+ # disable these annotations altogether to ensure that our toolchain is usable
+ # outside of our build since not every user uses hidden visibility by default.
+ defines = [ "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS" ]
cflags = [ "-fvisibility=hidden" ]
}