diff options
author | Ben Shi <powerman1st@163.com> | 2023-03-29 09:08:02 +0800 |
---|---|---|
committer | Ben Shi <powerman1st@163.com> | 2023-03-29 10:33:47 +0800 |
commit | 504df554d2ccd86b1d11d25a8e20134f2ad3a43f (patch) | |
tree | 5afc21b9993820c01d6545bbd2f22b6490a98b4a /lld/ELF | |
parent | d44371c00d87f73aba4ba0feafb4a18151d6f831 (diff) | |
download | llvm-504df554d2ccd86b1d11d25a8e20134f2ad3a43f.tar.gz |
[lld][ELF] Support relocations R_AVR_8_LO8/R_AVR_8_HI8/R_AVR_8_HLO8
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D147100
Diffstat (limited to 'lld/ELF')
-rw-r--r-- | lld/ELF/Arch/AVR.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lld/ELF/Arch/AVR.cpp b/lld/ELF/Arch/AVR.cpp index f0bb8efc4c51..8a5087df4934 100644 --- a/lld/ELF/Arch/AVR.cpp +++ b/lld/ELF/Arch/AVR.cpp @@ -56,6 +56,9 @@ RelExpr AVR::getRelExpr(RelType type, const Symbol &s, case R_AVR_6: case R_AVR_6_ADIW: case R_AVR_8: + case R_AVR_8_LO8: + case R_AVR_8_HI8: + case R_AVR_8_HLO8: case R_AVR_16: case R_AVR_16_PM: case R_AVR_32: @@ -99,6 +102,18 @@ void AVR::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { checkUInt(loc, val, 8, rel); *loc = val; break; + case R_AVR_8_LO8: + checkUInt(loc, val, 32, rel); + *loc = val & 0xff; + break; + case R_AVR_8_HI8: + checkUInt(loc, val, 32, rel); + *loc = (val >> 8) & 0xff; + break; + case R_AVR_8_HLO8: + checkUInt(loc, val, 32, rel); + *loc = (val >> 16) & 0xff; + break; case R_AVR_16: // Note: this relocation is often used between code and data space, which // are 0x800000 apart in the output ELF file. The bitmask cuts off the high |