public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: Andreas Krebbel <krebbel@linux.ibm.com>
Cc: Alan Modra <amodra@gmail.com>,
	 "binutils@sourceware.org" <binutils@sourceware.org>
Subject: Re: [RFC] Make __bss_start point at actual start of .bss
Date: Mon, 26 Jun 2023 15:51:01 +0000 (UTC)	[thread overview]
Message-ID: <alpine.LSU.2.20.2306261537260.13548@wotan.suse.de> (raw)
In-Reply-To: <566bcf75-4459-37c9-e613-e572c436c25c@linux.ibm.com>

Hello,

On Mon, 26 Jun 2023, Andreas Krebbel via Binutils wrote:

> > The question is, how is __bss_start used?  Is it the start of the .bss
> > section or the start of the bss segment?  I think it is mainly used as
> > the start of the segment, when loaders zero out all bss memory, so it
> > should stay before other bss-style sections like .sbss.
> 
> The usage which triggered the problem came from qemu and the code there 
> clears memory from __bss_start through _end. This should work.

But that's _exactly_ the case that Alan worried about: __bss_start being 
assumed to be the start of the bss segment, not merely of the section 
named .bss.  If bss-style sections come before .bss (like .sbss does on 
some targets) then __bss_start should be in front of those ones, otherwise 
the above clearing that qemu does would not work anymore (.sbss wouldn't 
be cleared).  See here (elf.sc):

  ${RELOCATING+${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}__bss_start = .${CREATE_SHLIB+)};}
  ${RELOCATING+${OTHER_BSS_SYMBOLS}}
  ${DATA_SDATA-${SBSS}}
  ${BSS_PLT+${PLT}}
  .${BSS_NAME}          ${RELOCATING-0} :
  {
     ... normal bss stuff ...

__bss_start needs to remain in front of the SBSS entry for the 
traditional usage to keep working (on targets where DATA_SDATA isn't set).


Ciao,
Michael.

  reply	other threads:[~2023-06-26 15:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23  6:37 Andreas Krebbel
2023-06-23 10:15 ` Alan Modra
2023-06-26  6:39   ` Andreas Krebbel
2023-06-26 15:51     ` Michael Matz [this message]
2023-06-26 16:10       ` Andreas Krebbel
2023-06-26 16:27         ` Michael Matz

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=alpine.LSU.2.20.2306261537260.13548@wotan.suse.de \
    --to=matz@suse.de \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=krebbel@linux.ibm.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).