public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: binutils@sources.redhat.com
Cc: Yaakov Yaari <YAARI@il.ibm.com>
Subject: Set SEC_EXCLUDE for .gnu.warning* sections
Date: Tue, 22 Mar 2005 16:59:00 -0000	[thread overview]
Message-ID: <20050322144642.GC30711@bubble.modra.org> (raw)

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

                 reply	other threads:[~2005-03-22 14:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050322144642.GC30711@bubble.modra.org \
    --to=amodra@bigpond.net.au \
    --cc=YAARI@il.ibm.com \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).