From c71193ae53d65fd7d329b96729a8fb08d1e0ce7d Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Mon, 16 Dec 2019 09:55:10 -0800 Subject: [PATCH] Add whole_static_libs to non-svelte configs. This is to support enabling scudo only for non-svelte configs. Also, add exclude_static_libs to allow removing the jemalloc libs. Bug: 137795072 Test: Verified that a svelte and non-svelte config can use this method Test: to properly choose between scudo and jemalloc. Change-Id: Iec6bfe159f8491138e93dde1d225a8c874c7ce31 --- android/variable.go | 6 ++++-- cc/linker.go | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/android/variable.go b/android/variable.go index 74734913b..c5a6fb35b 100644 --- a/android/variable.go +++ b/android/variable.go @@ -43,8 +43,10 @@ type variableProperties struct { } `android:"arch_variant"` Malloc_not_svelte struct { - Cflags []string `android:"arch_variant"` - Shared_libs []string `android:"arch_variant"` + Cflags []string `android:"arch_variant"` + Shared_libs []string `android:"arch_variant"` + Whole_static_libs []string `android:"arch_variant"` + Exclude_static_libs []string `android:"arch_variant"` } `android:"arch_variant"` Safestack struct { diff --git a/cc/linker.go b/cc/linker.go index c2b4a3a53..3e4426996 100644 --- a/cc/linker.go +++ b/cc/linker.go @@ -164,6 +164,9 @@ type BaseLinkerProperties struct { // local file name to pass to the linker as --version_script Version_script *string `android:"path,arch_variant"` + + // list of static libs that should not be used to build this module + Exclude_static_libs []string } func NewBaseLinker(sanitize *sanitize) *baseLinker { @@ -209,6 +212,8 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps { deps.ReexportSharedLibHeaders = append(deps.ReexportSharedLibHeaders, linker.Properties.Export_shared_lib_headers...) deps.ReexportGeneratedHeaders = append(deps.ReexportGeneratedHeaders, linker.Properties.Export_generated_headers...) + deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, linker.Properties.Exclude_static_libs) + if Bool(linker.Properties.Use_version_lib) { deps.WholeStaticLibs = append(deps.WholeStaticLibs, "libbuildversion") }