<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - LLVM 12 regression: ld.lld: error: test.o:(.rodata.str1.1): offset is outside the section"
href="https://bugs.llvm.org/show_bug.cgi?id=49821">49821</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLVM 12 regression: ld.lld: error: test.o:(.rodata.str1.1): offset is outside the section
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>release blocker
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>andrew@ziglang.org
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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: <a href="https://github.com/ziglang/zig/issues/8155">https://github.com/ziglang/zig/issues/8155</a>
content copied here for convenience:
--------------------
Minimal reproducer:
```asm
.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
```</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>