This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: powerpc64 toc pointer value
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Tue, 2 Jul 2013 09:56:31 +0930
- Subject: Re: powerpc64 toc pointer value
- References: <20121106051720 dot GK31965 at bubble dot grove dot modra dot org> <20130701031642 dot GZ21523 at bubble dot grove dot modra dot org>
This fixes a segfault on ld -r with object files that reference .TOC.,
and changes gas to emit the symbol as strong. A strong symbol is
probably best since it will result in older linkers complaining if
trying to link a new object file that references .TOC.
bfd/
* elf64-ppc.c (ppc64_elf_relocate_section): Set "relocation" for
.TOC. after relocatable check.
gas/
* config/tc-ppc.c (ppc_elf_adjust_symtab): Don't make .TOC. weak.
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.412
diff -u -p -r1.412 elf64-ppc.c
--- bfd/elf64-ppc.c 1 Jul 2013 03:45:05 -0000 1.412
+++ bfd/elf64-ppc.c 1 Jul 2013 23:15:32 -0000
@@ -12467,13 +12449,6 @@ ppc64_elf_relocate_section (bfd *output_
}
}
}
- if (h_elf == htab->elf.hgot)
- {
- relocation = (TOCstart
- + htab->stub_group[input_section->id].toc_off);
- sec = bfd_abs_section_ptr;
- unresolved_reloc = FALSE;
- }
}
h = (struct ppc_link_hash_entry *) h_elf;
@@ -12486,6 +12461,14 @@ ppc64_elf_relocate_section (bfd *output_
if (info->relocatable)
continue;
+ if (h != NULL && &h->elf == htab->elf.hgot)
+ {
+ relocation = (TOCstart
+ + htab->stub_group[input_section->id].toc_off);
+ sec = bfd_abs_section_ptr;
+ unresolved_reloc = FALSE;
+ }
+
/* TLS optimizations. Replace instruction sequences and relocs
based on information we collected in tls_optimize. We edit
RELOCS so that --emit-relocs will output something sensible
Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.200
diff -u -p -r1.200 tc-ppc.c
--- gas/config/tc-ppc.c 21 May 2013 01:36:45 -0000 1.200
+++ gas/config/tc-ppc.c 1 Jul 2013 23:15:32 -0000
@@ -2318,8 +2318,6 @@ ppc_elf_adjust_symtab (void)
asymbol *bsym = symbol_get_bfdsym (symp);
if ((bsym->flags & BSF_KEEP) == 0)
symbol_remove (symp, &symbol_rootP, &symbol_lastP);
- else
- S_SET_WEAK (symp);
}
}
}
--
Alan Modra
Australia Development Lab, IBM