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]

[patch] elf64-hppa handling for undefweak symbols


We are seeing ld segfaults when compiling linux kernels for
hppa64-linux. It looks like the linker does not properly handle LTOFF
relocs against undefweak symbols.

The following patch seems to allow me to build a working kernel.
Comments appreciated. Pls apply if it's ok.

thanks,
randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

2003-07-15  Randolph Chung <tausq@debian.org>

	* elf-hppa.h: fill in dyn_h to pass to 
	elf_hppa_final_link_relocate
	* elf64-hppa.c: check to make sure symbol is
	defined before applying relocation

Index: elf-hppa.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-hppa.h,v
retrieving revision 1.62
diff -u -p -r1.62 elf-hppa.h
--- elf-hppa.h	25 Jun 2003 06:40:19 -0000	1.62
+++ elf-hppa.h	16 Jul 2003 05:10:49 -0000
@@ -1496,7 +1496,22 @@ elf_hppa_relocate_section (output_bfd, i
 	      relocation = 0;
 	    }
 	  else if (h->root.type == bfd_link_hash_undefweak)
-	    relocation = 0;
+            {
+	      dyn_name = get_dyn_name (input_section, h, rel,
+				       &dynh_buf, &dynh_buflen);
+	      dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
+						  dyn_name, FALSE, FALSE);
+
+	      if (dyn_h == NULL)
+		{
+		  (*_bfd_error_handler)
+		    (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
+		     bfd_archive_filename (input_bfd), h->root.root.string,
+		     bfd_get_section_name (input_bfd, input_section));
+		  relocation = 0;
+		}
+	      relocation = 0;
+	    }
 	  else
 	    {
 	      /* Ignore dynamic loader defined symbols.  */
Index: elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.33
diff -u -p -r1.33 elf64-hppa.c
--- elf64-hppa.c	25 Jun 2003 06:40:23 -0000	1.33
+++ elf64-hppa.c	16 Jul 2003 05:10:49 -0000
@@ -2269,7 +2269,9 @@ elf64_hppa_finalize_dlt (dyn_h, data)
 		   + hppa_info->opd_sec->output_offset
 		   + hppa_info->opd_sec->output_section->vma);
 	}
-      else if (h->root.u.def.section)
+      else if (h->root.type != bfd_link_hash_undefined &&
+               h->root.type != bfd_link_hash_undefweak &&
+	       h->root.u.def.section)
 	{
 	  value = h->root.u.def.value + h->root.u.def.section->output_offset;
 	  if (h->root.u.def.section->output_section)


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