- Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
| Bugzilla Link | 49821 |
| Resolution | FIXED |
| Resolved on | Jun 08, 2021 16:17 |
| Version | trunk |
| OS | All |
| Blocks | #48661 |
| CC | @DimitryAndric,@emaste,@MaskRay,@slacka,@nicolas17,@atanasyan,@tstellar |
| Fixed by commit(s) | 7e83a7f fec90b2 |
Extended Description
A regression in LLVM12 (tested on rc2, rc4) is causing Zig test suite to fail on the target mips-linux.
ld.lld: error: /home/andy/Downloads/zig/zig-cache/o/7da08f6c0f092ce043d5af1591728354/test.o:(.rodata.str1.1): offset is outside the section
The following command exited with error code 1:
/home/andy/Downloads/zig/build-llvm12/zig test /home/andy/Downloads/zig/test/stage1/behavior.zig --test-name-prefix behavior-mips-linux-none-Debug-bare-multi --cache-dir /home/andy/Downloads/zig/zig-cache --global-cache-dir /home/andy/.cache/zig --name test -target mips-linux-none --test-cmd qemu-mips --test-cmd-bin -I /home/andy/Downloads/zig/test -L /home/andy/local/llvm12-release/lib -isystem /home/andy/local/llvm12-release/include --override-lib-dir /home/andy/Downloads/zig/lib
downstream issue: ziglang/zig#8155
content copied here for convenience:
Minimal reproducer:
.text foo: lui$2, %hi(bar) addiu$2, $2, %lo(bar) .section.rodata.str1.1,"aMS",@progbits,1 .zero 0x8000 bar: .asciz"hello"The 0x8000 gap simulates the previous content in the .rodata.str1.1 section, it's big enough to get sign-extended and small enough to fit in 16bit. The problem is in LLD's MarkLive::resolveReloc, the code is not able to handle the HI16/LO16 relocation pairs.
It's the 32bit one that's showing this problem:
llvm-mc-12 -triple mipsel-linux-none -filetype obj -o - /tmp/foo.s | llvm-objdump-12 -dr - 00000000 <foo>: 0: 01 00 02 3c lui $2, 1 <foo+0x1> 00000000: R_MIPS_HI16 .rodata.str1.1 4: 00 80 42 24 addiu $2, $2, -32768 <foo+0xffffffffffff8000> 00000004: R_MIPS_LO16 .rodata.str1.1