Open
Description
demo:
void __attribute__((constructor)) kkk2()
{
__asm__ volatile ("":::);
}
void __attribute__ ((destructor)) foo()
{
__asm__ volatile ("":::);
}
https://godbolt.org/z/7shvxT3hY
There are differences in the behavior of __attribute__((constructor)) __attribute__((destructor))
between GCC and LLVM. GCC places functions with the __attribute__((constructor))
attribute in the .text.startup
section, and places functions with the __attribute__((destructor))
attribute in the .text.exit
section,but LLVM does not. Why is this the case?