public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: William Tambe <tambewilliam@gmail.com>
Cc: "H.J. Lu" <hjl.tools@gmail.com>, Binutils <binutils@sourceware.org>
Subject: Re: how to set .bss section type to PROGBITS within linker script
Date: Tue, 29 Sep 2020 13:34:29 +0000 (UTC)	[thread overview]
Message-ID: <alpine.LSU.2.20.2009291320330.20802@wotan.suse.de> (raw)
In-Reply-To: <CAMe9rOp7EWP+mu5+orn667kkXtRafZxp990hj6kaxjVpyXREuA@mail.gmail.com>

Hello,

On Mon, 28 Sep 2020, H.J. Lu via Binutils wrote:

> On Mon, Sep 28, 2020 at 7:38 AM William Tambe via Binutils
> <binutils@sourceware.org> wrote:
> >
> > Is there a way to set .bss section type to PROGBITS within a linker script ?
> 
> By definition, a .bss output section is NOBITS.  You can't make a NOBITS
> output section PROGBITS.

Well, technically you can make all input .bss sections be part of output 
.data, and get the above effect:

...
SECTIONS {
  ...
  .data
  {
    *(.data .data.* .gnu.linkonce.d.*)
    *(.bss .bss.* .gnu.linkonce.b.*)
    SORT(CONSTRUCTORS)
  }
  ...
}

(Of course the side-effect will be that there's no output .bss anymore, so 
if you really want to have the output .bss be SHT_PROGBITS, then H.J. is 
right).


Ciao,
Michael.

      reply	other threads:[~2020-09-29 13:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 14:37 William Tambe
2020-09-28 14:42 ` H.J. Lu
2020-09-29 13:34   ` Michael Matz [this message]

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.2009291320330.20802@wotan.suse.de \
    --to=matz@suse.de \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=tambewilliam@gmail.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).