From 0a36a439ee413816df8ab88a769135076e6355f6 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 16 Sep 2008 14:09:34 +0000 Subject: bfd/ 2008-09-16 H.J. Lu PR ld/6877 * elflink.c (_bfd_elf_merge_symbol): Allow a common symbol to override the function in a shared library. ld/testsuite/ 2008-09-16 H.J. Lu PR ld/6877 * ld-elf/comm1.c: New. * ld-elf/func1.c: Likewise. * ld-elf/shared.exp: Add tests for libfunc1.so and comm1. --- ld/testsuite/ChangeLog | 8 ++++++++ ld/testsuite/ld-elf/comm1.c | 17 +++++++++++++++++ ld/testsuite/ld-elf/func1.c | 2 ++ ld/testsuite/ld-elf/shared.exp | 12 ++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 ld/testsuite/ld-elf/comm1.c create mode 100644 ld/testsuite/ld-elf/func1.c (limited to 'ld/testsuite') diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index a2c3050..cc898e6 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2008-09-16 H.J. Lu + + PR ld/6877 + * ld-elf/comm1.c: New. + * ld-elf/func1.c: Likewise. + + * ld-elf/shared.exp: Add tests for libfunc1.so and comm1. + 2008-08-26 Nick Clifton * ld-arm/arm-elf.exp: Add farcall-thumb-arm-short test. diff --git a/ld/testsuite/ld-elf/comm1.c b/ld/testsuite/ld-elf/comm1.c new file mode 100644 index 0000000..c553d86 --- /dev/null +++ b/ld/testsuite/ld-elf/comm1.c @@ -0,0 +1,17 @@ +#include +#include + +int foo; +void bar (void); + +int +main () +{ + if (foo != 0) + abort (); + foo = 200; + bar (); + if (foo == 200) + printf ("PASS\n"); + return 0; +} diff --git a/ld/testsuite/ld-elf/func1.c b/ld/testsuite/ld-elf/func1.c new file mode 100644 index 0000000..99443e4 --- /dev/null +++ b/ld/testsuite/ld-elf/func1.c @@ -0,0 +1,2 @@ +void foo (void) { } +void bar (void) { } diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 846027e..f0bc403 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -123,6 +123,12 @@ set build_tests { {"Build libdata1.so" "-shared" "-fPIC" {data1.c} {} "libdata1.so"} + {"Build libcomm1.o" + "-r -nostdlib" "" + {comm1.c} {} "libcomm1.o"} + {"Build libfunc1.so" + "-shared" "-fPIC" + {func1.c} {} "libfunc1.so"} } set run_tests { @@ -235,6 +241,12 @@ set run_tests { {"Run with libdata1.so" "tmpdir/libdata1.so" "" {dynbss1.c} "dynbss1" "pass.out"} + {"Run with libfunc1.so comm1.o" + "tmpdir/libfunc1.so tmpdir/comm1.o" "" + {dummy.c} "comm1" "pass.out"} + {"Run with comm1.o libfunc1.so" + "tmpdir/comm1.o tmpdir/libfunc1.so" "" + {dummy.c} "comm1" "pass.out"} } run_cc_link_tests $build_tests -- cgit v1.1