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

H.J. Lu hjl@lucon.org
Thu Dec 27 01:25:00 GMT 2007


ELF linker may write out a section even when its output section is
marked with SEC_NEVER_LOAD and override the next section. This patch
fixes it.

H.J.
---
2007-12-26  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.

--- bfd/elflink.c.noload	2007-12-21 17:34:49.000000000 -0800
+++ bfd/elflink.c	2007-12-26 17:21:01.000000000 -0800
@@ -9599,6 +9599,7 @@ elf_link_input_bfd (struct elf_final_lin
 	default:
 	  {
 	    if (! (o->flags & SEC_EXCLUDE)
+		&& ! (o->output_section->flags & SEC_NEVER_LOAD)
 		&& ! bfd_set_section_contents (output_bfd, o->output_section,
 					       contents,
 					       (file_ptr) o->output_offset,



More information about the Binutils mailing list