OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [pr45506.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { 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;
26
static 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
}
38
static 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
}
45
static uintptr_t ldd (void *frame) {
46
  atexit(_do_exit_fini);
47
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.