Skip to content

Commit cd28a68

Browse files
avoid __builtin_return_address
1 parent c98a544 commit cd28a68

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

libc/src/setjmp/x86_64/setjmp.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,15 @@ LLVM_LIBC_FUNCTION(int, setjmp, (__jmp_buf * buf)) {
2828
"lea 8(%%rsp), %%rax\n\t"
2929
"mov %%rax, %c[rsp](%%rdi)\n\t"
3030

31-
"mov %[read_rip], %c[rip](%%rdi)\n\t"
31+
"mov (%%rsp), %%rax\n\t"
32+
"mov %%rax, %c[rip](%%rdi)\n\t"
3233

3334
"xorl %%eax, %%eax\n\t"
34-
"retq"
35-
::
36-
[rbx] "i"(offsetof(__jmp_buf, rbx)), [r12] "i"(offsetof(__jmp_buf, r12)),
35+
"retq" ::[rbx] "i"(offsetof(__jmp_buf, rbx)),
36+
[rbp] "i"(offsetof(__jmp_buf, rbp)), [r12] "i"(offsetof(__jmp_buf, r12)),
3737
[r13] "i"(offsetof(__jmp_buf, r13)), [r14] "i"(offsetof(__jmp_buf, r14)),
38-
[r15] "i"(offsetof(__jmp_buf, r15)), [rbp] "i"(offsetof(__jmp_buf, rbp)),
39-
[rsp] "i"(offsetof(__jmp_buf, rsp)), [rip] "i"(offsetof(__jmp_buf, rip)),
40-
[read_rip] "r" (reinterpret_cast<__UINTPTR_TYPE__>(__builtin_return_address(0)))
38+
[r15] "i"(offsetof(__jmp_buf, r15)), [rsp] "i"(offsetof(__jmp_buf, rsp)),
39+
[rip] "i"(offsetof(__jmp_buf, rip))
4140
: "rax");
4241
}
4342

0 commit comments

Comments
 (0)