1 /* { dg-do compile } */
2 /* { dg-require-effective-target ilp32 } */
3 /* { dg-options "-g -O -w" } */
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
;
21 struct object
*object
;
24 static uintptr_t ldd(void *frame
) __attribute__((__used__
));
25 static list_head_t
*_dl_all_objects_ptr
;
26 int dynvec(struct object
*, int);
27 int relative_relocp(struct object
*);
28 static void fini_array(struct object
*const obj
) {
29 if ((dynvec(obj
,(unsigned)26)) != ((Elf32_Word
)-1)) {
31 const unsigned funcs
= (dynvec(obj
,(unsigned)28)) / 4;
32 const Elf32_Word fa
= (dynvec(obj
,(unsigned)26));
33 const int *const p
= (int *) relative_relocp(obj
);
34 for (i
= (funcs
? (funcs
- 1) : 0U); i
!= 0U; i
--) {
35 void (*const func
)(void) = (void *) p
[i
];
40 static void _do_exit_fini(void) {
41 const struct objlist
*o
;
42 for (((o
)) = ((void *)(((list_head_t
*)(_dl_all_objects_ptr
))->next
));
43 !((((o
))) == ((void *)((list_head_t
*)(_dl_all_objects_ptr
))));
44 ((o
)) = ((void *)(((list_head_t
*)((o
)))->next
)))
45 fini_array (o
->object
);
47 void atexit(void (*)(void));
48 static uintptr_t ldd (void *frame
) {
49 atexit(_do_exit_fini
);