public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Vincent Chen <vincent.chen@sifive.com>
To: libc-alpha@sourceware.org, palmer@dabbelt.com,
	darius@bluespec.com, dj@redhat.com
Cc: nelson.chu@sifive.com, jimw@sifive.com, paul.walmsley@sifive.com,
	Vincent Chen <vincent.chen@sifive.com>
Subject: [PATCH v2 0/2] riscv: add support for GNU indirect function
Date: Tue, 15 Dec 2020 17:16:38 +0800	[thread overview]
Message-ID: <1608023800-14560-1-git-send-email-vincent.chen@sifive.com> (raw)

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


             reply	other threads:[~2020-12-15  9:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15  9:16 Vincent Chen [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1608023800-14560-1-git-send-email-vincent.chen@sifive.com \
    --to=vincent.chen@sifive.com \
    --cc=darius@bluespec.com \
    --cc=dj@redhat.com \
    --cc=jimw@sifive.com \
    --cc=libc-alpha@sourceware.org \
    --cc=nelson.chu@sifive.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).