llvm.org GIT mirror llvm / 36b9c09
BPF: Use official ELF e_machine value The same value for EM_BPF is being propagated to glibc, elfutils, and binutils. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Alexei Starovoitov <ast@kernel.org> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275633 91177308-0d34-0410-b5e6-96231b3b80d8 Alexei Starovoitov 3 years ago
8 changed file(s) with 33 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
885885 return (EF.getHeader()->e_ident[ELF::EI_OSABI] == ELF::ELFOSABI_AMDGPU_HSA
886886 && IsLittleEndian) ?
887887 "ELF64-amdgpu-hsacobj" : "ELF64-amdgpu";
888 case ELF::EM_BPF:
889 return "ELF64-BPF";
888890 default:
889891 return "ELF64-unknown";
890892 }
947949 && IsLittleEndian) ?
948950 Triple::amdgcn : Triple::UnknownArch;
949951
952 case ELF::EM_BPF:
953 return IsLittleEndian ? Triple::bpfel : Triple::bpfeb;
954
950955 default:
951956 return Triple::UnknownArch;
952957 }
310310 EM_CSR_KALIMBA = 219, // CSR Kalimba architecture family
311311 EM_AMDGPU = 224, // AMD GPU architecture
312312 EM_LANAI = 244, // Lanai 32-bit processor
313 EM_BPF = 247, // Linux kernel bpf virtual machine
313314
314315 // A request has been made to the maintainer of the official registry for
315316 // such numbers for an official value for WebAssembly. As soon as one is
613614 // ELF Relocation types for AMDGPU
614615 enum {
615616 #include "ELFRelocs/AMDGPU.def"
617 };
618
619 // ELF Relocation types for BPF
620 enum {
621 #include "ELFRelocs/BPF.def"
616622 };
617623
618624 #undef ELF_RELOC
0 #ifndef ELF_RELOC
1 #error "ELF_RELOC must be defined"
2 #endif
3
4 // No relocation
5 ELF_RELOC(R_BPF_NONE, 0)
6 // Map index in "maps" section to file descriptor
7 // within ld_64 instruction.
8 ELF_RELOC(R_BPF_MAP_FD, 1)
110110 default:
111111 break;
112112 }
113 case ELF::EM_BPF:
114 switch (Type) {
115 #include "llvm/Support/ELFRelocs/BPF.def"
116 default:
117 break;
118 }
113119 break;
114120 default:
115121 break;
194194 ECase(EM_56800EX)
195195 ECase(EM_AMDGPU)
196196 ECase(EM_LANAI)
197 ECase(EM_BPF)
197198 #undef ECase
198199 }
199200
533534 case ELF::EM_AMDGPU:
534535 #include "llvm/Support/ELFRelocs/AMDGPU.def"
535536 break;
537 case ELF::EM_BPF:
538 #include "llvm/Support/ELFRelocs/BPF.def"
539 break;
536540 default:
537541 llvm_unreachable("Unsupported architecture");
538542 }
2727 }
2828
2929 BPFELFObjectWriter::BPFELFObjectWriter(uint8_t OSABI)
30 : MCELFObjectTargetWriter(/*Is64Bit*/ true, OSABI, ELF::EM_NONE,
30 : MCELFObjectTargetWriter(/*Is64Bit*/ true, OSABI, ELF::EM_BPF,
3131 /*HasRelocationAddend*/ false) {}
3232
3333 BPFELFObjectWriter::~BPFELFObjectWriter() {}
588588 case ELF::EM_ARM:
589589 case ELF::EM_HEXAGON:
590590 case ELF::EM_MIPS:
591 case ELF::EM_BPF:
591592 res = Target;
592593 break;
593594 case ELF::EM_WEBASSEMBLY:
955955 ENUM_ENT(EM_AMDGPU, "EM_AMDGPU"),
956956 ENUM_ENT(EM_WEBASSEMBLY, "EM_WEBASSEMBLY"),
957957 ENUM_ENT(EM_LANAI, "EM_LANAI"),
958 ENUM_ENT(EM_BPF, "EM_BPF"),
958959 };
959960
960961 static const EnumEntry ElfSymbolBindings[] = {