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

The riscv Binutils supported GNU indirect function in the commit
02dd9d25. In order to make the whole mechanism work properly, the
first patch adds the required ports to enable Glibc to address the
riscv IRELATIVE relocation. 
In addition, since the dynamic linker resolves the IRELATIVE relocation
before jumping into the executable program, the $gp register has not
been initialized when the IFUNC resolver function is executed. It cause
that some unexpected error may occur when the dynamic loader resolves the
IREALTIVE relocation of the position-dependent executable program. To
solve this problem, a new RISCV specific dynamic entry, DT_RISCV_GP,
created by Binutils is used to record the gp address. The dynamic
linker can use it to initialize $gp register before resolving the
IREALTIVE relocation of the PDE program.
 
The related patch of DT_RISCV_GP in Binutils could be found in
https://sourceware.org/pipermail/binutils/2020-December/114346.html

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

 elf/elf.h                    |  4 +++
 libc-abis                    |  1 +
 sysdeps/riscv/dl-dtprocnum.h | 22 +++++++++++++++
 sysdeps/riscv/dl-irel.h      | 53 ++++++++++++++++++++++++++++++++++++
 sysdeps/riscv/dl-machine.h   | 31 +++++++++++++++++++++
 5 files changed, 111 insertions(+)
 create mode 100644 sysdeps/riscv/dl-dtprocnum.h
 create mode 100644 sysdeps/riscv/dl-irel.h

-- 
2.29.2


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

end of thread, other threads:[~2020-12-07 21:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-01 10:22 [PATCH 0/2] riscv: add support for GNU indirect function Vincent Chen
2020-12-01 10:22 ` [PATCH 1/2] riscv: Add " Vincent Chen
2020-12-01 11:14   ` Andreas Schwab
2020-12-01 11:42   ` Florian Weimer
2020-12-04  3:29     ` Vincent Chen
2020-12-04  5:57       ` Florian Weimer
2020-12-01 13:13   ` Szabolcs Nagy
2020-12-04  3:35     ` Vincent Chen
2020-12-01 10:23 ` [PATCH 2/2] riscv: Initialize $gp before resolving the IRELATIVE relocation Vincent Chen
2020-12-02  2:52 ` [PATCH 0/2] riscv: add support for GNU indirect function Jim Wilson
2020-12-07 21:36   ` Jim Wilson

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