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 alpha brsgp target gp test


Found by actually using the thing in the linux kernel.  The
target object file may have no relocations at all, and thus
have no specified gp.


r~


        * elf64-alpha.c (elf64_alpha_relocate_section) [BRSGP]: A target
        section with no got matches any got.  Simplify error generaion.

Index: elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.56
diff -u -p -r1.56 elf64-alpha.c
--- elf64-alpha.c	2002/02/09 22:53:53	1.56
+++ elf64-alpha.c	2002/02/15 21:16:42
@@ -3581,24 +3581,18 @@ elf64_alpha_relocate_section (output_bfd
 	       the instruction rather than the end.  */
 	    addend -= 4;
 
-	    /* The source and destination gp must be the same.  */
-	    if (h != NULL
+	    /* The source and destination gp must be the same.  Note that
+	       the source will always have an assigned gp, since we forced
+	       one in check_relocs, but that the destination may not, as
+	       it might not have had any relocations at all.  Also take 
+	       care not to crash if H is an undefined symbol.  */
+	    if (h != NULL && sec != NULL
+		&& alpha_elf_tdata (sec->owner)->gotobj
 		&& gotobj != alpha_elf_tdata (sec->owner)->gotobj)
 	      {
-		if (h != NULL)
-		  name = h->root.root.root.string;
-		else
-		  {
-		    name = (bfd_elf_string_from_elf_section
-			    (input_bfd, symtab_hdr->sh_link, sym->st_name));
-		    if (name == NULL)
-		      name = _("<unknown>");
-		    else if (name[0] == 0)
-		      name = bfd_section_name (input_bfd, sec);
-		  }
 		(*_bfd_error_handler)
 		  (_("%s: change in gp: BRSGP %s"),
-		   bfd_archive_filename (input_bfd), name);
+		   bfd_archive_filename (input_bfd), h->root.root.root.string);
 		ret_val = false;
 	      }
 


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