projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e4365b2
)
Add support for people calling main recursively
author
Chris Lattner
<sabre@nondot.org>
Fri, 19 Dec 2003 07:51:46 +0000
(07:51 +0000)
committer
Chris Lattner
<sabre@nondot.org>
Fri, 19 Dec 2003 07:51:46 +0000
(07:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10535
91177308
-0d34-0410-b5e6-
96231b3b80d8
runtime/GCCLibraries/crtend/crtend.c
patch
|
blob
|
history
diff --git
a/runtime/GCCLibraries/crtend/crtend.c
b/runtime/GCCLibraries/crtend/crtend.c
index 50bbdb708141c913e2eabafed844582afe43ce15..58f1bf5f9abfdcab3ef6e142ff8bccd698f93029 100644
(file)
--- a/
runtime/GCCLibraries/crtend/crtend.c
+++ b/
runtime/GCCLibraries/crtend/crtend.c
@@
-34,6
+34,13
@@
void __main(void) {
/* Loop over all of the constructor records, calling each function pointer. */
TorRec *R = __llvm_getGlobalCtors();
+ /* Recursively calling main is not legal C, but lots of people do it for
+ * testing stuff. We might as well work for them.
+ */
+ static _Bool Initialized = 0;
+ if (Initialized) return;
+ Initialized = 1;
+
/* Only register the global dtor handler if there is at least one global
* dtor!
*/