public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: "H.J. Lu" <hjl.tools@gmail.com>,
	GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH 3/3] csu: Move static pie self relocation later [BZ #27072]
Date: Thu, 7 Jan 2021 14:25:30 +0000	[thread overview]
Message-ID: <20210107142530.GQ2379@arm.com> (raw)
In-Reply-To: <20210107130217.GN2379@arm.com>

The 01/07/2021 13:02, Szabolcs Nagy via Libc-alpha wrote:
> this is about static pie: sorting relocs does not help, the
> problem is not that ifunc resolvers have some relocs in them,
> but that the target specific relocation processing is one
> monolithic switch in a loop that handles all relocs in one go,
> there is no api to request only a subset of relocs to be
> processed (either by type or ordering in the list of relocs).
> 
> in __libc_start_main we need to do
> 
>   do_relative_relocs();
>   setup_auxv_tunables_cpu_etc();
>   do_irelative_relocs();

i just realized we can do this because RELATIVE and IRELATIVE
happen to be in different places (one where DT_REL{A} points
to and another where DT_JUMPREL points to).

i dont know how reliable this is across targets, but we only
need this to work in static pie (which is only supported on
a small number of targets as far as i know).

so i can try to tease _dl_relocate_static_pie apart into
'normal' reloc and 'plt' reloc processing (normally this
is done so that plt relocs can be lazy evaluated, but here
we would do it so IRELATIVE is processed in a separate step).

it still sounds like a big hack that relies on where
IRELATIVE is placed with current linkers and that there
are no other relocs we need to care about in static pie.
i can create a patch to see if it works.

  reply	other threads:[~2021-01-07 14:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 11:00 [PATCH 0/3] fix ifunc with static pie " Szabolcs Nagy
2021-01-07 11:01 ` [PATCH 1/3] Make libc symbols hidden in static PIE Szabolcs Nagy
2021-01-07 11:01 ` [PATCH 2/3] [RFC] elf: hack up tunables to avoid RELATIVE relocs Szabolcs Nagy
2021-01-07 13:50   ` Siddhesh Poyarekar
2021-01-07 11:01 ` [PATCH 3/3] csu: Move static pie self relocation later [BZ #27072] Szabolcs Nagy
2021-01-07 12:36   ` H.J. Lu
2021-01-07 12:46     ` Carlos O'Donell
2021-01-07 12:51       ` H.J. Lu
2021-01-07 13:02         ` Szabolcs Nagy
2021-01-07 14:25           ` Szabolcs Nagy [this message]
2021-01-07 14:48             ` Siddhesh Poyarekar
2021-01-07 15:25               ` Szabolcs Nagy
2021-01-07 17:48                 ` H.J. Lu
2021-01-07 21:03   ` H.J. Lu
2021-01-08 10:08     ` Szabolcs Nagy
2021-01-07 12:48 ` [PATCH 0/3] fix ifunc with static pie " H.J. Lu
2021-01-07 12:50   ` Carlos O'Donell
2021-01-07 12:55     ` H.J. Lu
2021-01-07 13:03       ` Szabolcs Nagy
2021-01-07 13:15         ` H.J. Lu
2021-01-07 13:28           ` Szabolcs Nagy

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=20210107142530.GQ2379@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /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).