summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-26 04:20:38 +0000
committerChris Lattner <sabre@nondot.org>2003-06-26 04:20:38 +0000
commit5d243c2fa51490110bd105c1f5b6cfde9a3b8cc0 (patch)
tree3b3fbab27e157f058d2bf8d520c506047e9fa0f5 /runtime
parentbc601fe3e718f77a0e312d045279852442b7ad9d (diff)
downloadllvm-5d243c2fa51490110bd105c1f5b6cfde9a3b8cc0.tar.gz
llvm-5d243c2fa51490110bd105c1f5b6cfde9a3b8cc0.tar.bz2
llvm-5d243c2fa51490110bd105c1f5b6cfde9a3b8cc0.tar.xz
Don't register the destructors if the list is empty
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtime')
-rw-r--r--runtime/GCCLibraries/crtend/crtend.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/GCCLibraries/crtend/crtend.c b/runtime/GCCLibraries/crtend/crtend.c
index 69eac4ff98..50bbdb7081 100644
--- a/runtime/GCCLibraries/crtend/crtend.c
+++ b/runtime/GCCLibraries/crtend/crtend.c
@@ -34,8 +34,12 @@ void __main(void) {
/* Loop over all of the constructor records, calling each function pointer. */
TorRec *R = __llvm_getGlobalCtors();
- if (atexit(run_destructors))
- abort(); /* Should be able to install ONE atexit handler! */
+ /* Only register the global dtor handler if there is at least one global
+ * 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! */
for (; R->FP; ++R)