diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2013-01-18 00:01:52 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2013-01-18 00:01:52 +0000 |
commit | 1cf48f484248026335ee15c3a178e4bb4f88d2ba (patch) | |
tree | 7fb41f5559aa9dad75764b55be29fd64513bf715 | |
parent | ce24f61737e0e3f6832ac5aad643f2e291e0ab5a (diff) | |
download | fsf-binutils-gdb-1cf48f484248026335ee15c3a178e4bb4f88d2ba.zip fsf-binutils-gdb-1cf48f484248026335ee15c3a178e4bb4f88d2ba.tar.gz fsf-binutils-gdb-1cf48f484248026335ee15c3a178e4bb4f88d2ba.tar.bz2 |
Add size-1 and size-2 tests
* ld-size/size-1.c: New file.
* ld-size/size-1.out: Likewise.
* ld-size/size-1a.c: Likewise.
* ld-size/size-1b.c: Likewise.
* ld-size/size-2.c: Likewise.
* ld-size/size-2.out: Likewise.
* ld-size/size-2a.c: Likewise.
* ld-size/size-2b.c: Likewise.
* ld-size/size.exp (build_tests): Build libsize-1.so and
libsize-2.so.
(run_tests): Run size-1 and size-2.
-rw-r--r-- | ld/testsuite/ChangeLog | 15 | ||||
-rw-r--r-- | ld/testsuite/ld-size/size-1.c | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-size/size-1.out | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-size/size-1a.c | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-size/size-1b.c | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-size/size-2.c | 14 | ||||
-rw-r--r-- | ld/testsuite/ld-size/size-2.out | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-size/size-2a.c | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-size/size-2b.c | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-size/size.exp | 12 |
10 files changed, 70 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 2432df4..c7ffa1e 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,5 +1,20 @@ 2013-01-17 H.J. Lu <hongjiu.lu@intel.com> + * ld-size/size-1.c: New file. + * ld-size/size-1.out: Likewise. + * ld-size/size-1a.c: Likewise. + * ld-size/size-1b.c: Likewise. + * ld-size/size-2.c: Likewise. + * ld-size/size-2.out: Likewise. + * ld-size/size-2a.c: Likewise. + * ld-size/size-2b.c: Likewise. + + * ld-size/size.exp (build_tests): Build libsize-1.so and + libsize-2.so. + (run_tests): Run size-1 and size-2. + +2013-01-17 H.J. Lu <hongjiu.lu@intel.com> + * ld-size/size32-3-i386.d: New file. * ld-size/size32-3-x32.d: Likewise. * ld-size/size32-3-x86-64.d: Likewise. diff --git a/ld/testsuite/ld-size/size-1.c b/ld/testsuite/ld-size/size-1.c new file mode 100644 index 0000000..71a7a66 --- /dev/null +++ b/ld/testsuite/ld-size/size-1.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +extern int bar_size; + +int +main () +{ + if (bar_size == 10) + printf ("OK\n"); + + return 0; +} diff --git a/ld/testsuite/ld-size/size-1.out b/ld/testsuite/ld-size/size-1.out new file mode 100644 index 0000000..d86bac9 --- /dev/null +++ b/ld/testsuite/ld-size/size-1.out @@ -0,0 +1 @@ +OK diff --git a/ld/testsuite/ld-size/size-1a.c b/ld/testsuite/ld-size/size-1a.c new file mode 100644 index 0000000..a9b20f5 --- /dev/null +++ b/ld/testsuite/ld-size/size-1a.c @@ -0,0 +1 @@ +char bar[10] __attribute__ ((visibility("hidden"))); diff --git a/ld/testsuite/ld-size/size-1b.c b/ld/testsuite/ld-size/size-1b.c new file mode 100644 index 0000000..723c60a --- /dev/null +++ b/ld/testsuite/ld-size/size-1b.c @@ -0,0 +1,3 @@ +extern char bar[]; +extern char size_of_bar asm ("bar@SIZE"); +char *bar_size = &size_of_bar; diff --git a/ld/testsuite/ld-size/size-2.c b/ld/testsuite/ld-size/size-2.c new file mode 100644 index 0000000..47e6a2f --- /dev/null +++ b/ld/testsuite/ld-size/size-2.c @@ -0,0 +1,14 @@ +#include <stdio.h> + +extern int bar_size; +extern char *get_bar (int, int); + +int +main () +{ + char *bar = get_bar (2, 20); + if (bar_size == 10 && bar[2] == 20) + printf ("OK\n"); + + return 0; +} diff --git a/ld/testsuite/ld-size/size-2.out b/ld/testsuite/ld-size/size-2.out new file mode 100644 index 0000000..d86bac9 --- /dev/null +++ b/ld/testsuite/ld-size/size-2.out @@ -0,0 +1 @@ +OK diff --git a/ld/testsuite/ld-size/size-2a.c b/ld/testsuite/ld-size/size-2a.c new file mode 100644 index 0000000..0b96aa7 --- /dev/null +++ b/ld/testsuite/ld-size/size-2a.c @@ -0,0 +1 @@ +__thread char bar[10] __attribute__ ((visibility("hidden"))); diff --git a/ld/testsuite/ld-size/size-2b.c b/ld/testsuite/ld-size/size-2b.c new file mode 100644 index 0000000..0f02c94 --- /dev/null +++ b/ld/testsuite/ld-size/size-2b.c @@ -0,0 +1,10 @@ +extern __thread char bar[]; +extern char size_of_bar asm ("bar@SIZE"); +char *bar_size = &size_of_bar; + +char * +get_bar (int i, int v) +{ + bar[i] = v; + return bar; +} diff --git a/ld/testsuite/ld-size/size.exp b/ld/testsuite/ld-size/size.exp index 4bbb5d7..fe4702c 100644 --- a/ld/testsuite/ld-size/size.exp +++ b/ld/testsuite/ld-size/size.exp @@ -55,6 +55,12 @@ if { [which $CC] == 0 } { } set build_tests { + {"Build libsize-1.so" + "-shared" "-fPIC" + {size-1a.c size-1b.c} {} "libsize-1.so"} + {"Build libsize-2.so" + "-shared" "-fPIC" + {size-2a.c size-2b.c} {} "libsize-2.so"} {"Build libsize-3a.so" "-shared" "-fPIC" {size-3a.c} {} "libsize-3a.so"} @@ -84,6 +90,12 @@ set build_tests { run_cc_link_tests $build_tests set run_tests { + {"Run size-1" + "tmpdir/libsize-1.so" "" + {size-1.c} "size-1" "size-1.out"} + {"Run size-2" + "tmpdir/libsize-2.so" "" + {size-2.c} "size-2" "size-2.out"} {"Run size-3a" "" "" {size-3.c size-3a.c} "size-3a" "size-3.out"} |