aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-03-05 19:27:57 +1030
committerAlan Modra <amodra@gmail.com>2014-03-05 19:27:57 +1030
commitf50c47f1184b39831f7c8a8200bc349f47619ac3 (patch)
tree4edc57abf92eaed468e6a165c928d5fdf783ec47
parentb2b255bdf3d29d97c10668b4bb5fceeb886a15f1 (diff)
downloadfsf-binutils-gdb-f50c47f1184b39831f7c8a8200bc349f47619ac3.zip
fsf-binutils-gdb-f50c47f1184b39831f7c8a8200bc349f47619ac3.tar.gz
fsf-binutils-gdb-f50c47f1184b39831f7c8a8200bc349f47619ac3.tar.bz2
Remove magic treatment of toc symbols for powerpc ELF
The XCOFF assembler does some wierd things with instructions like `lwz 9,sym(30'. See the comment in md_apply_fix. From an ELF perspective, it's weird even to magically select a TOC16 reloc when a symbol is in the TOC/GOT. ELF assemblers generally use modifiers like @toc to select relocs, so remove this "feature" for ELF. I believe this was to support gcc -m32 -mcall-aixdesc but that combination of gcc options has been broken for a long time. * config/tc-ppc.c (ppc_is_toc_sym): Remove OBJ_ELF support. (md_assemble): Don't call ppc_is_toc_sym for ELF.
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-ppc.c37
2 files changed, 15 insertions, 27 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 88e9d81..e3ebd67 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2014-03-05 Alan Modra <amodra@gmail.com>
+
+ * config/tc-ppc.c (ppc_is_toc_sym): Remove OBJ_ELF support.
+ (md_assemble): Don't call ppc_is_toc_sym for ELF.
+
2014-03-04 Heiher <r@hev.cc>
* config/tc-mips.c (mips_cpu_info_table): Use ISA_MIPS64R2 for
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 7c99e43..176b13c 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -2531,25 +2531,16 @@ parse_toc_entry (enum toc_size_qualifier *toc_kind)
}
#endif
-#if defined (OBJ_XCOFF) || defined (OBJ_ELF)
+#ifdef OBJ_XCOFF
/* 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) */
+#endif
#ifdef OBJ_ELF
@@ -3280,25 +3271,17 @@ md_assemble (char *str)
&& (operand->bitm & 0xfff0) == 0xfff0
&& operand->shift == 0)
{
- /* Note: the symbol may be not yet defined. */
- if (ppc_is_toc_sym (ex.X_add_symbol))
- {
- reloc = BFD_RELOC_PPC_TOC16;
+ reloc = BFD_RELOC_16;
#ifdef OBJ_ELF
- if (ppc_obj64
- && (operand->flags & PPC_OPERAND_DS) != 0)
- reloc = BFD_RELOC_PPC64_TOC16_DS;
+ if (ppc_obj64
+ && (operand->flags & PPC_OPERAND_DS) != 0)
+ reloc = BFD_RELOC_PPC64_ADDR16_DS;
#endif
- }
- else
- {
- reloc = BFD_RELOC_16;
-#ifdef OBJ_ELF
- if (ppc_obj64
- && (operand->flags & PPC_OPERAND_DS) != 0)
- reloc = BFD_RELOC_PPC64_ADDR16_DS;
+#ifdef OBJ_XCOFF
+ /* Note: the symbol may be not yet defined. */
+ if (ppc_is_toc_sym (ex.X_add_symbol))
+ reloc = BFD_RELOC_PPC_TOC16;
#endif
- }
}
#endif /* defined (OBJ_XCOFF) || defined (OBJ_ELF) */