mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Max Filippov <jcmvbkbc@gmail.com>
Cc: musl@lists.openwall.com
Subject: Re: [musl] Initial xtensa/fdpic port review
Date: Thu, 29 Feb 2024 10:35:31 -0500	[thread overview]
Message-ID: <20240229153531.GT4163@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAMo8Bf+bA-a0vgi1uxBbiHfFMUgkn8ceJy+jjHaCwogSsJgiMw@mail.gmail.com>

On Thu, Feb 29, 2024 at 04:03:02AM -0800, Max Filippov wrote:
> On Wed, Feb 28, 2024 at 1:28 PM Max Filippov <jcmvbkbc@gmail.com> wrote:
> > On Wed, Feb 28, 2024 at 10:30 AM Rich Felker <dalias@libc.org> wrote:
> > > Is there a reason local, relative jumps/calls can't be done by
> > > computing the address of a nearby label and using the offset relative
> > > to that? That's how they (at least some types; I forget the details)
> > > work on sh/fdpic.
> >
> > IIUC that would require the actual PC knowledge and there's no direct
> > access to the PC on xtensa.
> 
> I thought about it for a bit and although the current PC can easily
> be fetched I don't see how it can work for multiple text segments
> without a GOT entry. OTOH a link-time conversion of a call without
> GOT to a call with GOT in case the target and the call site are in
> the different text segments seems feasible.

With multiple text segments, a cross-segment call cannot be relative
to begin with. Because fdpic lets them float independently, it would
have to go thru the GOT.

Rather than having the linker convert calls *to* using GOT, I think
the safe way to do things would be to have the compiler emit calls
thru the GOT but linker relax them to avoid the GOT when they're in
the same segment. But there's no reason this has to be done initially.
I'm just thinking in terms of making sure the design doesn't preclude
or make it difficult to do multiple segments in the future if desired.

Rich

  reply	other threads:[~2024-02-29 15:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 23:24 Rich Felker
2024-02-28  0:13 ` Rich Felker
2024-02-28 17:20   ` Max Filippov
2024-02-28 18:30     ` Rich Felker
2024-02-28 18:37       ` Rich Felker
2024-02-28 19:34         ` Max Filippov
2024-02-28 19:41           ` Max Filippov
2024-02-28 20:14             ` Rich Felker
2024-02-28 20:26               ` Rich Felker
2024-02-28 20:37                 ` Rich Felker
2024-02-28 21:28       ` Max Filippov
2024-02-29 12:03         ` Max Filippov
2024-02-29 15:35           ` Rich Felker [this message]
2024-02-29 16:25       ` Max Filippov
2024-02-29 18:16         ` Rich Felker
2024-03-19 15:25       ` Max Filippov
2024-03-19 16:08       ` Max Filippov

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=20240229153531.GT4163@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).