public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Fix two bugs breaking IFUNC in static PIE
@ 2022-09-20  6:09 Xi Ruoyao
  2022-09-20  6:09 ` [PATCH v2 1/2] LoongArch: Don't write into GOT for local ifunc Xi Ruoyao
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Xi Ruoyao @ 2022-09-20  6:09 UTC (permalink / raw)
  To: binutils; +Cc: liuzhensong, Lulu Cheng, Wang Xuerui, Chenghua Xu, Xi Ruoyao

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-20  9:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20  6:09 [PATCH v2 0/2] Fix two bugs breaking IFUNC in static PIE Xi Ruoyao
2022-09-20  6:09 ` [PATCH v2 1/2] LoongArch: Don't write into GOT for local ifunc Xi Ruoyao
2022-09-20  6:09 ` [PATCH v2 2/2] LoongArch: Fix R_LARCH_IRELATIVE insertion after elf_link_sort_relocs Xi Ruoyao
2022-09-20  9:29 ` [PATCH v2 0/2] Fix two bugs breaking IFUNC in static PIE liuzhensong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).