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]

Re: binutils test failure on PPC: Segementation fault in ppc_elf_create_linker_section


On Mon, Apr 15, 2002 at 05:58:31PM +0200, Christian Jönsson wrote:
> On Mon, Apr 15, 2002 at 06:15:34PM +0930, Alan Modra wrote:
> > 	* elf32-ppc.c (ppc_elf_add_symbol_hook): Check the hash table type.
> 
> Are there other targets that might have a similar problem?

Yes, there were a few other places.  The mmix change is cosmetic,
the other fix real bugs.

bfd/ChangeLog
	* elf32-m32r.c (m32r_elf_add_symbol_hook): Check the hash table
	type rather than just assuming entries are ELF.
	* elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
	* elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
	* elf64-sparc.c (sparc64_elf_add_symbol_hook): Likewise.
	* elf64-mmix.c (mmix_elf_add_symbol_hook): Use bfd_link_hash_entry
	rather than elf_link_hash_entry.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: bfd/elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.21
diff -u -p -r1.21 elf32-m32r.c
--- bfd/elf32-m32r.c	17 Jan 2002 13:02:40 -0000	1.21
+++ bfd/elf32-m32r.c	16 Apr 2002 03:46:38 -0000
@@ -838,7 +838,8 @@ m32r_elf_add_symbol_hook (abfd, info, sy
 {
   if (! info->relocateable
       && (*namep)[0] == '_' && (*namep)[1] == 'S'
-      && strcmp (*namep, "_SDA_BASE_") == 0)
+      && strcmp (*namep, "_SDA_BASE_") == 0
+      && info->hash->creator->flavour == bfd_target_elf_flavour)
     {
       /* This is simpler than using _bfd_elf_create_linker_section
 	 (our needs are simpler than ppc's needs).  Also
Index: bfd/elf32-sh64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh64.c,v
retrieving revision 1.2
diff -u -p -r1.2 elf32-sh64.c
--- bfd/elf32-sh64.c	11 Feb 2002 06:17:43 -0000	1.2
+++ bfd/elf32-sh64.c	16 Apr 2002 03:46:38 -0000
@@ -389,7 +389,8 @@ sh64_elf_add_symbol_hook (abfd, info, sy
      bfd_vma *valp;
 {
   /* We want to do this for relocatable as well as final linking.  */
-  if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL)
+  if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL
+      && info->hash->creator->flavour == bfd_target_elf_flavour)
     {
       struct elf_link_hash_entry *h;
 
Index: bfd/elf64-mmix.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-mmix.c,v
retrieving revision 1.10
diff -u -p -r1.10 elf64-mmix.c
--- bfd/elf64-mmix.c	9 Feb 2002 05:04:27 -0000	1.10
+++ bfd/elf64-mmix.c	16 Apr 2002 03:46:41 -0000
@@ -1953,16 +1953,16 @@ mmix_elf_add_symbol_hook (abfd, info, sy
 		       strlen (MMIX_LOC_SECTION_START_SYMBOL_PREFIX)) == 0)
     {
       /* See if we have another one.  */
-      struct elf_link_hash_entry *h
-	= (struct elf_link_hash_entry *) bfd_link_hash_lookup (info->hash,
-							       *namep,
-							       false,
-							       false, false);
+      struct bfd_link_hash_entry *h = bfd_link_hash_lookup (info->hash,
+							    *namep,
+							    false,
+							    false,
+							    false);
 
-      if (h != NULL && h->root.type != bfd_link_hash_undefined)
+      if (h != NULL && h->type != bfd_link_hash_undefined)
 	{
 	  /* How do we get the asymbol (or really: the filename) from h?
-	     h->root.u.def.section->owner is NULL.  */
+	     h->u.def.section->owner is NULL.  */
 	  ((*_bfd_error_handler)
 	   (_("%s: Error: multiple definition of `%s'; start of %s is set in a earlier linked file\n"),
 	    bfd_get_filename (abfd), *namep,
Index: bfd/elf64-sh64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sh64.c,v
retrieving revision 1.6
diff -u -p -r1.6 elf64-sh64.c
--- bfd/elf64-sh64.c	4 Apr 2002 19:53:37 -0000	1.6
+++ bfd/elf64-sh64.c	16 Apr 2002 03:46:46 -0000
@@ -2929,7 +2929,8 @@ sh64_elf64_add_symbol_hook (abfd, info, 
      bfd_vma *valp;
 {
   /* We want to do this for relocatable as well as final linking.  */
-  if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL)
+  if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL
+      && info->hash->creator->flavour == bfd_target_elf_flavour)
     {
       struct elf_link_hash_entry *h;
 
Index: bfd/elf64-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sparc.c,v
retrieving revision 1.52
diff -u -p -r1.52 elf64-sparc.c
--- bfd/elf64-sparc.c	4 Apr 2002 19:53:37 -0000	1.52
+++ bfd/elf64-sparc.c	16 Apr 2002 03:46:49 -0000
@@ -1385,9 +1385,8 @@ sparc64_elf_add_symbol_hook (abfd, info,
       *namep = NULL;
       return true;
     }
-  else if (! *namep || ! **namep)
-    return true;
-  else
+  else if (*namep && **namep
+	   && info->hash->creator->flavour == bfd_target_elf_flavour)
     {
       int i;
       struct sparc64_elf_app_reg *p;


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