1 /* { dg-do compile { target R_flag_in_section } } */
2 /* { dg-skip-if "non-ELF target" { *-*-darwin* powerpc*-*-aix* } } */
3 /* { dg-options "-Wall -O2" } */
4 
5 struct dtv_slotinfo_list
6 {
7   struct dtv_slotinfo_list *next;
8 };
9 
10 extern struct dtv_slotinfo_list *list;
11 
12 static int __attribute__ ((used, retain, section ("__libc_freeres_fn")))
free_slotinfo(struct dtv_slotinfo_list ** elemp)13 free_slotinfo (struct dtv_slotinfo_list **elemp)
14 {
15   if (!free_slotinfo (&(*elemp)->next))
16     return 0;
17   return 1;
18 }
19 
20 __attribute__ ((section ("__libc_freeres_fn")))
free_mem(void)21 void free_mem (void)
22 /* { dg-warning "'.*' without 'retain' attribute and '.*' with 'retain' attribute are placed in a section with the same name" "" { target R_flag_in_section } .-1 } */
23 {
24   free_slotinfo (&list);
25 }
26 
27 /* { dg-final { scan-assembler "__libc_freeres_fn,\"ax\"" { target R_flag_in_section } } } */
28 /* { dg-final { scan-assembler "__libc_freeres_fn,\"axR\"" { target R_flag_in_section } } } */
29