aboutsummaryrefslogtreecommitdiff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2023-12-08 09:51:34 +0100
committerFlorian Weimer <fweimer@redhat.com>2023-12-08 14:33:03 +0100
commitb3bee76c5f59498b9c189608f0a3132e2013fa1a (patch)
tree93d49eb46df401b8bbdaf7effe387f6a7f81fb26 /elf/rtld.c
parent60c57b8467f11e334e7c7fd07d588c248e93d952 (diff)
downloadglibc-b3bee76c5f59498b9c189608f0a3132e2013fa1a.zip
glibc-b3bee76c5f59498b9c189608f0a3132e2013fa1a.tar.gz
glibc-b3bee76c5f59498b9c189608f0a3132e2013fa1a.tar.bz2
elf: Initialize GLRO(dl_lazy) before relocating libc in dynamic startup
GLRO(dl_lazy) is used to set the parameters for the early _dl_relocate_object call, so the consider_profiling setting has to be applied before the call. Fixes commit 78ca44da0160a0b442f0ca1f253e3360f044b2ec ("elf: Relocate libc.so early during startup and dlmopen (bug 31083)"). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index f0b0f33..326286f 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2278,14 +2278,14 @@ dl_main (const ElfW(Phdr) *phdr,
int consider_profiling = GLRO(dl_profile) != NULL;
+ /* If we are profiling we also must do lazy reloaction. */
+ GLRO(dl_lazy) |= consider_profiling;
+
if (GL(dl_ns)[LM_ID_BASE].libc_map != NULL)
_dl_relocate_object (GL(dl_ns)[LM_ID_BASE].libc_map,
GL(dl_ns)[LM_ID_BASE].libc_map->l_scope,
GLRO(dl_lazy) ? RTLD_LAZY : 0, consider_profiling);
- /* If we are profiling we also must do lazy reloaction. */
- GLRO(dl_lazy) |= consider_profiling;
-
RTLD_TIMING_VAR (start);
rtld_timer_start (&start);
{