aboutsummaryrefslogtreecommitdiffstats
path: root/cc/linker.go
diff options
context:
space:
mode:
Diffstat (limited to 'cc/linker.go')
-rw-r--r--cc/linker.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/cc/linker.go b/cc/linker.go
index 2c391320..1a842ae2 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -152,11 +152,23 @@ func (linker *baseLinker) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
}
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 !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,
linker.Properties.System_shared_libs...)
} 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,
"libc",
"libm",
+ "libdl",
)
}
if ctx.vndk() {
- deps.LateSharedLibs = append(deps.LateSharedLibs, "libc", "libm")
+ deps.LateSharedLibs = append(deps.LateSharedLibs, "libc", "libm", "libdl")
}
}