Browse Source

Init TLS before allocator

Jeremy Soller 4 years ago
parent
commit
ae8e070b9e
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/start.rs

+ 5 - 3
src/start.rs

@@ -112,15 +112,17 @@ pub unsafe extern "C" fn relibc_start(sp: &'static Stack) -> ! {
         fn _init();
         fn main(argc: isize, argv: *mut *mut c_char, envp: *mut *mut c_char) -> c_int;
     }
-    // Step 1 setup the right allocator...
-    // if any memory rust based memory allocation happen before this step .. we are doomed.
-    alloc_init();
 
     // Ensure correct host system before executing more system calls
     relibc_verify_host();
 
+    // Initialize TLS, if necessary
     ld_so::init(sp);
 
+    // Set up the right allocator...
+    // if any memory rust based memory allocation happen before this step .. we are doomed.
+    alloc_init();
+
     // Set up argc and argv
     let argc = sp.argc;
     let argv = sp.argv();