mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +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:
parent
c46ea19bd3
commit
90908cb34d
@ -68,16 +68,23 @@ void BPFAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,10 @@ unsigned BPFELFObjectWriter::GetRelocType(const MCValue &Target,
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,8 @@ public:
|
||||
UsesELFSectionDirectiveForBSS = true;
|
||||
HasSingleParameterDotFile = false;
|
||||
HasDotTypeDotSizeDirective = false;
|
||||
|
||||
SupportsDebugInformation = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user