public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Jessica Clarke <jrtc27@jrtc27.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: Evan Green <evan@rivosinc.com>,
	libc-alpha@sourceware.org, slewis@rivosinc.com,
	Vineet Gupta <vineetg@rivosinc.com>,
	palmer@rivosinc.com
Subject: Re: [PATCH v8 3/6] riscv: Add __riscv_hwprobe pointer to ifunc calls
Date: Fri, 29 Sep 2023 20:49:09 +0100	[thread overview]
Message-ID: <80C0E219-6C20-49E5-89C4-899DEF6156D7@jrtc27.com> (raw)
In-Reply-To: <87v8bszs20.fsf@oldenburg.str.redhat.com>

On 29 Sep 2023, at 20:40, Florian Weimer <fweimer@redhat.com> wrote:
> 
> * Jessica Clarke:
> 
>> Being able to write portable IFUNC resolvers across Linux, BSDs and
>> other similar OSes is valuable, and this would preclude that. In FreeBSD
>> there are no issues with calling functions from IFUNC resolvers; we just
>> process all non-IRELATIVE relocations before IRELATIVE ones.
> 
> Even across multiple objects?  In glibc, we rely on relocation order by
> the link editor to put IRELATIVE last, so we don't have that particular
> problem for IRELATIVE, but we have it for regular symbol-based
> relocations that happen to refer to IFUNC symbols because the relocation
> order my not reflect the symbol binding order.

No, just within an object, but that’s fine so long as you relocate
objects in the order they appear in the link map. But you do need to
take care with relocations that happen to refer to IFUNCs, as you say;
they get deferred in FreeBSD too. This also means we’re not dependent
on the static linker’s relocation order for IRELATIVE.

I believe those guarantees are sufficient for allowing an IFUNC
resolver to call into libc functions like __riscv_hwprobe if in libc
itself or in a library linked against libc. The only issue would be
something like libgcc_s needing to do so, but that doesn’t seem like a
big deal, and can be worked around if you really need an IFUNC in
libgcc_s.

Jess


  reply	other threads:[~2023-09-29 19:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01 23:52 [PATCH v8 0/6] RISC-V: ifunced memcpy using new kernel hwprobe interface Evan Green
2023-09-01 23:52 ` [PATCH v8 1/6] riscv: Add Linux hwprobe syscall support Evan Green
2023-09-01 23:52 ` [PATCH v8 2/6] riscv: Add hwprobe vdso call support Evan Green
2023-09-01 23:52 ` [PATCH v8 3/6] riscv: Add __riscv_hwprobe pointer to ifunc calls Evan Green
2023-09-29 18:21   ` Jessica Clarke
2023-09-29 19:40     ` Florian Weimer
2023-09-29 19:49       ` Jessica Clarke [this message]
2023-10-17  4:46       ` Fangrui Song
2023-09-01 23:52 ` [PATCH v8 4/6] riscv: Enable multi-arg ifunc resolvers Evan Green
2023-09-01 23:52 ` [PATCH v8 5/6] riscv: Add ifunc helper method to hwprobe.h Evan Green
2023-09-01 23:52 ` [PATCH v8 6/6] riscv: Add and use alignment-ignorant memcpy Evan Green
2023-09-25 10:28 ` [PATCH v8 0/6] RISC-V: ifunced memcpy using new kernel hwprobe interface Palmer Dabbelt
2023-09-26  2:24   ` enh

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=80C0E219-6C20-49E5-89C4-899DEF6156D7@jrtc27.com \
    --to=jrtc27@jrtc27.com \
    --cc=evan@rivosinc.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=palmer@rivosinc.com \
    --cc=slewis@rivosinc.com \
    --cc=vineetg@rivosinc.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).