summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/weak/weak-16.c
blob: 3bcf3885d7dd763ac4ed6c0e2d434ebafedf5429 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
}