diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2021-08-17 19:36:04 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2021-09-29 16:15:44 -0700 |
commit | 88361b408b9dbd313f15413cc2e6be0f1cafb01a (patch) | |
tree | 8c95b7ac2ae27783ebbfae890a3921d60a452370 /elf | |
parent | ee874f44fd55988808a4a162ef21bfa2cc8dc6f7 (diff) | |
download | glibc-88361b408b9dbd313f15413cc2e6be0f1cafb01a.zip glibc-88361b408b9dbd313f15413cc2e6be0f1cafb01a.tar.gz glibc-88361b408b9dbd313f15413cc2e6be0f1cafb01a.tar.bz2 |
elf: Copy l_addr/l_ld when adding ld.so to a new namespace
When add ld.so to a new namespace, we don't actually load ld.so. We
create a new link map and refers the real one for almost everything.
Copy l_addr and l_ld from the real ld.so link map to avoid GDB warning:
warning: .dynamic section for ".../elf/ld-linux-x86-64.so.2" is not at the expected address (wrong library or version mismatch?)
when handling shared library loaded by dlmopen.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-load.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c index 6ea7107..99c5ab8 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1026,6 +1026,10 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, /* Refer to the real descriptor. */ l->l_real = &GL(dl_rtld_map); + /* Copy l_addr and l_ld to avoid a GDB warning with dlmopen(). */ + l->l_addr = l->l_real->l_addr; + l->l_ld = l->l_real->l_ld; + /* No need to bump the refcount of the real object, ld.so will never be unloaded. */ __close_nocancel (fd); |