[libc-commits] [PATCH] D139678: [libc][bazel] Mark all libc public functions to have "default" visibility.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Dec 9 23:16:22 PST 2022


sivachandra added a comment.

PTAL



================
Comment at: libc/src/__support/common.h:25
 #ifndef LLVM_LIBC_FUNCTION_ATTR
-#define LLVM_LIBC_FUNCTION_ATTR
+#define LLVM_LIBC_FUNCTION_ATTR __attribute__((visibility("default")))
 #endif
----------------
gchatelet wrote:
> Since we're carefully defining it in the build system I think it makes sense to err if the attribute is not defined otherwise it's complicated to reason about it and debug.
> ```
> #error make sure that LLVM_LIBC_FUNCTION_ATTR is defined in either CMake of Bazel configuration
> ```
> 
> Then we'd need the same logic in CMake.
I removed this change now - we will keep the definition of the macro up to the individual build system. The "default" visibility thing is now added only for Bazel.


================
Comment at: utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl:81
+        default_vis = "__attribute__((visibility(\"default\")))"
+        copts.append("-DLLVM_LIBC_FUNCTION_ATTR='%s %s'" % (weak_attr, default_vis))
+    _libc_library(
----------------
gchatelet wrote:
> This should be a `defines` attribute I think (and above as well)
> https://bazel.build/reference/be/c-cpp#cc_binary.defines
I moved all preprocessor defines to `local_defines` now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139678/new/

https://reviews.llvm.org/D139678



More information about the libc-commits mailing list