Compare commits

...

1 Commits

Author SHA1 Message Date
H.J. Lu
fcf7574b6a Initial pr21964-3 tests 2018-01-26 05:56:18 -08:00
4 changed files with 65 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
extern int __start___verbose[];
extern int __stop___verbose[];
int
foo1 (void)
{
static int my_var[5] __attribute__((used, section("__verbose")))
= { 5, 4, 3, 2, 1 };
if (__start___verbose == __stop___verbose
|| __start___verbose[0] != 5)
return -1;
else
return 0;
}

View File

@@ -0,0 +1,13 @@
extern int __start___verbose[];
extern int __stop___verbose[];
int
foo2 (void)
{
static int my_var[10] __attribute__((used, section("__verbose")))
= { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
if (__start___verbose == __stop___verbose
|| __start___verbose[0] != 10)
return -1;
else
return 0;
}

View File

@@ -0,0 +1,30 @@
#include <stdio.h>
extern int foo1 (void);
extern int foo2 (void);
extern int __start___verbose[];
extern int __stop___verbose[];
static int my_var[6] __attribute__((used, section("__verbose")))
= { 6, 4, 3, 2, 1 };
int
bar (void)
{
if (__start___verbose == __stop___verbose)
return -1;
if (__start___verbose[0] != 6)
return -2;
else
return 0;
}
int
main ()
{
if (bar () == 0
&& foo1 () == 0
&& foo2 () == 0)
printf ("PASS\n");
return 0;
}

View File

@@ -565,6 +565,12 @@ set build_tests {
{"Build pr21964-2b.so"
"-shared" "-fPIC"
{pr21964-2b.c} {} "pr21964-2b.so"}
{"Build pr21964-3a.so"
"-shared" "-fPIC"
{pr21964-3a.c} {} "pr21964-3a.so"}
{"Build pr21964-3b.so"
"-shared" "-fPIC"
{pr21964-3b.c} {} "pr21964-3b.so"}
{"Dump pr21978.so"
"-shared" "-fPIC -g -O2"
{pr21978a.c pr21978b.c} {{objdump {-Sl} pr21978.od}} "pr21978.so"}
@@ -701,6 +707,9 @@ set run_tests [list \
[list "Run pr21964-1" \
"-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-1a.so tmpdir/pr21964-1b.so" "" \
{pr21964-1c.c} "pr21964-1" "pass.out" ] \
[list "Run pr21964-3" \
"-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-3a.so tmpdir/pr21964-3b.so" "" \
{pr21964-3c.c} "pr21964-3" "pass.out" ] \
]
# NetBSD ELF systems do not currently support the .*_array sections.