mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-13 08:26:02 +00:00
[bpf] initial support for debug_info
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243087 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -68,8 +68,14 @@ void BPFAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
|
|||||||
|
|
||||||
if (Fixup.getKind() == FK_SecRel_4 || Fixup.getKind() == FK_SecRel_8) {
|
if (Fixup.getKind() == FK_SecRel_4 || Fixup.getKind() == FK_SecRel_8) {
|
||||||
assert(Value == 0);
|
assert(Value == 0);
|
||||||
return;
|
} 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 {
|
||||||
assert(Fixup.getKind() == FK_PCRel_2);
|
assert(Fixup.getKind() == FK_PCRel_2);
|
||||||
Value = (uint16_t)((Value - 8) / 8);
|
Value = (uint16_t)((Value - 8) / 8);
|
||||||
if (IsLittleEndian) {
|
if (IsLittleEndian) {
|
||||||
@@ -80,6 +86,7 @@ void BPFAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
|
|||||||
Data[Fixup.getOffset() + 3] = Value & 0xFF;
|
Data[Fixup.getOffset() + 3] = Value & 0xFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MCObjectWriter *BPFAsmBackend::createObjectWriter(raw_pwrite_stream &OS) const {
|
MCObjectWriter *BPFAsmBackend::createObjectWriter(raw_pwrite_stream &OS) const {
|
||||||
return createBPFELFObjectWriter(OS, 0, IsLittleEndian);
|
return createBPFELFObjectWriter(OS, 0, IsLittleEndian);
|
||||||
|
@@ -44,6 +44,10 @@ unsigned BPFELFObjectWriter::GetRelocType(const MCValue &Target,
|
|||||||
return ELF::R_X86_64_64;
|
return ELF::R_X86_64_64;
|
||||||
case FK_SecRel_4:
|
case FK_SecRel_4:
|
||||||
return ELF::R_X86_64_PC32;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,6 +34,8 @@ public:
|
|||||||
UsesELFSectionDirectiveForBSS = true;
|
UsesELFSectionDirectiveForBSS = true;
|
||||||
HasSingleParameterDotFile = false;
|
HasSingleParameterDotFile = false;
|
||||||
HasDotTypeDotSizeDirective = false;
|
HasDotTypeDotSizeDirective = false;
|
||||||
|
|
||||||
|
SupportsDebugInformation = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user