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 committed Feb 27, 2022
1 parent 5dddf13 commit 4205085
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/ADT/Triple.h
Original file line number Diff line number Diff line change
Expand Up @@ -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).
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 @@ -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);
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 @@ -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:
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 @@ -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:
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 @@ -665,6 +665,7 @@ PrettyPrinter &selectPrettyPrinter(Triple const &Triple) {
return AMDGCNPrettyPrinterInst;
case Triple::bpfel:
case Triple::bpfeb:
case Triple::sbf:
return BPFPrettyPrinterInst;
}
}
Expand Down

0 comments on commit 4205085

Please sign in to comment.