public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Fangrui Song <i@maskray.me>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [PATCH] ELF: Don't check relocations in non-loaded, non-alloced sections
Date: Tue, 2 Jun 2020 18:29:16 -0700	[thread overview]
Message-ID: <CAMe9rOqtub-8Cu=bQ=EThXP_-SM3X=Fo6S0qHcZcSykR-tftmA@mail.gmail.com> (raw)
In-Reply-To: <MWHPR12MB14567E24AED5430AAE2497A8CB880@MWHPR12MB1456.namprd12.prod.outlook.com>

On Tue, Jun 2, 2020 at 5:06 PM Fangrui Song <i@maskray.me> wrote:
>
> I haven't really read the patch, but just wanted to express a point.
> It is sometimes useful to check relocations even for a non-SHF_ALLOC
> section. For example, a PC relative relocation type does not make
> sense from a non-SHF_ALLOC section referencing a SHF_ALLOC section.
>
> Conceptually, even if a non-SHF_ALLOC is loaded as part of the memory
> image, the distance between it and a SHF_ALLOC section may not be a
> constant, so the linker cannot reasonably resolve the relocation.
>

Since non-SHF_ALLOC sections have no impact on run-time behavior,
ld.so ignores dynamic relocations on non-SHF_ALLOC section.   In
checking phase, relocations on non-SHF_ALLOC section shouldn't
alter other relocatitons against the same symbol.  When resolving
such relocations, linker should ignore any relocation errors for such
relocations.


-- 
H.J.

  parent reply	other threads:[~2020-06-03  1:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02 20:38 H.J. Lu
2020-06-03  0:05 ` Fangrui Song
     [not found] ` <MWHPR12MB14567E24AED5430AAE2497A8CB880@MWHPR12MB1456.namprd12.prod.outlook.com>
2020-06-03  1:29   ` H.J. Lu [this message]
2020-06-03 16:48     ` V2 " H.J. Lu
2020-06-03 18:55       ` V3 " H.J. Lu
2020-06-04  7:47         ` Alan Modra
2020-06-04 11:24           ` V4 " H.J. Lu
2020-06-04 12:41             ` Alan Modra
2020-06-05  3:07               ` Alan Modra
2020-06-05 12:32                 ` [PATCH] bfin: Skip non SEC_ALLOC section 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='CAMe9rOqtub-8Cu=bQ=EThXP_-SM3X=Fo6S0qHcZcSykR-tftmA@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=i@maskray.me \
    /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).