CompCert icon indicating copy to clipboard operation
CompCert copied to clipboard

RISC-V -- error: fixup value out of range

Open brad0 opened this issue 3 years ago • 2 comments

CompCert 3.11 Clang / LLD 13.0.0 OpenBSD/riscv64 -current

When trying to build CompCert 3.11 on RISC-V 64-bit the compiler builds Ok. When building the tests the build has an error like so..

../../ccomp   -stdlib ../../runtime -dparse -dclight -dasm -fstruct-return   -c -o eval.o eval.c
eval.s:579:2: error: fixup value out of range
        bge     x23, x14, .L101
        ^
eval.s:586:2: error: fixup value out of range
        bgeu    x6, x31, .L102
        ^
eval.s:626:2: error: fixup value out of range
        bne     x12, x0, .L102
        ^
eval.s:638:2: error: fixup value out of range
        bltu    x21, x6, .L168
        ^
ccomp: error: assembler command failed with exit code 1 (use -v to see invocation)

1 error detected.

brad0 avatar Aug 15 '22 18:08 brad0

It looks like the assembler you use does not perform branch relaxation. With the GNU assembler, the first bge is turned into blt .. pc+4; j .L101, avoiding the out-of-range issue.

xavierleroy avatar Aug 16 '22 09:08 xavierleroy

Ah, thanks. This is currently an issue with Clang on RISC-V that should be resolved soon.

The relaxation support is currently disabled on OpenBSD's Clang since we're using LLD for the linker and there isn't any relaxation support within LLD until 15.0.0

brad0 avatar Aug 16 '22 17:08 brad0