Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SOL] Add missing SBF conditions to match BPFEL target #22

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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