File: dyn_stop.c

package info (click to toggle)
dietlibc 0.34~cvs20160606-10
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 11,336 kB
  • sloc: ansic: 71,631; asm: 13,006; cpp: 1,860; makefile: 799; sh: 292; perl: 62
file content (47 lines) | stat: -rw-r--r-- 1,124 bytes parent folder | download | duplicates (2)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "dietfeatures.h"

#ifdef WANT_DYNAMIC
#include <sys/cdefs.h>
#include <endian.h>

typedef void(*structor)(void);

__attribute__((section(".ctors")))
__attribute_used
static structor __CTOR_END__[1]={((structor)0)};

__attribute__((section(".dtors")))
__attribute_used
static structor __DTOR_END__[1]={((structor)0)};

/* see gcc-3.4/gcc/crtstuff.c */
#if !defined(EH_FRAME_SECTION_CONST)
#if defined(__s390__) || defined(__x86_64__)
# define EH_FRAME_SECTION_CONST const
#endif
#endif
#if !defined(EH_FRAME_SECTION_CONST)
# define EH_FRAME_SECTION_CONST
#endif

__attribute__((section(".eh_frame")))
__attribute_used
static
#if __WORDSIZE == 32
EH_FRAME_SECTION_CONST char __FRAME_END__[4] = { 0, 0, 0, 0 };
#else
EH_FRAME_SECTION_CONST char __FRAME_END__[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
#endif

static void __do_global_ctors_aux(void)
{
  structor *cf=__DTOR_END__;	/* ugly trick to prevent warning */
  for(cf=((__CTOR_END__)-1); (*cf) != (structor)-1; cf--) (*cf)();
}

void _init(void) __attribute__((section(".init")));
__attribute__((section(".init"))) void _init(void)
{
  __do_global_ctors_aux();
}
#endif