This is the mail archive of the binutils@sources.redhat.com 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]

I checked in a bfd patch for ia32


With some bad .o files, we will get

....
collect2: ld terminated with signal 11 [Segmentation fault], core dumped
/usr/bin/ld: bfd assertion fail elf32-i386.c:675
/usr/bin/ld: bfd assertion fail elf32-i386.c:675
/usr/bin/ld: bfd assertion fail elf32-i386.c:675
/usr/bin/ld: bfd assertion fail elf32-i386.c:675
/usr/bin/ld: bfd assertion fail elf32-i386.c:675
/usr/bin/ld: bfd assertion fail elf32-i386.c:675
/usr/bin/ld: bfd assertion fail elf32-i386.c:1632

It doesn't help anyone. Now it says:

....
/work/build/gnu/bin/binutils-debug/ld/ld-new: StdAfx.o: bad relocation section name `s'
/work/build/gnu/bin/binutils-debug/ld/ld-new: StdAfx.o: bad relocation section name `s'
/work/build/gnu/bin/binutils-debug/ld/ld-new: StdAfx.o: bad relocation section name `e'
/work/build/gnu/bin/binutils-debug/ld/ld-new: libfoo.a(oddcppdll.o): bad relocation section name `s'
/work/build/gnu/bin/binutils-debug/ld/ld-new: libfoo.a(oddcppdll.o): bad relocation section name `s'
/work/build/gnu/bin/binutils-debug/ld/ld-new: libfoo.a(oddcppdll.o): bad relocation section name `e'
/work/build/gnu/bin/binutils-debug/ld/ld-new: StdAfx.o: bad relocation section name `s'


-- 
H.J. Lu (hjl@valinux.com)
---
2001-01-19  H.J. Lu  <hjl@gnu.org>

	* elf32-i386.c (elf_i386_check_relocs): Report files with bad
	relocation section names.
	(elf_i386_relocate_section): Report files with bad relocation
	section names and return false.

Index: elf32-i386.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-i386.c,v
retrieving revision 1.19
diff -u -p -r1.19 elf32-i386.c
--- elf32-i386.c	2000/12/11 19:51:33	1.19
+++ elf32-i386.c	2001/01/20 06:03:31
@@ -670,9 +670,20 @@ elf_i386_check_relocs (abfd, info, sec, 
 		  if (name == NULL)
 		    return false;
 
-		  BFD_ASSERT (strncmp (name, ".rel", 4) == 0
-			      && strcmp (bfd_get_section_name (abfd, sec),
-					 name + 4) == 0);
+		  if (strncmp (name, ".rel", 4) != 0
+		      || strcmp (bfd_get_section_name (abfd, sec),
+				 name + 4) != 0)
+		    {
+		      if (abfd->my_archive)
+			(*_bfd_error_handler) (_("%s(%s): bad relocation section name `%s\'"),
+					       bfd_get_filename (abfd->my_archive),
+					       bfd_get_filename (abfd),
+					       name);
+		      else
+			(*_bfd_error_handler) (_("%s: bad relocation section name `%s\'"),
+					       bfd_get_filename (abfd),
+					       name);
+		  }
 
 		  sreloc = bfd_get_section_by_name (dynobj, name);
 		  if (sreloc == NULL)
@@ -1626,10 +1637,22 @@ elf_i386_relocate_section (output_bfd, i
 		  if (name == NULL)
 		    return false;
 
-		  BFD_ASSERT (strncmp (name, ".rel", 4) == 0
-			      && strcmp (bfd_get_section_name (input_bfd,
-							       input_section),
-					 name + 4) == 0);
+		  if (strncmp (name, ".rel", 4) != 0
+		      || strcmp (bfd_get_section_name (input_bfd,
+						       input_section),
+				 name + 4) != 0)
+		    {
+		      if (input_bfd->my_archive)
+			(*_bfd_error_handler) (_("%s(%s): bad relocation section name `%s\'"),
+					       bfd_get_filename (input_bfd->my_archive),
+					       bfd_get_filename (input_bfd),
+					       name);
+		      else
+			(*_bfd_error_handler) (_("%s: bad relocation section name `%s\'"),
+					       bfd_get_filename (input_bfd),
+					       name);
+		      return false;
+		    }
 
 		  sreloc = bfd_get_section_by_name (dynobj, name);
 		  BFD_ASSERT (sreloc != NULL);

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