PATCH: PR ld/5522: Section contents partially overwritten with zero

Alan Modra
Tue Jan 8 16:45:00 GMT 2008

> >2007-12-27  H.J. Lu  <>
> >
> >	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. 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?

Alan Modra
Australia Development Lab, IBM

More information about the Binutils mailing list