mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-26 12:41:05 +00:00
RISC-V: Fix the static-PIE non-relocated object check
The value of l_scope is only valid post relocation, so this original
check was triggering undefined behavior. Instead just directly check to
see if the object has been relocated, at which point using l_scope is
safe.
Reported-by: Andreas Schwab <schwab@suse.de>
Closes: BZ #31317
Fixes: e0590f41fe
("RISC-V: Enable static-pie.")
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
This commit is contained in:
parent
dc1a77269c
commit
96d1b9ac23
@ -348,7 +348,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[],
|
||||
gotplt[1] = (ElfW(Addr)) l;
|
||||
}
|
||||
|
||||
if (l->l_type == lt_executable && l->l_scope != NULL)
|
||||
if (l->l_type == lt_executable && l->l_relocated)
|
||||
{
|
||||
/* The __global_pointer$ may not be defined by the linker if the
|
||||
$gp register does not be used to access the global variable
|
||||
|
Loading…
Reference in New Issue
Block a user