[PATCH] D110869: [X86] Implement -fzero-call-used-regs option

Bill Wendling via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 15:06:37 PDT 2021


void added a comment.

In D110869#3034616 <https://reviews.llvm.org/D110869#3034616>, @nickdesaulniers wrote:

> We'll probably need to investigate code gen a little.
>
> A mainline linux kernel defconfig built with `CONFIG_ZERO_CALL_USED_REGS=y` enabled doesn't boot, for example.  I consider that a blocker before landing this (much-appreciated) feature; marking it as such.  (Though it's possible that there are TUs in the kernel that may need to be built with `-fzero-call-used-regs=skip` that aren't (yet) failing with GCC).  I don't observe the kernel getting to `start_kernel`, which is the arch-agnostic entry point of the boot; so there's likely x86 specific C code invoked before the generic boot code takes over that may not play well with the instrumentation as implemented.

I found a likely issue. In `arch/x86/kernel/e820.c`, the function `cpcompare` returns a value, but we generate `xorq %rax, %rax` before returning. So not great. The issue is telling which registers are "live out" of the function (or exit block) so that we don't accidentally zero them out.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110869/new/

https://reviews.llvm.org/D110869



More information about the llvm-commits mailing list