-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Closed
Labels
llvm:mcMachine (object) codeMachine (object) code
Milestone
Description
After 1a47f3f (which does not appear to have a corresponding PR), I see an error when building certain Linux kernels:
error: <instantiation>:9:2: error: value of -130 is too large for field of 1 byte.
jmp 801b
^
make[5]: *** [/builds/linux/scripts/Makefile.build:361: arch/x86/kvm/svm/vmenter.o] Error 1
https://elixir.bootlin.com/linux/v6.6.41/source/arch/x86/kvm/svm/vmenter.S#L60
I used cvise --not-c to produce
.macro ALTERNATIVE_2 oldinstr newinstr1
.skip (144f-143f) ^ (144f-143f < 145-144)
.pushsection ""
143:
\newinstr1
144:
.popsection
.endm
.macro FILL_RETURN_BUFFER reg
ALTERNATIVE_2 , "mov $0, \reg; 771: 999: .pushsection .discard.intra_function_calls; .long 999b; .popsection;; call 772f; int3; 72: 99: .pushsection .discard.intra_function_calls; .long 99b; .popsection;; call 772f; int3; 772: add $0 * 2, %rsp; dec \reg; jnz 771b; lfence; movq $-1, %gs:pcpu_hot + 6;"
.endm
.macro CALL_UNTRAIN_RET
ALTERNATIVE_2 , "call entry_untrain_ret"
.endm
.macro __UNTRAIN_RET ibpb_feature call_depth_insns
CALL_UNTRAIN_RET
ALTERNATIVE_2 , "\call_depth_insns"
.endm
.macro RESTORE_GUEST_SPEC_CTRL
801:
.endm
.macro RESTORE_GUEST_SPEC_CTRL_BODY
movl 936(%rdi), %eax
cmp %gs:x86_spec_ctrl_current, %eax
je 801b
mov edx, %edx
wrmsr
jmp 801b
.endm
.macro RESTORE_HOST_SPEC_CTRL
ALTERNATIVE_2 , "jmp 900f"
901:
.endm
.macro RESTORE_HOST_SPEC_CTRL_BODY
900:
mov $0x00000048, %ecx
jmp 901b
.endm
RESTORE_GUEST_SPEC_CTRL
2: cli
pop %rdi
FILL_RETURN_BUFFER %rax
RESTORE_HOST_SPEC_CTRL
__UNTRAIN_RET , "xor %eax, %eax; bts $63, %rax; movq %rax, %gs:pcpu_hot + 6;"
pop %r12
pop rbp
jmp __x86_return_thunk
RESTORE_GUEST_SPEC_CTRL_BODY
RESTORE_HOST_SPEC_CTRL_BODY
cmpb $0, kvm_rebooting
jne 2b
as a reproducer that has no error with GNU as or clang at the parent of 1a47f3f:
$ x86_64-linux-as --version | head -1
GNU assembler (GNU Binutils) 2.42
$ x86_64-linux-gcc -c -o /dev/null vmenter.s
$ clang --version | head -1
ClangBuiltLinux clang version 19.0.0git (https://github.com/llvm/llvm-project.git 0387cd052b081d6bc9856ef756942a5df1a2a301)
$ clang --target=x86_64-linux-gnu -c -o /dev/null vmenter.s
$ clang --version | head -1
ClangBuiltLinux clang version 19.0.0git (https://github.com/llvm/llvm-project.git 1a47f3f3db66589c11f8ddacfeaecc03fb80c510)
$ clang --target=x86_64-linux-gnu -c -o /dev/null vmenter.s
vmenter.s:51:2: error: value of -130 is too large for field of 1 byte.
jne 2b
^
cc @MaskRay
Metadata
Metadata
Assignees
Labels
llvm:mcMachine (object) codeMachine (object) code
Type
Projects
Status
Done