[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 19:34:11 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG504df554d2cc: [lld][ELF] Support relocations R_AVR_8_LO8/R_AVR_8_HI8/R_AVR_8_HLO8 (authored by benshi001).

Repository:
  rG LLVM Github Monorepo

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

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.509191.patch
Type: text/x-patch
Size: 1424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230329/c5adca24/attachment.bin>


More information about the llvm-commits mailing list