public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Set SEC_EXCLUDE for .gnu.warning* sections
@ 2005-03-22 16:59 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2005-03-22 16:59 UTC (permalink / raw)
  To: binutils; +Cc: Yaakov Yaari

Symbols defined in these sections are useless IMO, and confusing.
glibc tends to define __evoke_linker_warning_* as the array holding the
warning message, and this symbol gets copied to the output.  That would
be OK if the warning section was also copied to the output, but it
isn't.  Which results in object symbols with non-zero size overlapping
other sections.

bfd/
	* elflink.c (elf_link_add_object_symbols): Set SEC_EXCLUDE on
	.gnu.warning.* sections.
ld/
	* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Set
	SEC_EXCLUDE on .gnu.warning sections.

Applying mainline and branch.

Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.140
diff -u -p -r1.140 elflink.c
--- bfd/elflink.c	18 Mar 2005 23:51:21 -0000	1.140
+++ bfd/elflink.c	22 Mar 2005 10:02:49 -0000
@@ -3240,6 +3240,10 @@ elf_link_add_object_symbols (bfd *abfd, 
 		  /* Clobber the section size so that the warning does
 		     not get copied into the output file.  */
 		  s->size = 0;
+
+		  /* Also set SEC_EXCLUDE, so that symbols defined in
+		     the warning section don't get copied to the output.  */
+		  s->flags |= SEC_EXCLUDE;
 		}
 	    }
 	}
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.133
diff -u -p -r1.133 elf32.em
--- ld/emultempl/elf32.em	18 Mar 2005 15:56:27 -0000	1.133
+++ ld/emultempl/elf32.em	22 Mar 2005 10:03:09 -0000
@@ -1105,6 +1105,10 @@ ${ELF_INTERPRETER_SET_DEFAULT}
 	/* Clobber the section size, so that we don't waste copying the
 	   warning into the output file.  */
 	s->size = 0;
+
+	/* Also set SEC_EXCLUDE, so that symbols defined in the warning
+	   section don't get copied to the output.  */
+	s->flags |= SEC_EXCLUDE;
       }
   }
 }

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-03-22 14:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-22 16:59 Set SEC_EXCLUDE for .gnu.warning* sections Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).