https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114543
Bug ID: 114543 Summary: mcmodel=kernel generates relocation that definitely can't be handled Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: link-failure Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Target: x86_64-linux-gnu Take: ``` const char *f() { return "1" + 2147483647; } int main() {} ``` Compile/link with `-O2 mcmodel=kernel` and you get: ``` ASM generation compiler returned: 0 /tmp/cc57BgGX.o: in function `f()': example.cpp:(.text+0x3): relocation truncated to fit: R_X86_64_32S against `.LC0' collect2: error: ld returned 1 exit status Execution build compiler returned: 1 ``` That is because GCC Produces: ``` movq $.LC0+2147483647, %rax ``` But it should have split up the addon from the LC0 here. Note that was reported in PR 91420 originally but that is a riscv64 backend issue rather than one in the x86_64 backend.