+2021-06-17 Clément Chigot <clement.chigot@atos.net>
+
+ * 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.
+
2021-06-16 Jan Beulich <jbeulich@suse.com>
* read.c (parse_one_float): New.
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. */
/* 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
}
run_dump_test "xcoff-function-1-32"
run_dump_test "xcoff-function-1-64"
+
+ run_dump_test "xcoff-tlsm-32"
+ run_dump_test "xcoff-tlsm-64"
}
--- /dev/null
+#as: -a32
+#source: xcoff-tlsm.s
+#objdump: -Dr
+#name: XCOFF TLSM relocation (32 bit)
+
+.*
+Disassembly of section .data:
+
+00000000 <TOC>:
+ 0: 00 00 00 10.*
+ 0: R_TLS foo_tdata-0x10
+
+00000004 <.foo_tdata>:
+ 4: 00 00 00 00.*
+ 4: R_TLSM foo_tdata-0x10
+
+00000008 <foo_tbss>:
+ 8: 00 00 00 20.*
+ 8: R_TLS foo_tbss-0x20
+
+0000000c <.foo_tbss>:
+ c: 00 00 00 00.*
+ c: R_TLSM foo_tbss-0x20
+
+Disassembly of section .tdata:
+
+00000010 <foo_tdata>:
+ 10: 00 00 00 01.*
+ ...
+
+Disassembly of section .tbss:
+
+00000020 <foo_tbss>:
+ ...
--- /dev/null
+#as: -a64
+#source: xcoff-tlsm.s
+#objdump: -Dr
+#name: XCOFF TLSM relocation (64 bit)
+
+.*
+Disassembly of section .data:
+
+0000000000000000 <TOC>:
+ 0: 00 00 00 00.*
+ 0: R_TLS foo_tdata-0x20
+ 4: 00 00 00 20.*
+
+0000000000000008 <.foo_tdata>:
+ ...
+ 8: R_TLSM foo_tdata-0x20
+
+0000000000000010 <foo_tbss>:
+ 10: 00 00 00 00.*
+ 10: R_TLS foo_tbss-0x30
+ 14: 00 00 00 30.*
+
+0000000000000018 <.foo_tbss>:
+ ...
+ 18: R_TLSM foo_tbss-0x30
+
+Disassembly of section .tdata:
+
+0000000000000020 <foo_tdata>:
+ 20: 00 00 00 01.*
+ ...
+
+Disassembly of section .tbss:
+
+0000000000000030 <foo_tbss>:
+ ...
--- /dev/null
+ .csect foo_tdata[TL],4
+ .align 2
+foo_tdata:
+ .long 1
+
+ .comm foo_tbss[UL],8
+
+ .toc
+ .tc foo_tdata[TC],foo_tdata[TL]
+ .tc .foo_tdata[TC],foo_tdata[TL]@m
+ .tc foo_tbss[TC],foo_tbss[UL]
+ .tc .foo_tbss[TC],foo_tbss[UL]@m