Make libc_scudo always go first.

In addition, add Shared_libs to malloc_not_svelte.

Bug: 123689570

Test: Verified that libc_scudo is first wherever it is added.
Change-Id: Ibdc5dbd019a382630a727c270f846aa4446f8d99
Merged-In: Ibdc5dbd019a382630a727c270f846aa4446f8d99
This commit is contained in:
Christopher Ferris
2019-04-01 16:30:21 -07:00
parent b007b2bde5
commit 134f8f6f00
2 changed files with 13 additions and 1 deletions

View File

@@ -43,7 +43,8 @@ type variableProperties struct {
} `android:"arch_variant"` } `android:"arch_variant"`
Malloc_not_svelte struct { Malloc_not_svelte struct {
Cflags []string `android:"arch_variant"` Cflags []string `android:"arch_variant"`
Shared_libs []string `android:"arch_variant"`
} `android:"arch_variant"` } `android:"arch_variant"`
Safestack struct { Safestack struct {

View File

@@ -255,6 +255,17 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
} }
} }
if inList("libc_scudo", deps.SharedLibs) {
// libc_scudo is an alternate implementation of all
// allocation functions (malloc, free), that uses
// the scudo allocator instead of the default native
// allocator. If this library is in the list, make
// sure it's first so it properly overrides the
// allocation functions of all other shared libraries.
_, deps.SharedLibs = removeFromList("libc_scudo", deps.SharedLibs)
deps.SharedLibs = append([]string{"libc_scudo"}, deps.SharedLibs...)
}
// If libc and libdl are both in system_shared_libs make sure libdl comes after libc // If libc and libdl are both in system_shared_libs make sure libdl comes after libc
// to avoid loading libdl before libc. // to avoid loading libdl before libc.
if inList("libdl", systemSharedLibs) && inList("libc", systemSharedLibs) && if inList("libdl", systemSharedLibs) && inList("libc", systemSharedLibs) &&