mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 18:08:24 +08:00
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.
This commit is contained in:

committed by
Alan Modra

parent
7993124ee2
commit
3478a63d7e
@ -1,3 +1,13 @@
|
||||
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.
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -78,4 +78,7 @@ if { [istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"] } then {
|
||||
|
||||
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"
|
||||
}
|
||||
|
34
gas/testsuite/gas/ppc/xcoff-tlsm-32.d
Normal file
34
gas/testsuite/gas/ppc/xcoff-tlsm-32.d
Normal file
@ -0,0 +1,34 @@
|
||||
#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>:
|
||||
...
|
36
gas/testsuite/gas/ppc/xcoff-tlsm-64.d
Normal file
36
gas/testsuite/gas/ppc/xcoff-tlsm-64.d
Normal file
@ -0,0 +1,36 @@
|
||||
#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>:
|
||||
...
|
12
gas/testsuite/gas/ppc/xcoff-tlsm.s
Normal file
12
gas/testsuite/gas/ppc/xcoff-tlsm.s
Normal file
@ -0,0 +1,12 @@
|
||||
.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
|
Reference in New Issue
Block a user