Issue 179856
Summary Incorrect R_HEX_TPREL_32_6_X application causes invalid duplex extender
Labels bug, lld:ELF
Assignees androm3da
Reporter androm3da
    The test case below has been reduced from the original zig test case courtesy of @alexrp:
* [crash.bc.txt](https://github.com/user-attachments/files/25086209/crash.bc.txt)
* [crash.s.txt](https://github.com/user-attachments/files/25086210/crash.s.txt)

```
$ cat lld_hexagon_tprel_bug.s
    .text
    .globl _start
_start:
    {
 r2 = add(r2,##foo@TPREL)
        memw(r3+#0) = #0
    }
    jumpr r31

    .section .tbss,"awT",@nobits
    .p2align 2
    .space 0xd // Position foo at TLS offset 0xd
    .globl foo
foo:
    .space 0x40000      // Make TLS block size 0x4000d
```
Link the program:
```
llvm-mc -triple=hexagon -filetype=obj lld_hexagon_tprel_bug.s -o lld_hexagon_tprel_bug.o
ld.lld lld_hexagon_tprel_bug.o -o lld_hexagon_tprel_bug
```
Disassembly results:
```
llvm-objdump -d lld_hexagon_tprel_bug
...
000200d4 <_start>:
   200d4: ff 6f ff 0f 0fff6fff <unknown>
   200dc: 00 c0 9f 52  529fc000 {  jumpr r31 }
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to