Add DefaultSharedLibraries to Toolchain
Move the default value for system_shared_libs out of linker.go and into
a new DefaultSharedLibraries method in Toolchain. This will simplify
adding system_shared_libs to cc_object, and adding new toolchains with
different default system_shared_libs.
Test: m checkbuild
Test: go test ./cc/...
Change-Id: I422315f090be20719c08a4d33bd39b0b26a93d6c
diff --git a/cc/linker.go b/cc/linker.go
index d9ee0cf..7b16b40 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -344,7 +344,7 @@
// Provide a default system_shared_libs if it is unspecified. Note: If an
// empty list [] is specified, it implies that the module declines the
// default system_shared_libs.
- deps.SystemSharedLibs = []string{"libc", "libm", "libdl"}
+ deps.SystemSharedLibs = append(deps.SystemSharedLibs, ctx.toolchain().DefaultSharedLibraries()...)
}
if inList("libdl", deps.SharedLibs) {
@@ -365,10 +365,10 @@
indexList("libdl", deps.SystemSharedLibs) < indexList("libc", deps.SystemSharedLibs) {
ctx.PropertyErrorf("system_shared_libs", "libdl must be after libc")
}
-
- deps.LateSharedLibs = append(deps.LateSharedLibs, deps.SystemSharedLibs...)
}
+ deps.LateSharedLibs = append(deps.LateSharedLibs, deps.SystemSharedLibs...)
+
if ctx.Fuchsia() {
if ctx.ModuleName() != "libbioniccompat" &&
ctx.ModuleName() != "libcompiler_rt-extras" &&