Skip to content

Commit f02ffb8

Browse files
committed
Rewrite %rax register before syscall because it is overwritten by the syscall itself
1 parent 6354d48 commit f02ffb8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/libstd/sys/sgx/abi/entry.S

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ IMAGE_BASE:
115115
.type elf_entry,function
116116
elf_entry:
117117
/* print error message */
118-
movq $1,%rax /* write() syscall */
119-
movq $2,%rdi /* write to stderr (fd 2) */
118+
movq $2,%rdi /* write to stderr (fd 2) */
120119
lea .Lelf_entry_error_msg(%rip),%rsi
121120
movq $.Lelf_entry_error_msg_end-.Lelf_entry_error_msg,%rdx
122121
.Lelf_entry_call:
122+
movq $1,%rax /* write() syscall */
123123
syscall
124124
test %rax,%rax
125125
jle .Lelf_exit /* exit on error */

0 commit comments

Comments
 (0)