public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Alan Modra <amodra@gmail.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [PATCH v3 4/9] ld: Initial DT_RELR support
Date: Wed, 12 Jan 2022 06:14:43 -0800	[thread overview]
Message-ID: <CAMe9rOp8Kr0tUPkdiTv6NM3G6Yhf=kmmGUD9LujKKcD81L41HA@mail.gmail.com> (raw)
In-Reply-To: <Yd5xEKKcHuTb1qTh@squeak.grove.modra.org>

On Tue, Jan 11, 2022 at 10:11 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Tue, Jan 11, 2022 at 06:06:29AM -0800, 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.  DT_RELR is implemented with the linker
> > relaxation infrastructure, but it doesn't require the --relax option
> > enabled.  -z pack-relative-relocs implies -z combreloc.  -z nocombreloc
> > implies -z nopack-relative-relocs.
>
> Like Fangrui, I think these options should not interact in this way.
> -z pack-relative-relocs -z combreloc
>   -> .relr.dyn for relative encoding, .rel{,a}.dyn for others
> -z pack-relative-relocs -z nocombreloc
>   -> .relr.dyn for relative encoding, .rela.<multiple sections> for others
>
> In other words, -z pack-relative-relocs overrides the place where
> RELATIVE dynrelocs go, other dynrelocs are still controlled by
> combreloc.

I removed the combreloc change.

> > --- a/ld/ldlang.c
> > +++ b/ld/ldlang.c
> > @@ -7699,7 +7699,8 @@ lang_find_relro_sections (void)
> >  void
> >  lang_relax_sections (bool need_layout)
> >  {
> > -  if (RELAXATION_ENABLED)
> > +  /* NB: Also enable relaxation to layout sections for DT_RELR.  */
> > +  if (RELAXATION_ENABLED || link_info.enable_dt_relr)
> >      {
> >        /* We may need more than one relaxation pass.  */
> >        int i = link_info.relax_pass;
>
> Also, this isn't correct.  You should instead arrange for relaxation
> to be enabled by the x86 target code.  Not every target that
> implements DT_RELR will want to use bfd_relax_section.  It might be
> true that this will do no harm for targets that currently use
> bfd_generic_relax_section (that does nothing) but it's still wrong
> to turn on relaxation like this.

I will push this one unchanged.   I don't want to change
RELAXATION_ENABLED for DT_RELR since RELAXATION_ENABLED
should be false in

lang_size_sections (NULL, !RELAXATION_ENABLED);

We improve it after my patches are checked in.

> --
> Alan Modra
> Australia Development Lab, IBM

Thanks.

-- 
H.J.

  reply	other threads:[~2022-01-12 14:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11 14:06 [PATCH v3 0/9] ld: Implement DT_RELR for x86 H.J. Lu
2022-01-11 14:06 ` [PATCH v3 1/9] elf: Add .relr.dyn to special_sections_r H.J. Lu
2022-01-12  7:02   ` Alan Modra
2022-01-11 14:06 ` [PATCH v3 2/9] elf: Extract _bfd_elf_process_reverse_copy H.J. Lu
2022-01-12  2:28   ` Alan Modra
2022-01-11 14:06 ` [PATCH v3 3/9] elf: Pass need_layout to _bfd_elf_map_sections_to_segments H.J. Lu
2022-01-11 14:06 ` [PATCH v3 4/9] ld: Initial DT_RELR support H.J. Lu
2022-01-12  6:11   ` Alan Modra
2022-01-12 14:14     ` H.J. Lu [this message]
2022-01-11 14:06 ` [PATCH v3 5/9] elf: Add size_relative_relocs and finish_relative_relocs H.J. Lu
2022-01-11 14:06 ` [PATCH v3 6/9] elf: Support DT_RELR in linker tests H.J. Lu
2022-01-11 14:06 ` [PATCH v3 7/9] x86: Add DT_RELR support H.J. Lu
2022-01-11 14:06 ` [PATCH v3 8/9] ld: Add simple DT_RELR tests H.J. Lu
2022-01-11 14:06 ` [PATCH v3 9/9] ld: Add glibc dependency for DT_RELR 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='CAMe9rOp8Kr0tUPkdiTv6NM3G6Yhf=kmmGUD9LujKKcD81L41HA@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).