Support grouping static libraries
LLVM has complicated static library layering that sometimes changes.
The make solution was to list all the static libraries twice, but
Soong dedups the list. Add a group_static_libs flag to allow
surrounding the static libs with -Wl,--start-group and
-Wl,--end-group.
Test: mmma -j external/llvm
Change-Id: Ic08a183d7def9c9249d4a3014760759f16b68d04
diff --git a/cc/linker.go b/cc/linker.go
index 6d4edbc..dac51d6 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -76,6 +76,10 @@
// don't link in crt_begin and crt_end. This flag should only be necessary for
// compiling crt or libc.
Nocrt *bool `android:"arch_variant"`
+
+ // group static libraries. This can resolve missing symbols issues with interdependencies
+ // between static libraries, but it is generally better to order them correctly instead.
+ Group_static_libs *bool `android:"arch_variant"`
}
func NewBaseLinker() *baseLinker {
@@ -193,6 +197,10 @@
flags.LdFlags = append(flags.LdFlags, toolchain.ToolchainLdflags())
}
+ if Bool(linker.Properties.Group_static_libs) {
+ flags.GroupStaticLibs = true
+ }
+
return flags
}