Initial commit
This commit is contained in:
commit
c8c516e548
222 changed files with 38483 additions and 0 deletions
24
src/Runtime.PPCEABI.H/global_destructor_chain.c
Normal file
24
src/Runtime.PPCEABI.H/global_destructor_chain.c
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include "Runtime.PPCEABI.H/NMWException.h"
|
||||
|
||||
DestructorChain* __global_destructor_chain;
|
||||
|
||||
void* __register_global_object(void* object, void* destructor, void* regmem) {
|
||||
((DestructorChain*)regmem)->next = __global_destructor_chain;
|
||||
((DestructorChain*)regmem)->destructor = destructor;
|
||||
((DestructorChain*)regmem)->object = object;
|
||||
__global_destructor_chain = (DestructorChain*)regmem;
|
||||
return object;
|
||||
}
|
||||
|
||||
void __destroy_global_chain(void) {
|
||||
DestructorChain* iter;
|
||||
while ((iter = __global_destructor_chain) != 0) {
|
||||
__global_destructor_chain = iter->next;
|
||||
DTORCALL(iter->destructor, iter->object);
|
||||
}
|
||||
}
|
||||
|
||||
/* clang-format off */
|
||||
__declspec(section ".dtors")
|
||||
static void* const __destroy_global_chain_reference = __destroy_global_chain;
|
||||
/* clang-format on */
|
||||
Loading…
Add table
Add a link
Reference in a new issue