Skip to content

Commit

Permalink
[SOL] Add missing SBF conditions to match BPFEL target
Browse files Browse the repository at this point in the history
  • Loading branch information
dmakarov authored and LucasSte committed Feb 16, 2024
1 parent a4488d2 commit 470273a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion llvm/include/llvm/TargetParser/Triple.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/BinaryFormat/ELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/MC/MCObjectFileInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Object/RelocationResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
4 changes: 3 additions & 1 deletion llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions llvm/tools/llvm-objdump/llvm-objdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 470273a

Please sign in to comment.