1 /* { dg-do compile } */ 2 /* { dg-require-effective-target ilp32 } */ 3 /* { dg-options "-g -O -w" } */ 4 5 typedef unsigned _GCC_ATTR_ALIGN_u32t; 6 typedef _GCC_ATTR_ALIGN_u32t _Uint32t __attribute__((__aligned__(4))); 7 typedef int _Intptrt __attribute__((__mode__(__pointer__))); 8 typedef unsigned int _Uintptrt __attribute__((__mode__(__pointer__))); 9 typedef _Intptrt ptrdiff_t; 10 typedef _Uintptrt uintptr_t; 11 typedef _Uint32t Elf32_Word; 12 typedef struct list_head list_head_t; 13 14 struct list_head { 15 list_head_t *next; 16 }; 17 18 struct object { }; 19 20 struct objlist { 21 struct object *object; 22 }; 23 24 static uintptr_t ldd(void *frame) __attribute__((__used__)); 25 static list_head_t *_dl_all_objects_ptr; fini_array(struct object * const obj)26static void fini_array(struct object *const obj) { 27 if ((dynvec(obj,(unsigned)26)) != ((Elf32_Word)-1)) { 28 unsigned i; 29 const unsigned funcs = (dynvec(obj,(unsigned)28)) / 4; 30 const Elf32_Word fa = (dynvec(obj,(unsigned)26)); 31 const int *const p = relative_relocp(obj); 32 for (i = (funcs ? (funcs - 1) : 0U); i != 0U; i--) { 33 void (*const func)(void) = (void *) p[i]; 34 (*func)(); 35 } 36 } 37 } _do_exit_fini(void)38static void _do_exit_fini(void) { 39 const struct objlist *o; 40 for (((o)) = ((void *)(((list_head_t *)(_dl_all_objects_ptr))->next)); 41 !((((o))) == ((void *)((list_head_t *)(_dl_all_objects_ptr)))); 42 ((o)) = ((void *)(((list_head_t *)((o)))->next))) 43 fini_array (o->object); 44 } ldd(void * frame)45static uintptr_t ldd (void *frame) { 46 atexit(_do_exit_fini); 47 } 48