mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
Add support for people calling main recursively
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10535 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e4365b2e8c
commit
86f3dda18b
@ -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!
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user