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.
This commit is contained in:
H.J. Lu 2013-01-18 00:01:52 +00:00
parent ce24f61737
commit 1cf48f4842
10 changed files with 70 additions and 0 deletions

View File

@ -1,3 +1,18 @@
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.

View File

@ -0,0 +1,12 @@
#include <stdio.h>
extern int bar_size;
int
main ()
{
if (bar_size == 10)
printf ("OK\n");
return 0;
}

View File

@ -0,0 +1 @@
OK

View File

@ -0,0 +1 @@
char bar[10] __attribute__ ((visibility("hidden")));

View File

@ -0,0 +1,3 @@
extern char bar[];
extern char size_of_bar asm ("bar@SIZE");
char *bar_size = &size_of_bar;

View File

@ -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;
}

View File

@ -0,0 +1 @@
OK

View File

@ -0,0 +1 @@
__thread char bar[10] __attribute__ ((visibility("hidden")));

View File

@ -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;
}

View File

@ -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"}