clarify licensing
[nestedvm.git] / src / org / ibex / nestedvm / crt0.c
index a85cdbc..8965c1f 100644 (file)
@@ -1,7 +1,5 @@
 #include <stddef.h>
 
-extern int _gp[];
-
 extern int main(int argc, char **argv, char **envp);
 extern void exit(int status);
 extern int atexit(void (*f)());
@@ -10,11 +8,16 @@ extern int atexit(void (*f)());
 extern void _init();
 extern void _fini();
 
+extern char _gp[];
+register char *gp asm("$28");
 char **environ;
     
 void _start(char **argv, char **environ_) {
     int argc;
     
+    if(!gp) gp = _gp;
+    
     environ = environ_;
     
     /* Call global constructors */