diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-07-02 14:40:19 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-07-02 14:40:19 +0000 |
commit | a47edf2745dd6414d635e4b372d416035c7b8c12 (patch) | |
tree | fcd8a353d7fa007c2202ecc035015511d09d4cad /ld | |
parent | 8d6eee87b6546bb3e51d704ee0bd0bd33115f96f (diff) | |
download | gdb-a47edf2745dd6414d635e4b372d416035c7b8c12.zip gdb-a47edf2745dd6414d635e4b372d416035c7b8c12.tar.gz gdb-a47edf2745dd6414d635e4b372d416035c7b8c12.tar.bz2 |
Add a test for weak alias
* ld-elf/data2.c: New file.
* ld-elf/weakdef1.c: Likewise.
* ld-elf/shared.exp: Add tests for libdata2 and weakdef1.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/data2.c | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/shared.exp | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/weakdef1.c | 15 |
4 files changed, 37 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index ecd5610..f1879da 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2012-07-02 H.J. Lu <hongjiu.lu@intel.com> + + * ld-elf/data2.c: New file. + * ld-elf/weakdef1.c: Likewise. + + * ld-elf/shared.exp: Add tests for libdata2 and weakdef1. + 2012-06-28 Roland McGrath <mcgrathr@google.com> * ld-arm/arm-elf.exp (armelftests_common): Add a test that gets diff --git a/ld/testsuite/ld-elf/data2.c b/ld/testsuite/ld-elf/data2.c new file mode 100644 index 0000000..c137b7c --- /dev/null +++ b/ld/testsuite/ld-elf/data2.c @@ -0,0 +1,9 @@ +int foo = 0; +extern int foo_alias __attribute__ ((weak, alias ("foo"))); + +void +bar (void) +{ + foo = -1; +} + diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index f39bf0f..aaaa85b 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -127,6 +127,9 @@ set build_tests { {"Build libdata1.so" "-shared" "-fPIC" {data1.c} {} "libdata1.so"} + {"Build libdata2.so" + "-shared" "-fPIC" + {data2.c} {} "libdata2.so"} {"Build libcomm1.o" "-r -nostdlib" "" {comm1.c} {} "libcomm1.o"} @@ -281,6 +284,9 @@ set run_tests { {"Run with libdata1.so" "tmpdir/libdata1.so" "" {dynbss1.c} "dynbss1" "pass.out"} + {"Run with libdata2.so" + "tmpdir/libdata2.so" "" + {weakdef1.c} "weakdef1" "pass.out"} {"Run with libfunc1.so comm1.o" "tmpdir/libfunc1.so tmpdir/comm1.o" "" {dummy.c} "comm1" "pass.out"} diff --git a/ld/testsuite/ld-elf/weakdef1.c b/ld/testsuite/ld-elf/weakdef1.c new file mode 100644 index 0000000..82642bb --- /dev/null +++ b/ld/testsuite/ld-elf/weakdef1.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include <stdlib.h> + +extern int foo_alias; +extern void bar (void); + +int +main (void) +{ + bar (); + if (foo_alias != -1) + abort (); + printf ("PASS\n"); + return 0; +} |