aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/attr-used-5.c
blob: 7ba5a455706fcbfe30ff72bd14e7b1e3844b5662 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* { dg-do compile } */
/* { dg-skip-if "non-ELF target" { *-*-darwin* } } */
/* { dg-options "-Wall -Wno-infinite-recursion -O2" } */

struct dtv_slotinfo_list
{
  struct dtv_slotinfo_list *next;
};

extern struct dtv_slotinfo_list *list;

static int __attribute__ ((section ("__libc_freeres_fn")))
free_slotinfo (struct dtv_slotinfo_list **elemp)
{
  if (!free_slotinfo (&(*elemp)->next))
    return 0;
  return 1;
}

__attribute__ ((used, section ("__libc_freeres_fn")))
static void free_mem (void)
{
  free_slotinfo (&list);
}

/* { dg-final { scan-assembler "__libc_freeres_fn,\"ax\"" { target R_flag_in_section } } } */
/* { dg-final { scan-assembler-not "__libc_freeres_fn,\"axR\"" { target R_flag_in_section } } } */