This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: NOLOAD section attribute in gold.

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]