diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h index d7cec5e7107949..8f536acf678762 100644 --- a/llvm/include/llvm/TargetParser/Triple.h +++ b/llvm/include/llvm/TargetParser/Triple.h @@ -982,7 +982,8 @@ class Triple { /// Tests whether the target is eBPF. bool isBPF() const { - return getArch() == Triple::bpfel || getArch() == Triple::bpfeb; + return getArch() == Triple::bpfel || getArch() == Triple::bpfeb || + getArch() == Triple::sbf; } /// Tests whether the target supports comdat diff --git a/llvm/lib/BinaryFormat/ELF.cpp b/llvm/lib/BinaryFormat/ELF.cpp index dc8f3051a1495e..69f880417b3992 100644 --- a/llvm/lib/BinaryFormat/ELF.cpp +++ b/llvm/lib/BinaryFormat/ELF.cpp @@ -195,6 +195,7 @@ uint16_t ELF::convertArchNameToEMachine(StringRef Arch) { .Case("riscv", EM_RISCV) .Case("lanai", EM_LANAI) .Case("bpf", EM_BPF) + .Case("sbf", EM_BPF) .Case("ve", EM_VE) .Case("csky", EM_CSKY) .Case("loongarch", EM_LOONGARCH) diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp index 0b5109e41e7171..4788053614f52a 100644 --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -356,6 +356,7 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(const Triple &T, bool Large) { break; case Triple::bpfel: case Triple::bpfeb: + case Triple::sbf: FDECFIEncoding = dwarf::DW_EH_PE_sdata8; break; case Triple::hexagon: diff --git a/llvm/lib/Object/RelocationResolver.cpp b/llvm/lib/Object/RelocationResolver.cpp index 03ac592895284b..e070af7ad72eaf 100644 --- a/llvm/lib/Object/RelocationResolver.cpp +++ b/llvm/lib/Object/RelocationResolver.cpp @@ -784,6 +784,7 @@ getRelocationResolver(const ObjectFile &Obj) { return {supportsAArch64, resolveAArch64}; case Triple::bpfel: case Triple::bpfeb: + case Triple::sbf: return {supportsBPF, resolveBPF}; case Triple::loongarch64: return {supportsLoongArch, resolveLoongArch}; diff --git a/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp b/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp index 57be97fa1e700e..f6733544f5d1d4 100644 --- a/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp +++ b/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp @@ -24,7 +24,9 @@ namespace { class BPFAsmBackend : public MCAsmBackend { public: BPFAsmBackend(support::endianness Endian, const MCSubtargetInfo &STI) - : MCAsmBackend(Endian), isSolana(STI.hasFeature(BPF::FeatureSolana)) {} + : MCAsmBackend(Endian), + isSolana(STI.hasFeature(BPF::FeatureSolana) || + STI.getTargetTriple().getArch() == Triple::sbf) {} ~BPFAsmBackend() override = default; void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index bd45ed199767f9..b91de46c99b79a 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -824,6 +824,7 @@ PrettyPrinter &selectPrettyPrinter(Triple const &Triple) { return AMDGCNPrettyPrinterInst; case Triple::bpfel: case Triple::bpfeb: + case Triple::sbf: return BPFPrettyPrinterInst; case Triple::arm: case Triple::armeb: