llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

arch/x86/entry/entry_64_compat.S: Assertion `OS.tell() - Start == Layout.getSectionAddressSize(Sec)' failed

Open jcai19 opened this issue 6 years ago • 4 comments

Bugzilla Link 45190
Resolution FIXED
Resolved on Mar 23, 2020 11:44
Version trunk
OS All
CC @RKSimon
Fixed by commit(s) rG6a38e0e4f518

Extended Description

Building above file in the linux kernel triggered the assertion failure. The reason is due to the following code pattern

$ cat bad.s .macro ALTERNATIVE newinstr .skip 144f-143f,0x0 .pushsection .altinstr_replacement,"ax" 143: \newinstr 144: .popsection .endm

.section .entry.text, "ax" ALTERNATIVE "jmp .Lint80_keep_stack" .Lint80_keep_stack:

$ gcc -c bad.s $ echo $? 0

jcai19 avatar Mar 13 '20 01:03 jcai19

The fix has been accepted and submitted upstream.

jcai19 avatar Mar 23 '20 18:03 jcai19

Proposed fix: https://reviews.llvm.org/D76114

jcai19 avatar Mar 13 '20 01:03 jcai19

The reason is when the jump instruction gets relaxed, the evaluation of 144f-143f changed in the example. However, the offsets of the fragments following the FT_Fill fragment enclosing .skip directive are not updated.

jcai19 avatar Mar 13 '20 01:03 jcai19

assigned to @jcai19

jcai19 avatar Mar 13 '20 01:03 jcai19