Add libdl.so to the list of system shared libs
Note that libdl is already (always) implicitly loaded because libc.so has a dependency on it. This change also makes sure that libc.so always goes before libdl.so in DT_NEEDED list. Bug: http://b/62815515 Test: make Change-Id: Idb231f8a8443ee859828bac6462236a1b7199d05
This commit is contained in:
17
cc/linker.go
17
cc/linker.go
@@ -152,11 +152,23 @@ func (linker *baseLinker) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !ctx.static() {
|
if !ctx.static() {
|
||||||
|
// libdl should always appear after libc in dt_needed list - see below
|
||||||
|
// the only exception is when libc is not in linker.Properties.System_shared_libs
|
||||||
|
// such as for libc module itself
|
||||||
|
if inList("libc", linker.Properties.System_shared_libs) {
|
||||||
|
_, deps.SharedLibs = removeFromList("libdl", deps.SharedLibs)
|
||||||
|
}
|
||||||
|
|
||||||
if linker.Properties.System_shared_libs != nil {
|
if linker.Properties.System_shared_libs != nil {
|
||||||
|
if !inList("libdl", linker.Properties.System_shared_libs) &&
|
||||||
|
inList("libc", linker.Properties.System_shared_libs) {
|
||||||
|
linker.Properties.System_shared_libs = append(linker.Properties.System_shared_libs,
|
||||||
|
"libdl")
|
||||||
|
}
|
||||||
deps.LateSharedLibs = append(deps.LateSharedLibs,
|
deps.LateSharedLibs = append(deps.LateSharedLibs,
|
||||||
linker.Properties.System_shared_libs...)
|
linker.Properties.System_shared_libs...)
|
||||||
} else if !ctx.sdk() && !ctx.vndk() {
|
} else if !ctx.sdk() && !ctx.vndk() {
|
||||||
deps.LateSharedLibs = append(deps.LateSharedLibs, "libc", "libm")
|
deps.LateSharedLibs = append(deps.LateSharedLibs, "libc", "libm", "libdl")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,10 +176,11 @@ func (linker *baseLinker) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
|
|||||||
deps.SharedLibs = append(deps.SharedLibs,
|
deps.SharedLibs = append(deps.SharedLibs,
|
||||||
"libc",
|
"libc",
|
||||||
"libm",
|
"libm",
|
||||||
|
"libdl",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if ctx.vndk() {
|
if ctx.vndk() {
|
||||||
deps.LateSharedLibs = append(deps.LateSharedLibs, "libc", "libm")
|
deps.LateSharedLibs = append(deps.LateSharedLibs, "libc", "libm", "libdl")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user