tyfkda / xcc

Standalone C compiler/assembler/linker/libc for x86-64/aarch64/riscv64/wasm
https://tyfkda.github.io/xcc/
MIT License
197 stars 14 forks source link

__attribute__((constructor)) #144

Closed tyfkda closed 4 days ago

tyfkda commented 6 months ago
__attribute__((constructor))
static void start_func(void) {}

__attribute__((destructor))
static void end_func(void) {}
$ gcc -S -o- foo.c
...
    .section    .init_array,"aw"
    .align 8
    .quad   start_func
...
    .section    .fini_array,"aw"
    .align 8
    .quad   end_func
...