10b57cec5SDimitry Andric //===- Target.h -------------------------------------------------*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric #ifndef LLD_ELF_TARGET_H 100b57cec5SDimitry Andric #define LLD_ELF_TARGET_H 110b57cec5SDimitry Andric 1281ad6265SDimitry Andric #include "Config.h" 130b57cec5SDimitry Andric #include "InputSection.h" 140b57cec5SDimitry Andric #include "lld/Common/ErrorHandler.h" 1506c3fb27SDimitry Andric #include "llvm/ADT/StringExtras.h" 160b57cec5SDimitry Andric #include "llvm/Object/ELF.h" 175f757f3fSDimitry Andric #include "llvm/Object/ELFTypes.h" 18bdd1243dSDimitry Andric #include "llvm/Support/Compiler.h" 190b57cec5SDimitry Andric #include "llvm/Support/MathExtras.h" 200b57cec5SDimitry Andric #include <array> 210b57cec5SDimitry Andric 220b57cec5SDimitry Andric namespace lld { 230b57cec5SDimitry Andric std::string toString(elf::RelType type); 240b57cec5SDimitry Andric 250b57cec5SDimitry Andric namespace elf { 260b57cec5SDimitry Andric class Defined; 270b57cec5SDimitry Andric class InputFile; 280b57cec5SDimitry Andric class Symbol; 290b57cec5SDimitry Andric 300b57cec5SDimitry Andric class TargetInfo { 310b57cec5SDimitry Andric public: 320b57cec5SDimitry Andric virtual uint32_t calcEFlags() const { return 0; } 330b57cec5SDimitry Andric virtual RelExpr getRelExpr(RelType type, const Symbol &s, 340b57cec5SDimitry Andric const uint8_t *loc) const = 0; 350b57cec5SDimitry Andric virtual RelType getDynRel(RelType type) const { return 0; } 360b57cec5SDimitry Andric virtual void writeGotPltHeader(uint8_t *buf) const {} 370b57cec5SDimitry Andric virtual void writeGotHeader(uint8_t *buf) const {} 380b57cec5SDimitry Andric virtual void writeGotPlt(uint8_t *buf, const Symbol &s) const {}; 39480093f4SDimitry Andric virtual void writeIgotPlt(uint8_t *buf, const Symbol &s) const {} 400b57cec5SDimitry Andric virtual int64_t getImplicitAddend(const uint8_t *buf, RelType type) const; 410b57cec5SDimitry Andric virtual int getTlsGdRelaxSkip(RelType type) const { return 1; } 420b57cec5SDimitry Andric 430b57cec5SDimitry Andric // If lazy binding is supported, the first entry of the PLT has code 440b57cec5SDimitry Andric // to call the dynamic linker to resolve PLT entries the first time 450b57cec5SDimitry Andric // they are called. This function writes that code. 460b57cec5SDimitry Andric virtual void writePltHeader(uint8_t *buf) const {} 470b57cec5SDimitry Andric 48480093f4SDimitry Andric virtual void writePlt(uint8_t *buf, const Symbol &sym, 49480093f4SDimitry Andric uint64_t pltEntryAddr) const {} 50480093f4SDimitry Andric virtual void writeIplt(uint8_t *buf, const Symbol &sym, 51480093f4SDimitry Andric uint64_t pltEntryAddr) const { 52480093f4SDimitry Andric // All but PPC32 and PPC64 use the same format for .plt and .iplt entries. 53480093f4SDimitry Andric writePlt(buf, sym, pltEntryAddr); 54480093f4SDimitry Andric } 55480093f4SDimitry Andric virtual void writeIBTPlt(uint8_t *buf, size_t numEntries) const {} 560b57cec5SDimitry Andric virtual void addPltHeaderSymbols(InputSection &isec) const {} 570b57cec5SDimitry Andric virtual void addPltSymbols(InputSection &isec, uint64_t off) const {} 580b57cec5SDimitry Andric 590b57cec5SDimitry Andric // Returns true if a relocation only uses the low bits of a value such that 600b57cec5SDimitry Andric // all those bits are in the same page. For example, if the relocation 610b57cec5SDimitry Andric // only uses the low 12 bits in a system with 4k pages. If this is true, the 620b57cec5SDimitry Andric // bits will always have the same value at runtime and we don't have to emit 630b57cec5SDimitry Andric // a dynamic relocation. 640b57cec5SDimitry Andric virtual bool usesOnlyLowPageBits(RelType type) const; 650b57cec5SDimitry Andric 660b57cec5SDimitry Andric // Decide whether a Thunk is needed for the relocation from File 670b57cec5SDimitry Andric // targeting S. 680b57cec5SDimitry Andric virtual bool needsThunk(RelExpr expr, RelType relocType, 690b57cec5SDimitry Andric const InputFile *file, uint64_t branchAddr, 70480093f4SDimitry Andric const Symbol &s, int64_t a) const; 710b57cec5SDimitry Andric 720b57cec5SDimitry Andric // On systems with range extensions we place collections of Thunks at 730b57cec5SDimitry Andric // regular spacings that enable the majority of branches reach the Thunks. 740b57cec5SDimitry Andric // a value of 0 means range extension thunks are not supported. 750b57cec5SDimitry Andric virtual uint32_t getThunkSectionSpacing() const { return 0; } 760b57cec5SDimitry Andric 770b57cec5SDimitry Andric // The function with a prologue starting at Loc was compiled with 780b57cec5SDimitry Andric // -fsplit-stack and it calls a function compiled without. Adjust the prologue 790b57cec5SDimitry Andric // to do the right thing. See https://gcc.gnu.org/wiki/SplitStacks. 800b57cec5SDimitry Andric // The symbols st_other flags are needed on PowerPC64 for determining the 810b57cec5SDimitry Andric // offset to the split-stack prologue. 820b57cec5SDimitry Andric virtual bool adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end, 830b57cec5SDimitry Andric uint8_t stOther) const; 840b57cec5SDimitry Andric 850b57cec5SDimitry Andric // Return true if we can reach dst from src with RelType type. 860b57cec5SDimitry Andric virtual bool inBranchRange(RelType type, uint64_t src, 870b57cec5SDimitry Andric uint64_t dst) const; 880b57cec5SDimitry Andric 895ffd83dbSDimitry Andric virtual void relocate(uint8_t *loc, const Relocation &rel, 905ffd83dbSDimitry Andric uint64_t val) const = 0; 915ffd83dbSDimitry Andric void relocateNoSym(uint8_t *loc, RelType type, uint64_t val) const { 925ffd83dbSDimitry Andric relocate(loc, Relocation{R_NONE, type, 0, 0, nullptr}, val); 935ffd83dbSDimitry Andric } 94bdd1243dSDimitry Andric virtual void relocateAlloc(InputSectionBase &sec, uint8_t *buf) const; 955ffd83dbSDimitry Andric 96753f127fSDimitry Andric // Do a linker relaxation pass and return true if we changed something. 97753f127fSDimitry Andric virtual bool relaxOnce(int pass) const { return false; } 98753f127fSDimitry Andric 995ffd83dbSDimitry Andric virtual void applyJumpInstrMod(uint8_t *loc, JumpModType type, 1005ffd83dbSDimitry Andric JumpModType val) const {} 1010b57cec5SDimitry Andric 1020b57cec5SDimitry Andric virtual ~TargetInfo(); 1030b57cec5SDimitry Andric 1045ffd83dbSDimitry Andric // This deletes a jump insn at the end of the section if it is a fall thru to 1055ffd83dbSDimitry Andric // the next section. Further, if there is a conditional jump and a direct 1065ffd83dbSDimitry Andric // jump consecutively, it tries to flip the conditional jump to convert the 1075ffd83dbSDimitry Andric // direct jump into a fall thru and delete it. Returns true if a jump 1085ffd83dbSDimitry Andric // instruction can be deleted. 1095ffd83dbSDimitry Andric virtual bool deleteFallThruJmpInsn(InputSection &is, InputFile *file, 1105ffd83dbSDimitry Andric InputSection *nextIS) const { 1115ffd83dbSDimitry Andric return false; 1125ffd83dbSDimitry Andric } 1135ffd83dbSDimitry Andric 1140b57cec5SDimitry Andric unsigned defaultCommonPageSize = 4096; 1150b57cec5SDimitry Andric unsigned defaultMaxPageSize = 4096; 1160b57cec5SDimitry Andric 1170b57cec5SDimitry Andric uint64_t getImageBase() const; 1180b57cec5SDimitry Andric 1190b57cec5SDimitry Andric // True if _GLOBAL_OFFSET_TABLE_ is relative to .got.plt, false if .got. 120349cc55cSDimitry Andric bool gotBaseSymInGotPlt = false; 1210b57cec5SDimitry Andric 122349cc55cSDimitry Andric static constexpr RelType noneRel = 0; 1230b57cec5SDimitry Andric RelType copyRel; 1240b57cec5SDimitry Andric RelType gotRel; 1250b57cec5SDimitry Andric RelType pltRel; 1260b57cec5SDimitry Andric RelType relativeRel; 1270b57cec5SDimitry Andric RelType iRelativeRel; 1280b57cec5SDimitry Andric RelType symbolicRel; 1290b57cec5SDimitry Andric RelType tlsDescRel; 1300b57cec5SDimitry Andric RelType tlsGotRel; 1310b57cec5SDimitry Andric RelType tlsModuleIndexRel; 1320b57cec5SDimitry Andric RelType tlsOffsetRel; 133fe6060f1SDimitry Andric unsigned gotEntrySize = config->wordsize; 1340b57cec5SDimitry Andric unsigned pltEntrySize; 1350b57cec5SDimitry Andric unsigned pltHeaderSize; 136480093f4SDimitry Andric unsigned ipltEntrySize; 1370b57cec5SDimitry Andric 1380b57cec5SDimitry Andric // At least on x86_64 positions 1 and 2 are used by the first plt entry 1390b57cec5SDimitry Andric // to support lazy loading. 1400b57cec5SDimitry Andric unsigned gotPltHeaderEntriesNum = 3; 1410b57cec5SDimitry Andric 1420b57cec5SDimitry Andric // On PPC ELF V2 abi, the first entry in the .got is the .TOC. 1430b57cec5SDimitry Andric unsigned gotHeaderEntriesNum = 0; 1440b57cec5SDimitry Andric 14506c3fb27SDimitry Andric // On PPC ELF V2 abi, the dynamic section needs DT_PPC64_OPT (DT_LOPROC + 3) 14606c3fb27SDimitry Andric // to be set to 0x2 if there can be multiple TOC's. Although we do not emit 14706c3fb27SDimitry Andric // multiple TOC's, there can be a mix of TOC and NOTOC addressing which 14806c3fb27SDimitry Andric // is functionally equivalent. 14906c3fb27SDimitry Andric int ppc64DynamicSectionOpt = 0; 15006c3fb27SDimitry Andric 1510b57cec5SDimitry Andric bool needsThunks = false; 1520b57cec5SDimitry Andric 1530b57cec5SDimitry Andric // A 4-byte field corresponding to one or more trap instructions, used to pad 1540b57cec5SDimitry Andric // executable OutputSections. 1550b57cec5SDimitry Andric std::array<uint8_t, 4> trapInstr; 1560b57cec5SDimitry Andric 1575ffd83dbSDimitry Andric // Stores the NOP instructions of different sizes for the target and is used 1585ffd83dbSDimitry Andric // to pad sections that are relaxed. 159bdd1243dSDimitry Andric std::optional<std::vector<std::vector<uint8_t>>> nopInstrs; 1605ffd83dbSDimitry Andric 1610b57cec5SDimitry Andric // If a target needs to rewrite calls to __morestack to instead call 1620b57cec5SDimitry Andric // __morestack_non_split when a split-stack enabled caller calls a 1630b57cec5SDimitry Andric // non-split-stack callee this will return true. Otherwise returns false. 1640b57cec5SDimitry Andric bool needsMoreStackNonSplit = true; 1650b57cec5SDimitry Andric 166e8d8bef9SDimitry Andric virtual RelExpr adjustTlsExpr(RelType type, RelExpr expr) const; 167e8d8bef9SDimitry Andric virtual RelExpr adjustGotPcExpr(RelType type, int64_t addend, 168e8d8bef9SDimitry Andric const uint8_t *loc) const; 1690b57cec5SDimitry Andric 1700b57cec5SDimitry Andric protected: 1710b57cec5SDimitry Andric // On FreeBSD x86_64 the first page cannot be mmaped. 172480093f4SDimitry Andric // On Linux this is controlled by vm.mmap_min_addr. At least on some x86_64 173480093f4SDimitry Andric // installs this is set to 65536, so the first 15 pages cannot be used. 1740b57cec5SDimitry Andric // Given that, the smallest value that can be used in here is 0x10000. 1750b57cec5SDimitry Andric uint64_t defaultImageBase = 0x10000; 1760b57cec5SDimitry Andric }; 1770b57cec5SDimitry Andric 1780b57cec5SDimitry Andric TargetInfo *getAArch64TargetInfo(); 1790b57cec5SDimitry Andric TargetInfo *getAMDGPUTargetInfo(); 1800b57cec5SDimitry Andric TargetInfo *getARMTargetInfo(); 1810b57cec5SDimitry Andric TargetInfo *getAVRTargetInfo(); 1820b57cec5SDimitry Andric TargetInfo *getHexagonTargetInfo(); 18306c3fb27SDimitry Andric TargetInfo *getLoongArchTargetInfo(); 1840b57cec5SDimitry Andric TargetInfo *getMSP430TargetInfo(); 1850b57cec5SDimitry Andric TargetInfo *getPPC64TargetInfo(); 1860b57cec5SDimitry Andric TargetInfo *getPPCTargetInfo(); 1870b57cec5SDimitry Andric TargetInfo *getRISCVTargetInfo(); 1880b57cec5SDimitry Andric TargetInfo *getSPARCV9TargetInfo(); 1890b57cec5SDimitry Andric TargetInfo *getX86TargetInfo(); 1900b57cec5SDimitry Andric TargetInfo *getX86_64TargetInfo(); 1910b57cec5SDimitry Andric template <class ELFT> TargetInfo *getMipsTargetInfo(); 1920b57cec5SDimitry Andric 1930b57cec5SDimitry Andric struct ErrorPlace { 1940b57cec5SDimitry Andric InputSectionBase *isec; 1950b57cec5SDimitry Andric std::string loc; 196349cc55cSDimitry Andric std::string srcLoc; 1970b57cec5SDimitry Andric }; 1980b57cec5SDimitry Andric 1990b57cec5SDimitry Andric // Returns input section and corresponding source string for the given location. 2000b57cec5SDimitry Andric ErrorPlace getErrorPlace(const uint8_t *loc); 2010b57cec5SDimitry Andric 2020b57cec5SDimitry Andric static inline std::string getErrorLocation(const uint8_t *loc) { 2030b57cec5SDimitry Andric return getErrorPlace(loc).loc; 2040b57cec5SDimitry Andric } 2050b57cec5SDimitry Andric 20606c3fb27SDimitry Andric void processArmCmseSymbols(); 20706c3fb27SDimitry Andric 2080b57cec5SDimitry Andric void writePPC32GlinkSection(uint8_t *buf, size_t numEntries); 2090b57cec5SDimitry Andric 2100b57cec5SDimitry Andric unsigned getPPCDFormOp(unsigned secondaryOp); 2118a4dda33SDimitry Andric unsigned getPPCDSFormOp(unsigned secondaryOp); 2120b57cec5SDimitry Andric 2130b57cec5SDimitry Andric // In the PowerPC64 Elf V2 abi a function can have 2 entry points. The first 2140b57cec5SDimitry Andric // is a global entry point (GEP) which typically is used to initialize the TOC 2150b57cec5SDimitry Andric // pointer in general purpose register 2. The second is a local entry 2160b57cec5SDimitry Andric // point (LEP) which bypasses the TOC pointer initialization code. The 2170b57cec5SDimitry Andric // offset between GEP and LEP is encoded in a function's st_other flags. 2180b57cec5SDimitry Andric // This function will return the offset (in bytes) from the global entry-point 2190b57cec5SDimitry Andric // to the local entry-point. 2200b57cec5SDimitry Andric unsigned getPPC64GlobalEntryToLocalEntryOffset(uint8_t stOther); 2210b57cec5SDimitry Andric 222e8d8bef9SDimitry Andric // Write a prefixed instruction, which is a 4-byte prefix followed by a 4-byte 223e8d8bef9SDimitry Andric // instruction (regardless of endianness). Therefore, the prefix is always in 224e8d8bef9SDimitry Andric // lower memory than the instruction. 225e8d8bef9SDimitry Andric void writePrefixedInstruction(uint8_t *loc, uint64_t insn); 226e8d8bef9SDimitry Andric 2275ffd83dbSDimitry Andric void addPPC64SaveRestore(); 2280b57cec5SDimitry Andric uint64_t getPPC64TocBase(); 2290b57cec5SDimitry Andric uint64_t getAArch64Page(uint64_t expr); 23006c3fb27SDimitry Andric template <typename ELFT> void writeARMCmseImportLib(); 23106c3fb27SDimitry Andric uint64_t getLoongArchPageDelta(uint64_t dest, uint64_t pc); 232753f127fSDimitry Andric void riscvFinalizeRelax(int passes); 233bdd1243dSDimitry Andric void mergeRISCVAttributesSections(); 23406c3fb27SDimitry Andric void addArmInputSectionMappingSymbols(); 23506c3fb27SDimitry Andric void addArmSyntheticSectionMappingSymbol(Defined *); 23606c3fb27SDimitry Andric void sortArmMappingSymbols(); 23706c3fb27SDimitry Andric void convertArmInstructionstoBE8(InputSection *sec, uint8_t *buf); 2385f757f3fSDimitry Andric void createTaggedSymbols(const SmallVector<ELFFileBase *, 0> &files); 2390b57cec5SDimitry Andric 240bdd1243dSDimitry Andric LLVM_LIBRARY_VISIBILITY extern const TargetInfo *target; 2410b57cec5SDimitry Andric TargetInfo *getTarget(); 2420b57cec5SDimitry Andric 2430b57cec5SDimitry Andric template <class ELFT> bool isMipsPIC(const Defined *sym); 2440b57cec5SDimitry Andric 2455ffd83dbSDimitry Andric void reportRangeError(uint8_t *loc, const Relocation &rel, const Twine &v, 2465ffd83dbSDimitry Andric int64_t min, uint64_t max); 247e8d8bef9SDimitry Andric void reportRangeError(uint8_t *loc, int64_t v, int n, const Symbol &sym, 248e8d8bef9SDimitry Andric const Twine &msg); 2490b57cec5SDimitry Andric 2500b57cec5SDimitry Andric // Make sure that V can be represented as an N bit signed integer. 2515ffd83dbSDimitry Andric inline void checkInt(uint8_t *loc, int64_t v, int n, const Relocation &rel) { 2520b57cec5SDimitry Andric if (v != llvm::SignExtend64(v, n)) 2535ffd83dbSDimitry Andric reportRangeError(loc, rel, Twine(v), llvm::minIntN(n), llvm::maxIntN(n)); 2540b57cec5SDimitry Andric } 2550b57cec5SDimitry Andric 2560b57cec5SDimitry Andric // Make sure that V can be represented as an N bit unsigned integer. 2575ffd83dbSDimitry Andric inline void checkUInt(uint8_t *loc, uint64_t v, int n, const Relocation &rel) { 2580b57cec5SDimitry Andric if ((v >> n) != 0) 2595ffd83dbSDimitry Andric reportRangeError(loc, rel, Twine(v), 0, llvm::maxUIntN(n)); 2600b57cec5SDimitry Andric } 2610b57cec5SDimitry Andric 2620b57cec5SDimitry Andric // Make sure that V can be represented as an N bit signed or unsigned integer. 2635ffd83dbSDimitry Andric inline void checkIntUInt(uint8_t *loc, uint64_t v, int n, 2645ffd83dbSDimitry Andric const Relocation &rel) { 2650b57cec5SDimitry Andric // For the error message we should cast V to a signed integer so that error 2660b57cec5SDimitry Andric // messages show a small negative value rather than an extremely large one 2670b57cec5SDimitry Andric if (v != (uint64_t)llvm::SignExtend64(v, n) && (v >> n) != 0) 2685ffd83dbSDimitry Andric reportRangeError(loc, rel, Twine((int64_t)v), llvm::minIntN(n), 2690b57cec5SDimitry Andric llvm::maxUIntN(n)); 2700b57cec5SDimitry Andric } 2710b57cec5SDimitry Andric 2725ffd83dbSDimitry Andric inline void checkAlignment(uint8_t *loc, uint64_t v, int n, 2735ffd83dbSDimitry Andric const Relocation &rel) { 2740b57cec5SDimitry Andric if ((v & (n - 1)) != 0) 2750b57cec5SDimitry Andric error(getErrorLocation(loc) + "improper alignment for relocation " + 2765ffd83dbSDimitry Andric lld::toString(rel.type) + ": 0x" + llvm::utohexstr(v) + 2770b57cec5SDimitry Andric " is not aligned to " + Twine(n) + " bytes"); 2780b57cec5SDimitry Andric } 2790b57cec5SDimitry Andric 2800b57cec5SDimitry Andric // Endianness-aware read/write. 2810b57cec5SDimitry Andric inline uint16_t read16(const void *p) { 2820b57cec5SDimitry Andric return llvm::support::endian::read16(p, config->endianness); 2830b57cec5SDimitry Andric } 2840b57cec5SDimitry Andric 2850b57cec5SDimitry Andric inline uint32_t read32(const void *p) { 2860b57cec5SDimitry Andric return llvm::support::endian::read32(p, config->endianness); 2870b57cec5SDimitry Andric } 2880b57cec5SDimitry Andric 2890b57cec5SDimitry Andric inline uint64_t read64(const void *p) { 2900b57cec5SDimitry Andric return llvm::support::endian::read64(p, config->endianness); 2910b57cec5SDimitry Andric } 2920b57cec5SDimitry Andric 2930b57cec5SDimitry Andric inline void write16(void *p, uint16_t v) { 2940b57cec5SDimitry Andric llvm::support::endian::write16(p, v, config->endianness); 2950b57cec5SDimitry Andric } 2960b57cec5SDimitry Andric 2970b57cec5SDimitry Andric inline void write32(void *p, uint32_t v) { 2980b57cec5SDimitry Andric llvm::support::endian::write32(p, v, config->endianness); 2990b57cec5SDimitry Andric } 3000b57cec5SDimitry Andric 3010b57cec5SDimitry Andric inline void write64(void *p, uint64_t v) { 3020b57cec5SDimitry Andric llvm::support::endian::write64(p, v, config->endianness); 3030b57cec5SDimitry Andric } 304*1db9f3b2SDimitry Andric 305*1db9f3b2SDimitry Andric // Overwrite a ULEB128 value and keep the original length. 306*1db9f3b2SDimitry Andric inline uint64_t overwriteULEB128(uint8_t *bufLoc, uint64_t val) { 307*1db9f3b2SDimitry Andric while (*bufLoc & 0x80) { 308*1db9f3b2SDimitry Andric *bufLoc++ = 0x80 | (val & 0x7f); 309*1db9f3b2SDimitry Andric val >>= 7; 310*1db9f3b2SDimitry Andric } 311*1db9f3b2SDimitry Andric *bufLoc = val; 312*1db9f3b2SDimitry Andric return val; 313*1db9f3b2SDimitry Andric } 3140b57cec5SDimitry Andric } // namespace elf 3150b57cec5SDimitry Andric } // namespace lld 3160b57cec5SDimitry Andric 3171fd87a68SDimitry Andric #ifdef __clang__ 3181fd87a68SDimitry Andric #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" 3191fd87a68SDimitry Andric #endif 3201fd87a68SDimitry Andric #define invokeELFT(f, ...) \ 3211fd87a68SDimitry Andric switch (config->ekind) { \ 3225f757f3fSDimitry Andric case lld::elf::ELF32LEKind: \ 3235f757f3fSDimitry Andric f<llvm::object::ELF32LE>(__VA_ARGS__); \ 3241fd87a68SDimitry Andric break; \ 3255f757f3fSDimitry Andric case lld::elf::ELF32BEKind: \ 3265f757f3fSDimitry Andric f<llvm::object::ELF32BE>(__VA_ARGS__); \ 3271fd87a68SDimitry Andric break; \ 3285f757f3fSDimitry Andric case lld::elf::ELF64LEKind: \ 3295f757f3fSDimitry Andric f<llvm::object::ELF64LE>(__VA_ARGS__); \ 3301fd87a68SDimitry Andric break; \ 3315f757f3fSDimitry Andric case lld::elf::ELF64BEKind: \ 3325f757f3fSDimitry Andric f<llvm::object::ELF64BE>(__VA_ARGS__); \ 3331fd87a68SDimitry Andric break; \ 3341fd87a68SDimitry Andric default: \ 3351fd87a68SDimitry Andric llvm_unreachable("unknown config->ekind"); \ 3361fd87a68SDimitry Andric } 3371fd87a68SDimitry Andric 3380b57cec5SDimitry Andric #endif 339