This is an archive of the discontinued LLVM Phabricator instance.

[libc][bazel] Mark all libc public functions to have "default" visibility.
ClosedPublic

Authored by sivachandra on Dec 8 2022, 3:28 PM.

Details

Summary

For the bazel build, we also build all source files with
-fvisibility=hidden.

Diff Detail

Event Timeline

sivachandra created this revision.Dec 8 2022, 3:28 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 8 2022, 3:28 PM
sivachandra requested review of this revision.Dec 8 2022, 3:28 PM
gchatelet added inline comments.Dec 9 2022, 1:52 AM
libc/src/__support/common.h
25 ↗(On Diff #481462)

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.

utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
52

Thx!

86

This should be a defines attribute I think (and above as well)
https://bazel.build/reference/be/c-cpp#cc_binary.defines

  • Confine the change to bazel.
  • Use local_defines instead of copts to pass preprocessor defines.
Herald added a project: Restricted Project. · View Herald TranscriptDec 9 2022, 10:42 PM

PTAL

libc/src/__support/common.h
25 ↗(On Diff #481462)

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.

utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
86

I moved all preprocessor defines to local_defines now.

gchatelet accepted this revision.Dec 12 2022, 12:57 AM
This revision is now accepted and ready to land.Dec 12 2022, 12:57 AM