PowerPC64 toc optimisation for power9
Recognize power9 and a few other insns from older machines. Fixes linker complaints like "toc optimization is not supported for 0xf4090002 instruction". 0xf4090002 is stxsd v0,0(r9) bfd/ * elf64-ppc.c (ok_lo_toc_insn): Add r_type param. Recognize lq,lfq,lxv,lxsd,lxssp,lfdp,stq,stfq,stxv,stxsd,stxssp,stfdp. Don't match lmd and stmd. ld/ * testsuite/ld-powerpc/tocopt7.s, * testsuite/ld-powerpc/tocopt7.out, * testsuite/ld-powerpc/tocopt7.d: New test. * testsuite/ld-powerpc/tocopt8.s, * testsuite/ld-powerpc/tocopt8.d: New test. * testsuite/ld-powerpc/powerpc.exp: Run them.
This commit is contained in:
parent
fc72affa68
commit
39eeab2534
@ -1,3 +1,9 @@
|
|||||||
|
2016-12-06 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* elf64-ppc.c (ok_lo_toc_insn): Add r_type param. Recognize
|
||||||
|
lq,lfq,lxv,lxsd,lxssp,lfdp,stq,stfq,stxv,stxsd,stxssp,stfdp.
|
||||||
|
Don't match lmd and stmd.
|
||||||
|
|
||||||
2016-12-05 Alyssa Milburn <amilburn@zall.org>
|
2016-12-05 Alyssa Milburn <amilburn@zall.org>
|
||||||
|
|
||||||
* elfxx-sparc.c: Do not stop processing relocations after
|
* elfxx-sparc.c: Do not stop processing relocations after
|
||||||
|
@ -8904,12 +8904,14 @@ adjust_toc_syms (struct elf_link_hash_entry *h, void *inf)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return TRUE iff INSN is one we expect on a _LO variety toc/got reloc. */
|
/* Return TRUE iff INSN with a relocation of R_TYPE is one we expect
|
||||||
|
on a _LO variety toc/got reloc. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
ok_lo_toc_insn (unsigned int insn)
|
ok_lo_toc_insn (unsigned int insn, enum elf_ppc64_reloc_type r_type)
|
||||||
{
|
{
|
||||||
return ((insn & (0x3f << 26)) == 14u << 26 /* addi */
|
return ((insn & (0x3f << 26)) == 12u << 26 /* addic */
|
||||||
|
|| (insn & (0x3f << 26)) == 14u << 26 /* addi */
|
||||||
|| (insn & (0x3f << 26)) == 32u << 26 /* lwz */
|
|| (insn & (0x3f << 26)) == 32u << 26 /* lwz */
|
||||||
|| (insn & (0x3f << 26)) == 34u << 26 /* lbz */
|
|| (insn & (0x3f << 26)) == 34u << 26 /* lbz */
|
||||||
|| (insn & (0x3f << 26)) == 36u << 26 /* stw */
|
|| (insn & (0x3f << 26)) == 36u << 26 /* stw */
|
||||||
@ -8923,11 +8925,20 @@ ok_lo_toc_insn (unsigned int insn)
|
|||||||
|| (insn & (0x3f << 26)) == 50u << 26 /* lfd */
|
|| (insn & (0x3f << 26)) == 50u << 26 /* lfd */
|
||||||
|| (insn & (0x3f << 26)) == 52u << 26 /* stfs */
|
|| (insn & (0x3f << 26)) == 52u << 26 /* stfs */
|
||||||
|| (insn & (0x3f << 26)) == 54u << 26 /* stfd */
|
|| (insn & (0x3f << 26)) == 54u << 26 /* stfd */
|
||||||
|| ((insn & (0x3f << 26)) == 58u << 26 /* lwa,ld,lmd */
|
|| (insn & (0x3f << 26)) == 56u << 26 /* lq,lfq */
|
||||||
&& (insn & 3) != 1)
|
|| ((insn & (0x3f << 26)) == 57u << 26 /* lxsd,lxssp,lfdp */
|
||||||
|| ((insn & (0x3f << 26)) == 62u << 26 /* std, stmd */
|
/* Exclude lfqu by testing reloc. If relocs are ever
|
||||||
&& ((insn & 3) == 0 || (insn & 3) == 3))
|
defined for the reduced D field in psq_lu then those
|
||||||
|| (insn & (0x3f << 26)) == 12u << 26 /* addic */);
|
will need testing too. */
|
||||||
|
&& r_type != R_PPC64_TOC16_LO && r_type != R_PPC64_GOT16_LO)
|
||||||
|
|| ((insn & (0x3f << 26)) == 58u << 26 /* ld,lwa */
|
||||||
|
&& (insn & 1) == 0)
|
||||||
|
|| (insn & (0x3f << 26)) == 60u << 26 /* stfq */
|
||||||
|
|| ((insn & (0x3f << 26)) == 61u << 26 /* lxv,stx{v,sd,ssp},stfdp */
|
||||||
|
/* Exclude stfqu. psq_stu as above for psq_lu. */
|
||||||
|
&& r_type != R_PPC64_TOC16_LO && r_type != R_PPC64_GOT16_LO)
|
||||||
|
|| ((insn & (0x3f << 26)) == 62u << 26 /* std,stq */
|
||||||
|
&& (insn & 1) == 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Examine all relocs referencing .toc sections in order to remove
|
/* Examine all relocs referencing .toc sections in order to remove
|
||||||
@ -9232,7 +9243,7 @@ ppc64_elf_edit_toc (struct bfd_link_info *info)
|
|||||||
}
|
}
|
||||||
insn = bfd_get_32 (ibfd, buf);
|
insn = bfd_get_32 (ibfd, buf);
|
||||||
if (insn_check == check_lo
|
if (insn_check == check_lo
|
||||||
? !ok_lo_toc_insn (insn)
|
? !ok_lo_toc_insn (insn, r_type)
|
||||||
: ((insn & ((0x3f << 26) | 0x1f << 16))
|
: ((insn & ((0x3f << 26) | 0x1f << 16))
|
||||||
!= ((15u << 26) | (2 << 16)) /* addis rt,2,imm */))
|
!= ((15u << 26) | (2 << 16)) /* addis rt,2,imm */))
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2016-12-06 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* testsuite/ld-powerpc/tocopt7.s,
|
||||||
|
* testsuite/ld-powerpc/tocopt7.out,
|
||||||
|
* testsuite/ld-powerpc/tocopt7.d: New test.
|
||||||
|
* testsuite/ld-powerpc/tocopt8.s,
|
||||||
|
* testsuite/ld-powerpc/tocopt8.d: New test.
|
||||||
|
* testsuite/ld-powerpc/powerpc.exp: Run them.
|
||||||
|
|
||||||
2016-12-05 Nick Clifton <nickc@redhat.com>
|
2016-12-05 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
PR ld/20906
|
PR ld/20906
|
||||||
|
@ -227,6 +227,10 @@ set ppc64elftests {
|
|||||||
{{objdump -s tocopt5.d}} "tocopt5"}
|
{{objdump -s tocopt5.d}} "tocopt5"}
|
||||||
{"TOC opt6" "-melf64ppc" "" "-a64" {tocopt6a.s tocopt6b.s tocopt6c.s}
|
{"TOC opt6" "-melf64ppc" "" "-a64" {tocopt6a.s tocopt6b.s tocopt6c.s}
|
||||||
{{objdump -d tocopt6.d}} "tocopt6"}
|
{{objdump -d tocopt6.d}} "tocopt6"}
|
||||||
|
{"TOC opt7" "-melf64ppc" "" "-a64 -mpower9" {tocopt7.s}
|
||||||
|
{{ld tocopt7.out} {objdump -s tocopt7.d}} "tocopt7"}
|
||||||
|
{"TOC opt8" "-melf64ppc" "" "-a64 -mpower9" {tocopt8.s}
|
||||||
|
{{objdump -s tocopt8.d}} "tocopt8"}
|
||||||
{"ambig shared v1" "-shared -melf64ppc" "" "-a64" {funv1.s} {} "funv1.so"}
|
{"ambig shared v1" "-shared -melf64ppc" "" "-a64" {funv1.s} {} "funv1.so"}
|
||||||
{"ambig shared v2" "-shared -melf64ppc" "" "-a64" {funv2.s} {} "funv2.so"}
|
{"ambig shared v2" "-shared -melf64ppc" "" "-a64" {funv2.s} {} "funv2.so"}
|
||||||
}
|
}
|
||||||
|
54
ld/testsuite/ld-powerpc/tocopt7.d
Normal file
54
ld/testsuite/ld-powerpc/tocopt7.d
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
.*: file format .*
|
||||||
|
|
||||||
|
Contents of section \.text:
|
||||||
|
100000b0 (0000223d|3d220000) (288029e9|e9298028) (0000823c|3c820000) (3080a438|38a48030) .*
|
||||||
|
100000c0 (0000c5e8|e8c50000) (0000823f|3f820000) (29803ce9|e93c8029) (0000223d|3d220000) .*
|
||||||
|
100000d0 (108029e9|e9298010) (0000823c|3c820000) (1880a438|38a48018) (0000c5e8|e8c50000) .*
|
||||||
|
100000e0 (0000823f|3f820000) (11803ce9|e93c8011) (0000823c|3c820000) (3080a438|38a48030) .*
|
||||||
|
100000f0 (0000c580|80c50000) (0000223d|3d220000) (10802981|81298010) (0000823c|3c820000) .*
|
||||||
|
10000100 (1880a438|38a48018) (0000c580|80c50000) (0000823f|3f820000) (10803c85|853c8010) .*
|
||||||
|
10000110 (0000823c|3c820000) (3080a438|38a48030) (0200c5e8|e8c50002) (0000223d|3d220000) .*
|
||||||
|
10000120 (128029e9|e9298012) (0000823c|3c820000) (1880a438|38a48018) (0200c5e8|e8c50002) .*
|
||||||
|
10000130 (0000823c|3c820000) (3080a438|38a48030) (0000c5a0|a0c50000) (0000223d|3d220000) .*
|
||||||
|
10000140 (108029a1|a1298010) (0000823c|3c820000) (1880a438|38a48018) (0000c5a0|a0c50000) .*
|
||||||
|
10000150 (0000823f|3f820000) (10803ca5|a53c8010) (0000823c|3c820000) (3080a438|38a48030) .*
|
||||||
|
10000160 (0000c5a8|a8c50000) (0000223d|3d220000) (108029a9|a9298010) (0000823c|3c820000) .*
|
||||||
|
10000170 (1880a438|38a48018) (0000c5a8|a8c50000) (0000823c|3c820000) (3080a438|38a48030) .*
|
||||||
|
10000180 (0000c588|88c50000) (0000223d|3d220000) (10802989|89298010) (0000823c|3c820000) .*
|
||||||
|
10000190 (1880a438|38a48018) (0000c588|88c50000) (0000823f|3f820000) (10803c8d|8d3c8010) .*
|
||||||
|
100001a0 (0000823c|3c820000) (3080a438|38a48030) (0000c5c0|c0c50000) (0000223d|3d220000) .*
|
||||||
|
100001b0 (108029c1|c1298010) (0000823c|3c820000) (1880a438|38a48018) (0000c5c0|c0c50000) .*
|
||||||
|
100001c0 (0000823f|3f820000) (10803cc5|c53c8010) (0000823c|3c820000) (3080a438|38a48030) .*
|
||||||
|
100001d0 (0000c5c8|c8c50000) (0000223d|3d220000) (108029c9|c9298010) (0000823c|3c820000) .*
|
||||||
|
100001e0 (1880a438|38a48018) (0000c5c8|c8c50000) (0000823f|3f820000) (10803ccd|cd3c8010) .*
|
||||||
|
100001f0 (0000823c|3c820000) (3080a438|38a48030) (0100c5f4|f4c50001) (0000223d|3d220000) .*
|
||||||
|
10000200 (118029f5|f5298011) (0000823c|3c820000) (2080a438|38a48020) (0100c5f4|f4c50001) .*
|
||||||
|
10000210 (0000823c|3c820000) (3080a438|38a48030) (0200c5e4|e4c50002) (0000223d|3d220000) .*
|
||||||
|
10000220 (128029e5|e5298012) (0000823c|3c820000) (1880a438|38a48018) (0200c5e4|e4c50002) .*
|
||||||
|
10000230 (0000823c|3c820000) (3080a438|38a48030) (0300c5e4|e4c50003) (0000223d|3d220000) .*
|
||||||
|
10000240 (138029e5|e5298013) (0000823c|3c820000) (1880a438|38a48018) (0300c5e4|e4c50003) .*
|
||||||
|
10000250 (0000223d|3d220000) (108029f9|f9298010) (0000823c|3c820000) (1880a438|38a48018) .*
|
||||||
|
10000260 (0000c5f8|f8c50000) (0000823f|3f820000) (11803cf9|f93c8011) (0000223d|3d220000) .*
|
||||||
|
10000270 (10802991|91298010) (0000823c|3c820000) (1880a438|38a48018) (0000c590|90c50000) .*
|
||||||
|
10000280 (0000823f|3f820000) (10803c95|953c8010) (0000223d|3d220000) (108029b1|b1298010) .*
|
||||||
|
10000290 (0000823c|3c820000) (1880a438|38a48018) (0000c5b0|b0c50000) (0000823f|3f820000) .*
|
||||||
|
100002a0 (10803cb5|b53c8010) (0000223d|3d220000) (10802999|99298010) (0000823c|3c820000) .*
|
||||||
|
100002b0 (1880a438|38a48018) (0000c598|98c50000) (0000823f|3f820000) (10803c9d|9d3c8010) .*
|
||||||
|
100002c0 (0000223d|3d220000) (108029d1|d1298010) (0000823c|3c820000) (1880a438|38a48018) .*
|
||||||
|
100002d0 (0000c5d0|d0c50000) (0000823f|3f820000) (10803cd5|d53c8010) (0000223d|3d220000) .*
|
||||||
|
100002e0 (108029d9|d9298010) (0000823c|3c820000) (1880a438|38a48018) (0000c5d8|d8c50000) .*
|
||||||
|
100002f0 (0000823f|3f820000) (10803cdd|dd3c8010) (0000223d|3d220000) (158029f5|f5298015) .*
|
||||||
|
10000300 (0000823c|3c820000) (2080a438|38a48020) (0500c5f4|f4c50005) (0000223d|3d220000) .*
|
||||||
|
10000310 (128029f5|f5298012) (0000823c|3c820000) (1880a438|38a48018) (0200c5f4|f4c50002) .*
|
||||||
|
10000320 (0000223d|3d220000) (138029f5|f5298013) (0000823c|3c820000) (1880a438|38a48018) .*
|
||||||
|
10000330 (0300c5f4|f4c50003) .*
|
||||||
|
Contents of section \.got:
|
||||||
|
10010400 (00840110|00000000) (00000000|10018400) (00000000|00000000) (00000000|00000000) .*
|
||||||
|
10010410 (58040110|00000000) (00000000|10010458) (60040110|00000000) (00000000|10010460) .*
|
||||||
|
10010420 (68040110|00000000) (00000000|10010468) (40040110|00000000) (00000000|10010440) .*
|
||||||
|
10010430 (48040110|00000000) (00000000|10010448) .*
|
||||||
|
Contents of section \.sdata:
|
||||||
|
10010440 (01000000|00000000) (00000000|00000001) (02000000|00000000) (00000000|00000002) .*
|
||||||
|
10010450 (03000000|00000000) (00000000|00000003) (04000000|00000000) (00000000|00000004) .*
|
||||||
|
10010460 (05000000|00000000) (00000000|00000005) (06000000|00000000) (00000000|00000006) .*
|
26
ld/testsuite/ld-powerpc/tocopt7.out
Normal file
26
ld/testsuite/ld-powerpc/tocopt7.out
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
.*
|
||||||
|
\(\.text\+0x18\): .*
|
||||||
|
.*
|
||||||
|
\(\.text\+0x34\): .*
|
||||||
|
.*
|
||||||
|
\(\.text\+0x5c\): .*
|
||||||
|
.*
|
||||||
|
\(\.text\+0xa4\): .*
|
||||||
|
.*
|
||||||
|
\(\.text\+0xec\): .*
|
||||||
|
.*
|
||||||
|
\(\.text\+0x114\): .*
|
||||||
|
.*
|
||||||
|
\(\.text\+0x13c\): .*
|
||||||
|
.*
|
||||||
|
\(\.text\+0x1b8\): .*
|
||||||
|
.*
|
||||||
|
\(\.text\+0x1d4\): .*
|
||||||
|
.*
|
||||||
|
\(\.text\+0x1f0\): .*
|
||||||
|
.*
|
||||||
|
\(\.text\+0x20c\): .*
|
||||||
|
.*
|
||||||
|
\(\.text\+0x228\): .*
|
||||||
|
.*
|
||||||
|
\(\.text\+0x244\): .*
|
216
ld/testsuite/ld-powerpc/tocopt7.s
Normal file
216
ld/testsuite/ld-powerpc/tocopt7.s
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
.section .toc,"aw"
|
||||||
|
.p2align 4
|
||||||
|
x4t:
|
||||||
|
.quad x4
|
||||||
|
x5t:
|
||||||
|
.quad x5
|
||||||
|
x6t:
|
||||||
|
.quad x6
|
||||||
|
|
||||||
|
.section .sdata,"aw"
|
||||||
|
.p2align 4
|
||||||
|
x1:
|
||||||
|
.quad 1
|
||||||
|
x2:
|
||||||
|
.quad 2
|
||||||
|
x3:
|
||||||
|
.quad 3
|
||||||
|
x4:
|
||||||
|
.quad 4
|
||||||
|
x5:
|
||||||
|
.quad 5
|
||||||
|
x6:
|
||||||
|
.quad 6
|
||||||
|
|
||||||
|
.globl _start
|
||||||
|
.text
|
||||||
|
_start:
|
||||||
|
# no need for got entry, optimise to nop,addi
|
||||||
|
# note: ld doesn't yet do got optimisation, so we get nop,ld
|
||||||
|
addis 9,2,x1@got@ha
|
||||||
|
ld 9,x1@got@l(9)
|
||||||
|
# must keep got entry, optimise to nop,addi,ld
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
ld 6,0(5)
|
||||||
|
# can't optimise due to possibility that r28 isn't dead
|
||||||
|
addis 28,2,x1@got@ha
|
||||||
|
ldu 9,x1@got@l(28)
|
||||||
|
# no need for toc entry, optimise to nop,addi
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
ld 9,x4t@toc@l(9)
|
||||||
|
# must keep toc entry, optimise to nop,addi,ld
|
||||||
|
# if we had a reloc tying the ld to x5/x5t then we could throw away
|
||||||
|
# the toc entry and optimise to nop,nop,addi
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
ld 6,0(5)
|
||||||
|
# can't optimise due to possibility that r28 isn't dead
|
||||||
|
addis 28,2,x4t@toc@ha
|
||||||
|
ldu 9,x4t@toc@l(28)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lwz 6,0(5)
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
lwz 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lwz 6,0(5)
|
||||||
|
addis 28,2,x4t@toc@ha
|
||||||
|
lwzu 9,x4t@toc@l(28)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lwa 6,0(5)
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
lwa 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lwa 6,0(5)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lhz 6,0(5)
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
lhz 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lhz 6,0(5)
|
||||||
|
addis 28,2,x4t@toc@ha
|
||||||
|
lhzu 9,x4t@toc@l(28)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lha 6,0(5)
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
lha 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lha 6,0(5)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lbz 6,0(5)
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
lbz 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lbz 6,0(5)
|
||||||
|
addis 28,2,x4t@toc@ha
|
||||||
|
lbzu 9,x4t@toc@l(28)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lfs 6,0(5)
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
lfs 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lfs 6,0(5)
|
||||||
|
addis 28,2,x4t@toc@ha
|
||||||
|
lfsu 9,x4t@toc@l(28)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lfd 6,0(5)
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
lfd 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lfd 6,0(5)
|
||||||
|
addis 28,2,x4t@toc@ha
|
||||||
|
lfdu 9,x4t@toc@l(28)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lxv 6,0(5)
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
lxv 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x6t@toc@ha
|
||||||
|
addi 5,4,x6t@toc@l
|
||||||
|
lxv 6,0(5)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lxsd 6,0(5)
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
lxsd 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lxsd 6,0(5)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lxssp 6,0(5)
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
lxssp 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lxssp 6,0(5)
|
||||||
|
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
std 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
std 6,0(5)
|
||||||
|
addis 28,2,x4t@toc@ha
|
||||||
|
stdu 9,x4t@toc@l(28)
|
||||||
|
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
stw 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
stw 6,0(5)
|
||||||
|
addis 28,2,x4t@toc@ha
|
||||||
|
stwu 9,x4t@toc@l(28)
|
||||||
|
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
sth 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
sth 6,0(5)
|
||||||
|
addis 28,2,x4t@toc@ha
|
||||||
|
sthu 9,x4t@toc@l(28)
|
||||||
|
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
stb 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
stb 6,0(5)
|
||||||
|
addis 28,2,x4t@toc@ha
|
||||||
|
stbu 9,x4t@toc@l(28)
|
||||||
|
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
stfs 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
stfs 6,0(5)
|
||||||
|
addis 28,2,x4t@toc@ha
|
||||||
|
stfsu 9,x4t@toc@l(28)
|
||||||
|
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
stfd 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
stfd 6,0(5)
|
||||||
|
addis 28,2,x4t@toc@ha
|
||||||
|
stfdu 9,x4t@toc@l(28)
|
||||||
|
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
stxv 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x6t@toc@ha
|
||||||
|
addi 5,4,x6t@toc@l
|
||||||
|
stxv 6,0(5)
|
||||||
|
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
stxsd 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
stxsd 6,0(5)
|
||||||
|
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
stxssp 9,x4t@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
stxssp 6,0(5)
|
46
ld/testsuite/ld-powerpc/tocopt8.d
Normal file
46
ld/testsuite/ld-powerpc/tocopt8.d
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
.*: file format .*
|
||||||
|
|
||||||
|
Contents of section \.text:
|
||||||
|
100000b0 (00000060|60000000) (108022e9|e9228010) (00000060|60000000) (1880a238|38a28018) .*
|
||||||
|
100000c0 (0000c5e8|e8c50000) (00000060|60000000) (38802239|39228038) (00000060|60000000) .*
|
||||||
|
100000d0 (0880a238|38a28008) (0000c5e8|e8c50000) (00000060|60000000) (088022e9|e9228008) .*
|
||||||
|
100000e0 (00000060|60000000) (1880a238|38a28018) (0000c580|80c50000) (00000060|60000000) .*
|
||||||
|
100000f0 (20802281|81228020) (00000060|60000000) (0880a238|38a28008) (0000c580|80c50000) .*
|
||||||
|
10000100 (00000060|60000000) (1880a238|38a28018) (0200c5e8|e8c50002) (00000060|60000000) .*
|
||||||
|
10000110 (228022e9|e9228022) (00000060|60000000) (0880a238|38a28008) (0200c5e8|e8c50002) .*
|
||||||
|
10000120 (00000060|60000000) (1880a238|38a28018) (0000c5a0|a0c50000) (00000060|60000000) .*
|
||||||
|
10000130 (208022a1|a1228020) (00000060|60000000) (0880a238|38a28008) (0000c5a0|a0c50000) .*
|
||||||
|
10000140 (00000060|60000000) (1880a238|38a28018) (0000c5a8|a8c50000) (00000060|60000000) .*
|
||||||
|
10000150 (208022a9|a9228020) (00000060|60000000) (0880a238|38a28008) (0000c5a8|a8c50000) .*
|
||||||
|
10000160 (00000060|60000000) (1880a238|38a28018) (0000c588|88c50000) (00000060|60000000) .*
|
||||||
|
10000170 (20802289|89228020) (00000060|60000000) (0880a238|38a28008) (0000c588|88c50000) .*
|
||||||
|
10000180 (00000060|60000000) (1880a238|38a28018) (0000c5c0|c0c50000) (00000060|60000000) .*
|
||||||
|
10000190 (208022c1|c1228020) (00000060|60000000) (0880a238|38a28008) (0000c5c0|c0c50000) .*
|
||||||
|
100001a0 (00000060|60000000) (1880a238|38a28018) (0000c5c8|c8c50000) (00000060|60000000) .*
|
||||||
|
100001b0 (208022c9|c9228020) (00000060|60000000) (0880a238|38a28008) (0000c5c8|c8c50000) .*
|
||||||
|
100001c0 (00000060|60000000) (1880a238|38a28018) (0100c5f4|f4c50001) (00000060|60000000) .*
|
||||||
|
100001d0 (218022f5|f5228021) (00000060|60000000) (2080a238|38a28020) (0100c5f4|f4c50001) .*
|
||||||
|
100001e0 (00000060|60000000) (1880a238|38a28018) (0200c5e4|e4c50002) (00000060|60000000) .*
|
||||||
|
100001f0 (228022e5|e5228022) (00000060|60000000) (0880a238|38a28008) (0200c5e4|e4c50002) .*
|
||||||
|
10000200 (00000060|60000000) (1880a238|38a28018) (0300c5e4|e4c50003) (00000060|60000000) .*
|
||||||
|
10000210 (238022e5|e5228023) (00000060|60000000) (0880a238|38a28008) (0300c5e4|e4c50003) .*
|
||||||
|
10000220 (00000060|60000000) (208022f9|f9228020) (00000060|60000000) (0880a238|38a28008) .*
|
||||||
|
10000230 (0000c5f8|f8c50000) (00000060|60000000) (20802291|91228020) (00000060|60000000) .*
|
||||||
|
10000240 (0880a238|38a28008) (0000c590|90c50000) (00000060|60000000) (208022b1|b1228020) .*
|
||||||
|
10000250 (00000060|60000000) (0880a238|38a28008) (0000c5b0|b0c50000) (00000060|60000000) .*
|
||||||
|
10000260 (20802299|99228020) (00000060|60000000) (0880a238|38a28008) (0000c598|98c50000) .*
|
||||||
|
10000270 (00000060|60000000) (208022d1|d1228020) (00000060|60000000) (0880a238|38a28008) .*
|
||||||
|
10000280 (0000c5d0|d0c50000) (00000060|60000000) (208022d9|d9228020) (00000060|60000000) .*
|
||||||
|
10000290 (0880a238|38a28008) (0000c5d8|d8c50000) (00000060|60000000) (258022f5|f5228025) .*
|
||||||
|
100002a0 (00000060|60000000) (2080a238|38a28020) (0500c5f4|f4c50005) (00000060|60000000) .*
|
||||||
|
100002b0 (228022f5|f5228022) (00000060|60000000) (0880a238|38a28008) (0200c5f4|f4c50002) .*
|
||||||
|
100002c0 (00000060|60000000) (238022f5|f5228023) (00000060|60000000) (0880a238|38a28008) .*
|
||||||
|
100002d0 (0300c5f4|f4c50003) .*
|
||||||
|
Contents of section \.got:
|
||||||
|
10010300 (00830110|00000000) (00000000|10018300) (40030110|00000000) (00000000|10010340) .*
|
||||||
|
10010310 (20030110|00000000) (00000000|10010320) (28030110|00000000) (00000000|10010328) .*
|
||||||
|
Contents of section \.sdata:
|
||||||
|
10010320 (01000000|00000000) (00000000|00000001) (02000000|00000000) (00000000|00000002) .*
|
||||||
|
10010330 (03000000|00000000) (00000000|00000003) (04000000|00000000) (00000000|00000004) .*
|
||||||
|
10010340 (05000000|00000000) (00000000|00000005) (06000000|00000000) (00000000|00000006) .*
|
188
ld/testsuite/ld-powerpc/tocopt8.s
Normal file
188
ld/testsuite/ld-powerpc/tocopt8.s
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
.section .toc,"aw"
|
||||||
|
x4t:
|
||||||
|
.quad x4
|
||||||
|
x5t:
|
||||||
|
.quad x5
|
||||||
|
|
||||||
|
.section .sdata,"aw"
|
||||||
|
.p2align 4
|
||||||
|
x1:
|
||||||
|
.quad 1
|
||||||
|
x2:
|
||||||
|
.quad 2
|
||||||
|
x3:
|
||||||
|
.quad 3
|
||||||
|
x4:
|
||||||
|
.quad 4
|
||||||
|
x5:
|
||||||
|
.quad 5
|
||||||
|
x6:
|
||||||
|
.quad 6
|
||||||
|
|
||||||
|
.globl _start
|
||||||
|
.text
|
||||||
|
_start:
|
||||||
|
# no need for got entry, optimise to nop,addi
|
||||||
|
# note: ld doesn't yet do got optimisation, so we get nop,ld
|
||||||
|
addis 9,2,x1@got@ha
|
||||||
|
ld 9,x1@got@l(9)
|
||||||
|
# must keep got entry, optimise to nop,addi,ld
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
ld 6,0(5)
|
||||||
|
# no need for toc entry, optimise to nop,addi
|
||||||
|
addis 9,2,x4t@toc@ha
|
||||||
|
ld 9,x4t@toc@l(9)
|
||||||
|
# must keep toc entry, optimise to nop,addi,ld
|
||||||
|
# if we had a reloc tying the ld to x5/x5t then we could throw away
|
||||||
|
# the toc entry and optimise to nop,nop,addi
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
ld 6,0(5)
|
||||||
|
# keep toc entry due to other accesses to x5t, optimise to nop,ld
|
||||||
|
addis 9,2,x5t@toc@ha
|
||||||
|
ld 9,x5t@toc@l(9)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lwz 6,0(5)
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
lwz 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lwz 6,0(5)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lwa 6,0(5)
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
lwa 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lwa 6,0(5)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lhz 6,0(5)
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
lhz 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lhz 6,0(5)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lha 6,0(5)
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
lha 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lha 6,0(5)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lbz 6,0(5)
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
lbz 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lbz 6,0(5)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lfs 6,0(5)
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
lfs 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lfs 6,0(5)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lfd 6,0(5)
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
lfd 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lfd 6,0(5)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lxv 6,0(5)
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
lxv 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x1@toc@ha
|
||||||
|
addi 5,4,x1@toc@l
|
||||||
|
lxv 6,0(5)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lxsd 6,0(5)
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
lxsd 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lxsd 6,0(5)
|
||||||
|
|
||||||
|
addis 4,2,x2@got@ha
|
||||||
|
addi 5,4,x2@got@l
|
||||||
|
lxssp 6,0(5)
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
lxssp 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
lxssp 6,0(5)
|
||||||
|
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
std 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
std 6,0(5)
|
||||||
|
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
stw 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
stw 6,0(5)
|
||||||
|
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
sth 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
sth 6,0(5)
|
||||||
|
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
stb 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
stb 6,0(5)
|
||||||
|
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
stfs 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
stfs 6,0(5)
|
||||||
|
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
stfd 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
stfd 6,0(5)
|
||||||
|
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
stxv 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x1@toc@ha
|
||||||
|
addi 5,4,x1@toc@l
|
||||||
|
stxv 6,0(5)
|
||||||
|
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
stxsd 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
stxsd 6,0(5)
|
||||||
|
|
||||||
|
addis 9,2,x1@toc@ha
|
||||||
|
stxssp 9,x1@toc@l(9)
|
||||||
|
addis 4,2,x5t@toc@ha
|
||||||
|
addi 5,4,x5t@toc@l
|
||||||
|
stxssp 6,0(5)
|
Loading…
x
Reference in New Issue
Block a user