Fixed #5563 (add __attribute__((destructor)) and improve __attribute__((constructor)) support)