public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Fix NOCROSSREFS fail on hppa64-hp-hpux11
@ 2002-06-11  9:33 John David Anglin
  2002-06-12 11:15 ` law
  0 siblings, 1 reply; 2+ messages in thread
From: John David Anglin @ 2002-06-11  9:33 UTC (permalink / raw)
  To: binutils

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 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix NOCROSSREFS fail on hppa64-hp-hpux11
  2002-06-11  9:33 Fix NOCROSSREFS fail on hppa64-hp-hpux11 John David Anglin
@ 2002-06-12 11:15 ` law
  0 siblings, 0 replies; 2+ messages in thread
From: law @ 2002-06-12 11:15 UTC (permalink / raw)
  To: John David Anglin; +Cc: binutils

In message <200206111632.g5BGWutf022527@hiauly1.hia.nrc.ca>, "John David Anglin
" writes:
 > 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-66
 > 05)
 > 
 > 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.
Thanks.  Installed.
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-06-12 18:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-11  9:33 Fix NOCROSSREFS fail on hppa64-hp-hpux11 John David Anglin
2002-06-12 11:15 ` law

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).