From 1cf48f484248026335ee15c3a178e4bb4f88d2ba Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 18 Jan 2013 00:01:52 +0000 Subject: [PATCH] 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. --- ld/testsuite/ChangeLog | 15 +++++++++++++++ ld/testsuite/ld-size/size-1.c | 12 ++++++++++++ ld/testsuite/ld-size/size-1.out | 1 + ld/testsuite/ld-size/size-1a.c | 1 + ld/testsuite/ld-size/size-1b.c | 3 +++ ld/testsuite/ld-size/size-2.c | 14 ++++++++++++++ ld/testsuite/ld-size/size-2.out | 1 + ld/testsuite/ld-size/size-2a.c | 1 + ld/testsuite/ld-size/size-2b.c | 10 ++++++++++ ld/testsuite/ld-size/size.exp | 12 ++++++++++++ 10 files changed, 70 insertions(+) create mode 100644 ld/testsuite/ld-size/size-1.c create mode 100644 ld/testsuite/ld-size/size-1.out create mode 100644 ld/testsuite/ld-size/size-1a.c create mode 100644 ld/testsuite/ld-size/size-1b.c create mode 100644 ld/testsuite/ld-size/size-2.c create mode 100644 ld/testsuite/ld-size/size-2.out create mode 100644 ld/testsuite/ld-size/size-2a.c create mode 100644 ld/testsuite/ld-size/size-2b.c diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 2432df42295..c7ffa1e2628 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2013-01-17 H.J. Lu + + * 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 * ld-size/size32-3-i386.d: New file. diff --git a/ld/testsuite/ld-size/size-1.c b/ld/testsuite/ld-size/size-1.c new file mode 100644 index 00000000000..71a7a667efb --- /dev/null +++ b/ld/testsuite/ld-size/size-1.c @@ -0,0 +1,12 @@ +#include + +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 00000000000..d86bac9de59 --- /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 00000000000..a9b20f5c6a9 --- /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 00000000000..723c60a84c7 --- /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 00000000000..47e6a2fc509 --- /dev/null +++ b/ld/testsuite/ld-size/size-2.c @@ -0,0 +1,14 @@ +#include + +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 00000000000..d86bac9de59 --- /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 00000000000..0b96aa7c1e5 --- /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 00000000000..0f02c940279 --- /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 4bbb5d720bf..fe4702cf398 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"} -- 2.30.2