LLVM  14.0.0git
ELFObjectFile.cpp
Go to the documentation of this file.
1 //===- ELFObjectFile.cpp - ELF object file implementation -----------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Part of the ELFObjectFile class implementation.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "llvm/ADT/Triple.h"
15 #include "llvm/BinaryFormat/ELF.h"
18 #include "llvm/Object/ELF.h"
19 #include "llvm/Object/ELFTypes.h"
20 #include "llvm/Object/Error.h"
23 #include "llvm/Support/Endian.h"
29 #include <algorithm>
30 #include <cstddef>
31 #include <cstdint>
32 #include <memory>
33 #include <string>
34 #include <system_error>
35 #include <utility>
36 
37 using namespace llvm;
38 using namespace object;
39 
41  {"None", "NOTYPE", ELF::STT_NOTYPE},
42  {"Object", "OBJECT", ELF::STT_OBJECT},
43  {"Function", "FUNC", ELF::STT_FUNC},
44  {"Section", "SECTION", ELF::STT_SECTION},
45  {"File", "FILE", ELF::STT_FILE},
46  {"Common", "COMMON", ELF::STT_COMMON},
47  {"TLS", "TLS", ELF::STT_TLS},
48  {"Unknown", "<unknown>: 7", 7},
49  {"Unknown", "<unknown>: 8", 8},
50  {"Unknown", "<unknown>: 9", 9},
51  {"GNU_IFunc", "IFUNC", ELF::STT_GNU_IFUNC},
52  {"OS Specific", "<OS specific>: 11", 11},
53  {"OS Specific", "<OS specific>: 12", 12},
54  {"Proc Specific", "<processor specific>: 13", 13},
55  {"Proc Specific", "<processor specific>: 14", 14},
56  {"Proc Specific", "<processor specific>: 15", 15}
57 };
58 
60  : ObjectFile(Type, Source) {}
61 
62 template <class ELFT>
64 createPtr(MemoryBufferRef Object, bool InitContent) {
65  auto Ret = ELFObjectFile<ELFT>::create(Object, InitContent);
66  if (Error E = Ret.takeError())
67  return std::move(E);
68  return std::make_unique<ELFObjectFile<ELFT>>(std::move(*Ret));
69 }
70 
73  std::pair<unsigned char, unsigned char> Ident =
75  std::size_t MaxAlignment =
76  1ULL << countTrailingZeros(
77  reinterpret_cast<uintptr_t>(Obj.getBufferStart()));
78 
79  if (MaxAlignment < 2)
80  return createError("Insufficient alignment");
81 
82  if (Ident.first == ELF::ELFCLASS32) {
83  if (Ident.second == ELF::ELFDATA2LSB)
84  return createPtr<ELF32LE>(Obj, InitContent);
85  else if (Ident.second == ELF::ELFDATA2MSB)
86  return createPtr<ELF32BE>(Obj, InitContent);
87  else
88  return createError("Invalid ELF data");
89  } else if (Ident.first == ELF::ELFCLASS64) {
90  if (Ident.second == ELF::ELFDATA2LSB)
91  return createPtr<ELF64LE>(Obj, InitContent);
92  else if (Ident.second == ELF::ELFDATA2MSB)
93  return createPtr<ELF64BE>(Obj, InitContent);
94  else
95  return createError("Invalid ELF data");
96  }
97  return createError("Invalid ELF class");
98 }
99 
100 SubtargetFeatures ELFObjectFileBase::getMIPSFeatures() const {
101  SubtargetFeatures Features;
102  unsigned PlatformFlags = getPlatformFlags();
103 
104  switch (PlatformFlags & ELF::EF_MIPS_ARCH) {
105  case ELF::EF_MIPS_ARCH_1:
106  break;
107  case ELF::EF_MIPS_ARCH_2:
108  Features.AddFeature("mips2");
109  break;
110  case ELF::EF_MIPS_ARCH_3:
111  Features.AddFeature("mips3");
112  break;
113  case ELF::EF_MIPS_ARCH_4:
114  Features.AddFeature("mips4");
115  break;
116  case ELF::EF_MIPS_ARCH_5:
117  Features.AddFeature("mips5");
118  break;
120  Features.AddFeature("mips32");
121  break;
123  Features.AddFeature("mips64");
124  break;
126  Features.AddFeature("mips32r2");
127  break;
129  Features.AddFeature("mips64r2");
130  break;
132  Features.AddFeature("mips32r6");
133  break;
135  Features.AddFeature("mips64r6");
136  break;
137  default:
138  llvm_unreachable("Unknown EF_MIPS_ARCH value");
139  }
140 
141  switch (PlatformFlags & ELF::EF_MIPS_MACH) {
143  // No feature associated with this value.
144  break;
146  Features.AddFeature("cnmips");
147  break;
148  default:
149  llvm_unreachable("Unknown EF_MIPS_ARCH value");
150  }
151 
152  if (PlatformFlags & ELF::EF_MIPS_ARCH_ASE_M16)
153  Features.AddFeature("mips16");
154  if (PlatformFlags & ELF::EF_MIPS_MICROMIPS)
155  Features.AddFeature("micromips");
156 
157  return Features;
158 }
159 
160 SubtargetFeatures ELFObjectFileBase::getARMFeatures() const {
161  SubtargetFeatures Features;
165  return SubtargetFeatures();
166  }
167 
168  // both ARMv7-M and R have to support thumb hardware div
169  bool isV7 = false;
170  Optional<unsigned> Attr =
171  Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch);
172  if (Attr.hasValue())
173  isV7 = Attr.getValue() == ARMBuildAttrs::v7;
174 
175  Attr = Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch_profile);
176  if (Attr.hasValue()) {
177  switch (Attr.getValue()) {
179  Features.AddFeature("aclass");
180  break;
182  Features.AddFeature("rclass");
183  if (isV7)
184  Features.AddFeature("hwdiv");
185  break;
187  Features.AddFeature("mclass");
188  if (isV7)
189  Features.AddFeature("hwdiv");
190  break;
191  }
192  }
193 
194  Attr = Attributes.getAttributeValue(ARMBuildAttrs::THUMB_ISA_use);
195  if (Attr.hasValue()) {
196  switch (Attr.getValue()) {
197  default:
198  break;
200  Features.AddFeature("thumb", false);
201  Features.AddFeature("thumb2", false);
202  break;
204  Features.AddFeature("thumb2");
205  break;
206  }
207  }
208 
209  Attr = Attributes.getAttributeValue(ARMBuildAttrs::FP_arch);
210  if (Attr.hasValue()) {
211  switch (Attr.getValue()) {
212  default:
213  break;
215  Features.AddFeature("vfp2sp", false);
216  Features.AddFeature("vfp3d16sp", false);
217  Features.AddFeature("vfp4d16sp", false);
218  break;
220  Features.AddFeature("vfp2");
221  break;
224  Features.AddFeature("vfp3");
225  break;
228  Features.AddFeature("vfp4");
229  break;
230  }
231  }
232 
233  Attr = Attributes.getAttributeValue(ARMBuildAttrs::Advanced_SIMD_arch);
234  if (Attr.hasValue()) {
235  switch (Attr.getValue()) {
236  default:
237  break;
239  Features.AddFeature("neon", false);
240  Features.AddFeature("fp16", false);
241  break;
243  Features.AddFeature("neon");
244  break;
246  Features.AddFeature("neon");
247  Features.AddFeature("fp16");
248  break;
249  }
250  }
251 
252  Attr = Attributes.getAttributeValue(ARMBuildAttrs::MVE_arch);
253  if (Attr.hasValue()) {
254  switch (Attr.getValue()) {
255  default:
256  break;
258  Features.AddFeature("mve", false);
259  Features.AddFeature("mve.fp", false);
260  break;
262  Features.AddFeature("mve.fp", false);
263  Features.AddFeature("mve");
264  break;
266  Features.AddFeature("mve.fp");
267  break;
268  }
269  }
270 
271  Attr = Attributes.getAttributeValue(ARMBuildAttrs::DIV_use);
272  if (Attr.hasValue()) {
273  switch (Attr.getValue()) {
274  default:
275  break;
277  Features.AddFeature("hwdiv", false);
278  Features.AddFeature("hwdiv-arm", false);
279  break;
281  Features.AddFeature("hwdiv");
282  Features.AddFeature("hwdiv-arm");
283  break;
284  }
285  }
286 
287  return Features;
288 }
289 
290 SubtargetFeatures ELFObjectFileBase::getRISCVFeatures() const {
291  SubtargetFeatures Features;
292  unsigned PlatformFlags = getPlatformFlags();
293 
294  if (PlatformFlags & ELF::EF_RISCV_RVC) {
295  Features.AddFeature("c");
296  }
297 
298  // Add features according to the ELF attribute section.
299  // If there are any unrecognized features, ignore them.
302  // TODO Propagate Error.
304  return Features; // Keep "c" feature if there is one in PlatformFlags.
305  }
306 
307  Optional<StringRef> Attr = Attributes.getAttributeString(RISCVAttrs::ARCH);
308  if (Attr.hasValue()) {
309  // The Arch pattern is [rv32|rv64][i|e]version(_[m|a|f|d|c]version)*
310  // Version string pattern is (major)p(minor). Major and minor are optional.
311  // For example, a version number could be 2p0, 2, or p92.
312  StringRef Arch = Attr.getValue();
313  if (Arch.consume_front("rv32"))
314  Features.AddFeature("64bit", false);
315  else if (Arch.consume_front("rv64"))
316  Features.AddFeature("64bit");
317 
318  while (!Arch.empty()) {
319  switch (Arch[0]) {
320  default:
321  break; // Ignore unexpected features.
322  case 'i':
323  Features.AddFeature("e", false);
324  break;
325  case 'd':
326  Features.AddFeature("f"); // D-ext will imply F-ext.
328  case 'e':
329  case 'm':
330  case 'a':
331  case 'f':
332  case 'c':
333  Features.AddFeature(Arch.take_front());
334  break;
335  }
336 
337  // FIXME: Handle version numbers.
338  Arch = Arch.drop_until([](char c) { return c == '_' || c == '\0'; });
339  Arch = Arch.drop_while([](char c) { return c == '_'; });
340  }
341  }
342 
343  return Features;
344 }
345 
347  switch (getEMachine()) {
348  case ELF::EM_MIPS:
349  return getMIPSFeatures();
350  case ELF::EM_ARM:
351  return getARMFeatures();
352  case ELF::EM_RISCV:
353  return getRISCVFeatures();
354  default:
355  return SubtargetFeatures();
356  }
357 }
358 
360  switch (getEMachine()) {
361  case ELF::EM_AMDGPU:
362  return getAMDGPUCPUName();
363  default:
364  return None;
365  }
366 }
367 
368 StringRef ELFObjectFileBase::getAMDGPUCPUName() const {
370  unsigned CPU = getPlatformFlags() & ELF::EF_AMDGPU_MACH;
371 
372  switch (CPU) {
373  // Radeon HD 2000/3000 Series (R600).
375  return "r600";
377  return "r630";
379  return "rs880";
381  return "rv670";
382 
383  // Radeon HD 4000 Series (R700).
385  return "rv710";
387  return "rv730";
389  return "rv770";
390 
391  // Radeon HD 5000 Series (Evergreen).
393  return "cedar";
395  return "cypress";
397  return "juniper";
399  return "redwood";
401  return "sumo";
402 
403  // Radeon HD 6000 Series (Northern Islands).
405  return "barts";
407  return "caicos";
409  return "cayman";
411  return "turks";
412 
413  // AMDGCN GFX6.
415  return "gfx600";
417  return "gfx601";
419  return "gfx602";
420 
421  // AMDGCN GFX7.
423  return "gfx700";
425  return "gfx701";
427  return "gfx702";
429  return "gfx703";
431  return "gfx704";
433  return "gfx705";
434 
435  // AMDGCN GFX8.
437  return "gfx801";
439  return "gfx802";
441  return "gfx803";
443  return "gfx805";
445  return "gfx810";
446 
447  // AMDGCN GFX9.
449  return "gfx900";
451  return "gfx902";
453  return "gfx904";
455  return "gfx906";
457  return "gfx908";
459  return "gfx909";
461  return "gfx90a";
463  return "gfx90c";
464 
465  // AMDGCN GFX10.
467  return "gfx1010";
469  return "gfx1011";
471  return "gfx1012";
473  return "gfx1013";
475  return "gfx1030";
477  return "gfx1031";
479  return "gfx1032";
481  return "gfx1033";
483  return "gfx1034";
485  return "gfx1035";
486  default:
487  llvm_unreachable("Unknown EF_AMDGPU_MACH value");
488  }
489 }
490 
491 // FIXME Encode from a tablegen description or target parser.
492 void ELFObjectFileBase::setARMSubArch(Triple &TheTriple) const {
493  if (TheTriple.getSubArch() != Triple::NoSubArch)
494  return;
495 
498  // TODO Propagate Error.
500  return;
501  }
502 
503  std::string Triple;
504  // Default to ARM, but use the triple if it's been set.
505  if (TheTriple.isThumb())
506  Triple = "thumb";
507  else
508  Triple = "arm";
509 
510  Optional<unsigned> Attr =
511  Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch);
512  if (Attr.hasValue()) {
513  switch (Attr.getValue()) {
514  case ARMBuildAttrs::v4:
515  Triple += "v4";
516  break;
517  case ARMBuildAttrs::v4T:
518  Triple += "v4t";
519  break;
520  case ARMBuildAttrs::v5T:
521  Triple += "v5t";
522  break;
523  case ARMBuildAttrs::v5TE:
524  Triple += "v5te";
525  break;
527  Triple += "v5tej";
528  break;
529  case ARMBuildAttrs::v6:
530  Triple += "v6";
531  break;
532  case ARMBuildAttrs::v6KZ:
533  Triple += "v6kz";
534  break;
535  case ARMBuildAttrs::v6T2:
536  Triple += "v6t2";
537  break;
538  case ARMBuildAttrs::v6K:
539  Triple += "v6k";
540  break;
541  case ARMBuildAttrs::v7: {
542  Optional<unsigned> ArchProfileAttr =
543  Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch_profile);
544  if (ArchProfileAttr.hasValue() &&
545  ArchProfileAttr.getValue() == ARMBuildAttrs::MicroControllerProfile)
546  Triple += "v7m";
547  else
548  Triple += "v7";
549  break;
550  }
551  case ARMBuildAttrs::v6_M:
552  Triple += "v6m";
553  break;
555  Triple += "v6sm";
556  break;
558  Triple += "v7em";
559  break;
560  case ARMBuildAttrs::v8_A:
561  Triple += "v8a";
562  break;
563  case ARMBuildAttrs::v8_R:
564  Triple += "v8r";
565  break;
567  Triple += "v8m.base";
568  break;
570  Triple += "v8m.main";
571  break;
573  Triple += "v8.1m.main";
574  break;
575  }
576  }
577  if (!isLittleEndian())
578  Triple += "eb";
579 
580  TheTriple.setArchName(Triple);
581 }
582 
583 std::vector<std::pair<Optional<DataRefImpl>, uint64_t>>
585  std::string Err;
586  const auto Triple = makeTriple();
587  const auto *T = TargetRegistry::lookupTarget(Triple.str(), Err);
588  if (!T)
589  return {};
590  uint64_t JumpSlotReloc = 0;
591  switch (Triple.getArch()) {
592  case Triple::x86:
593  JumpSlotReloc = ELF::R_386_JUMP_SLOT;
594  break;
595  case Triple::x86_64:
596  JumpSlotReloc = ELF::R_X86_64_JUMP_SLOT;
597  break;
598  case Triple::aarch64:
599  case Triple::aarch64_be:
600  JumpSlotReloc = ELF::R_AARCH64_JUMP_SLOT;
601  break;
602  default:
603  return {};
604  }
605  std::unique_ptr<const MCInstrInfo> MII(T->createMCInstrInfo());
606  std::unique_ptr<const MCInstrAnalysis> MIA(
607  T->createMCInstrAnalysis(MII.get()));
608  if (!MIA)
609  return {};
610  Optional<SectionRef> Plt = None, RelaPlt = None, GotPlt = None;
611  for (const SectionRef &Section : sections()) {
612  Expected<StringRef> NameOrErr = Section.getName();
613  if (!NameOrErr) {
614  consumeError(NameOrErr.takeError());
615  continue;
616  }
617  StringRef Name = *NameOrErr;
618 
619  if (Name == ".plt")
620  Plt = Section;
621  else if (Name == ".rela.plt" || Name == ".rel.plt")
622  RelaPlt = Section;
623  else if (Name == ".got.plt")
624  GotPlt = Section;
625  }
626  if (!Plt || !RelaPlt || !GotPlt)
627  return {};
628  Expected<StringRef> PltContents = Plt->getContents();
629  if (!PltContents) {
630  consumeError(PltContents.takeError());
631  return {};
632  }
633  auto PltEntries = MIA->findPltEntries(Plt->getAddress(),
634  arrayRefFromStringRef(*PltContents),
635  GotPlt->getAddress(), Triple);
636  // Build a map from GOT entry virtual address to PLT entry virtual address.
638  for (const auto &Entry : PltEntries)
639  GotToPlt.insert(std::make_pair(Entry.second, Entry.first));
640  // Find the relocations in the dynamic relocation table that point to
641  // locations in the GOT for which we know the corresponding PLT entry.
642  std::vector<std::pair<Optional<DataRefImpl>, uint64_t>> Result;
643  for (const auto &Relocation : RelaPlt->relocations()) {
644  if (Relocation.getType() != JumpSlotReloc)
645  continue;
646  auto PltEntryIter = GotToPlt.find(Relocation.getOffset());
647  if (PltEntryIter != GotToPlt.end()) {
648  symbol_iterator Sym = Relocation.getSymbol();
649  if (Sym == symbol_end())
650  Result.emplace_back(None, PltEntryIter->second);
651  else
652  Result.emplace_back(Sym->getRawDataRefImpl(), PltEntryIter->second);
653  }
654  }
655  return Result;
656 }
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX1032
@ EF_AMDGPU_MACH_AMDGCN_GFX1032
Definition: ELF.h:737
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX703
@ EF_AMDGPU_MACH_AMDGCN_GFX703
Definition: ELF.h:718
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX705
@ EF_AMDGPU_MACH_AMDGCN_GFX705
Definition: ELF.h:740
llvm::ELF::EF_MIPS_ARCH_32
@ EF_MIPS_ARCH_32
Definition: ELF.h:557
llvm::ELF::EF_AMDGPU_MACH_R600_CAICOS
@ EF_AMDGPU_MACH_R600_CAICOS
Definition: ELF.h:700
llvm::MemoryBufferRef::getBufferStart
const char * getBufferStart() const
Definition: MemoryBufferRef.h:35
MathExtras.h
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX1030
@ EF_AMDGPU_MACH_AMDGCN_GFX1030
Definition: ELF.h:735
llvm::StringRef::empty
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:153
llvm::ELF::EF_AMDGPU_MACH_R600_SUMO
@ EF_AMDGPU_MACH_R600_SUMO
Definition: ELF.h:697
llvm::ELF::EF_MIPS_ARCH
@ EF_MIPS_ARCH
Definition: ELF.h:563
llvm::RISCVAttributeParser
Definition: RISCVAttributeParser.h:16
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX600
@ EF_AMDGPU_MACH_AMDGCN_GFX600
Definition: ELF.h:713
llvm::ELF::EM_ARM
@ EM_ARM
Definition: ELF.h:157
llvm::ARMBuildAttrs::v7E_M
@ v7E_M
Definition: ARMBuildAttributes.h:102
llvm::ARMBuildAttrs::Advanced_SIMD_arch
@ Advanced_SIMD_arch
Definition: ARMBuildAttributes.h:45
llvm::ELF::EF_AMDGPU_MACH_R600_REDWOOD
@ EF_AMDGPU_MACH_R600_REDWOOD
Definition: ELF.h:696
llvm::ELF::ELFCLASS32
@ ELFCLASS32
Definition: ELF.h:328
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX900
@ EF_AMDGPU_MACH_AMDGCN_GFX900
Definition: ELF.h:725
llvm::ARMBuildAttrs::AllowDIVExt
@ AllowDIVExt
Definition: ARMBuildAttributes.h:233
llvm::Triple::x86
@ x86
Definition: Triple.h:83
llvm::ELF::STT_NOTYPE
@ STT_NOTYPE
Definition: ELF.h:1150
llvm::ELF::EF_MIPS_ARCH_32R6
@ EF_MIPS_ARCH_32R6
Definition: ELF.h:561
llvm::object::Binary::isLittleEndian
bool isLittleEndian() const
Definition: Binary.h:148
llvm::SubtargetFeatures::AddFeature
void AddFeature(StringRef String, bool Enable=true)
Adds Features.
Definition: SubtargetFeature.cpp:41
llvm::object::ELFObjectFileBase::getPltAddresses
std::vector< std::pair< Optional< DataRefImpl >, uint64_t > > getPltAddresses() const
Definition: ELFObjectFile.cpp:584
llvm::ARMBuildAttrs::ApplicationProfile
@ ApplicationProfile
Definition: ARMBuildAttributes.h:112
llvm::ARMBuildAttrs::CPU_arch_profile
@ CPU_arch_profile
Definition: ARMBuildAttributes.h:40
llvm::ELF::EF_MIPS_MACH_OCTEON
@ EF_MIPS_MACH_OCTEON
Definition: ELF.h:532
llvm::ELF::EM_RISCV
@ EM_RISCV
Definition: ELF.h:318
llvm::object::ELFObjectFileBase::getBuildAttributes
virtual Error getBuildAttributes(ELFAttributeParser &Attributes) const =0
llvm::ELF::EF_MIPS_ARCH_ASE_M16
@ EF_MIPS_ARCH_ASE_M16
Definition: ELF.h:547
ErrorHandling.h
llvm::ELF::STT_TLS
@ STT_TLS
Definition: ELF.h:1156
llvm::ELF::STT_FILE
@ STT_FILE
Definition: ELF.h:1154
llvm::object::ELFObjectFileBase::getEMachine
virtual uint16_t getEMachine() const =0
llvm::object::createError
static Error createError(const Twine &Err)
Definition: ELF.h:84
llvm::ARMBuildAttrs::v8_1_M_Main
@ v8_1_M_Main
Definition: ARMBuildAttributes.h:107
llvm::ELF::EF_MIPS_ARCH_5
@ EF_MIPS_ARCH_5
Definition: ELF.h:556
llvm::StringRef::consume_front
bool consume_front(StringRef Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
Definition: StringRef.h:682
llvm::ARMBuildAttrs::v7
@ v7
Definition: ARMBuildAttributes.h:99
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX803
@ EF_AMDGPU_MACH_AMDGCN_GFX803
Definition: ELF.h:723
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::ELF::EF_AMDGPU_MACH_R600_RS880
@ EF_AMDGPU_MACH_R600_RS880
Definition: ELF.h:686
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX908
@ EF_AMDGPU_MACH_AMDGCN_GFX908
Definition: ELF.h:729
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::object::NumElfSymbolTypes
constexpr int NumElfSymbolTypes
Definition: ELFObjectFile.h:44
llvm::Triple::x86_64
@ x86_64
Definition: Triple.h:84
llvm::ELF::STT_GNU_IFUNC
@ STT_GNU_IFUNC
Definition: ELF.h:1157
llvm::ARMBuildAttrs::AllowMVEInteger
@ AllowMVEInteger
Definition: ARMBuildAttributes.h:150
llvm::ELF::ELFDATA2LSB
@ ELFDATA2LSB
Definition: ELF.h:335
llvm::ELF::EF_AMDGPU_MACH_R600_CAYMAN
@ EF_AMDGPU_MACH_R600_CAYMAN
Definition: ELF.h:701
llvm::Optional< unsigned >
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::ARMAttributeParser
Definition: ARMAttributeParser.h:23
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX1035
@ EF_AMDGPU_MACH_AMDGCN_GFX1035
Definition: ELF.h:742
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:116
RISCVAttributes.h
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX1011
@ EF_AMDGPU_MACH_AMDGCN_GFX1011
Definition: ELF.h:733
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
createPtr
static Expected< std::unique_ptr< ELFObjectFile< ELFT > > > createPtr(MemoryBufferRef Object, bool InitContent)
Definition: ELFObjectFile.cpp:64
llvm::ELF::EF_RISCV_RVC
@ EF_RISCV_RVC
Definition: ELF.h:649
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX1012
@ EF_AMDGPU_MACH_AMDGCN_GFX1012
Definition: ELF.h:734
llvm::TargetRegistry::lookupTarget
static const Target * lookupTarget(const std::string &Triple, std::string &Error)
lookupTarget - Lookup a target based on a target triple.
Definition: TargetRegistry.cpp:62
llvm::consumeError
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:1035
llvm::MemoryBufferRef
Definition: MemoryBufferRef.h:22
llvm::ARMBuildAttrs::Not_Allowed
@ Not_Allowed
Definition: ARMBuildAttributes.h:120
llvm::EnumEntry
Definition: ScopedPrinter.h:24
llvm::ELF::EF_AMDGPU_MACH_R600_RV730
@ EF_AMDGPU_MACH_R600_RV730
Definition: ELF.h:690
llvm::Optional::hasValue
constexpr bool hasValue() const
Definition: Optional.h:288
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:78
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX601
@ EF_AMDGPU_MACH_AMDGCN_GFX601
Definition: ELF.h:714
llvm::object::SymbolicFile::symbol_end
virtual basic_symbol_iterator symbol_end() const =0
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX90C
@ EF_AMDGPU_MACH_AMDGCN_GFX90C
Definition: ELF.h:731
llvm::ARMBuildAttrs::AllowFPv4B
@ AllowFPv4B
Definition: ARMBuildAttributes.h:134
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX802
@ EF_AMDGPU_MACH_AMDGCN_GFX802
Definition: ELF.h:722
ARMAttributeParser.h
llvm::object::ELFObjectFileBase::getPlatformFlags
virtual unsigned getPlatformFlags() const =0
Returns platform-specific object flags, if any.
llvm::ARMBuildAttrs::v5TE
@ v5TE
Definition: ARMBuildAttributes.h:93
Error.h
SubtargetFeature.h
ELF.h
llvm::ELF::EF_AMDGPU_MACH_R600_RV710
@ EF_AMDGPU_MACH_R600_RV710
Definition: ELF.h:689
llvm::StringRef::take_front
LLVM_NODISCARD StringRef take_front(size_t N=1) const
Return a StringRef equal to 'this' but with only the first N elements remaining.
Definition: StringRef.h:620
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX700
@ EF_AMDGPU_MACH_AMDGCN_GFX700
Definition: ELF.h:715
llvm::ELF::EF_MIPS_ARCH_3
@ EF_MIPS_ARCH_3
Definition: ELF.h:554
llvm::object::BasicSymbolRef::getRawDataRefImpl
DataRefImpl getRawDataRefImpl() const
Definition: SymbolicFile.h:206
llvm::Triple::str
const std::string & str() const
Definition: Triple.h:376
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::ELF::EF_AMDGPU_MACH_R600_BARTS
@ EF_AMDGPU_MACH_R600_BARTS
Definition: ELF.h:699
llvm::ELF::EM_MIPS
@ EM_MIPS
Definition: ELF.h:142
llvm::SubtargetFeatures
Manages the enabling and disabling of subtarget specific features.
Definition: SubtargetFeature.h:183
llvm::ARMBuildAttrs::FP_arch
@ FP_arch
Definition: ARMBuildAttributes.h:43
llvm::ARMBuildAttrs::v6K
@ v6K
Definition: ARMBuildAttributes.h:98
llvm::ELF::EF_AMDGPU_MACH_R600_CYPRESS
@ EF_AMDGPU_MACH_R600_CYPRESS
Definition: ELF.h:694
llvm::ARMBuildAttrs::AllowMVEIntegerAndFloat
@ AllowMVEIntegerAndFloat
Definition: ARMBuildAttributes.h:151
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX1034
@ EF_AMDGPU_MACH_AMDGCN_GFX1034
Definition: ELF.h:743
llvm::ARMBuildAttrs::RealTimeProfile
@ RealTimeProfile
Definition: ARMBuildAttributes.h:113
llvm::ARMBuildAttrs::v8_M_Main
@ v8_M_Main
Definition: ARMBuildAttributes.h:106
llvm::StringRef::drop_until
LLVM_NODISCARD StringRef drop_until(function_ref< bool(char)> F) const
Return a StringRef equal to 'this', but with all characters not satisfying the given predicate droppe...
Definition: StringRef.h:676
llvm::object::ObjectFile::createELFObjectFile
static Expected< std::unique_ptr< ObjectFile > > createELFObjectFile(MemoryBufferRef Object, bool InitContent=true)
Definition: ELFObjectFile.cpp:72
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX810
@ EF_AMDGPU_MACH_AMDGCN_GFX810
Definition: ELF.h:724
llvm::object::ELFObjectFile::create
static Expected< ELFObjectFile< ELFT > > create(MemoryBufferRef Object, bool InitContent=true)
Definition: ELFObjectFile.h:1074
llvm::Triple::getArch
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:307
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX702
@ EF_AMDGPU_MACH_AMDGCN_GFX702
Definition: ELF.h:717
c
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int int c
Definition: README.txt:418
llvm::ELF::EF_MIPS_MACH
@ EF_MIPS_MACH
Definition: ELF.h:543
llvm::None
const NoneType None
Definition: None.h:23
llvm::ELF::ELFDATA2MSB
@ ELFDATA2MSB
Definition: ELF.h:336
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX1013
@ EF_AMDGPU_MACH_AMDGCN_GFX1013
Definition: ELF.h:747
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX801
@ EF_AMDGPU_MACH_AMDGCN_GFX801
Definition: ELF.h:721
llvm::ARMBuildAttrs::v6_M
@ v6_M
Definition: ARMBuildAttributes.h:100
llvm::StringRef::drop_while
LLVM_NODISCARD StringRef drop_while(function_ref< bool(char)> F) const
Return a StringRef equal to 'this', but with all characters satisfying the given predicate dropped fr...
Definition: StringRef.h:669
llvm::OutputFileType::Object
@ Object
llvm::object::SectionRef
This is a value type class that represents a single section in the list of sections in the object fil...
Definition: ObjectFile.h:80
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX906
@ EF_AMDGPU_MACH_AMDGCN_GFX906
Definition: ELF.h:728
llvm::object::ElfSymbolTypes
const llvm::EnumEntry< unsigned > ElfSymbolTypes[NumElfSymbolTypes]
Definition: ELFObjectFile.cpp:40
llvm::ELF::EF_MIPS_ARCH_64R2
@ EF_MIPS_ARCH_64R2
Definition: ELF.h:560
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX904
@ EF_AMDGPU_MACH_AMDGCN_GFX904
Definition: ELF.h:727
llvm::Triple::isThumb
bool isThumb() const
Tests whether the target is Thumb (little and big endian).
Definition: Triple.h:714
llvm::ARMBuildAttrs::THUMB_ISA_use
@ THUMB_ISA_use
Definition: ARMBuildAttributes.h:42
object
bar al al movzbl eax ret Missed when stored in a memory object
Definition: README.txt:1411
llvm::ELF::ELFCLASS64
@ ELFCLASS64
Definition: ELF.h:329
uint64_t
llvm::object::symbol_iterator
Definition: ObjectFile.h:207
ELF.h
llvm::object::ELFObjectFileBase::getFeatures
SubtargetFeatures getFeatures() const override
Definition: ELFObjectFile.cpp:346
llvm::ELF::EF_MIPS_MACH_NONE
@ EF_MIPS_MACH_NONE
Definition: ELF.h:524
llvm::ELF::EF_AMDGPU_MACH_R600_R630
@ EF_AMDGPU_MACH_R600_R630
Definition: ELF.h:685
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::DenseMap
Definition: DenseMap.h:714
llvm::ARMBuildAttrs::v6KZ
@ v6KZ
Definition: ARMBuildAttributes.h:96
RISCVAttributeParser.h
Attributes
AMDGPU Kernel Attributes
Definition: AMDGPULowerKernelAttributes.cpp:254
llvm::DenseMapBase< DenseMap< KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::find
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:150
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::ARMBuildAttrs::AllowNeon
@ AllowNeon
Definition: ARMBuildAttributes.h:144
llvm::ARMBuildAttrs::AllowFPv4A
@ AllowFPv4A
Definition: ARMBuildAttributes.h:133
llvm::ARMBuildAttrs::MicroControllerProfile
@ MicroControllerProfile
Definition: ARMBuildAttributes.h:114
ELFTypes.h
llvm::MemoryBufferRef::getBuffer
StringRef getBuffer() const
Definition: MemoryBufferRef.h:32
llvm::ARMBuildAttrs::AllowThumb32
@ AllowThumb32
Definition: ARMBuildAttributes.h:126
llvm::ELF::EF_AMDGPU_MACH_R600_R600
@ EF_AMDGPU_MACH_R600_R600
Definition: ELF.h:684
llvm::ELF::EM_AMDGPU
@ EM_AMDGPU
Definition: ELF.h:317
llvm::ELF::STT_FUNC
@ STT_FUNC
Definition: ELF.h:1152
llvm::ELF::EF_AMDGPU_MACH_R600_RV670
@ EF_AMDGPU_MACH_R600_RV670
Definition: ELF.h:687
llvm::object::ObjectFile::makeTriple
Triple makeTriple() const
Create a triple from the data in this object file.
Definition: ObjectFile.cpp:104
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX1010
@ EF_AMDGPU_MACH_AMDGCN_GFX1010
Definition: ELF.h:732
Triple.h
llvm::Sched::Source
@ Source
Definition: TargetLowering.h:99
llvm::ARMBuildAttrs::v6
@ v6
Definition: ARMBuildAttributes.h:95
MCInstrAnalysis.h
llvm::ARMBuildAttrs::v6T2
@ v6T2
Definition: ARMBuildAttributes.h:97
llvm::ELF::EF_MIPS_MICROMIPS
@ EF_MIPS_MICROMIPS
Definition: ELF.h:546
llvm::countTrailingZeros
unsigned countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1.
Definition: MathExtras.h:156
llvm::Triple::aarch64_be
@ aarch64_be
Definition: Triple.h:53
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::object::ObjectFile
This class is the base class for all object file types.
Definition: ObjectFile.h:228
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::ARMBuildAttrs::v4
@ v4
Definition: ARMBuildAttributes.h:90
llvm::ARMBuildAttrs::DIV_use
@ DIV_use
Definition: ARMBuildAttributes.h:70
llvm::ELF::STT_COMMON
@ STT_COMMON
Definition: ELF.h:1155
llvm::RISCVAttrs::ARCH
@ ARCH
Definition: RISCVAttributes.h:30
llvm::ELF::EF_MIPS_ARCH_64R6
@ EF_MIPS_ARCH_64R6
Definition: ELF.h:562
LLVM_FALLTHROUGH
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
Definition: Compiler.h:273
llvm::DenseMapBase< DenseMap< KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::insert
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Definition: DenseMap.h:207
llvm::ARMBuildAttrs::v8_A
@ v8_A
Definition: ARMBuildAttributes.h:103
llvm::ELF::EF_AMDGPU_MACH_R600_JUNIPER
@ EF_AMDGPU_MACH_R600_JUNIPER
Definition: ELF.h:695
ELFObjectFile.h
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX90A
@ EF_AMDGPU_MACH_AMDGCN_GFX90A
Definition: ELF.h:744
llvm::ARMBuildAttrs::DisallowDIV
@ DisallowDIV
Definition: ARMBuildAttributes.h:232
llvm::ARMBuildAttrs::MVE_arch
@ MVE_arch
Definition: ARMBuildAttributes.h:72
llvm::ELF::EF_MIPS_ARCH_1
@ EF_MIPS_ARCH_1
Definition: ELF.h:552
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::ELF::STT_OBJECT
@ STT_OBJECT
Definition: ELF.h:1151
llvm::ARMBuildAttrs::v8_R
@ v8_R
Definition: ARMBuildAttributes.h:104
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX805
@ EF_AMDGPU_MACH_AMDGCN_GFX805
Definition: ELF.h:741
llvm::Triple::getSubArch
SubArchType getSubArch() const
getSubArch - get the parsed subarchitecture type for this triple.
Definition: Triple.h:310
llvm::DenseMapBase< DenseMap< KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::end
iterator end()
Definition: DenseMap.h:83
llvm::object::ELFObjectFileBase::setARMSubArch
void setARMSubArch(Triple &TheTriple) const override
Definition: ELFObjectFile.cpp:492
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::ARMBuildAttrs::v5T
@ v5T
Definition: ARMBuildAttributes.h:92
llvm::ARMBuildAttrs::CPU_arch
@ CPU_arch
Definition: ARMBuildAttributes.h:39
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX902
@ EF_AMDGPU_MACH_AMDGCN_GFX902
Definition: ELF.h:726
llvm::ARMBuildAttrs::v8_M_Base
@ v8_M_Base
Definition: ARMBuildAttributes.h:105
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX1031
@ EF_AMDGPU_MACH_AMDGCN_GFX1031
Definition: ELF.h:736
llvm::ELF::EF_MIPS_ARCH_2
@ EF_MIPS_ARCH_2
Definition: ELF.h:553
ARMBuildAttributes.h
llvm::ELF::EF_AMDGPU_MACH
@ EF_AMDGPU_MACH
Definition: ELF.h:676
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX602
@ EF_AMDGPU_MACH_AMDGCN_GFX602
Definition: ELF.h:739
llvm::Expected::takeError
Error takeError()
Take ownership of the stored error.
Definition: Error.h:589
llvm::ELF::EF_AMDGPU_MACH_R600_TURKS
@ EF_AMDGPU_MACH_R600_TURKS
Definition: ELF.h:702
llvm::Triple::setArchName
void setArchName(StringRef Str)
setArchName - Set the architecture (first) component of the triple by name.
Definition: Triple.cpp:1236
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX1033
@ EF_AMDGPU_MACH_AMDGCN_GFX1033
Definition: ELF.h:738
llvm::ARMBuildAttrs::v5TEJ
@ v5TEJ
Definition: ARMBuildAttributes.h:94
llvm::ELF::EF_AMDGPU_MACH_R600_CEDAR
@ EF_AMDGPU_MACH_R600_CEDAR
Definition: ELF.h:693
llvm::ARMBuildAttrs::v4T
@ v4T
Definition: ARMBuildAttributes.h:91
llvm::object::ObjectFile::sections
section_iterator_range sections() const
Definition: ObjectFile.h:322
llvm::ELF::STT_SECTION
@ STT_SECTION
Definition: ELF.h:1153
llvm::ARMBuildAttrs::AllowFPv3A
@ AllowFPv3A
Definition: ARMBuildAttributes.h:131
llvm::ARMBuildAttrs::AllowFPv2
@ AllowFPv2
Definition: ARMBuildAttributes.h:130
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX909
@ EF_AMDGPU_MACH_AMDGCN_GFX909
Definition: ELF.h:730
llvm::object::getElfArchType
std::pair< unsigned char, unsigned char > getElfArchType(StringRef Object)
Definition: ELF.h:76
llvm::ELF::EF_AMDGPU_MACH_R600_RV770
@ EF_AMDGPU_MACH_R600_RV770
Definition: ELF.h:691
llvm::ELF::EF_MIPS_ARCH_4
@ EF_MIPS_ARCH_4
Definition: ELF.h:555
llvm::ELF::EF_MIPS_ARCH_64
@ EF_MIPS_ARCH_64
Definition: ELF.h:558
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX704
@ EF_AMDGPU_MACH_AMDGCN_GFX704
Definition: ELF.h:719
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_GFX701
@ EF_AMDGPU_MACH_AMDGCN_GFX701
Definition: ELF.h:716
llvm::Triple::NoSubArch
@ NoSubArch
Definition: Triple.h:107
llvm::ARMBuildAttrs::v6S_M
@ v6S_M
Definition: ARMBuildAttributes.h:101
llvm::object::ELFObjectFileBase::tryGetCPUName
Optional< StringRef > tryGetCPUName() const override
Definition: ELFObjectFile.cpp:359
Endian.h
TargetRegistry.h
llvm::ELF::EF_MIPS_ARCH_32R2
@ EF_MIPS_ARCH_32R2
Definition: ELF.h:559
llvm::ARMBuildAttrs::AllowFPv3B
@ AllowFPv3B
Definition: ARMBuildAttributes.h:132
llvm::object::ELFObjectFileBase::ELFObjectFileBase
ELFObjectFileBase(unsigned int Type, MemoryBufferRef Source)
Definition: ELFObjectFile.cpp:59
llvm::Triple::aarch64
@ aarch64
Definition: Triple.h:52
llvm::ARMBuildAttrs::AllowNeon2
@ AllowNeon2
Definition: ARMBuildAttributes.h:145
llvm::Optional::getValue
constexpr const T & getValue() const LLVM_LVALUE_FUNCTION
Definition: Optional.h:282