* testsuite/ld-powerpc/powerpc.exp: Run TOCSAVE tests.
* testsuite/ld-powerpc/tocsave1.s,
* testsuite/ld-powerpc/tocsave1a.d,
* testsuite/ld-powerpc/tocsave1s.d,
* testsuite/ld-powerpc/tocsave2.s,
* testsuite/ld-powerpc/tocsave2a.d,
* testsuite/ld-powerpc/tocsave2s.d,
* testsuite/ld-powerpc/tocsavelib.s: New files.
+2017-06-21 Alan Modra <amodra@gmail.com>
+
+ * testsuite/ld-powerpc/powerpc.exp: Run TOCSAVE tests.
+ * testsuite/ld-powerpc/tocsave1.s,
+ * testsuite/ld-powerpc/tocsave1a.d,
+ * testsuite/ld-powerpc/tocsave1s.d,
+ * testsuite/ld-powerpc/tocsave2.s,
+ * testsuite/ld-powerpc/tocsave2a.d,
+ * testsuite/ld-powerpc/tocsave2s.d,
+ * testsuite/ld-powerpc/tocsavelib.s: New files.
+
2017-06-19 H.J. Lu <hongjiu.lu@intel.com>
PR ld/21626
{{ld tocopt7.out} {objdump -s tocopt7.d}} "tocopt7"}
{"TOC opt8" "-melf64ppc" "" "-a64 -mpower9" {tocopt8.s}
{{objdump -s tocopt8.d}} "tocopt8"}
+ {"tocsave lib" "-shared -melf64ppc" "" "-a64" {tocsavelib.s}
+ {} "tocsavelib.so"}
+ {"tocsave1 shared" "-melf64ppc" "tmpdir/tocsavelib.so" "-a64" {tocsave1.s}
+ {{objdump -dr tocsave1s.d}} "tocsave1s"}
+ {"tocsave1 static" "-melf64ppc" "tmpdir/tocsavelib.o" "-a64" {tocsave1.s}
+ {{objdump -dr tocsave1a.d}} "tocsave1a"}
+ {"tocsave2 shared" "-melf64ppc" "tmpdir/tocsavelib.so" "-a64" {tocsave2.s}
+ {{objdump -dr tocsave2s.d}} "tocsave2s"}
+ {"tocsave2 static" "-melf64ppc" "tmpdir/tocsavelib.o" "-a64" {tocsave2.s}
+ {{objdump -dr tocsave2a.d}} "tocsave2a"}
{"ambig shared v1" "-shared -melf64ppc" "" "-a64" {funv1.s} {} "funv1.so"}
{"ambig shared v2" "-shared -melf64ppc" "" "-a64" {funv2.s} {} "funv2.so"}
}
--- /dev/null
+ .abiversion 1
+ .global _start
+ .type _start,@function
+ .section ".opd","aw",@progbits
+ .p2align 3
+_start:
+ .quad .L_start, .TOC.@tocbase, 0
+
+ .text
+.L_start:
+ nop
+.L1:
+# tocsave in a function prologue
+ .reloc .,R_PPC64_TOCSAVE,.L1
+ nop
+
+ nop
+# tocsave on a call
+ bl foo
+ .reloc .,R_PPC64_TOCSAVE,.L1
+ nop
+
+ blr
+ .size _start, .-.L_start
--- /dev/null
+
+.*: file format .*
+
+Disassembly of section \.text:
+
+.* <\._start>:
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (0d 00 00 48|48 00 00 0d) bl .* <foo>
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (20 00 80 4e|4e 80 00 20) blr
+
+.* <foo>:
+.*: (20 00 80 4e|4e 80 00 20) blr
--- /dev/null
+#...
+.* <\._start>:
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (28 00 41 f8|f8 41 00 28) std r2,40\(r1\)
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (.. .. .. 4b|4b .. .. ..) bl .* <.*\.plt_call\.foo>
+.*: (28 00 41 e8|e8 41 00 28) ld r2,40\(r1\)
+.*: (20 00 80 4e|4e 80 00 20) blr
+#pass
--- /dev/null
+ .abiversion 2
+ .global _start
+ .type _start,@function
+_start:
+ nop
+.L1:
+# Function prologue tocsave.
+ .reloc .,R_PPC64_TOCSAVE,.L1
+ nop
+
+ nop
+# Call with tocsave on nop
+ bl foo
+ .reloc .,R_PPC64_TOCSAVE,.L1
+ nop
+
+ nop
+# A call without tocsave (maybe in a different function, or after alloca
+# dynamic stack allocation loses r2 save in same function).
+ bl foo
+ nop
+
+ blr
+ .size _start, .-_start
--- /dev/null
+
+.*: file format .*
+
+Disassembly of section \.text:
+
+.* <_start>:
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (19 00 00 48|48 00 00 19) bl .* <foo>
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (0d 00 00 48|48 00 00 0d) bl .* <foo>
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (20 00 80 4e|4e 80 00 20) blr
+
+.* <foo>:
+.*: (20 00 80 4e|4e 80 00 20) blr
--- /dev/null
+#...
+.* <_start>:
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (18 00 41 f8|f8 41 00 18) std r2,24\(r1\)
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (.. .. .. 4b|4b .. .. ..) bl .* <.*\.plt_call\.foo\+0x4>
+.*: (18 00 41 e8|e8 41 00 18) ld r2,24\(r1\)
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (.. .. .. 4b|4b .. .. ..) bl .* <.*\.plt_call\.foo>
+.*: (18 00 41 e8|e8 41 00 18) ld r2,24\(r1\)
+.*: (20 00 80 4e|4e 80 00 20) blr
+.*: (00 00 00 60|60 00 00 00) nop
+#pass
--- /dev/null
+ .global foo
+ .type foo,@function
+foo:
+ blr
+ .size foo, .-foo