aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2010-08-05 14:38:10 +0000
committerAlan Modra <amodra@gmail.com>2010-08-05 14:38:10 +0000
commitb3808325c52ab089d28b5bf9b8d9558e8c2fa329 (patch)
tree500d56d64dc25985909918d68d622b93e1621f2e /ld
parentd983b7a0c394e35ab90cb7b92de98963e3996ef1 (diff)
downloadgdb-b3808325c52ab089d28b5bf9b8d9558e8c2fa329.zip
gdb-b3808325c52ab089d28b5bf9b8d9558e8c2fa329.tar.gz
gdb-b3808325c52ab089d28b5bf9b8d9558e8c2fa329.tar.bz2
* ld-powerpc/tocopt.s, * ld-powerpc/tocopt.d: New test.
* ld-powerpc/powerpc.exp: Run it.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog5
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp2
-rw-r--r--ld/testsuite/ld-powerpc/tocopt.d14
-rw-r--r--ld/testsuite/ld-powerpc/tocopt.s51
4 files changed, 72 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index b407ab6..f5b05fa 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-06 Alan Modra <amodra@gmail.com>
+
+ * ld-powerpc/tocopt.s, * ld-powerpc/tocopt.d: New test.
+ * ld-powerpc/powerpc.exp: Run it.
+
2010-07-23 Naveen.H.S <naveen.S@kpitcummins.com>
Ina Pandit <ina.pandit@kpitcummins.com>
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index 9d0207f..6cb797e 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -178,6 +178,8 @@ set ppc64elftests {
"tlsmark"}
{"sym@tocbase" "-shared -melf64ppc" "-a64" {symtocbase-1.s symtocbase-2.s}
{{objdump -dj.data symtocbase.d}} "symtocbase.so"}
+ {"TOC opt" "-melf64ppc" "-a64" {tocopt.s}
+ {{objdump -s tocopt.d}} "tocopt"}
}
diff --git a/ld/testsuite/ld-powerpc/tocopt.d b/ld/testsuite/ld-powerpc/tocopt.d
new file mode 100644
index 0000000..9168661
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tocopt.d
@@ -0,0 +1,14 @@
+
+.*: 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 .*
+Contents of section \.got:
+ 100100f0 00000000 100180f0 00000000 10010124 .*
+ 10010100 00000000 10010125 00000000 10010120 .*
+ 10010110 00000000 10010121 00000000 10010122 .*
+Contents of section \.sdata:
+ 10010120 01020304 0506 .*
diff --git a/ld/testsuite/ld-powerpc/tocopt.s b/ld/testsuite/ld-powerpc/tocopt.s
new file mode 100644
index 0000000..a2447ca
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tocopt.s
@@ -0,0 +1,51 @@
+ .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)
+# must keep got entry, optimise to nop,li,ldx
+ lis 29,x3@got@ha
+ addi 29,29,x3@got@l
+ ldx 3,2,29
+
+# 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)
+# must keep toc entry, optimise to nop,li,ldx
+ lis 29,x6t@toc@ha
+ addi 29,29,x6t@toc@l
+ ldx 3,2,29