mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-04 19:00:09 +00:00
powerpc: Fix ld.so address determination for PCREL mode (bug 31640)
This seems to have stopped working with some GCC 14 versions,
which clobber r2. With other compilers, the kernel-provided
r2 value is still available at this point.
Reviewed-by: Peter Bergner <bergner@linux.ibm.com>
(cherry picked from commit 14e56bd4ce
)
This commit is contained in:
parent
7b92f46f04
commit
edb9a76e30
@ -78,6 +78,7 @@ elf_host_tolerates_class (const Elf64_Ehdr *ehdr)
|
|||||||
static inline Elf64_Addr
|
static inline Elf64_Addr
|
||||||
elf_machine_load_address (void) __attribute__ ((const));
|
elf_machine_load_address (void) __attribute__ ((const));
|
||||||
|
|
||||||
|
#ifndef __PCREL__
|
||||||
static inline Elf64_Addr
|
static inline Elf64_Addr
|
||||||
elf_machine_load_address (void)
|
elf_machine_load_address (void)
|
||||||
{
|
{
|
||||||
@ -105,6 +106,24 @@ elf_machine_dynamic (void)
|
|||||||
/* Then subtract off the load address offset. */
|
/* Then subtract off the load address offset. */
|
||||||
return runtime_dynamic - elf_machine_load_address() ;
|
return runtime_dynamic - elf_machine_load_address() ;
|
||||||
}
|
}
|
||||||
|
#else /* __PCREL__ */
|
||||||
|
/* In PCREL mode, r2 may have been clobbered. Rely on relative
|
||||||
|
relocations instead. */
|
||||||
|
|
||||||
|
static inline ElfW(Addr)
|
||||||
|
elf_machine_load_address (void)
|
||||||
|
{
|
||||||
|
extern const ElfW(Ehdr) __ehdr_start attribute_hidden;
|
||||||
|
return (ElfW(Addr)) &__ehdr_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline ElfW(Addr)
|
||||||
|
elf_machine_dynamic (void)
|
||||||
|
{
|
||||||
|
extern ElfW(Dyn) _DYNAMIC[] attribute_hidden;
|
||||||
|
return (ElfW(Addr)) _DYNAMIC - elf_machine_load_address ();
|
||||||
|
}
|
||||||
|
#endif /* __PCREL__ */
|
||||||
|
|
||||||
/* The PLT uses Elf64_Rela relocs. */
|
/* The PLT uses Elf64_Rela relocs. */
|
||||||
#define elf_machine_relplt elf_machine_rela
|
#define elf_machine_relplt elf_machine_rela
|
||||||
|
Loading…
Reference in New Issue
Block a user