diff options
author | Hans-Peter Nilsson <hp@gcc.gnu.org> | 2008-09-22 01:54:41 +0000 |
---|---|---|
committer | Hans-Peter Nilsson <hp@gcc.gnu.org> | 2008-09-22 01:54:41 +0000 |
commit | 187fcb85b64e556f8e1142fa944ed05e5a21fc57 (patch) | |
tree | 260c382923a70dfdbc147094e351b12a26aae542 /gcc/testsuite/gcc.dg | |
parent | c70d0414afa803f535420815116971725933234c (diff) | |
download | gcc-187fcb85b64e556f8e1142fa944ed05e5a21fc57.zip gcc-187fcb85b64e556f8e1142fa944ed05e5a21fc57.tar.gz gcc-187fcb85b64e556f8e1142fa944ed05e5a21fc57.tar.bz2 |
re PR target/37170 (gcc.dg/weak/weak-1.c)
PR middle-end/37170
PR middle-end/37280
* gcc.dg/weak/weak-15.c, gcc.dg/weak/weak-16.c,
g++.dg/ext/inline1.C: New tests.
From-SVN: r140540
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/weak/weak-15.c | 39 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/weak/weak-16.c | 21 |
2 files changed, 60 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/weak/weak-15.c b/gcc/testsuite/gcc.dg/weak/weak-15.c new file mode 100644 index 0000000..2218ca4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/weak/weak-15.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-require-weak "" } */ +/* { dg-options "-fno-common" } */ + +/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?a" } } */ +/* { dg-final { scan-assembler-not "weak\[^ \t\]*\[ \t\]_?b" } } */ +/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?c" } } */ +/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?d" } } */ + +#pragma weak a +extern char a[]; + +char *user_a(void) +{ + return a+1; +} + +int x; +int extern inline b(int y) +{ + return x+y; +} + +extern int b(int y); + +int user_b(int z) +{ + return b(z); +} + +#pragma weak c +extern int c; + +int *user_c = &c; + +#pragma weak d +extern char d[]; + +char *user_d = &d[1]; diff --git a/gcc/testsuite/gcc.dg/weak/weak-16.c b/gcc/testsuite/gcc.dg/weak/weak-16.c new file mode 100644 index 0000000..3bcf388 --- /dev/null +++ b/gcc/testsuite/gcc.dg/weak/weak-16.c @@ -0,0 +1,21 @@ +/* From PR37280. */ +/* { dg-do compile } */ +/* { dg-require-weak "" } */ +/* { dg-options "-fno-common -Os" } */ +/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?kallsyms_token_index" } } */ +/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?kallsyms_token_table" } } */ + +extern int kallsyms_token_index[] __attribute__((weak)); +extern int kallsyms_token_table[] __attribute__((weak)); +void kallsyms_expand_symbol(int *result) +{ + int len = *result; + int *tptr; + while(len) { + tptr = &kallsyms_token_table[ kallsyms_token_index[*result] ]; + len--; + while (*tptr) tptr++; + *tptr = 1; + } + *result = 0; +} |