[llvm] r243087 - [bpf] initial support for debug_info
Alexei Starovoitov
alexei.starovoitov at gmail.com
Thu Jul 23 20:17:09 PDT 2015
Author: ast
Date: Thu Jul 23 22:17:08 2015
New Revision: 243087
URL: http://llvm.org/viewvc/llvm-project?rev=243087&view=rev
Log:
[bpf] initial support for debug_info
Modified:
llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp
llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h
Modified: llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp?rev=243087&r1=243086&r2=243087&view=diff
==============================================================================
--- llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp Thu Jul 23 22:17:08 2015
@@ -68,16 +68,23 @@ void BPFAsmBackend::applyFixup(const MCF
if (Fixup.getKind() == FK_SecRel_4 || Fixup.getKind() == FK_SecRel_8) {
assert(Value == 0);
- return;
- }
- assert(Fixup.getKind() == FK_PCRel_2);
- Value = (uint16_t)((Value - 8) / 8);
- if (IsLittleEndian) {
- Data[Fixup.getOffset() + 2] = Value & 0xFF;
- Data[Fixup.getOffset() + 3] = Value >> 8;
+ } else if (Fixup.getKind() == FK_Data_4 || Fixup.getKind() == FK_Data_8) {
+ unsigned Size = Fixup.getKind() == FK_Data_4 ? 4 : 8;
+
+ for (unsigned i = 0; i != Size; ++i) {
+ unsigned Idx = IsLittleEndian ? i : Size - i;
+ Data[Fixup.getOffset() + Idx] = uint8_t(Value >> (i * 8));
+ }
} else {
- Data[Fixup.getOffset() + 2] = Value >> 8;
- Data[Fixup.getOffset() + 3] = Value & 0xFF;
+ assert(Fixup.getKind() == FK_PCRel_2);
+ Value = (uint16_t)((Value - 8) / 8);
+ if (IsLittleEndian) {
+ Data[Fixup.getOffset() + 2] = Value & 0xFF;
+ Data[Fixup.getOffset() + 3] = Value >> 8;
+ } else {
+ Data[Fixup.getOffset() + 2] = Value >> 8;
+ Data[Fixup.getOffset() + 3] = Value & 0xFF;
+ }
}
}
Modified: llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp?rev=243087&r1=243086&r2=243087&view=diff
==============================================================================
--- llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp Thu Jul 23 22:17:08 2015
@@ -44,6 +44,10 @@ unsigned BPFELFObjectWriter::GetRelocTyp
return ELF::R_X86_64_64;
case FK_SecRel_4:
return ELF::R_X86_64_PC32;
+ case FK_Data_8:
+ return IsPCRel ? ELF::R_X86_64_PC64 : ELF::R_X86_64_64;
+ case FK_Data_4:
+ return IsPCRel ? ELF::R_X86_64_PC32 : ELF::R_X86_64_32;
}
}
Modified: llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h?rev=243087&r1=243086&r2=243087&view=diff
==============================================================================
--- llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h (original)
+++ llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h Thu Jul 23 22:17:08 2015
@@ -34,6 +34,8 @@ public:
UsesELFSectionDirectiveForBSS = true;
HasSingleParameterDotFile = false;
HasDotTypeDotSizeDirective = false;
+
+ SupportsDebugInformation = true;
}
};
}
More information about the llvm-commits
mailing list