[PATCH 0/2] LoongArch: Fix two bugs breaking IFUNC in static PIE

Xi Ruoyao xry111@xry111.site
Tue Sep 13 15:44:12 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.

[1]: https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601541.html

Xi Ruoyao (2):
  LoongArch: Avoid heap-buffer-overflow in
    loongarch_elf_relocate_section
  LoongArch: Fix R_LARCH_IRELATIVE insertion after elf_link_sort_relocs

 bfd/elfnn-loongarch.c | 59 +++++++++++++++++++++++--------------------
 1 file changed, 32 insertions(+), 27 deletions(-)

-- 
2.37.0



More information about the Binutils mailing list