Rewrite %rax register before syscall because it is overwritten by the syscall itself
diff --git a/src/libstd/sys/sgx/abi/entry.S b/src/libstd/sys/sgx/abi/entry.S
index ca2848c..a3e059e81 100644
--- a/src/libstd/sys/sgx/abi/entry.S
+++ b/src/libstd/sys/sgx/abi/entry.S
@@ -115,11 +115,11 @@
.type elf_entry,function
elf_entry:
/* print error message */
- movq $1,%rax /* write() syscall */
- movq $2,%rdi /* write to stderr (fd 2) */
+ movq $2,%rdi /* write to stderr (fd 2) */
lea .Lelf_entry_error_msg(%rip),%rsi
movq $.Lelf_entry_error_msg_end-.Lelf_entry_error_msg,%rdx
.Lelf_entry_call:
+ movq $1,%rax /* write() syscall */
syscall
test %rax,%rax
jle .Lelf_exit /* exit on error */