Make libc_scudo always go first. am: 134f8f6f00

am: 2000f21705

Change-Id: Ie3fbc98f6f4b23ede09562635bae18bc24b6081a
This commit is contained in:
Christopher Ferris 2019-04-03 16:22:44 -07:00 committed by android-build-merger
commit 90625f92d9
2 changed files with 13 additions and 1 deletions

View file

@ -43,7 +43,8 @@ type variableProperties struct {
} `android:"arch_variant"`
Malloc_not_svelte struct {
Cflags []string `android:"arch_variant"`
Cflags []string `android:"arch_variant"`
Shared_libs []string `android:"arch_variant"`
} `android:"arch_variant"`
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
// to avoid loading libdl before libc.
if inList("libdl", systemSharedLibs) && inList("libc", systemSharedLibs) &&