From: "H.J. Lu" <hjl.tools@gmail.com>
To: Fangrui Song <i@maskray.me>
Cc: Binutils <binutils@sourceware.org>,
GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH 05/10] ld: Initial DT_RELR support
Date: Sat, 8 Jan 2022 05:19:55 -0800 [thread overview]
Message-ID: <CAMe9rOp7AEYnP8-i0jQVcXA93c4Kw6zZ-ids2fp2rUpiD5CizQ@mail.gmail.com> (raw)
In-Reply-To: <20220108083044.mkom7nyt72kedoxz@gmail.com>
On Sat, Jan 8, 2022 at 12:30 AM Fangrui Song <i@maskray.me> wrote:
>
> On 2022-01-07, H.J. Lu via Binutils wrote:
> >Add a -z pack-relative-relocs option to enable DT_RELR and create a
> >relr.dyn section for DT_RELR.
> >
> >-z pack-relative-relocs implies -z combreloc and --relax. --no-relax
> >and -z nocombreloc imply -z nopack-relative-relocs.
> >
> >-z pack-relative-relocs is chosen over the similar option in lld,
> >--pack-dyn-relocs=relr, to implement a glibc binary lockout mechanism
> >with a special glibc version symbol, to avoid random crashes of DT_RELR
> >binaries with the existing glibc binaries.
>
> I think -z pack-relative-relocs is orthogonal to -z combreloc.
> -z combreloc affects how .rela.dyn is sorted and whether RELACOUNT is
> generated. It has nothing to do with .relr.dyn, which is a different section.
With -z nocombreloc, ld can generate:
$ readelf -r tmpdir/pr25754-3ba
Relocation section '.rela.data.rel.ro' at offset 0x540 contains 1 entry:
Offset Info Type Sym. Value Sym. Name + Addend
000000003de8 000000000008 R_X86_64_RELATIVE 3de8
Relocation section '.rela.got' at offset 0x558 contains 5 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000003fd0 000100000006 R_X86_64_GLOB_DAT 0000000000000000
__libc_start_main@GLIBC_2.34 + 0
000000003fd8 000200000006 R_X86_64_GLOB_DAT 0000000000000000
_ITM_deregisterTM[...] + 0
000000003fe8 000400000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ + 0
000000003ff0 000500000006 R_X86_64_GLOB_DAT 0000000000000000
_ITM_registerTMCl[...] + 0
000000003ff8 000600000006 R_X86_64_GLOB_DAT 0000000000000000
__cxa_finalize@GLIBC_2.2.5 + 0
Relocation section '.rela.fini_array' at offset 0x5d0 contains 1 entry:
Offset Info Type Sym. Value Sym. Name + Addend
000000003de0 000000000008 R_X86_64_RELATIVE 10f0
Relocation section '.rela.init_array' at offset 0x5e8 contains 1 entry:
Offset Info Type Sym. Value Sym. Name + Addend
000000003dd8 000000000008 R_X86_64_RELATIVE 1130
Relocation section '.rela.plt' at offset 0x600 contains 1 entry:
Offset Info Type Sym. Value Sym. Name + Addend
000000004018 000300000007 R_X86_64_JUMP_SLO 0000000000000000
puts@GLIBC_2.2.5 + 0
3 R_X86_64_RELATIVEs are 3 different .rela sections.
If they are put in a single section, they are combined.
--
H.J.
next prev parent reply other threads:[~2022-01-08 13:20 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-07 19:06 [PATCH 0/10] ld: Implement DT_RELR for x86 H.J. Lu
2022-01-07 19:06 ` [PATCH 01/10] ld: Extract _bfd_elf_link_iterate_on_relocs H.J. Lu
2022-01-07 19:06 ` [PATCH 02/10] elf: Add .relr.dyn to special_sections_r H.J. Lu
2022-01-07 19:06 ` [PATCH 03/10] elf: Extract _bfd_elf_process_reverse_copy H.J. Lu
2022-01-07 19:06 ` [PATCH 04/10] elf: Pass need_layout to _bfd_elf_map_sections_to_segments H.J. Lu
2022-01-07 19:06 ` [PATCH 05/10] ld: Initial DT_RELR support H.J. Lu
2022-01-08 2:10 ` Fangrui Song
2022-01-08 2:42 ` H.J. Lu
2022-01-08 18:32 ` H.J. Lu
2022-01-08 8:30 ` Fangrui Song
2022-01-08 13:19 ` H.J. Lu [this message]
2022-01-07 19:06 ` [PATCH 06/10] elf: Add size_relative_relocs and finish_relative_relocs H.J. Lu
2022-01-07 19:06 ` [PATCH 07/10] elf: Support DT_RELR in linker tests H.J. Lu
2022-01-08 2:42 ` Fangrui Song
2022-01-08 13:46 ` H.J. Lu
2022-01-07 19:06 ` [PATCH 08/10] x86: Add DT_RELR support H.J. Lu
2022-01-07 19:06 ` [PATCH 09/10] ld: Add simple DT_RELR tests H.J. Lu
2022-01-08 2:39 ` Fangrui Song
2022-01-08 2:44 ` H.J. Lu
2022-01-08 8:37 ` Fangrui Song
2022-01-08 18:33 ` H.J. Lu
2022-01-07 19:06 ` [PATCH 10/10] ld: Add glibc dependency for DT_RELR H.J. Lu
2022-01-08 4:43 ` Fangrui Song
2022-01-08 4:51 ` H.J. Lu
2022-01-08 8:19 ` Fangrui Song
2022-01-08 18:37 ` H.J. Lu
2022-01-07 23:45 ` [PATCH 0/10] ld: Implement DT_RELR for x86 Fangrui Song
2022-01-07 23:56 ` H.J. Lu
2022-01-08 1:31 ` Fangrui Song
2022-01-08 1:55 ` H.J. Lu
2022-01-08 18:30 ` H.J. Lu
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=CAMe9rOp7AEYnP8-i0jQVcXA93c4Kw6zZ-ids2fp2rUpiD5CizQ@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=binutils@sourceware.org \
--cc=i@maskray.me \
--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).