From 3e60bf4df86f323dde4281886a355589488149aa Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 25 Mar 2014 12:01:09 +1030 Subject: [PATCH] Revert "Remove magic treatment of toc symbols for powerpc ELF" It turns out that glibc's sysdeps/powerpc/powerpc64/start.S uses this feature. :-( * config/tc-ppc.c (ppc_is_toc_sym): Revert 2014-03-05. (md_assemble): Likewise. Warn. --- gas/ChangeLog | 5 +++++ gas/config/tc-ppc.c | 23 +++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index ef4b6869b3f..d8d89f056a6 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2014-03-25 Alan Modra + + * config/tc-ppc.c (ppc_is_toc_sym): Revert 2014-03-05. + (md_assemble): Likewise. Warn. + 2014-03-21 David Weatherford Max Filippov diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 8609ce754af..9f24f3f54b3 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -2530,16 +2530,25 @@ parse_toc_entry (enum toc_size_qualifier *toc_kind) } #endif -#ifdef OBJ_XCOFF +#if defined (OBJ_XCOFF) || defined (OBJ_ELF) /* See whether a symbol is in the TOC section. */ static int ppc_is_toc_sym (symbolS *sym) { +#ifdef OBJ_XCOFF return (symbol_get_tc (sym)->symbol_class == XMC_TC || symbol_get_tc (sym)->symbol_class == XMC_TC0); -} #endif +#ifdef OBJ_ELF + const char *sname = segment_name (S_GET_SEGMENT (sym)); + if (ppc_obj64) + return strcmp (sname, ".toc") == 0; + else + return strcmp (sname, ".got") == 0; +#endif +} +#endif /* defined (OBJ_XCOFF) || defined (OBJ_ELF) */ #ifdef OBJ_ELF @@ -3167,11 +3176,17 @@ md_assemble (char *str) && operand->shift == 0) { reloc = BFD_RELOC_16; -#ifdef OBJ_XCOFF +#if defined OBJ_XCOFF || defined OBJ_ELF /* Note: the symbol may be not yet defined. */ if ((operand->flags & PPC_OPERAND_PARENS) != 0 && ppc_is_toc_sym (ex.X_add_symbol)) - reloc = BFD_RELOC_PPC_TOC16; + { + reloc = BFD_RELOC_PPC_TOC16; +#ifdef OBJ_ELF + as_warn (_("assuming %s on symbol"), + ppc_obj64 ? "@toc" : "@xgot"); +#endif + } #endif } -- 2.30.2