This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PowerPC64 toc edit fail
Committed.
* ld-powerpc/tocopt4a.s, * ld-powerpc/tocopt4b.s,
* ld-powerpc/tocopt4.d: New test.
* ld-powerpc/powerpc.exp: Run it.
Index: ld-powerpc/tocopt4a.s
===================================================================
RCS file: ld-powerpc/tocopt4a.s
diff -N ld-powerpc/tocopt4a.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld-powerpc/tocopt4a.s 22 Aug 2011 14:26:08 -0000
@@ -0,0 +1,4 @@
+ .globl _start
+ .text
+_start:
+ ld 9,xt@toc(9)
Index: ld-powerpc/tocopt4b.s
===================================================================
RCS file: ld-powerpc/tocopt4b.s
diff -N ld-powerpc/tocopt4b.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld-powerpc/tocopt4b.s 22 Aug 2011 14:26:08 -0000
@@ -0,0 +1,17 @@
+ .section .toc,"aw"
+ .globl xt
+xt:
+ .quad x
+#
+# This testcase will fail with a warning "xt defined on removed toc entry"
+# if a large-toc access like the following is added to this file, because
+# toc analysis only considers toc accesses from the current object file.
+# The small-toc access from tocopt4a.s doesn't cause xt entry to be marked
+# !can_optimize. The testcase only passes because toc analysis considers
+# *no* access from the current file as being sufficiently unusual to
+# warrant keeping the toc entry. So, if you use global symbols on toc
+# entries, don't mix code models.
+#
+# .text
+# addis 9,2,xt@toc@ha
+# ld 9,xt@toc@l(9)
Index: ld-powerpc/tocopt4.d
===================================================================
RCS file: ld-powerpc/tocopt4.d
diff -N ld-powerpc/tocopt4.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld-powerpc/tocopt4.d 22 Aug 2011 14:26:08 -0000
@@ -0,0 +1,7 @@
+
+.*: file format .*
+
+Contents of section \.text:
+ 100000b0 e9298000 .*
+Contents of section \.got:
+ 100100b8 00000000 00000002 .*
Index: ld-powerpc/powerpc.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-powerpc/powerpc.exp,v
retrieving revision 1.35
diff -u -p -r1.35 powerpc.exp
--- ld-powerpc/powerpc.exp 26 Jul 2011 01:57:18 -0000 1.35
+++ ld-powerpc/powerpc.exp 22 Aug 2011 14:26:23 -0000
@@ -209,6 +209,8 @@ set ppc64elftests {
{{ld tocopt2.out} {objdump -s tocopt2.d}} "tocopt2"}
{"TOC opt3" "-melf64ppc -no-keep-memory --defsym x=2" "-a64" {tocopt3.s}
{{objdump -s tocopt3.d}} "tocopt3"}
+ {"TOC opt4" "-melf64ppc -no-keep-memory --defsym x=2" "-a64"
+ {tocopt4a.s tocopt4b.s} {{objdump -s tocopt4.d}} "tocopt4"}
}
--
Alan Modra
Australia Development Lab, IBM