public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* how to set .bss section type to PROGBITS within linker script
@ 2020-09-28 14:37 William Tambe
  2020-09-28 14:42 ` H.J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: William Tambe @ 2020-09-28 14:37 UTC (permalink / raw)
  To: Binutils

Is there a way to set .bss section type to PROGBITS within a linker script ?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to set .bss section type to PROGBITS within linker script
  2020-09-28 14:37 how to set .bss section type to PROGBITS within linker script William Tambe
@ 2020-09-28 14:42 ` H.J. Lu
  2020-09-29 13:34   ` Michael Matz
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2020-09-28 14:42 UTC (permalink / raw)
  To: William Tambe; +Cc: Binutils

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.

-- 
H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to set .bss section type to PROGBITS within linker script
  2020-09-28 14:42 ` H.J. Lu
@ 2020-09-29 13:34   ` Michael Matz
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Matz @ 2020-09-29 13:34 UTC (permalink / raw)
  To: William Tambe; +Cc: H.J. Lu, Binutils

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-29 13:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28 14:37 how to set .bss section type to PROGBITS within linker script William Tambe
2020-09-28 14:42 ` H.J. Lu
2020-09-29 13:34   ` Michael Matz

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).