[PATCH] D147100: [lld][ELF] Support relocations R_AVR_8_LO8/R_AVR_8_HI8/R_AVR_8_HLO8
Ben Shi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 28 18:11:57 PDT 2023
benshi001 created this revision.
benshi001 added reviewers: MaskRay, aykevl.
Herald added subscribers: Jim, arichardson, emaste, dylanmckay.
Herald added a project: All.
benshi001 requested review of this revision.
Herald added subscribers: llvm-commits, jacquesguan.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147100
Files:
lld/ELF/Arch/AVR.cpp
lld/test/ELF/avr-reloc.s
Index: lld/test/ELF/avr-reloc.s
===================================================================
--- lld/test/ELF/avr-reloc.s
+++ lld/test/ELF/avr-reloc.s
@@ -96,8 +96,11 @@
.section .DATA,"ax", at progbits
; HEX-LABEL: section .DATA:
-; HEX-NEXT: {{.*}} 1e1e000f 00785634 12
+; HEX-NEXT: {{.*}} 1e1e000f 00785634 12785634
.byte b ; R_AVR_8
.short b ; R_AVR_16
.short gs(b) ; R_AVR_16_PM
.long a ; R_AVR_32
+.byte lo8(a) ; R_AVR_8_LO8
+.byte hi8(a) ; R_AVR_8_HI8
+.byte hlo8(a) ; R_AVR_8_HLO8
Index: lld/ELF/Arch/AVR.cpp
===================================================================
--- lld/ELF/Arch/AVR.cpp
+++ lld/ELF/Arch/AVR.cpp
@@ -56,6 +56,9 @@
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 @@
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147100.509183.patch
Type: text/x-patch
Size: 1424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230329/a54c9948/attachment.bin>
More information about the llvm-commits
mailing list