Don't register the destructors if the list is empty
llvm-svn: 6909
This commit is contained in:
parent
dda8abec9b
commit
0fe5e45ee9
|
@ -34,8 +34,12 @@ void __main(void) {
|
||||||
/* Loop over all of the constructor records, calling each function pointer. */
|
/* Loop over all of the constructor records, calling each function pointer. */
|
||||||
TorRec *R = __llvm_getGlobalCtors();
|
TorRec *R = __llvm_getGlobalCtors();
|
||||||
|
|
||||||
if (atexit(run_destructors))
|
/* Only register the global dtor handler if there is at least one global
|
||||||
abort(); /* Should be able to install ONE atexit handler! */
|
* dtor!
|
||||||
|
*/
|
||||||
|
if (__llvm_getGlobalDtors()[0].FP)
|
||||||
|
if (atexit(run_destructors))
|
||||||
|
abort(); /* Should be able to install ONE atexit handler! */
|
||||||
|
|
||||||
/* FIXME: This should sort the list by priority! */
|
/* FIXME: This should sort the list by priority! */
|
||||||
for (; R->FP; ++R)
|
for (; R->FP; ++R)
|
||||||
|
|
Loading…
Reference in New Issue