[libc-commits] [libc] 53cc24d - [libc] Disable hidden visibility for LIBC_NAMESPACE with GCC (#98549)

via libc-commits libc-commits at lists.llvm.org
Thu Jul 11 14:18:58 PDT 2024


Author: Petr Hosek
Date: 2024-07-11T14:18:55-07:00
New Revision: 53cc24d70d40c1b1ccc00ef2525c4006c8f4bdde

URL: https://github.com/llvm/llvm-project/commit/53cc24d70d40c1b1ccc00ef2525c4006c8f4bdde
DIFF: https://github.com/llvm/llvm-project/commit/53cc24d70d40c1b1ccc00ef2525c4006c8f4bdde.diff

LOG: [libc] Disable hidden visibility for LIBC_NAMESPACE with GCC (#98549)

GCC emits a warning when using the visibility attribute which needs to
be diagnosed and addressed, but this change should unbreak the GCC build
as a temporary workaround.

The issue is tracked as #98548.

Added: 
    

Modified: 
    libc/src/__support/macros/config.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/macros/config.h b/libc/src/__support/macros/config.h
index 5c3ec634449f8..8b1263e08249c 100644
--- a/libc/src/__support/macros/config.h
+++ b/libc/src/__support/macros/config.h
@@ -28,6 +28,7 @@
 #define LIBC_HAS_FEATURE(f) 0
 #endif
 
+#ifdef __clang__
 // Declare a LIBC_NAMESPACE with hidden visibility. `namespace
 // LIBC_NAMESPACE_DECL {` should be used around all declarations and definitions
 // for libc internals as opposed to just `namespace LIBC_NAMESPACE {`. This
@@ -37,5 +38,10 @@
 // dynamic relocations. This does not affect the public C symbols which are
 // controlled independently via `LLVM_LIBC_FUNCTION_ATTR`.
 #define LIBC_NAMESPACE_DECL [[gnu::visibility("hidden")]] LIBC_NAMESPACE
+#else
+// TODO(#98548): GCC emits a warning when using the visibility attribute which
+// needs to be diagnosed and addressed.
+#define LIBC_NAMESPACE_DECL LIBC_NAMESPACE
+#endif
 
 #endif // LLVM_LIBC_SRC___SUPPORT_MACROS_CONFIG_H


        


More information about the libc-commits mailing list