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

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Apr 9 13:06:01 PDT 2024


nickdesaulniers wrote:

FWIW: here's a quick reimplementation in out of line assembler: https://github.com/llvm/llvm-project/pull/88157

That MUST NOT land without updating our coding style to reflect the policy around usage of out of line assembler.

So three different contrasting fixes:

1. https://github.com/llvm/llvm-project/pull/87837 (this PR): play whack-a-mole with disabling compiler instrumentation.  We can keep going and add function attributes to disable inlining (for LTO), sanitizers, and coverage.
2. https://github.com/llvm/llvm-project/pull/88054 : naked fn + 100% inline asm.  I kind of like this because we can lean on the register allocator, and get debug info. But this approach will not work for aarch64 with gcc.
3. https://github.com/llvm/llvm-project/pull/88157 : 100% out of line asm.  A bit more brittle than #88054 (not super happy with the offsets).

Either of the asm approaches will not be fun to extend in the future, when we'll want to do something fancier in our implementation.  IIUC, bionic seems to store a cookie and mangle registers to harden the impl.

I've also written up a draft of a policy for assembler sources [here](https://github.com/llvm/llvm-project/pull/88185) which will be useful no matter which way we go, but especially useful if we go with 3.

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


More information about the libc-commits mailing list