Skip to content

lld gets "relocation R_HEX_B22_PCREL out of range" #149689

@androm3da

Description

@androm3da

When building zig test cases for hexagon with lld, we encounter range limitations in the relocations, see below for errors. The limited range of these relocations is expected behavior, but for users making large programs it's undesirable. lld can make extensions using thunks/trampolines, but those aren't yet supported.

Note also that #116798 improved lld by correcting the range calculation - it was previously too small. But that fix alone is not effective for very large programs.

Thanks @alexrp for the bug report.

error: ld.lld: /home/alexrp/Source/ziglang/zig/.zig-cache/o/ef6d73811ed43e51b7ff5085bd10310c/test.o:(function os.linux.test.test.user and group ids: .text+0x138d57c): relocation R_HEX_B22_PCREL out of range: -11927916 is not in [-8388608, 8388607]; references 'getauxval'
    note: referenced by test.zig:107 (/home/alexrp/Source/ziglang/zig/lib/std/os/linux/test.zig:107)
    note: defined in /home/alexrp/Source/ziglang/zig/.zig-cache/o/ef6d73811ed43e51b7ff5085bd10310c/test.o
error: ld.lld: /home/alexrp/Source/ziglang/zig/.zig-cache/o/ef6d73811ed43e51b7ff5085bd10310c/test.o:(function os.linux.test.test.user and group ids: .text+0x138d5ec): relocation R_HEX_B22_PCREL out of range: -11928028 is not in [-8388608, 8388607]; references 'getauxval'
    note: referenced by test.zig:108 (/home/alexrp/Source/ziglang/zig/lib/std/os/linux/test.zig:108)
    note: defined in /home/alexrp/Source/ziglang/zig/.zig-cache/o/ef6d73811ed43e51b7ff5085bd10310c/test.o
error: ld.lld: /home/alexrp/Source/ziglang/zig/.zig-cache/o/ef6d73811ed43e51b7ff5085bd10310c/test.o:(function os.linux.test.test.user and group ids: .text+0x138d65c): relocation R_HEX_B22_PCREL out of range: -11928140 is not in [-8388608, 8388607]; references 'getauxval'
    note: referenced by test.zig:109 (/home/alexrp/Source/ziglang/zig/lib/std/os/linux/test.zig:109)
    note: defined in /home/alexrp/Source/ziglang/zig/.zig-cache/o/ef6d73811ed43e51b7ff5085bd10310c/test.o
error: ld.lld: /home/alexrp/Source/ziglang/zig/.zig-cache/o/ef6d73811ed43e51b7ff5085bd10310c/test.o:(function os.linux.test.test.user and group ids: .text+0x138d6cc): relocation R_HEX_B22_PCREL out of range: -11928252 is not in [-8388608, 8388607]; references 'getauxval'
    note: referenced by test.zig:110 (/home/alexrp/Source/ziglang/zig/lib/std/os/linux/test.zig:110)
    note: defined in /home/alexrp/Source/ziglang/zig/.zig-cache/o/ef6d73811ed43e51b7ff5085bd10310c/test.o

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions