public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] riscv: add support for GNU indirect function
@ 2020-12-15  9:16 Vincent Chen
  2020-12-15  9:16 ` [PATCH v2 1/2] riscv: support " Vincent Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Vincent Chen @ 2020-12-15  9:16 UTC (permalink / raw)
  To: libc-alpha, palmer, darius, dj
  Cc: nelson.chu, jimw, paul.walmsley, Vincent Chen

The riscv Binutils supported GNU indirect function in the commit 
02dd9d25. To make the entire mechanism work, these patches adds the
required ports to enable Glibc to address the IRELATIVE relocation.

Because the dynamic linker resolves the IRELATIVE relocation before
jumping into the executable program, the $gp register is not initialized
when executing the IFUNC resolver function. It may cause some unexpected
error to occur when the dynamic loader resolves the IREALTIVE relocation
of the position-dependent executable program. To solve this issue, the
second patch enables dynamic linker to look for the __global_pointer$
symbol and use it to initialize $gp before resolving the IREALTIVE
relocation of the PDE program.


Changes since v1:
1. Move the riscv entry to the end of libc-abis file
2. Add the second input argument to IFUNC resolver to preserve the
   extension flexibility
3. Enable ld.so to initilize $gp by __global_pointer$ symbol instead
   of the DT_RISCV_GP dynamic entry to avoid to modify the riscv ELF
   psABI specification.


Vincent Chen (2):
  riscv: support GNU indirect function
  riscv: Initialize $gp before resolving the IRELATIVE relocation

 libc-abis                  |  1 +
 sysdeps/riscv/dl-irel.h    | 56 ++++++++++++++++++++++++++++++++++++++
 sysdeps/riscv/dl-machine.h | 44 +++++++++++++++++++++++++++++-
 3 files changed, 100 insertions(+), 1 deletion(-)
 create mode 100644 sysdeps/riscv/dl-irel.h

-- 
2.29.2


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

end of thread, other threads:[~2021-01-11  7:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15  9:16 [PATCH v2 0/2] riscv: add support for GNU indirect function Vincent Chen
2020-12-15  9:16 ` [PATCH v2 1/2] riscv: support " Vincent Chen
2020-12-15  9:16 ` [PATCH v2 2/2] riscv: Initialize $gp before resolving the IRELATIVE relocation Vincent Chen
2021-01-04  1:38 ` [PATCH v2 0/2] riscv: add support for GNU indirect function Vincent Chen
2021-01-05  1:53   ` Jim Wilson
2021-01-05  3:13     ` Nelson Chu
2021-01-05 12:32     ` Carlos O'Donell
2021-01-06  0:53       ` Vincent Chen
2021-01-11  2:29   ` DJ Delorie
2021-01-11  7:34     ` Nelson Chu

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).