diff options
author | Colin Cross <ccross@android.com> | 2022-12-20 16:42:33 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2022-12-21 13:36:45 -0800 |
commit | 348d11e3b236b36f786741bdde1acf417a9b0d79 (patch) | |
tree | 49d6e4349476913f883bfbdace5698aa46e2f97a | |
parent | a46a14013843cbe753b7cb34f450507c399b04c8 (diff) | |
download | musl-348d11e3b236b36f786741bdde1acf417a9b0d79.tar.gz |
Don't use header_libs for musl crt objectsmain-16k-with-phones
Bazel considers the musl crt objects depending on a header lib
to be a circular dependency (toolchain -> crt objects -> header
lib -> toolchain). Make a copy of the headers in the crt defaults
instead of using the header libs.
Bug: 259266326
Bug: 263407827
Test: USE_HOST_MUSL=true build/bazel/ci/mixed_libc.sh
Test: m USE_HOST_MUSL=true
Change-Id: I6d1747e8b582e92daefda2384593164bf4ec19ea
-rw-r--r-- | Android.bp | 67 |
1 files changed, 56 insertions, 11 deletions
@@ -78,7 +78,7 @@ cc_library_headers { } cc_defaults { - name: "libc_musl_defaults", + name: "libc_musl_base_defaults", host_supported: true, device_supported: false, system_shared_libs: [], @@ -170,15 +170,6 @@ cc_defaults { asflags: ["-Wno-unused-command-line-argument"], - header_libs: [ - // The order here is very important, private headers like src/include/features.h override - // public headers like include/features.h, and arch headers like arch/x86_64/ksigaction.h - // override private headers like src/internal/ksigaction.h. - "libc_musl_arch_headers", - "libc_musl_private_headers", - "libc_musl_public_headers", - ], - stl: "none", c_std: "c99", sanitize: { @@ -197,6 +188,19 @@ cc_defaults { }, } +cc_defaults { + name: "libc_musl_defaults", + defaults: ["libc_musl_base_defaults"], + header_libs: [ + // The order here is very important, private headers like src/include/features.h override + // public headers like include/features.h, and arch headers like arch/x86_64/ksigaction.h + // override private headers like src/internal/ksigaction.h. + "libc_musl_arch_headers", + "libc_musl_private_headers", + "libc_musl_public_headers", + ], +} + cc_library_headers { name: "libc_musl_headers", visibility: ["//bionic/libc"], @@ -232,6 +236,14 @@ cc_library { "-nostdlib", ], dynamic_list: "dynamic.list", + export_header_lib_headers: [ + "libc_musl_arch_headers", + "libc_musl_public_headers", + "libc_llndk_headers", + ], + header_libs: [ + "libc_llndk_headers", + ], } // All the static parts of the main musl libc. Don't use this directly, use @@ -345,7 +357,7 @@ cc_library_shared { cc_defaults { name: "libc_musl_crt_defaults", - defaults: ["libc_musl_defaults"], + defaults: ["libc_musl_base_defaults"], cflags: [ // These are required to make sure the C code in crt/*.c // doesn't have any dependencies on libc. @@ -355,6 +367,39 @@ cc_defaults { ldflags: [ "-Wl,--no-gc-sections", ], + + // The headers below are the same as the header_libs in + // libc_musl_defaults, but bazel considers the crt depending + // on a header lib to be a circular dependency (toolchain -> + // crt objects -> header lib -> toolchain). + // TODO(b/263407827): go back to using header_libs once bazel + // supports it without introducing a dependency on the toolchain. + arch: { + arm: { + local_include_dirs: ["arch/arm"], + }, + arm64: { + local_include_dirs: ["arch/aarch64"], + }, + x86: { + local_include_dirs: ["arch/i386"], + }, + x86_64: { + local_include_dirs: ["arch/x86_64"], + }, + }, + generated_headers: [ + "libc_musl_alltypes.h", + "libc_musl_syscall.h", + "libc_musl_version.h", + ], + local_include_dirs: [ + "arch/generic", + "src/include", + "src/internal", + "android/include", + "include", + ], } cc_object { |