Index: third_party/libc++/BUILD.gn |
diff --git a/third_party/libc++/BUILD.gn b/third_party/libc++/BUILD.gn |
index ff51ab9260f771fcdafc6fa7f937bbe0dff607aa..8fc686b6d28b1a229a6bf3f6bd7cd4105216f0ca 100644 |
--- a/third_party/libc++/BUILD.gn |
+++ b/third_party/libc++/BUILD.gn |
@@ -98,6 +98,18 @@ target(link_target_type, "libc++") { |
"trunk/src/valarray.cpp", |
"trunk/src/variant.cpp", |
] |
+ if (libcpp_is_static) { |
+ # Current gcc and clang do not allow declaring several allocation |
+ # operators with hidden visibility [1] [2], however we don't want |
+ # these symbols exported on static builds. This is a workaround |
+ # that takes advantage of an ELF visibility merging rule that |
+ # picks the "most hidden" visibility of all versions of a symbol, |
+ # even if the symbol is undefined. |
+ # |
+ # [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81107 |
+ # [2] https://bugs.llvm.org/show_bug.cgi?id=33473 |
+ sources += [ "alloc_visibility_overrides.S" ] |
+ } |
configs -= [ |
"//build/config/compiler:chromium_code", |
"//build/config/compiler:no_rtti", |