[PATCH] D78741: [LLD][ELF][AVR] Implement the missing relocation types

Ayke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 13:01:48 PDT 2020


aykevl added a comment.

I have attached a patch that addresses review comments:

- Fixed `R_AVR_16` to mask off the high bits instead of raising an error.
- Added `checkInt` to `R_AVR_7_PCREL`.
- Used `-NEXT` in the test where possible.
- Switched to checking instructions now that more instructions can be disassembled.

With these changes, I can successfully link at least some TinyGo compiled programs.

F12263666: phabricator.patch <https://reviews.llvm.org/F12263666>

@LemonBoy from your previous comment it looks like you don't intend to work on this further, is that correct? If so, are you okay with me taking over this patch, thus uploading this new patch for example?



================
Comment at: lld/ELF/Arch/AVR.cpp:103
+  case R_AVR_HI8_LDI_NEG:
+    writeLDI(loc, ((~val + 1) >> 8) & 0xff);
+    break;
----------------
dylanmckay wrote:
> I suspect all of these remaining cases can/should have `checkUInt(loc, val, N, rel)` calls
This relocation also goes between code and data space, so may be 0x800000 apart. Therefore there is a good reason why these symbols would be far apart and masking off the high bits is valid.

(Sidenote: I've heard avr-ld shipped with GCC 9 requires code and data to not overlap or it complains, so it actually has to be done this way).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78741/new/

https://reviews.llvm.org/D78741





More information about the llvm-commits mailing list