Make sure that ASAN runtime lib is the first DT_NEEDED one

Introduce a new tag earlySharedDepTag which is added in front of the
ordinary sharedDep dependencies. Dependency to the ASAN runtime lib is
added with the new tag.

Bug: 120894259
Bug: 121038155
Test: m; SANITIZE_TARGET=address m
Use readelf -d to see if the runtime lib is in the first DT_NEEDED one.

Change-Id: I90de6ab95df734a99995532d826564b13fe05316
This commit is contained in:
Jiyong Park
2019-01-18 14:37:08 +09:00
parent de54534d2a
commit 64a44f231d
4 changed files with 16 additions and 6 deletions

View File

@@ -363,8 +363,10 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
var sharedLibs android.Paths
// Ignore shared libs for static executables.
if !binary.static() {
sharedLibs = deps.SharedLibs
sharedLibs = deps.EarlySharedLibs
sharedLibs = append(sharedLibs, deps.SharedLibs...)
sharedLibs = append(sharedLibs, deps.LateSharedLibs...)
linkerDeps = append(linkerDeps, deps.EarlySharedLibsDeps...)
linkerDeps = append(linkerDeps, deps.SharedLibsDeps...)
linkerDeps = append(linkerDeps, deps.LateSharedLibsDeps...)
}