This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Fix SPU extern __ea vars
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Mon, 21 Jul 2008 17:00:12 +0930
- Subject: Fix SPU extern __ea vars
My 2008-05-08 change
http://sourceware.org/ml/binutils/2008-05/msg00081.html
broke linking of extern __ea vars. This cures the unwanted undefined
symbol error.
* elf32-spu.c (spu_elf_relocate_section): Expand
RELOC_FOR_GLOBAL_SYMBOL. Don't warn about undefined symbols for
R_SPU_PPU32 and R_SPU_PPU64 relocations.
Index: src/bfd/elf32-spu.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-spu.c,v
retrieving revision 1.48
diff -u -p -r1.48 elf32-spu.c
--- src/bfd/elf32-spu.c 19 Jun 2008 16:16:58 -0000 1.48
+++ src/bfd/elf32-spu.c 21 Jul 2008 01:23:37 -0000
@@ -3966,10 +3966,51 @@ spu_elf_relocate_section (bfd *output_bf
}
else
{
- RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
- r_symndx, symtab_hdr, sym_hashes,
- h, sec, relocation,
- unresolved_reloc, warned);
+ if (sym_hashes == NULL)
+ return FALSE;
+
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ relocation = 0;
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ sec = h->root.u.def.section;
+ if (sec == NULL
+ || sec->output_section == NULL)
+ /* Set a flag that will be cleared later if we find a
+ relocation value for this symbol. output_section
+ is typically NULL for symbols satisfied by a shared
+ library. */
+ unresolved_reloc = TRUE;
+ else
+ relocation = (h->root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
+ }
+ else if (h->root.type == bfd_link_hash_undefweak)
+ ;
+ else if (info->unresolved_syms_in_objects == RM_IGNORE
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+ ;
+ else if (!info->relocatable
+ && !(r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64))
+ {
+ bfd_boolean err;
+ err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
+ || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT);
+ if (!info->callbacks->undefined_symbol (info,
+ h->root.root.string,
+ input_bfd,
+ input_section,
+ rel->r_offset, err))
+ return FALSE;
+ warned = TRUE;
+ }
sym_name = h->root.root.string;
}
--
Alan Modra
Australia Development Lab, IBM