[llvm] r351720 - [AVR] Enable emission of debug information

Dylan McKay via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 20 20:27:09 PST 2019


Author: dylanmckay
Date: Sun Jan 20 20:27:08 2019
New Revision: 351720

URL: http://llvm.org/viewvc/llvm-project?rev=351720&view=rev
Log:
[AVR] Enable emission of debug information

Prior to this, the code was missing AVR-specific relocation logic in
RelocVisitor.h.

This patch teaches RelocVisitor about R_AVR_16 and R_AVR_32.

Debug information is emitted in the final object file, and understood by
'avr-readelf --debug-dump' from AVR-GCC.

llvm-dwarfdump is yet to understand how to dump AVR DWARF symbols.

Modified:
    llvm/trunk/include/llvm/Object/RelocVisitor.h
    llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp

Modified: llvm/trunk/include/llvm/Object/RelocVisitor.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/RelocVisitor.h?rev=351720&r1=351719&r2=351720&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/RelocVisitor.h (original)
+++ llvm/trunk/include/llvm/Object/RelocVisitor.h Sun Jan 20 20:27:08 2019
@@ -100,6 +100,8 @@ private:
     case Triple::arm:
     case Triple::armeb:
       return visitARM(Rel, R, Value);
+    case Triple::avr:
+      return visitAVR(Rel, R, Value);
     case Triple::lanai:
       return visitLanai(Rel, R, Value);
     case Triple::mipsel:
@@ -256,6 +258,16 @@ private:
     }
     HasError = true;
     return 0;
+  }
+
+  uint64_t visitAVR(uint32_t Rel, RelocationRef R, uint64_t Value) {
+    if (Rel == ELF::R_AVR_16) {
+      return (Value + getELFAddend(R)) & 0xFFFF;
+    } else if (Rel == ELF::R_AVR_32) {
+      return (Value + getELFAddend(R)) & 0xFFFFFFFF;
+    }
+    HasError = true;
+    return 0;
   }
 
   uint64_t visitLanai(uint32_t Rel, RelocationRef R, uint64_t Value) {

Modified: llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp?rev=351720&r1=351719&r2=351720&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp Sun Jan 20 20:27:08 2019
@@ -23,6 +23,7 @@ AVRMCAsmInfo::AVRMCAsmInfo(const Triple
   PrivateGlobalPrefix = ".L";
   UsesELFSectionDirectiveForBSS = true;
   UseIntegratedAssembler = true;
+  SupportsDebugInformation = true;
 }
 
 } // end of namespace llvm




More information about the llvm-commits mailing list