Allow cc_object to use libc headers under the VNDK
Bionic headers aren't implicit when building with the VNDK, they're
exported from libc. So add libc to the shared libraries of a cc_object
if it wants the standard flags.
Removes a duplicate No_default_compiler_flags
Test: Add cc_object with vendor_available, build on aosp_arm64_ab (VNDK-enabled)
Change-Id: I9bfcd1e1a65de4edc597bd348b79d625ecae4f5e
diff --git a/cc/object.go b/cc/object.go
index 1478908..3cc089c 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -53,6 +53,11 @@
func (*objectLinker) linkerInit(ctx BaseModuleContext) {}
func (object *objectLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
+ if !ctx.noDefaultCompilerFlags() && ctx.toolchain().Bionic() {
+ // Needed for VNDK builds where bionic headers aren't automatically added.
+ deps.LateSharedLibs = append(deps.LateSharedLibs, "libc")
+ }
+
deps.ObjFiles = append(deps.ObjFiles, object.Properties.Objs...)
return deps
}