]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
This commit was manufactured by cvs2svn to create branch 'binutils-
authornobody <>
Wed, 19 Sep 2012 00:53:31 +0000 (00:53 +0000)
committernobody <>
Wed, 19 Sep 2012 00:53:31 +0000 (00:53 +0000)
2_23-branch'.

Cherrypick from master 2012-09-19 00:53:30 UTC H.J. Lu <hjl.tools@gmail.com> 'Properly handle common symbol and weak function':
    ld/testsuite/ld-elf/comm-data3.sd
    ld/testsuite/ld-elf/comm-data3a.s
    ld/testsuite/ld-elf/comm-data3b.s
    ld/testsuite/ld-ifunc/ifunc-17a-i386.d
    ld/testsuite/ld-ifunc/ifunc-17a-x86-64.d
    ld/testsuite/ld-ifunc/ifunc-17a.s
    ld/testsuite/ld-ifunc/ifunc-17b-i386.d
    ld/testsuite/ld-ifunc/ifunc-17b-x86-64.d
    ld/testsuite/ld-ifunc/ifunc-17b.s
    ld/testsuite/ld-ifunc/ifunc-common-1.out
    ld/testsuite/ld-ifunc/ifunc-common-1a.c
    ld/testsuite/ld-ifunc/ifunc-common-1b.c

12 files changed:
ld/testsuite/ld-elf/comm-data3.sd [new file with mode: 0644]
ld/testsuite/ld-elf/comm-data3a.s [new file with mode: 0644]
ld/testsuite/ld-elf/comm-data3b.s [new file with mode: 0644]
ld/testsuite/ld-ifunc/ifunc-17a-i386.d [new file with mode: 0644]
ld/testsuite/ld-ifunc/ifunc-17a-x86-64.d [new file with mode: 0644]
ld/testsuite/ld-ifunc/ifunc-17a.s [new file with mode: 0644]
ld/testsuite/ld-ifunc/ifunc-17b-i386.d [new file with mode: 0644]
ld/testsuite/ld-ifunc/ifunc-17b-x86-64.d [new file with mode: 0644]
ld/testsuite/ld-ifunc/ifunc-17b.s [new file with mode: 0644]
ld/testsuite/ld-ifunc/ifunc-common-1.out [new file with mode: 0644]
ld/testsuite/ld-ifunc/ifunc-common-1a.c [new file with mode: 0644]
ld/testsuite/ld-ifunc/ifunc-common-1b.c [new file with mode: 0644]

diff --git a/ld/testsuite/ld-elf/comm-data3.sd b/ld/testsuite/ld-elf/comm-data3.sd
new file mode 100644 (file)
index 0000000..5a96ed7
--- /dev/null
@@ -0,0 +1,3 @@
+#...
+ +[0-9]+: +[0-9a-f]+ +4 +OBJECT +GLOBAL +DEFAULT +[1-9] foo
+#pass
diff --git a/ld/testsuite/ld-elf/comm-data3a.s b/ld/testsuite/ld-elf/comm-data3a.s
new file mode 100644 (file)
index 0000000..e0bde49
--- /dev/null
@@ -0,0 +1,11 @@
+       .globl main
+       .globl start
+       .globl _start
+       .globl __start
+       .text
+main:
+start:
+_start:
+__start:
+       .byte 0
+       .common foo,4,4
diff --git a/ld/testsuite/ld-elf/comm-data3b.s b/ld/testsuite/ld-elf/comm-data3b.s
new file mode 100644 (file)
index 0000000..837a099
--- /dev/null
@@ -0,0 +1,6 @@
+       .weak   foo
+       .type   foo,%function
+       .size   foo,1
+       .text
+foo:
+       .byte   1
diff --git a/ld/testsuite/ld-ifunc/ifunc-17a-i386.d b/ld/testsuite/ld-ifunc/ifunc-17a-i386.d
new file mode 100644 (file)
index 0000000..303b54e
--- /dev/null
@@ -0,0 +1,10 @@
+#source: ifunc-17a.s
+#source: ifunc-17b.s
+#ld: -static -m elf_i386
+#as: --32
+#readelf: -s --wide
+#target: x86_64-*-* i?86-*-*
+
+#...
+ +[0-9]+: +[0-9a-f]+ +4 +OBJECT +GLOBAL +DEFAULT +[1-9] foo
+#pass
diff --git a/ld/testsuite/ld-ifunc/ifunc-17a-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-17a-x86-64.d
new file mode 100644 (file)
index 0000000..965ef63
--- /dev/null
@@ -0,0 +1,10 @@
+#source: ifunc-17a.s
+#source: ifunc-17b.s
+#ld: -static -m elf_x86_64
+#as: --64
+#readelf: -s --wide
+#target: x86_64-*-*
+
+#...
+ +[0-9]+: +[0-9a-f]+ +4 +OBJECT +GLOBAL +DEFAULT +[1-9] foo
+#pass
diff --git a/ld/testsuite/ld-ifunc/ifunc-17a.s b/ld/testsuite/ld-ifunc/ifunc-17a.s
new file mode 100644 (file)
index 0000000..e0bde49
--- /dev/null
@@ -0,0 +1,11 @@
+       .globl main
+       .globl start
+       .globl _start
+       .globl __start
+       .text
+main:
+start:
+_start:
+__start:
+       .byte 0
+       .common foo,4,4
diff --git a/ld/testsuite/ld-ifunc/ifunc-17b-i386.d b/ld/testsuite/ld-ifunc/ifunc-17b-i386.d
new file mode 100644 (file)
index 0000000..82ccac2
--- /dev/null
@@ -0,0 +1,10 @@
+#source: ifunc-17b.s
+#source: ifunc-17a.s
+#ld: -static -m elf_i386
+#as: --32
+#readelf: -s --wide
+#target: x86_64-*-* i?86-*-*
+
+#...
+ +[0-9]+: +[0-9a-f]+ +4 +OBJECT +GLOBAL +DEFAULT +[1-9] foo
+#pass
diff --git a/ld/testsuite/ld-ifunc/ifunc-17b-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-17b-x86-64.d
new file mode 100644 (file)
index 0000000..7527eae
--- /dev/null
@@ -0,0 +1,10 @@
+#source: ifunc-17b.s
+#source: ifunc-17a.s
+#ld: -static -m elf_x86_64
+#as: --64
+#readelf: -s --wide
+#target: x86_64-*-*
+
+#...
+ +[0-9]+: +[0-9a-f]+ +4 +OBJECT +GLOBAL +DEFAULT +[1-9] foo
+#pass
diff --git a/ld/testsuite/ld-ifunc/ifunc-17b.s b/ld/testsuite/ld-ifunc/ifunc-17b.s
new file mode 100644 (file)
index 0000000..66abe04
--- /dev/null
@@ -0,0 +1,6 @@
+       .weak   foo
+       .type foo, %gnu_indirect_function
+       .size   foo,1
+       .text
+foo:
+       .byte   1
diff --git a/ld/testsuite/ld-ifunc/ifunc-common-1.out b/ld/testsuite/ld-ifunc/ifunc-common-1.out
new file mode 100644 (file)
index 0000000..31a3ce2
--- /dev/null
@@ -0,0 +1 @@
+PASSED: 0
diff --git a/ld/testsuite/ld-ifunc/ifunc-common-1a.c b/ld/testsuite/ld-ifunc/ifunc-common-1a.c
new file mode 100644 (file)
index 0000000..794ca45
--- /dev/null
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+int foo;
+int
+main ()
+{
+  printf ("PASSED: %d\n", foo);
+  return 0;
+}
diff --git a/ld/testsuite/ld-ifunc/ifunc-common-1b.c b/ld/testsuite/ld-ifunc/ifunc-common-1b.c
new file mode 100644 (file)
index 0000000..1235942
--- /dev/null
@@ -0,0 +1,12 @@
+void alt (void) { }
+
+void foo (void);
+void * foo_ifunc (void) __asm__ ("foo");
+__asm__(".type foo, %gnu_indirect_function");
+__asm__(".weak foo");
+
+void *
+foo_ifunc (void)
+{
+  return alt;
+}