]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
This commit was manufactured by cvs2svn to create branch 'binutils-
authornobody <>
Fri, 30 Sep 2011 05:11:05 +0000 (05:11 +0000)
committernobody <>
Fri, 30 Sep 2011 05:11:05 +0000 (05:11 +0000)
2_22-branch'.

Cherrypick from master 2011-09-30 05:11:04 UTC Alan Modra <amodra@gmail.com> ' PR ld/13235':
    ld/testsuite/ld-elf/pr13195.c
    ld/testsuite/ld-elf/pr13195.d
    ld/testsuite/ld-elf/pr13195.s
    ld/testsuite/ld-elf/pr13195.t
    ld/testsuite/ld-powerpc/tocopt5.d
    ld/testsuite/ld-powerpc/tocopt5.s

ld/testsuite/ld-elf/pr13195.c [new file with mode: 0644]
ld/testsuite/ld-elf/pr13195.d [new file with mode: 0644]
ld/testsuite/ld-elf/pr13195.s [new file with mode: 0644]
ld/testsuite/ld-elf/pr13195.t [new file with mode: 0644]
ld/testsuite/ld-powerpc/tocopt5.d [new file with mode: 0644]
ld/testsuite/ld-powerpc/tocopt5.s [new file with mode: 0644]

diff --git a/ld/testsuite/ld-elf/pr13195.c b/ld/testsuite/ld-elf/pr13195.c
new file mode 100644 (file)
index 0000000..a9bce4a
--- /dev/null
@@ -0,0 +1,5 @@
+int
+main ()
+{
+  return 0;
+}
diff --git a/ld/testsuite/ld-elf/pr13195.d b/ld/testsuite/ld-elf/pr13195.d
new file mode 100644 (file)
index 0000000..796102b
--- /dev/null
@@ -0,0 +1,10 @@
+#ld: --gc-sections -shared -version-script pr13195.t
+#readelf: -s --wide -D
+#target: *-*-linux* *-*-gnu*
+#notarget: arc-*-* d30v-*-* dlx-*-* i960-*-* or32-*-* pj*-*-*
+#notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+
+#...
+ +[0-9]+ +[0-9]+: +[0-9a-f]+ +[0-9]+ +FUNC +GLOBAL +DEFAULT +[1-9]+ foo
+#pass
diff --git a/ld/testsuite/ld-elf/pr13195.s b/ld/testsuite/ld-elf/pr13195.s
new file mode 100644 (file)
index 0000000..409b5af
--- /dev/null
@@ -0,0 +1,6 @@
+       .section .text.new_foo,"ax",%progbits
+       .globl  new_foo
+       .type   new_foo, %function
+new_foo:
+       .byte 0
+       .symver new_foo,foo@@VERS_2.0
diff --git a/ld/testsuite/ld-elf/pr13195.t b/ld/testsuite/ld-elf/pr13195.t
new file mode 100644 (file)
index 0000000..2b82842
--- /dev/null
@@ -0,0 +1,6 @@
+VERS_2.0 {
+global:
+  foo;
+local:
+  *;
+};
diff --git a/ld/testsuite/ld-powerpc/tocopt5.d b/ld/testsuite/ld-powerpc/tocopt5.d
new file mode 100644 (file)
index 0000000..8f03c07
--- /dev/null
@@ -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 (file)
index 0000000..67da1a9
--- /dev/null
@@ -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)