about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorPieter Agten <pieter.agten@fortanix.com>2019-12-06 10:54:53 +0100
committerPieter Agten <pieter.agten@fortanix.com>2019-12-06 10:54:53 +0100
commitf02ffb8b4ca760117875f3b5326e9cff6598dde3 (patch)
treef1bad247964b424b1b48f858adaa07ac7ee0081e /src/libstd/sys
parent6354d48dc5839878742e7fbf21a120c5c51a946f (diff)
downloadrust-f02ffb8b4ca760117875f3b5326e9cff6598dde3.tar.gz
rust-f02ffb8b4ca760117875f3b5326e9cff6598dde3.zip
Rewrite %rax register before syscall because it is overwritten by the syscall itself
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/sgx/abi/entry.S4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/sys/sgx/abi/entry.S b/src/libstd/sys/sgx/abi/entry.S
index ca2848c61d9..a3e059e8131 100644
--- a/src/libstd/sys/sgx/abi/entry.S
+++ b/src/libstd/sys/sgx/abi/entry.S
@@ -115,11 +115,11 @@ IMAGE_BASE:
 .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          */