diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h index 754269d226a190..be1e6d65f46949 100644 --- a/llvm/include/llvm/ADT/Triple.h +++ b/llvm/include/llvm/ADT/Triple.h @@ -743,7 +743,8 @@ class Triple { /// Tests whether the target is BPF (little and big endian). bool isBPF() const { - return getArch() == Triple::bpfel || getArch() == Triple::bpfeb; + return getArch() == Triple::bpfel || getArch() == Triple::bpfeb || + getArch() == Triple::sbf; } /// Tests whether the target is MIPS 32-bit (little and big endian). diff --git a/llvm/lib/BinaryFormat/ELF.cpp b/llvm/lib/BinaryFormat/ELF.cpp index 2ede63f464d3ae..261db8abf2c49a 100644 --- a/llvm/lib/BinaryFormat/ELF.cpp +++ b/llvm/lib/BinaryFormat/ELF.cpp @@ -196,6 +196,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) .Default(EM_NONE); diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp index 7ea1106068b74d..385932a41b290c 100644 --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -327,6 +327,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 ab98a2dd2ac1f0..71163515cb5995 100644 --- a/llvm/lib/Object/RelocationResolver.cpp +++ b/llvm/lib/Object/RelocationResolver.cpp @@ -667,6 +667,7 @@ getRelocationResolver(const ObjectFile &Obj) { return {supportsAArch64, resolveAArch64}; case Triple::bpfel: case Triple::bpfeb: + case Triple::sbf: return {supportsBPF, resolveBPF}; case Triple::mips64el: case Triple::mips64: diff --git a/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp b/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp index bd38c0140fd238..b9f6efcb2c3a2f 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 48ae92f734c74d..e0f9fb614f625f 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -665,6 +665,7 @@ PrettyPrinter &selectPrettyPrinter(Triple const &Triple) { return AMDGCNPrettyPrinterInst; case Triple::bpfel: case Triple::bpfeb: + case Triple::sbf: return BPFPrettyPrinterInst; } }