diff options
author | Alan Modra <amodra@bigpond.net.au> | 2012-11-06 05:18:02 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2012-11-06 05:18:02 +0000 |
commit | 1af0a55685a8206d65aa258aed5c2afa5d46aef4 (patch) | |
tree | f667dca8d0a5e78aef2bff5dfeafd4f57e8fd9d1 /gas | |
parent | 6ede38e8a05b789238377a0b40f228b47aa04953 (diff) | |
download | binutils-redhat-1af0a55685a8206d65aa258aed5c2afa5d46aef4.tar.gz |
bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add dot_toc_dot.
(ppc64_elf_size_stubs): Lookup ".TOC.".
(ppc64_elf_relocate_section): Resolve special symbol ".TOC.".
gas/
* config/tc-ppc.c (ppc_elf_adjust_symtab): New function, split out..
(ppc_frob_file_before_adjust): ..from here.
(md_apply_fix): Set BSF_KEEP on .TOC. if not @tocbase.
* config/tc-ppc.h (ppc_elf_adjust_symtab): Declare.
(tc_adjust_symtab): Define.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 8 | ||||
-rw-r--r-- | gas/config/tc-ppc.c | 37 | ||||
-rw-r--r-- | gas/config/tc-ppc.h | 3 |
3 files changed, 43 insertions, 5 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 474b617c2e..9ad252f619 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,13 @@ 2012-11-06 Alan Modra <amodra@gmail.com> + * config/tc-ppc.c (ppc_elf_adjust_symtab): New function, split out.. + (ppc_frob_file_before_adjust): ..from here. + (md_apply_fix): Set BSF_KEEP on .TOC. if not @tocbase. + * config/tc-ppc.h (ppc_elf_adjust_symtab): Declare. + (tc_adjust_symtab): Define. + +2012-11-06 Alan Modra <amodra@gmail.com> + * config/tc-ppc.c (md_apply_fix): Fix xcoff build breakage from last patch. diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index c72a8632ba..1b12f57b8c 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -2323,11 +2323,28 @@ ppc_frob_file_before_adjust (void) && toc_reloc_types != has_large_toc_reloc && bfd_section_size (stdoutput, toc) > 0x10000) as_warn (_("TOC section size exceeds 64k")); +} + +/* .TOC. used in an opd entry as .TOC.@tocbase doesn't need to be + emitted. Other uses of .TOC. will cause the symbol to be marked + with BSF_KEEP in md_apply_fix. */ - /* Don't emit .TOC. symbol. */ - symp = symbol_find (".TOC."); - if (symp != NULL) - symbol_remove (symp, &symbol_rootP, &symbol_lastP); +void +ppc_elf_adjust_symtab (void) +{ + if (ppc_obj64) + { + symbolS *symp; + symp = symbol_find (".TOC."); + if (symp != NULL) + { + asymbol *bsym = symbol_get_bfdsym (symp); + if ((bsym->flags & BSF_KEEP) == 0) + symbol_remove (symp, &symbol_rootP, &symbol_lastP); + else + S_SET_WEAK (symp); + } + } } #endif /* OBJ_ELF */ @@ -6850,7 +6867,17 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) then the section contents are immaterial, so don't warn if they happen to overflow. Leave such warnings to ld. */ if (!fixP->fx_done) - fixP->fx_no_overflow = 1; + { + fixP->fx_no_overflow = 1; + + /* Arrange to emit .TOC. as a normal symbol if used in anything + but .TOC.@tocbase. */ + if (ppc_obj64 + && fixP->fx_r_type != BFD_RELOC_PPC64_TOC + && fixP->fx_addsy != NULL + && strcmp (S_GET_NAME (fixP->fx_addsy), ".TOC.") == 0) + symbol_get_bfdsym (fixP->fx_addsy)->flags |= BSF_KEEP; + } #else if (fixP->fx_r_type != BFD_RELOC_PPC_TOC16) fixP->fx_addnumber = 0; diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h index e053c9c827..3dd3f8190b 100644 --- a/gas/config/tc-ppc.h +++ b/gas/config/tc-ppc.h @@ -235,6 +235,9 @@ extern int ppc_fix_adjustable (struct fix *); #define tc_frob_file_before_adjust ppc_frob_file_before_adjust extern void ppc_frob_file_before_adjust (void); +#define tc_adjust_symtab() ppc_elf_adjust_symtab () +extern void ppc_elf_adjust_symtab (void); + #endif /* OBJ_ELF */ #if defined (OBJ_ELF) || defined (OBJ_XCOFF) |