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]

elf32-hppa and undefined syms


elf32-hppa complained about undefined stubs as well as undefined syms,
which is a little unnecessary.  Additionally, an undefined symbol
incorrectly caused a bfd_reloc_notsupported error, which bombs the link
after the first undefined sym, instead of reporting all such symbols.

bfd/ChangeLog
	* elf32-hppa.c (hppa_get_stub_entry): Remove debug message that
	happens to trigger on undefined symbols.
	(final_link_relocate): Return bfd_reloc_undefined for undefined
	stubs.
	(elf32_hppa_relocate_section): Don't say we can't handle a reloc
	if we have already warned about an undefined symbol.

-- 
Alan Modra

Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.64
diff -u -p -r1.64 elf32-hppa.c
--- elf32-hppa.c	2001/11/24 07:39:11	1.64
+++ elf32-hppa.c	2001/12/03 07:45:48
@@ -591,20 +591,8 @@ hppa_get_stub_entry (input_section, sym_
 
       stub_entry = hppa_stub_hash_lookup (&htab->stub_hash_table,
 					  stub_name, false, false);
-      if (stub_entry == NULL)
-	{
-	  if (hash == NULL || hash->elf.root.type != bfd_link_hash_undefweak)
-	    (*_bfd_error_handler) (_("%s(%s+0x%lx): cannot find stub entry %s"),
-				   bfd_archive_filename (input_section->owner),
-				   input_section->name,
-				   (long) rel->r_offset,
-				   stub_name);
-	}
-      else
-	{
-	  if (hash != NULL)
-	    hash->stub_cache = stub_entry;
-	}
+      if (hash != NULL)
+	hash->stub_cache = stub_entry;
 
       free (stub_name);
     }
@@ -3385,7 +3373,7 @@ final_link_relocate (input_section, cont
 	      addend = 8;
 	    }
 	  else
-	    return bfd_reloc_notsupported;
+	    return bfd_reloc_undefined;
 	}
       /* Fall thru.  */
 
@@ -3513,7 +3501,7 @@ final_link_relocate (input_section, cont
 	  stub_entry = hppa_get_stub_entry (input_section, sym_sec,
 					    h, rel, htab);
 	  if (stub_entry == NULL)
-	    return bfd_reloc_notsupported;
+	    return bfd_reloc_undefined;
 
 	  /* Munge up the value and addend so that we call the stub
 	     rather than the procedure directly.  */
@@ -3612,6 +3600,7 @@ elf32_hppa_relocate_section (output_bfd,
       bfd_reloc_status_type r;
       const char *sym_name;
       boolean plabel;
+      boolean warned_undef;
 
       r_type = ELF32_R_TYPE (rel->r_info);
       if (r_type >= (unsigned int) R_PARISC_UNIMPLEMENTED)
@@ -3647,6 +3636,7 @@ elf32_hppa_relocate_section (output_bfd,
       h = NULL;
       sym = NULL;
       sym_sec = NULL;
+      warned_undef = false;
       if (r_symndx < symtab_hdr->sh_info)
 	{
 	  /* This is a local symbol, h defaults to NULL.  */
@@ -3685,10 +3675,13 @@ elf32_hppa_relocate_section (output_bfd,
 		   && h->elf.type != STT_PARISC_MILLI)
 	    {
 	      if (info->symbolic && !info->allow_shlib_undefined)
-		if (!((*info->callbacks->undefined_symbol)
-		      (info, h->elf.root.root.string, input_bfd,
-		       input_section, rel->r_offset, false)))
-		  return false;
+		{
+		  if (!((*info->callbacks->undefined_symbol)
+			(info, h->elf.root.root.string, input_bfd,
+			 input_section, rel->r_offset, false)))
+		    return false;
+		  warned_undef = true;
+		}
 	    }
 	  else
 	    {
@@ -3696,6 +3689,7 @@ elf32_hppa_relocate_section (output_bfd,
 		    (info, h->elf.root.root.string, input_bfd,
 		     input_section, rel->r_offset, true)))
 		return false;
+	      warned_undef = true;
 	    }
 	}
 
@@ -4062,15 +4056,18 @@ elf32_hppa_relocate_section (output_bfd,
 
       if (r == bfd_reloc_undefined || r == bfd_reloc_notsupported)
 	{
-	  (*_bfd_error_handler)
-	    (_("%s(%s+0x%lx): cannot handle %s for %s"),
-	     bfd_archive_filename (input_bfd),
-	     input_section->name,
-	     (long) rel->r_offset,
-	     howto->name,
-	     sym_name);
-	  bfd_set_error (bfd_error_bad_value);
-	  return false;
+	  if (r == bfd_reloc_notsupported || !warned_undef)
+	    {
+	      (*_bfd_error_handler)
+		(_("%s(%s+0x%lx): cannot handle %s for %s"),
+		 bfd_archive_filename (input_bfd),
+		 input_section->name,
+		 (long) rel->r_offset,
+		 howto->name,
+		 sym_name);
+	      bfd_set_error (bfd_error_bad_value);
+	      return false;
+	    }
 	}
       else
 	{


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