Skip to content

Commit 3a35203

Browse files
committed
[SOL] Add BPF target to LLDB
1 parent 49982af commit 3a35203

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

lldb/include/lldb/Utility/ArchSpec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ class ArchSpec {
224224

225225
eCore_wasm32,
226226

227+
eCore_bpf,
227228
eCore_sbf,
228229
eCore_sbfv2,
229230

lldb/source/Utility/ArchSpec.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,9 @@ static const CoreDefinition g_core_definitions[] = {
231231
{eByteOrderLittle, 4, 1, 4, llvm::Triple::wasm32, ArchSpec::eCore_wasm32,
232232
"wasm32"},
233233

234-
{eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbf,
235-
"sbf"},
236-
237-
{eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbfv2,
238-
"sbfv2"},
234+
{eByteOrderLittle, 8, 8, 8, llvm::Triple::bpfel, ArchSpec::eCore_bpf, "bpf"},
235+
{eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbf, "sbf"},
236+
{eByteOrderLittle, 8, 8, 8, llvm::Triple::sbf, ArchSpec::eCore_sbfv2, "sbfv2"},
239237
};
240238

241239
// Ensure that we have an entry in the g_core_definitions for each core. If you
@@ -412,6 +410,8 @@ static const ArchDefinitionEntry g_elf_arch_entries[] = {
412410
ArchSpec::eRISCVSubType_riscv32, 0xFFFFFFFFu, 0xFFFFFFFFu}, // riscv32
413411
{ArchSpec::eCore_riscv64, llvm::ELF::EM_RISCV,
414412
ArchSpec::eRISCVSubType_riscv64, 0xFFFFFFFFu, 0xFFFFFFFFu}, // riscv64
413+
{ArchSpec::eCore_bpf, llvm::ELF::EM_BPF, LLDB_INVALID_CPUTYPE,
414+
0xFFFFFFFFu, 0xFFFFFFFFu}, // bpf
415415
{ArchSpec::eCore_sbf, llvm::ELF::EM_SBF, ArchSpec::eSBFSubType_sbf,
416416
0xFFFFFFFFu, 0xFFFFFFFFu}, // sbf
417417
{ArchSpec::eCore_sbfv2, llvm::ELF::EM_SBF, ArchSpec::eSBFSubType_sbfv2,

llvm/lib/Object/RelocationResolver.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ static uint64_t resolveAArch64(uint64_t Type, uint64_t Offset, uint64_t S,
107107

108108
static bool supportsBPF(uint64_t Type) {
109109
switch (Type) {
110+
case ELF::R_BPF_64_64:
110111
case ELF::R_BPF_64_ABS32:
111112
case ELF::R_BPF_64_ABS64:
112113
return true;
@@ -118,6 +119,8 @@ static bool supportsBPF(uint64_t Type) {
118119
static uint64_t resolveBPF(uint64_t Type, uint64_t Offset, uint64_t S,
119120
uint64_t LocData, int64_t /*Addend*/) {
120121
switch (Type) {
122+
case ELF::R_BPF_64_64:
123+
return S + LocData;
121124
case ELF::R_BPF_64_ABS32:
122125
return (S + LocData) & 0xFFFFFFFF;
123126
case ELF::R_BPF_64_ABS64:
@@ -129,6 +132,7 @@ static uint64_t resolveBPF(uint64_t Type, uint64_t Offset, uint64_t S,
129132

130133
static bool supportsSBF(uint64_t Type) {
131134
switch (Type) {
135+
case ELF::R_SBF_64_64:
132136
case ELF::R_SBF_64_ABS32:
133137
case ELF::R_SBF_64_ABS64:
134138
return true;
@@ -140,6 +144,8 @@ static bool supportsSBF(uint64_t Type) {
140144
static uint64_t resolveSBF(uint64_t Type, uint64_t Offset, uint64_t S,
141145
uint64_t LocData, int64_t /*Addend*/) {
142146
switch (Type) {
147+
case ELF::R_SBF_64_64:
148+
return S + LocData;
143149
case ELF::R_SBF_64_ABS32:
144150
return (S + LocData) & 0xFFFFFFFF;
145151
case ELF::R_SBF_64_ABS64:

0 commit comments

Comments
 (0)