Explorar el Código

Get rid of assembly code in call_inits_finis

oddcoder hace 4 años
padre
commit
0977133cc9
Se han modificado 1 ficheros con 2 adiciones y 12 borrados
  1. 2 12
      src/ld_so/linker.rs

+ 2 - 12
src/ld_so/linker.rs

@@ -865,16 +865,6 @@ impl Linker {
 }
 
 unsafe extern "C" fn call_inits_finis(addr: usize) {
-    #[cfg(target_arch = "x86_64")]
-    asm!("
-        cmp qword ptr [rdi], 0
-        je end
-        call [rdi]
-end:    nop
-        "
-        :
-        :
-        :
-        : "intel", "volatile"
-    );
+    let func = transmute::<usize, *const Option<extern "C" fn()>>(addr);
+    (*func).map(|x| x());
 }