[lld] [lld][ELF][AVR] Add range check for R_AVR_13_PCREL (PR #67636)
via llvm-commits
llvm-commits at lists.llvm.org
Sat May 18 09:10:32 PDT 2024
aykevl wrote:
The change to `R_AVR_7_PCREL` broke linking when updating to LLVM 18:
```
ld.lld-18: error: /tmp/tinygo1961037610/main.lto.main.o:(function runtime.run$1$gowrapper: .text.runtime.run$1$gowrapper+0x4c0): relocation R_AVR_7_PCREL out of range: -66 is not in [-64, 63]; references section '.text.runtime.run$1$gowrapper'
```
When I undo that one line change using the following patch, all AVR tests pass:
```diff
case R_AVR_7_PCREL: {
- checkInt(loc, val - 2, 7, rel);
+ checkInt(loc, val, 7, rel);
checkAlignment(loc, val, 2, rel);
const uint16_t target = (val - 2) >> 1;
write16le(loc, (read16le(loc) & 0xfc07) | ((target & 0x7f) << 3));
break;
}
```
https://github.com/llvm/llvm-project/pull/67636
More information about the llvm-commits
mailing list