[PATCH v2 0/2] Fix two bugs breaking IFUNC in static PIE
Xi Ruoyao
xry111@xry111.site
Tue Sep 20 06:09:28 GMT 2022
To generate a static PIE, the compiler should pass "-static -pie
--no-dynamic-linker -z text" options to the linker [1]. But, LoongArch
BFD linker currently produces wrong result (missing R_LARCH_IRELATIVE
relocs) with IFUNC and those options, causing test failures in Glibc if
static PIE is enabled. Fix them now.
For the detailed analysis of the bugs see the commit messages.
Changes v1 -> v2:
- Stop writing into GOT for local ifunc.
- Add a test case for R_LARCH_IRELATIVE insertion.
[1]: https://gcc.gnu.org/r13-2728
Xi Ruoyao (2):
LoongArch: Don't write into GOT for local ifunc
LoongArch: Fix R_LARCH_IRELATIVE insertion after elf_link_sort_relocs
bfd/elfnn-loongarch.c | 46 +++++++++++--------
.../ld-loongarch-elf/ld-loongarch-elf.exp | 1 +
.../ld-loongarch-elf/local-ifunc-reloc.d | 12 +++++
.../ld-loongarch-elf/local-ifunc-reloc.s | 28 +++++++++++
4 files changed, 68 insertions(+), 19 deletions(-)
create mode 100644 ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.d
create mode 100644 ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.s
--
2.37.0
More information about the Binutils
mailing list