[libc-commits] [libc] [libc][setjmp] fix setjmp test (PR #87837)

Eli Friedman via libc-commits libc-commits at lists.llvm.org
Mon Apr 8 12:57:45 PDT 2024


efriedma-quic wrote:

As noted on the Discourse thread, the issue isn't what the compiler generates right now; it's what the compiler promises to generate.  For setjmp() in particular, no matter how you write the code, there's no way reliably get the value of RBX on entry to the function in a non-naked function using inline asm.

I guess there's nothing stopping us from adding a clang intrinsic to return the value of rbx on entry, but it would only be useful for writing setjmp() implementations.  Just marking the function naked seems easier.

> You cannot refer to function parameters of naked functions: https://godbolt.org/z/b963seKxd .  I guess that's why @efriedma-quic was using offsetof

Right.

https://github.com/llvm/llvm-project/pull/87837


More information about the libc-commits mailing list