This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: NOLOAD section attribute in gold.
- From: Cary Coutant <ccoutant at gmail dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: Johan Karlsson <Johan dot Karlsson at enea dot com>, Binutils <binutils at sourceware dot org>
- Date: Mon, 14 Sep 2015 16:00:16 -0700
- Subject: Re: NOLOAD section attribute in gold.
- Authentication-results: sourceware.org; auth=none
- References: <5006DF1F5103294E8DA02CC4C71B1BF8087392A0 at SESTOEX04 dot enea dot se> <CAKOQZ8y8KrBTD_FW_m9H0=uHceZaYyFpGnv096Tz_dYPsK3VHQ at mail dot gmail dot com>
> I've never really understood what NOLOAD is supposed to mean for ELF.
> It was originally invented to set the STYP_NOLOAD bit in the output
> section for COFF. In COFF STYP_NOLOAD means a section that is
> allocated in memory, and has real contents, but is not loaded from the
> object file at run time. ELF doesn't really have a way to describe
> such a section. The linker documentation for NOLOAD doesn't clarify
> what it should mean for ELF.
Likewise.
I interpret NOLOAD as the opposite of SHF_ALLOC, meaning that the
section should not be allocated to a PT_LOAD segment, and that
interpretation matches the documentation in the linker manual: "The
section should be marked as not loadable, so that it will not be
loaded into memory when the program is run."
I've been trying to understand what PR 18935 is really trying to do --
defining a NOLOAD section and then allocating it to a PT_LOAD segment
seems contradictory, and I think the right thing for the linker to do
would be to issue an error.
If you're just trying to create a NOBITS section in the output, that
doesn't seem like a job for NOLOAD. I think we have another old bug
sitting around where a linker script makes .bss a PROGBITS section,
and I've been looking at what the proper fix for that should be. Maybe
we should add a NOBITS attribute to the script language? I do think
it's definitely a bug that when processing the SECTiONS clause, gold
creates all sections as PROGBITS. We ought to be able to recognize a
section that is NOBITS and mark it as such.
-cary