A patch for http://sourceware.cygnus.com/ml/binutils/2000-04/msg00373.html

H . J . Lu hjl@valinux.com
Sun Apr 16 13:12:00 GMT 2000


The old gld${EMULATION_NAME}_place_orphan assumes it only processes
SEC_ALLOC sections. When we allow ~SEC_ALLOC sections, we have to
check it. This patch seems to fix

http://sourceware.cygnus.com/ml/binutils/2000-04/msg00373.html


-- 
H.J. Lu (hjl@gnu.org)
---
2000-04-16  H.J. Lu  <hjl@gnu.org>

	* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Take
	into account that we also proecess ~SEC_ALLOC sections when
	placing a section.
	* emultempl/armelf.em (gld${EMULATION_NAME}_place_orphan):
	Likewise.
	* emultempl/pe.em (gld${EMULATION_NAME}_place_orphan):
	Likewise.

Index: emultempl/armelf.em
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/emultempl/armelf.em,v
retrieving revision 1.1.1.12
diff -u -p -r1.1.1.12 armelf.em
--- emultempl/armelf.em	2000/04/16 17:09:14	1.1.1.12
+++ emultempl/armelf.em	2000/04/16 19:58:36
@@ -845,6 +845,8 @@ gld${EMULATION_NAME}_place_orphan (file,
      in the first page.  */
   if (s->flags & SEC_EXCLUDE)
     return false;
+  else if ((s->flags & SEC_ALLOC) == 0)
+    place = NULL;
   else if ((s->flags & SEC_LOAD) != 0
 	   && strncmp (secname, ".note", 4) == 0
 	   && hold_interp.os != NULL)
Index: emultempl/elf32.em
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/emultempl/elf32.em,v
retrieving revision 1.12
diff -u -p -r1.12 elf32.em
--- emultempl/elf32.em	2000/04/16 17:13:46	1.12
+++ emultempl/elf32.em	2000/04/16 19:48:33
@@ -927,6 +927,8 @@ gld${EMULATION_NAME}_place_orphan (file,
      in the first page.  */
   if (s->flags & SEC_EXCLUDE)
     return false;
+  else if ((s->flags & SEC_ALLOC) == 0)
+    place = NULL;
   else if ((s->flags & SEC_LOAD) != 0
 	   && strncmp (secname, ".note", 4) == 0
 	   && hold_interp.os != NULL)
Index: emultempl/pe.em
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/emultempl/pe.em,v
retrieving revision 1.1.1.15
diff -u -p -r1.1.1.15 pe.em
--- emultempl/pe.em	2000/04/16 17:09:14	1.1.1.15
+++ emultempl/pe.em	2000/04/16 19:50:29
@@ -1128,7 +1128,8 @@ gld_${EMULATION_NAME}_place_orphan (file
 
       /* Try to put the new output section in a reasonable place based
 	 on the section name and section flags.  */
-      place = NULL;
+      if ((s->flags & SEC_ALLOC) == 0)
+	place = NULL;
       if ((s->flags & SEC_HAS_CONTENTS) == 0
 	  && hold_bss.os != NULL)
 	place = &hold_bss;
@@ -1142,6 +1143,8 @@ gld_${EMULATION_NAME}_place_orphan (file
       else if ((s->flags & SEC_READONLY) != 0
 	       && hold_text.os != NULL)
 	place = &hold_text;
+      else
+	place = NULL;
 
       /* Choose a unique name for the section.  This will be needed if
 	 the same section name appears in the input file with


More information about the Binutils mailing list