From be763f7b16ba0da0f085302fd3e96c3512871c2b Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 26 Apr 2021 17:07:17 -0700 Subject: [PATCH] Skip default dependencies for header libraries Header libraries don't compile anything, so they don't need the default stl and libclang_rt dependencies. Trimming the dependencies simplifies using header libraries for LLNDK libraries, which need extra variants that don't exist for the default dependencies. Test: m checkbuild Change-Id: Ib9864c3cc7048b2cc52acf304830777b65a51877 --- cc/linker.go | 2 +- cc/stl.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cc/linker.go b/cc/linker.go index ae333563b..73fc4f0ee 100644 --- a/cc/linker.go +++ b/cc/linker.go @@ -322,7 +322,7 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps { if ctx.toolchain().Bionic() { // libclang_rt.builtins has to be last on the command line - if !Bool(linker.Properties.No_libcrt) { + if !Bool(linker.Properties.No_libcrt) && !ctx.header() { deps.LateStaticLibs = append(deps.LateStaticLibs, config.BuiltinsRuntimeLibrary(ctx.toolchain())) } diff --git a/cc/stl.go b/cc/stl.go index 4f8865fd2..75921c6ff 100644 --- a/cc/stl.go +++ b/cc/stl.go @@ -62,6 +62,8 @@ func (stl *stl) begin(ctx BaseModuleContext) { s := "" if stl.Properties.Stl != nil { s = *stl.Properties.Stl + } else if ctx.header() { + s = "none" } if ctx.useSdk() && ctx.Device() { switch s {