diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-07-10 04:51:53 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-07-10 04:51:53 +0000 |
commit | bc9ad2e430bc419d4e37555d5d70bb6bb4fac341 (patch) | |
tree | 451d3cc3cf92c193c9c394d3c7d95f9244a8ffda | |
parent | b74db4368dc89ddbba419ea4fa7acaa27df03bfd (diff) | |
download | gdb-bc9ad2e430bc419d4e37555d5d70bb6bb4fac341.zip gdb-bc9ad2e430bc419d4e37555d5d70bb6bb4fac341.tar.gz gdb-bc9ad2e430bc419d4e37555d5d70bb6bb4fac341.tar.bz2 |
Add testcases for PR ld/14323
PR ld/14323
* ld-elf/pr14323-1.c: New.
* ld-elf/pr14323-2.c: Likewise.
* ld-elf/shared.exp (build_tests): Add libpr14323-2.so.
(run_tests): Add pr14323.
-rw-r--r-- | ld/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr14323-1.c | 17 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr14323-2.c | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/shared.exp | 6 |
4 files changed, 45 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index c1cfb34..f04cf04 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2012-07-09 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/14323 + * ld-elf/pr14323-1.c: New. + * ld-elf/pr14323-2.c: Likewise. + + * ld-elf/shared.exp (build_tests): Add libpr14323-2.so. + (run_tests): Add pr14323. + 2012-07-03 H.J. Lu <hongjiu.lu@intel.com> PR ld/3351 diff --git a/ld/testsuite/ld-elf/pr14323-1.c b/ld/testsuite/ld-elf/pr14323-1.c new file mode 100644 index 0000000..9f63f4c --- /dev/null +++ b/ld/testsuite/ld-elf/pr14323-1.c @@ -0,0 +1,17 @@ +#include <stdlib.h> +#include <stdio.h> + +extern int foo_alias; +extern char *bar (); + +int +main () +{ + if (foo_alias != 0) + abort (); + bar (); + if (foo_alias != -1) + abort (); + printf ("PASS\n"); + return 0; +} diff --git a/ld/testsuite/ld-elf/pr14323-2.c b/ld/testsuite/ld-elf/pr14323-2.c new file mode 100644 index 0000000..34753d1 --- /dev/null +++ b/ld/testsuite/ld-elf/pr14323-2.c @@ -0,0 +1,13 @@ +int foo __attribute__ ((section ("_data_foo"))) = 0; +extern int foo_alias __attribute__ ((weak, alias ("foo"))); +extern char __start__data_foo; +asm (".type __start__data_foo,%object"); +int x1 = 1; +int x2 = 2; + +char * +bar () +{ + foo = -1; + return &__start__data_foo; +} diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index aaaa85b..c00f3e5 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -170,6 +170,9 @@ set build_tests { {"Build libpr13250-3.o" "-r -nostdlib" "" {pr13250-3.c} {} "libpr13250-3.o"} + {"Build libpr14323-2.so" + "-shared" "-fPIC" + {pr14323-2.c} {} "libpr14323-2.so"} } run_cc_link_tests $build_tests @@ -302,6 +305,9 @@ set run_tests { {"Run with pr13250-3.c, libpr13250-1.so and libpr13250-2.so" "--as-needed tmpdir/pr13250-3.o tmpdir/libpr13250-1.so tmpdir/libpr13250-2.so" "" {dummy.c} "pr13250" "pass.out"} + {"Run with pr14323-1.c pr14323-2.so" + "tmpdir/libpr14323-2.so" "" + {pr14323-1.c} "pr14323" "pass.out"} } # NetBSD ELF systems do not currently support the .*_array sections. |