public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Eric Botcazou <botcazou@adacore.com>, binutils@sourceware.org
Subject: Re: [PATCH] Orphan sections and NOLOAD output section
Date: Thu, 21 Apr 2022 17:53:57 +0200	[thread overview]
Message-ID: <7a010ef9-a795-faa9-a5ea-1d710d728aeb@suse.com> (raw)
In-Reply-To: <2111887.irdbgypaU6@fomalhaut>

On 21.04.2022 17:31, Eric Botcazou via Binutils wrote:
> we recently got a report about a counter-intuitive behavior of the GNU linker
> for orphan sections matched by a NOLOAD output section, which turned out to be
> an exact duplicate of:
>   https://stackoverflow.com/questions/48764136/gcc-noload-directive-cause-wrong-memory-mapping
> 
> What happens is that the effect of the command:
> 
>   .foo (NOLOAD) : {}
> 
> is not equivalent to that of:
> 
>   .foo (NOLOAD) : { *(.foo) }
> 
> when there is more than 1 object file containing a .foo section: the former
> will output two .foo sections, the first with PROGBITS and the second with
> NOBITS, where the latter will output only one with NOBITS.
> 
> I think that the commands are essentially equivalent so the linker ought to yield
> the same outcome, namely the single output section with NOBITS.

Hmm, not having found any statement as to potentially special
meaning of nothing inside the braces, I'm not convinced the two
are "essentially equivalent". What I'm puzzled by though is your
reference to there needing to be more than one object file
involved - I wouldn't expect the behavior to depend on the number
of object files contributing to a section. Instead I'd expect a
single object file to similarly result in two .foo sections in
the output.

Jan


  reply	other threads:[~2022-04-21 15:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 15:31 Eric Botcazou
2022-04-21 15:53 ` Jan Beulich [this message]
2022-04-21 17:54   ` Eric Botcazou
2022-04-22  2:04 ` Alan Modra
2022-04-23 21:30 ` Fangrui Song

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=7a010ef9-a795-faa9-a5ea-1d710d728aeb@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=botcazou@adacore.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).