aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-ppc.c
diff options
context:
space:
mode:
authorClément Chigot <clement.chigot@atos.net>2021-06-14 13:25:42 +0200
committerAlan Modra <amodra@gmail.com>2021-06-17 15:38:09 +0930
commit3478a63d7ed68d666f842f5b8fb5bdade619c817 (patch)
tree59f2f76c4cab5ff09636525e9ac3485d17ce9d15 /gas/config/tc-ppc.c
parent7993124ee29271697870824c3a626babc7d5ab85 (diff)
downloadfsf-binutils-gdb-3478a63d7ed68d666f842f5b8fb5bdade619c817.zip
fsf-binutils-gdb-3478a63d7ed68d666f842f5b8fb5bdade619c817.tar.gz
fsf-binutils-gdb-3478a63d7ed68d666f842f5b8fb5bdade619c817.tar.bz2
gas: ensure sections contents is zero for BFD_RELOC_PPC*_TLSM on XCOFF.
AIX ld expects the section contents for relocations BFD_RELOC_PPC_TLSM or BFD_RELOC_PPC64_TLSM to be zero. Actually, it seems to be the case for all the TLS relocations generated by AIX assembly but only these two are mandatory. * config/tc-ppc.c (md_apply_fix): Adjust addend to nullify section contents for BFD_RELOC_PPC_TLSM or BFD_RELOC_PPC64_TLSM. * testsuite/gas/ppc/xcoff-tlsm-32.d: New test. * testsuite/gas/ppc/xcoff-tlsm-64.d: New test. * testsuite/gas/ppc/xcoff-tlsm.s: New test. * testsuite/gas/ppc/aix.exp: Run new tests.
Diffstat (limited to 'gas/config/tc-ppc.c')
-rw-r--r--gas/config/tc-ppc.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index fce2b15..72bf5ce 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -7411,11 +7411,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
symbol_get_bfdsym (fixP->fx_addsy)->flags |= BSF_KEEP;
}
#else
- if (fixP->fx_r_type != BFD_RELOC_PPC_TOC16
- && fixP->fx_r_type != BFD_RELOC_PPC_TOC16_HI
- && fixP->fx_r_type != BFD_RELOC_PPC_TOC16_LO)
- fixP->fx_addnumber = 0;
- else
+ if (fixP->fx_r_type == BFD_RELOC_PPC_TOC16
+ || fixP->fx_r_type == BFD_RELOC_PPC_TOC16_HI
+ || fixP->fx_r_type == BFD_RELOC_PPC_TOC16_LO)
{
/* We want to use the offset within the toc, not the actual VMA
of the symbol. */
@@ -7430,6 +7428,15 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
/* Set *valP to avoid errors. */
*valP = value;
}
+ else if (fixP->fx_r_type == BFD_RELOC_PPC_TLSM
+ || fixP->fx_r_type == BFD_RELOC_PPC64_TLSM)
+ /* AIX ld expects the section contents for these relocations
+ to be zero. Arrange for that to occur when
+ bfd_install_relocation is called. */
+ fixP->fx_addnumber = (- bfd_section_vma (S_GET_SEGMENT (fixP->fx_addsy))
+ - S_GET_VALUE (fixP->fx_addsy));
+ else
+ fixP->fx_addnumber = 0;
#endif
}