[llvm-bugs] [Bug 49821] New: LLVM 12 regression: ld.lld: error: test.o:(.rodata.str1.1): offset is outside the section

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 2 15:01:44 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49821

            Bug ID: 49821
           Summary: LLVM 12 regression: ld.lld: error:
                    test.o:(.rodata.str1.1): offset is outside the section
           Product: new-bugs
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: andrew at ziglang.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

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: https://github.com/ziglang/zig/issues/8155

content copied here for convenience:
--------------------

Minimal reproducer:

```asm
        .text
foo:
        lui     $2, %hi(bar)
        addiu   $2, $2, %lo(bar)

        .section        .rodata.str1.1,"aMS", at 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

```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210402/23695667/attachment.html>


More information about the llvm-bugs mailing list