[PATCH] D110869: [X86] Implement -fzero-call-used-regs option
Bill Wendling via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 3 17:31:21 PST 2022
void added a comment.
In D110869#3295477 <https://reviews.llvm.org/D110869#3295477>, @nathanchance wrote:
> It looks like `_paravirt_ident_64()` is the problematic function. This diff on top of v5.17-rc2 allows me to boot:
>
> diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
> index 4420499f7bb4..c1b68504136c 100644
> --- a/arch/x86/kernel/paravirt.c
> +++ b/arch/x86/kernel/paravirt.c
> @@ -96,7 +96,7 @@ static unsigned paravirt_patch_call(void *insn_buff, const void *target,
>
> #ifdef CONFIG_PARAVIRT_XXL
> /* identity function, which can be inlined */
> -u64 notrace _paravirt_ident_64(u64 x)
> +u64 notrace __attribute__((zero_call_used_regs("skip"))) _paravirt_ident_64(u64 x)
> {
> return x;
> }
>
> Rather interesting function to have problems with as a result of this patch but it seems like this function is being used in a very specific way further down the file with the `__PV_IS_CALLEE_SAVE` macro.
Weird. We generate similar code to GCC:
Clang:
_paravirt_ident_64: # @_paravirt_ident_64
.Lfunc_begin2:
.loc 2 100 0 is_stmt 1 # arch/x86/kernel/paravirt.c:100:0
.cfi_startproc
# %bb.0: # %entry
#DEBUG_VALUE: _paravirt_ident_64:x <- $rdi
movq %rdi, %rax
.Ltmp21:
.loc 2 101 2 prologue_end # arch/x86/kernel/paravirt.c:101:2
xorq %rdi, %rdi
.Ltmp22:
#DEBUG_VALUE: _paravirt_ident_64:x <- $rax
retq
.Ltmp23:
.Lfunc_end2:
.size _paravirt_ident_64, .Lfunc_end2-_paravirt_ident_64
.cfi_endproc
GCC:
_paravirt_ident_64:
# arch/x86/kernel/paravirt.c:100: {
movq %rdi, %rax # tmp85, x
# arch/x86/kernel/paravirt.c:102: }
xorl %edi, %edi #
ret
.size _paravirt_ident_64, .-_paravirt_ident_64
I'm a bit confused...
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