From: H.J. Lu Date: Tue, 10 Jul 2012 04:51:53 +0000 (+0000) Subject: Add testcases for PR ld/14323 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bc9ad2e430bc419d4e37555d5d70bb6bb4fac341;p=binutils-gdb.git 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. --- diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index c1cfb341fa8..f04cf04ae28 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2012-07-09 H.J. Lu + + 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 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 00000000000..9f63f4ce954 --- /dev/null +++ b/ld/testsuite/ld-elf/pr14323-1.c @@ -0,0 +1,17 @@ +#include +#include + +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 00000000000..34753d110e3 --- /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 aaaa85b95be..c00f3e588a1 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.