diff options
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/indirect.exp | 25 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr18720.out | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr18720a.c | 27 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr18720b.c | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr18720c.c | 15 |
6 files changed, 88 insertions, 1 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 727bcad..ea873d9 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2015-08-07 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/18720 + * ld-elf/indirect.exp: Run tests for PR ld/18720. + * ld-elf/pr18720.out: New file. + * ld-elf/pr18720a.c: Likewise. + * ld-elf/pr18720b.c: Likewise. + * ld-elf/pr18720c.c: Likewise. + 2015-08-04 Andrew Burgess <andrew.burgess@embecosm.com> * ld/ld-lib.exp (run_dump_test): When using the map option, no diff --git a/ld/testsuite/ld-elf/indirect.exp b/ld/testsuite/ld-elf/indirect.exp index 468ef2b..e8ac1ae 100644 --- a/ld/testsuite/ld-elf/indirect.exp +++ b/ld/testsuite/ld-elf/indirect.exp @@ -64,7 +64,9 @@ if { ![ld_compile $CC $srcdir/$subdir/indirect1a.c tmpdir/indirect1a.o] || ![ld_compile $CC $srcdir/$subdir/indirect3a.c tmpdir/indirect3a.o] || ![ld_compile $CC $srcdir/$subdir/indirect3b.c tmpdir/indirect3b.o] || ![ld_compile $CC $srcdir/$subdir/indirect4a.c tmpdir/indirect4a.o] - || ![ld_compile $CC $srcdir/$subdir/indirect4b.c tmpdir/indirect4b.o] } { + || ![ld_compile $CC $srcdir/$subdir/indirect4b.c tmpdir/indirect4b.o] + || ![ld_compile "$CC -O2 -fPIC -I../bfd" $srcdir/$subdir/pr18720a.c tmpdir/pr18720a.o] + || ![ld_compile $CC $srcdir/$subdir/pr18720b.c tmpdir/pr18720b.o] } { unresolved "Indirect symbol tests" return } @@ -79,6 +81,12 @@ set build_tests { {"Build libindirect4c.so" "-shared" "-fPIC" {indirect4c.c} {} "libindirect4c.so"} + {"Build libpr18720c.so" + "-shared" "-fPIC" + {pr18720c.c} {} "libpr18720c.so"} + {"Build pr18720b1.o" + "-r -nostdlib tmpdir/pr18720b.o" "" + {dummy.c} {} "pr18720b1.o"} } run_cc_link_tests $build_tests @@ -132,6 +140,21 @@ set run_tests { {"Run with libindirect4c.so 4" "tmpdir/libindirect4c.so tmpdir/indirect4b.o tmpdir/indirect4a.o" "" {dummy.c} "indirect4d" "indirect4.out"} + {"Run with libpr18720c.so 1" + "tmpdir/pr18720a.o tmpdir/pr18720b.o tmpdir/libpr18720c.so" "" + {check-ptr-eq.c} "pr18720a" "pr18720.out"} + {"Run with libpr18720c.so 2" + "tmpdir/pr18720a.o tmpdir/libpr18720c.so tmpdir/pr18720b.o" "" + {check-ptr-eq.c} "pr18720b" "pr18720.out"} + {"Run with libpr18720c.so 3" + "tmpdir/pr18720b.o tmpdir/libpr18720c.so tmpdir/pr18720a.o" "" + {check-ptr-eq.c} "pr18720c" "pr18720.out"} + {"Run with libpr18720c.so 4" + "tmpdir/libpr18720c.so tmpdir/pr18720b.o tmpdir/pr18720a.o" "" + {check-ptr-eq.c} "pr18720d" "pr18720.out"} + {"Run with libpr18720c.so 5" + "tmpdir/libpr18720c.so tmpdir/pr18720b1.o tmpdir/pr18720a.o" "" + {check-ptr-eq.c} "pr18720d" "pr18720.out"} } run_ld_link_exec_tests [] $run_tests diff --git a/ld/testsuite/ld-elf/pr18720.out b/ld/testsuite/ld-elf/pr18720.out new file mode 100644 index 0000000..482e981 --- /dev/null +++ b/ld/testsuite/ld-elf/pr18720.out @@ -0,0 +1,2 @@ +MAIN +DSO diff --git a/ld/testsuite/ld-elf/pr18720a.c b/ld/testsuite/ld-elf/pr18720a.c new file mode 100644 index 0000000..752623b --- /dev/null +++ b/ld/testsuite/ld-elf/pr18720a.c @@ -0,0 +1,27 @@ +#include <bfd_stdint.h> + +extern void bar (void); +extern void foo (void); +extern void foo_alias (void); +extern void check_ptr_eq (void *, void *); + +#if defined(__GNUC__) && (__GNUC__ * 1000 + __GNUC_MINOR__) >= 4005 +__attribute__ ((noinline, noclone)) +#else +__attribute__ ((noinline)) +#endif +int +foo_p (void) +{ + return (intptr_t) &foo == 0x12345678 ? 1 : 0; +} + +int +main (void) +{ + foo (); + foo_p (); + bar (); + check_ptr_eq (&foo, &foo_alias); + return 0; +} diff --git a/ld/testsuite/ld-elf/pr18720b.c b/ld/testsuite/ld-elf/pr18720b.c new file mode 100644 index 0000000..90d376b --- /dev/null +++ b/ld/testsuite/ld-elf/pr18720b.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +void +foo (void) +{ + printf ("MAIN\n"); +} + +asm (".symver foo,foo@FOO"); +asm (".set foo_alias,foo"); +asm (".global foo_alias"); diff --git a/ld/testsuite/ld-elf/pr18720c.c b/ld/testsuite/ld-elf/pr18720c.c new file mode 100644 index 0000000..b52cb95 --- /dev/null +++ b/ld/testsuite/ld-elf/pr18720c.c @@ -0,0 +1,15 @@ +#include <stdio.h> + +extern void foo (void); + +void +foo (void) +{ + printf ("DSO\n"); +} + +void +bar (void) +{ + foo (); +} |