summaryrefslogtreecommitdiff
path: root/lib/mlibc/options/internal/gcc/initfini.cpp
blob: b329f3840934ef129ca37b2dde06eeb589d4887f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

#include <stddef.h>
#include <stdint.h>
#include <string.h>

#include <mlibc/internal-sysdeps.hpp>
#include <mlibc/debug.hpp>

typedef void (*InitPtr)();

extern InitPtr __CTOR_LIST__ [[ gnu::visibility("hidden") ]];
extern InitPtr __CTOR_END__ [[ gnu::visibility("hidden") ]];

extern "C" [[ gnu::visibility("hidden") ]] void __mlibc_do_ctors() {
	auto it = &__CTOR_LIST__;
	while(it != &__CTOR_END__)
		(*it++)();
}

extern "C" [[ gnu::visibility("hidden") ]] void __mlibc_do_dtors() {
	mlibc::sys_libc_log("__mlibc_do_dtors() called");
}