This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix diagnostic on "gnu.warning" section


At the moment, if ld sees a symbol in "gnu.warning", it will emit a warning of 
the form:

	<some.file>: warning: warning: <warning text>

with the word "warning" repeated twice. This patch fixes this and adds a test 
for the right message. OK?

- Volodya

2006-11-04  Vladimir Prus  <vladimir@codesourcery.com>

	* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):
	Don't prepend "warning" to the message.

2006-11-04  Vladimir Prus  <vladimir@codesourcery.com>	
	
	* testsuite/ld-elf/warn2.d: New.
	* testsuite/ld-elf/symbol2w.s: New.
	* testsuite/ld-elf/symbol2ref.s: New.	


Index: emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.162.2.1
diff -u -r1.162.2.1 elf32.em
--- emultempl/elf32.em	22 Aug 2006 15:08:43 -0000	1.162.2.1
+++ emultempl/elf32.em	28 Oct 2006 16:06:07 -0000
@@ -1180,10 +1180,8 @@
       {
 	asection *s;
 	bfd_size_type sz;
-	bfd_size_type prefix_len;
 	char *msg;
 	bfd_boolean ret;
-	const char * gnu_warning_prefix = _("warning: ");
 
 	if (is->just_syms_flag)
 	  continue;
@@ -1193,14 +1191,12 @@
 	  continue;
 
 	sz = s->size;
-	prefix_len = strlen (gnu_warning_prefix);
-	msg = xmalloc ((size_t) (prefix_len + sz + 1));
-	strcpy (msg, gnu_warning_prefix);
-	if (! bfd_get_section_contents (is->the_bfd, s,	msg + prefix_len,
+	msg = xmalloc ((size_t) (sz + 1));
+	if (! bfd_get_section_contents (is->the_bfd, s,	msg,
 					(file_ptr) 0, sz))
 	  einfo ("%F%B: Can't read contents of section .gnu.warning: %E\n",
 		 is->the_bfd);
-	msg[prefix_len + sz] = '\0';
+	msg[sz] = '\0';
 	ret = link_info.callbacks->warning (&link_info, msg,
 					    (const char *) NULL,
 					    is->the_bfd, (asection *) NULL,

Attachment: symbol2ref.s
Description: Text document

Attachment: symbol2w.s
Description: Text document

Attachment: warn2.d
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]