<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/100283>100283</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
"value is too large for field of 1 byte" after commit 1a47f3f3db665
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nathanchance
</td>
</tr>
</table>
<pre>
After 1a47f3f3db66589c11f8ddacfeaecc03fb80c510 (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
```asm
.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 1a47f3f3db66589c11f8ddacfeaecc03fb80c510:
```
$ 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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEV29vozwS_zTOm1EQ2EDgRV4kafLcSn26j7LtSfcKGTMEb8Fwtslm79Of7CRt0s12u6c7XUUJtufvb2bsMTdG7hTinCRLktxN-GibXs8Vtw1Xwv3jpOyr7_NFbVFDxONZzWpWlWmaZLmIojqrKi5q5ChEyOoyC0UShUBo9q2RooGqRwOqt8CHAbkG20PD9wgcRK81mqFXlVQ7-GtLaE7oCj6BQQSuALXuNXxrUEE5ytZTCdSWSwX3Uo0HeEatsDWELUh4R8LzOw1Pjx96MYQtgLCVVMZyZSW3sleErQlb5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