From: Alan Modra <amodra@gmail.com>
To: Paul E Murphy <murphyp@linux.ibm.com>
Cc: libc-alpha@sourceware.org,
Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Subject: Re: [PATCH 2/5] [PowerPC64] Set up thread register for _dl_relocate_static_pie
Date: Sat, 19 Feb 2022 11:19:12 +1030 [thread overview]
Message-ID: <YhA+iBMWYUoLhU6b@squeak.grove.modra.org> (raw)
In-Reply-To: <c7ee251b-36ef-b090-2355-593c8c18669a@linux.ibm.com>
On Wed, Feb 16, 2022 at 05:02:51PM -0600, Paul E Murphy wrote:
>
>
> On 1/23/22 9:47 PM, Alan Modra via Libc-alpha wrote:
> > On Sun, Jan 23, 2022 at 11:12:13PM +1030, Alan Modra wrote:
> > > There's a serious problem in libgcc too. libgcc ifuncs access the
> > > AT_HWCAP words stored in the tcb with an offset from the thread
> > > pointer (r13), but r13 isn't set at the time _dl_relocate_static_pie
> > > runs, and I'm loathe to try calling init_tls early. A better approach
> > > that might work is to fake r13 so that _dl_hwcap is at the expected
> > > offset where we'd normally find the tcb hwcap words.
> >
> > Like this.
> >
> > libgcc ifunc resolvers that access hwcap via a field in the tcb can't
> > be called until the thread pointer is set up. This patch sets up a
> > fake thread pointer early so that static-pies won't segfault on
> > attempting to relocate themselves.
> >
>
> I suspect the thread pointer needs to be setup more. How much, I am not
> sure.
>
> Looking into the failure of tst-tlsifunc-static, we would need similar
> access to at_platform when resolving ifunc for similar reasons of hwcap.
> That seems like an easy fix.
Yes, it means arranging to have a copy of at_platform accessible from
the fake tls pointer reg, not just __tcb_hwcap. A tcbhead_t in
sysdeps/powerpc/hwcapinfo.c replacing __tcb_hwcap and __tcb_platform
there would be best, I think.
> However, I am not sure what to make of the other failure in this test. A
> pointer into tls is created as part of running an ifunc resolver. Do we
> need to preserve that behavior?
Tulio will be better placed to answer this question. Note that a
number of glibc test failures disappear with binutils commit
3a3a4c1fe4c.
--
Alan Modra
Australia Development Lab, IBM
next prev parent reply other threads:[~2022-02-19 0:49 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-23 12:42 [PowerPC64] Use medium model toc accesses throughout Alan Modra
2022-01-24 3:47 ` [PATCH 2/5] [PowerPC64] Set up thread register for _dl_relocate_static_pie Alan Modra
2022-02-16 23:02 ` Paul E Murphy
2022-02-19 0:49 ` Alan Modra [this message]
2022-01-24 3:50 ` [PATCH 3/5] [PowerPC] Relocate stinfo->main Alan Modra
2022-01-24 4:48 ` H.J. Lu
2022-01-24 6:51 ` Alan Modra
2022-01-24 3:52 ` [PATCH 4/5] Constify a variable in dl_vdso_vsym Alan Modra
2022-01-24 4:06 ` [PATCH 5/5] Enable static-pie on powerpc64 Alan Modra
2022-01-27 18:39 ` Florian Weimer
2022-01-28 8:45 ` Alan Modra
2022-01-28 17:48 ` [PowerPC64] Use medium model toc accesses throughout Paul E Murphy
2022-01-29 1:24 ` Alan Modra
2022-02-28 6:40 ` [PATCH v2 0/4] PowerPC64 static-pie Alan Modra
2022-02-28 6:40 ` [PATCH v2 1/4] powerpc64: Use medium model toc accesses throughout Alan Modra
2022-04-08 22:28 ` Tulio Magno Quites Machado Filho
2022-02-28 6:40 ` [PATCH v2 2/4] powerpc64: Set up thread register for _dl_relocate_static_pie Alan Modra
2022-04-08 22:28 ` Tulio Magno Quites Machado Filho
2022-02-28 6:40 ` [PATCH v2 3/4] powerpc: Relocate stinfo->main Alan Modra
2022-04-08 22:32 ` Tulio Magno Quites Machado Filho
2022-02-28 6:40 ` [PATCH v2 4/4] powerpc64: Enable static-pie Alan Modra
2022-04-08 22:49 ` Tulio Magno Quites Machado Filho
2022-04-14 1:16 ` Alan Modra
2022-04-14 3:42 ` Fangrui Song
2022-04-20 7:21 ` [PATCH v3] " Alan Modra
2022-03-04 12:48 ` [PATCH v2 0/4] PowerPC64 static-pie Alan Modra
2022-04-08 8:06 ` Alan Modra
2022-04-09 0:14 ` Fangrui Song
2022-04-14 0:33 ` Alan Modra
2022-04-14 1:54 ` DT_RELR without libc.so dependency H.J. Lu
2022-04-14 3:43 ` Fangrui Song
2022-04-14 5:18 ` Alan Modra
2022-04-14 17:55 ` H.J. Lu
2022-04-08 22:27 ` [PATCH v2 0/4] PowerPC64 static-pie Tulio Magno Quites Machado Filho
2022-04-11 1:38 ` Alan Modra
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=YhA+iBMWYUoLhU6b@squeak.grove.modra.org \
--to=amodra@gmail.com \
--cc=libc-alpha@sourceware.org \
--cc=murphyp@linux.ibm.com \
--cc=tuliom@linux.ibm.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).