diff options
author | Alan Modra <amodra@gmail.com> | 2011-09-30 05:11:04 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2011-09-30 05:11:04 +0000 |
commit | 9852805258de4c870df1f723bf22f21b41ebd6a7 (patch) | |
tree | 77b6ab2b4e26df33a38edf57d216e1be13637d52 /ld | |
parent | 723b724b171ec32ce7005c43fc7da4f5206f7190 (diff) | |
download | fsf-binutils-gdb-9852805258de4c870df1f723bf22f21b41ebd6a7.zip fsf-binutils-gdb-9852805258de4c870df1f723bf22f21b41ebd6a7.tar.gz fsf-binutils-gdb-9852805258de4c870df1f723bf22f21b41ebd6a7.tar.bz2 |
PR ld/13235
bfd/
* elf64-ppc.c (struct ppc64_elf_obj_tdata): Add ha_relocs_not_using_r2.
(ppc64_elf_edit_toc): Check HA relocs.
(ha_reloc_match): Delete function.
(ppc64_elf_relocate_section): Remove delayed HA nop optimization.
Instead do it and low part optimization based on
ha_relocs_not_using_r2.
ld/testsuite/
* ld-powerpc/tocopt.d: Update.
* ld-powerpc/tocopt5.d, * ld-powerpc/tocopt5.s: New test.
* ld-powerpc/powerpc.exp: Run new test.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/powerpc.exp | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tocopt.d | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tocopt5.d | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tocopt5.s | 43 |
5 files changed, 68 insertions, 4 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index be38879..54428dd 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-09-30 Alan Modra <amodra@gmail.com> + + * ld-powerpc/tocopt.d: Update. + * ld-powerpc/tocopt5.d, * ld-powerpc/tocopt5.s: New test. + * ld-powerpc/powerpc.exp: Run new test. + 2011-09-16 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/pr12975.d: Only run for *-*-linux* and *-*-gnu* diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp index 5ec36b2..7f9e7fa 100644 --- a/ld/testsuite/ld-powerpc/powerpc.exp +++ b/ld/testsuite/ld-powerpc/powerpc.exp @@ -211,6 +211,8 @@ set ppc64elftests { {{objdump -s tocopt3.d}} "tocopt3"} {"TOC opt4" "-melf64ppc -no-keep-memory --defsym x=2" "-a64" {tocopt4a.s tocopt4b.s} {{objdump -s tocopt4.d}} "tocopt4"} + {"TOC opt5" "-melf64ppc" "-a64" {tocopt5.s} + {{objdump -s tocopt5.d}} "tocopt5"} } diff --git a/ld/testsuite/ld-powerpc/tocopt.d b/ld/testsuite/ld-powerpc/tocopt.d index 9168661..f447f70 100644 --- a/ld/testsuite/ld-powerpc/tocopt.d +++ b/ld/testsuite/ld-powerpc/tocopt.d @@ -2,10 +2,10 @@ .*: file format .* Contents of section \.text: - 100000b0 60000000 e9228018 60000000 38a28020 .* - 100000c0 e8c50000 60000000 3ba08028 7c62e82a .* - 100000d0 60000000 39228033 60000000 38a28008 .* - 100000e0 e8c50000 60000000 3ba08010 7c62e82a .* + 100000b0 3d220000 e9298018 3c820000 38a48020 .* + 100000c0 e8c50000 3fa00000 3bbd8028 7c62e82a .* + 100000d0 3d220000 39298033 3c820000 38a48008 .* + 100000e0 e8c50000 3fa00000 3bbd8010 7c62e82a .* Contents of section \.got: 100100f0 00000000 100180f0 00000000 10010124 .* 10010100 00000000 10010125 00000000 10010120 .* diff --git a/ld/testsuite/ld-powerpc/tocopt5.d b/ld/testsuite/ld-powerpc/tocopt5.d new file mode 100644 index 0000000..8f03c07 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tocopt5.d @@ -0,0 +1,13 @@ + +.*: file format .* + +Contents of section \.text: + 100000b0 60000000 e9228018 60000000 38a28020 .* + 100000c0 e8c50000 60000000 3922802b 60000000 .* + 100000d0 38a28008 e8c50000 .* +Contents of section \.got: + 100100d8 00000000 100180d8 00000000 10010104 .* + 100100e8 00000000 10010105 00000000 10010100 .* + 100100f8 00000000 10010101 .* +Contents of section \.sdata: + 10010100 01020304 0506 .* diff --git a/ld/testsuite/ld-powerpc/tocopt5.s b/ld/testsuite/ld-powerpc/tocopt5.s new file mode 100644 index 0000000..67da1a9 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tocopt5.s @@ -0,0 +1,43 @@ + .section .toc,"aw" +x4t: + .quad x4 +x5t: + .quad x5 +x6t: + .quad x6 + + .section .sdata,"aw" +x1: + .byte 1 +x2: + .byte 2 +x3: + .byte 3 +x4: + .byte 4 +x5: + .byte 5 +x6: + .byte 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) |