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]
Other format: [Raw text]

Fix NOCROSSREFS fail on hppa64-hp-hpux11


The following patch fixes the NOCROSSREFS 1 failure on hppa64-hp-hpux11
and improves the error handling when a dynamic section is not found in
the output bfd (ie., print an informative message and exit rather than
print an assertion failure and segfault).  This type of error will be
relatively common on hppa64-hp-hpux11 with user defined linker scripts
because all output objects are dynamic.

Please apply if OK.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2002-06-11  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* elflink.h (elf_bfd_final_link): Improve error handling for missing
	dynamic sections.
	* ld-scripts/cross1.t: Add .hash, .dynstr and .dynsym sections to
	script.

Index: bfd/elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.165
diff -u -3 -p -r1.165 elflink.h
--- bfd/elflink.h	7 Jun 2002 14:57:11 -0000	1.165
+++ bfd/elflink.h	11 Jun 2002 16:10:23 -0000
@@ -5692,7 +5692,13 @@ elf_bfd_final_link (abfd, info)
 	      name = ".fini_array";
 	    get_size:
 	      o = bfd_get_section_by_name (abfd, name);
-	      BFD_ASSERT (o != NULL);
+	      if (o == NULL)
+		{
+		  (*_bfd_error_handler)
+		    (_("%s: could not find output section %s"),
+		     bfd_get_filename (abfd), name);
+		  goto error_return;
+		}
 	      if (o->_raw_size == 0)
 		(*_bfd_error_handler)
 		  (_("warning: %s section has zero size"), name);
@@ -5729,7 +5735,13 @@ elf_bfd_final_link (abfd, info)
 	      name = ".gnu.version";
 	    get_vma:
 	      o = bfd_get_section_by_name (abfd, name);
-	      BFD_ASSERT (o != NULL);
+	      if (o == NULL)
+		{
+		  (*_bfd_error_handler)
+		    (_("%s: could not find output section %s"),
+		     bfd_get_filename (abfd), name);
+		  goto error_return;
+		}
 	      dyn.d_un.d_ptr = o->vma;
 	      elf_swap_dyn_out (dynobj, &dyn, dyncon);
 	      break;
Index: ld/testsuite/ld-scripts/cross1.t
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/cross1.t,v
retrieving revision 1.3
diff -u -3 -p -r1.3 cross1.t
--- ld/testsuite/ld-scripts/cross1.t	31 Jan 2002 03:57:52 -0000	1.3
+++ ld/testsuite/ld-scripts/cross1.t	11 Jun 2002 16:10:24 -0000
@@ -1,6 +1,9 @@
 NOCROSSREFS ( .text .data )
 SECTIONS
 {
+  .dynsym : { *(.dynsym) }
+  .dynstr : { *(.dynstr) }
+  .hash : { *(.hash) }
   .toc  : { *(.toc) }
   .opd  : { *(.opd) }
   .text : { tmpdir/cross1.o }


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