[parisc-linux-cvs] binutils amodra

amodra@one.net.au amodra@one.net.au
Mon, 30 Apr 2001 23:17:28 +0930


On Mon, Apr 30, 2001 at 07:33:06AM -0600, Alan Modra wrote:
> Log message:
> * elf32-hppa.c (final_link_relocate): Branch to .+8 for
> calls to undefined weak symbols.

The comment below says it all.

Index: elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.30
diff -u -p -r1.30 elf32-hppa.c
--- elf32-hppa.c	2001/03/21 08:09:25	1.30
+++ elf32-hppa.c	2001/04/30 12:20:13
@@ -3271,10 +3271,13 @@ final_link_relocate (input_section, cont
 	  else if (sym_sec == NULL && h != NULL
 		   && h->elf.root.type == bfd_link_hash_undefweak)
 	    {
-	      /* It's OK if undefined weak.  Make undefined weak
-		 branches go nowhere.  */
+	      /* It's OK if undefined weak.  Calls to undefined weak
+		 symbols behave as if the "called" function
+		 immediately returns.  We can thus call to a weak
+		 function without first checking whether the function
+		 is defined.  */
 	      value = location;
-	      addend = 0;
+	      addend = 8;
 	    }
 	  else
 	    return bfd_reloc_notsupported;