From 365b60b058820ac395db8305aa5ab4ff5ce1a3af Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 22 Aug 2011 14:28:54 +0000 Subject: [PATCH] * ld-powerpc/tocopt4a.s, * ld-powerpc/tocopt4b.s, * ld-powerpc/tocopt4.d: New test. * ld-powerpc/powerpc.exp: Run it. --- ld/testsuite/ChangeLog | 6 ++++++ ld/testsuite/ld-powerpc/powerpc.exp | 2 ++ ld/testsuite/ld-powerpc/tocopt4.d | 7 +++++++ ld/testsuite/ld-powerpc/tocopt4a.s | 4 ++++ ld/testsuite/ld-powerpc/tocopt4b.s | 17 +++++++++++++++++ 5 files changed, 36 insertions(+) create mode 100644 ld/testsuite/ld-powerpc/tocopt4.d create mode 100644 ld/testsuite/ld-powerpc/tocopt4a.s create mode 100644 ld/testsuite/ld-powerpc/tocopt4b.s diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 013fbebe73..2edc17decd 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-08-22 Alan Modra + + * ld-powerpc/tocopt4a.s, * ld-powerpc/tocopt4b.s, + * ld-powerpc/tocopt4.d: New test. + * ld-powerpc/powerpc.exp: Run it. + 2011-08-12 H.J. Lu PR ld/13082 diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp index d48b148890..5ec36b29cd 100644 --- a/ld/testsuite/ld-powerpc/powerpc.exp +++ b/ld/testsuite/ld-powerpc/powerpc.exp @@ -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"} } diff --git a/ld/testsuite/ld-powerpc/tocopt4.d b/ld/testsuite/ld-powerpc/tocopt4.d new file mode 100644 index 0000000000..4f450e44a5 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tocopt4.d @@ -0,0 +1,7 @@ + +.*: file format .* + +Contents of section \.text: + 100000b0 e9298000 .* +Contents of section \.got: + 100100b8 00000000 00000002 .* diff --git a/ld/testsuite/ld-powerpc/tocopt4a.s b/ld/testsuite/ld-powerpc/tocopt4a.s new file mode 100644 index 0000000000..3d6f28e387 --- /dev/null +++ b/ld/testsuite/ld-powerpc/tocopt4a.s @@ -0,0 +1,4 @@ + .globl _start + .text +_start: + ld 9,xt@toc(9) diff --git a/ld/testsuite/ld-powerpc/tocopt4b.s b/ld/testsuite/ld-powerpc/tocopt4b.s new file mode 100644 index 0000000000..ee77d10bfd --- /dev/null +++ b/ld/testsuite/ld-powerpc/tocopt4b.s @@ -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) -- 2.34.1