This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/5522: Section contents partially overwritten with zero
- From: "H.J. Lu" <hjl at lucon dot org>
- To: Nick Clifton <nickc at redhat dot com>, binutils at sources dot redhat dot com
- Date: Tue, 8 Jan 2008 05:25:42 -0800
- Subject: Re: PATCH: PR ld/5522: Section contents partially overwritten with zero
- References: <20071227012529.GA28727@lucon.org> <20071227175254.GA419@lucon.org> <4782560E.1000509@redhat.com> <20080108105956.GA30641@bubble.grove.modra.org>
On Tue, Jan 08, 2008 at 09:29:56PM +1030, Alan Modra wrote:
> > >2007-12-27 H.J. Lu <hongjiu.lu@intel.com>
> > >
> > > PR ld/5522
> > > * elflink.c (elf_link_input_bfd): Don't write out a section if
> > > its output section is marked with SEC_NEVER_LOAD.
>
> ld.info gives an example of NOLOAD output sections saying "The
> contents of the section will appear in the linker output file as
> usual". NOLOAD sets SEC_NEVER_LOAD on the output section, therefore
> not writing out the section here is wrong. I think we are suffering
> bit rot. Probably partly my fault..
>
> >From what I can see of the history (I can't access private Cygnus CVS,
> so can't see before 1999), it appears that SEC_NEVER_LOAD was
> invented for COFF to mirror STYP_NOLOAD. I'm inclined to think it
> should remain that way. ie. Only used in COFF code or in the generic
> linker code to hanlde NOLOAD. ELF doesn't have an external section
> flag similar to STYP_NOLOAD so SEC_NEVER_LOAD should not appear
> anywhere in ELF specific code. SEC_LOAD is sufficient. Does anyone
> have any enlightening comments?
>
bfd/section.c has
. {* An instruction to the linker to not output the section
. even if it has information which would normally be written. *}
.#define SEC_NEVER_LOAD 0x200
I don't know which one is correct.
H.J.