From: "H.J. Lu" <hjl.tools@gmail.com>
To: Alan Modra <amodra@gmail.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: PowerPC64 DT_RELR
Date: Sat, 22 Jan 2022 05:04:37 -0800 [thread overview]
Message-ID: <CAMe9rOoh3rGymY9ywCGaa9rhkDL-fP-pgKGMPo70gn_CKwESZg@mail.gmail.com> (raw)
In-Reply-To: <YeuH6teztlxzIhQ8@squeak.grove.modra.org>
On Fri, Jan 21, 2022 at 8:28 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Wed, Jan 19, 2022 at 02:56:07PM -0800, H.J. Lu wrote:
> > Does PowerPC64 support static PIE? If yes, it may need more linker changes.
>
> No. There are things in glibc that need fixing. We have small-model
> toc relocs being used in assembly. This results in the linker
> refusing to do toc/got indirect to toc pointer relative code
> optimisation for those sequences. So we get toc/got entries with
> relative relocations that result in segfaults when static-pie binaries
> are trying to relocate themselves.
>
> What were the linker changes you thought would be necessary?
>
The main issue is symbols generated by linker and linker scripts.
I enabled DT_RELR in glibc and binutls by default
$ readelf -r elf/ld.so
...
Relocation section '.relr.dyn' at offset 0xd78 contains 6 entries:
142 offsets
0000000000033000
...
diff --git a/ld/ldmain.c b/ld/ldmain.c
index ea72b14a301..6ed71a74d87 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -359,6 +359,7 @@ main (int argc, char **argv)
#endif
link_info.start_stop_gc = false;
link_info.start_stop_visibility = STV_PROTECTED;
+ link_info.enable_dt_relr = 1;
ldfile_add_arch ("");
emulation = get_emulation (argc, argv);
These triggered many run-time and link-time failures.
--
H.J.
next prev parent reply other threads:[~2022-01-22 13:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-18 0:53 Alan Modra
2022-01-18 1:08 ` H.J. Lu
2022-01-18 13:32 ` H.J. Lu
2022-01-18 23:24 ` Alan Modra
2022-01-19 22:56 ` H.J. Lu
2022-01-22 4:28 ` Alan Modra
2022-01-22 13:04 ` H.J. Lu [this message]
2022-01-23 13:51 ` H.J. Lu
2022-03-02 8:41 ` Alan Modra
2022-03-03 2:33 ` PowerPC64 DT_RELR relative reloc addresses Alan Modra
2022-03-09 1:25 ` PowerPC64 DT_RELR Fangrui Song
[not found] ` <MWHPR1201MB0110441CD99C43F8215D15EBCB0A9@MWHPR1201MB0110.namprd12.prod.outlook.com>
2022-03-09 21:07 ` Alan Modra
2022-06-09 10:57 ` Florian Weimer
2022-06-09 22:57 ` Alan Modra
2022-06-09 23:53 ` 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=CAMe9rOoh3rGymY9ywCGaa9rhkDL-fP-pgKGMPo70gn_CKwESZg@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=amodra@gmail.com \
--cc=binutils@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).