Inclusion of Custom NOLOAD Section in pei-x86-64 Output Binary

Niteesh G. S. niteesh.gs@gmail.com
Tue May 27 09:30:24 GMT 2025


GNU binutils version 2.43.1
Target Format: pei-x86-64

I'm encountering an issue with the GNU linker when defining a custom
uninitialized data section in my linker script. Specifically, I have the
following section defined:

.boot.bss (NOLOAD) : {
  *(.boot.bss)
}

My expectation is that this section, marked with the NOLOAD attribute,
would not be included in the loadable segments of the output binary.
However, upon inspecting the generated binary, I observe that .boot.bss is
being included in the loadable segments, contrary to the intended
behavior.

objdump -h  kernel.pe
------------------------------------------------------------------------------------------
kernel/kernel.pe:     file format pei-x86-64

Sections:
Idx Name          Size      VMA               LMA               File off
 Algn
  0 .boot.text    00000048  0000000000100000  0000000000100000  00000400
 2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .boot.bss     00002000  0000000000101000  0000000000101000  00000600
 2**2
                  CONTENTS, ALLOC, LOAD, DATA
-------------------------------------------------------------------------------------------

Is this the intended behaviour? How can I create a custom BSS section in
non-elf targets?

thanks,
niteesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/binutils/attachments/20250527/f771b7d0/attachment.htm>


More information about the Binutils mailing list