LLVM: include/llvm/Object/ELFTypes.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_OBJECT_ELFTYPES_H
10#define LLVM_OBJECT_ELFTYPES_H
11
22#include
23#include
24#include
25#include <type_traits>
26
27namespace llvm {
29
35template <class ELFT, bool isRela> struct Elf_Rel_Impl;
49
50template <endianness E, bool Is64> struct ELFType {
51private:
52 template
54
55public:
58
59 using uint = std::conditional_t<Is64, uint64_t, uint32_t>;
88
89 using Half = packed<uint16_t>;
90 using Word = packed<uint32_t>;
91 using Sword = packed<int32_t>;
92 using Xword = packed<uint64_t>;
93 using Sxword = packed<int64_t>;
96};
97
102
103
104
105
106
107#define LLVM_ELF_IMPORT_TYPES_ELFT(ELFT) \
108 using Elf_Addr = typename ELFT::Addr; \
109 using Elf_Off = typename ELFT::Off; \
110 using Elf_Half = typename ELFT::Half; \
111 using Elf_Word = typename ELFT::Word; \
112 using Elf_Sword = typename ELFT::Sword; \
113 using Elf_Xword = typename ELFT::Xword; \
114 using Elf_Sxword = typename ELFT::Sxword; \
115 using uintX_t = typename ELFT::uint; \
116 using Elf_Ehdr = typename ELFT::Ehdr; \
117 using Elf_Shdr = typename ELFT::Shdr; \
118 using Elf_Sym = typename ELFT::Sym; \
119 using Elf_Dyn = typename ELFT::Dyn; \
120 using Elf_Phdr = typename ELFT::Phdr; \
121 using Elf_Rel = typename ELFT::Rel; \
122 using Elf_Rela = typename ELFT::Rela; \
123 using Elf_Crel = typename ELFT::Crel; \
124 using Elf_Relr = typename ELFT::Relr; \
125 using Elf_Verdef = typename ELFT::Verdef; \
126 using Elf_Verdaux = typename ELFT::Verdaux; \
127 using Elf_Verneed = typename ELFT::Verneed; \
128 using Elf_Vernaux = typename ELFT::Vernaux; \
129 using Elf_Versym = typename ELFT::Versym; \
130 using Elf_Hash = typename ELFT::Hash; \
131 using Elf_GnuHash = typename ELFT::GnuHash; \
132 using Elf_Chdr = typename ELFT::Chdr; \
133 using Elf_Nhdr = typename ELFT::Nhdr; \
134 using Elf_Note = typename ELFT::Note; \
135 using Elf_Note_Iterator = typename ELFT::NoteIterator; \
136 using Elf_CGProfile = typename ELFT::CGProfile; \
137 using Elf_Dyn_Range = typename ELFT::DynRange; \
138 using Elf_Shdr_Range = typename ELFT::ShdrRange; \
139 using Elf_Sym_Range = typename ELFT::SymRange; \
140 using Elf_Rel_Range = typename ELFT::RelRange; \
141 using Elf_Rela_Range = typename ELFT::RelaRange; \
142 using Elf_Relr_Range = typename ELFT::RelrRange; \
143 using Elf_Phdr_Range = typename ELFT::PhdrRange;
144
145#define LLVM_ELF_COMMA ,
146#define LLVM_ELF_IMPORT_TYPES(E, W) \
147 LLVM_ELF_IMPORT_TYPES_ELFT(ELFType<E LLVM_ELF_COMMA W>)
148
149
151
152template
166
181
182template
186
187
189 if (sh_entsize == 0)
190 return 0;
191 return sh_size / sh_entsize;
192 }
193};
194
196
197template
207
218
219template
225
226
227
228 unsigned char getBinding() const { return st_info >> 4; }
229 unsigned char getType() const { return st_info & 0x0f; }
233
235 st_info = (b << 4) + (t & 0x0f);
236 }
237
238
239
240
241
242
243 unsigned char getVisibility() const { return st_other & 0x3; }
245 assert(v < 4 && "Invalid value for visibility");
246 st_other = (st_other & ~0x3) | v;
247 }
248
250
254
256
260
264
270
272
276
278};
279
280template
285 "st_name (0x%" PRIx32
286 ") is past the end of the string table"
287 " of size 0x%zx",
290}
291
292
293
294template
299
300
301
302template
318
319
320
321template
327
328
329
330template
339
340
341
342template
351
352
353
355
365
366template
375
376
377template
381 using intX_t = std::conditional_t<ELFT::Is64Bits, int64_t, int32_t>;
382 using uintX_t = std::conditional_t<ELFT::Is64Bits, uint64_t, uint32_t>;
386};
387
388template
423
424template
432
440
444 return t;
445
446
447
448 return (t << 32) | ((t >> 8) & 0xff000000) | ((t >> 24) & 0x00ff0000) |
449 ((t >> 40) & 0x0000ff00) | ((t >> 56) & 0x000000ff);
450 }
451
453 if (IsMips64EL)
454 r_info = (R >> 32) | ((R & 0xff000000) << 8) | ((R & 0x00ff0000) << 24) |
455 ((R & 0x0000ff00) << 40) | ((R & 0x000000ff) << 56);
456 else
458 }
459
460
461
477};
478
479template
487
488
490 using uint = std::conditional_t<Is64, uint64_t, uint32_t>;
496 std::conditional_t<Is64, int64_t, int32_t> r_addend;
497
498
505};
506
507template
533
534template
546
559
560
561template
576
577
578template
585
590
593 reinterpret_cast<const Elf_Word *>(filter().end()), nbuckets);
594 }
595
600};
601
602
603
604template
611
620
621
622template
628
629
630
631
632
637};
638
639
640
641
642
643template
646
648
650
651public:
653
654
656 if (!Nhdr.n_namesz)
658 return StringRef(reinterpret_cast<const char *>(&Nhdr) + sizeof(Nhdr),
659 Nhdr.n_namesz - 1);
660 }
661
662
664 if (!Nhdr.n_descsz)
667 reinterpret_cast<const uint8_t *>(&Nhdr) +
669 Nhdr.n_descsz);
670 }
671
672
675 return StringRef(reinterpret_cast<const char *>(Desc.data()), Desc.size());
676 }
677
678
679 Elf_Word getType() const { return Nhdr.n_type; }
680};
681
682template class Elf_Note_Iterator_Impl {
683public:
689
690private:
691
693 size_t RemainingSize = 0u;
694 size_t Align = 0;
695 Error *Err = nullptr;
696
697 template friend class ELFFile;
698
699
700 void stopWithOverflowError() {
701 Nhdr = nullptr;
704 }
705
706
707
708
709
710
711 void advanceNhdr(const uint8_t *NhdrPos, size_t NoteSize) {
712 RemainingSize -= NoteSize;
713 if (RemainingSize == 0u) {
714
715
717 Nhdr = nullptr;
718 } else if (sizeof(*Nhdr) > RemainingSize)
719 stopWithOverflowError();
720 else {
721 Nhdr = reinterpret_cast<const Elf_Nhdr_Impl *>(NhdrPos + NoteSize);
723 stopWithOverflowError();
724 else
726 }
727 }
728
729 Elf_Note_Iterator_Impl() = default;
730 explicit Elf_Note_Iterator_Impl(Error &Err) : Err(&Err) {}
731 Elf_Note_Iterator_Impl(const uint8_t *Start, size_t Size, size_t Align,
732 Error &Err)
735 assert(Start && "ELF note iterator starting at NULL");
736 advanceNhdr(Start, 0u);
737 }
738
739public:
741 assert(Nhdr && "incremented ELF note end iterator");
742 const uint8_t *NhdrPos = reinterpret_cast<const uint8_t *>(Nhdr);
743 size_t NoteSize = Nhdr->getSize(Align);
744 advanceNhdr(NhdrPos, NoteSize);
745 return *this;
746 }
748 if (!Nhdr && Other.Err)
749 (void)(bool)(*Other.Err);
750 if (.Nhdr && Err)
751 (void)(bool)(*Err);
752 return Nhdr == Other.Nhdr;
753 }
755 return !(*this == Other);
756 }
758 assert(Nhdr && "dereferenced ELF note end iterator");
760 }
761};
762
767
768
769template
771
779
788
789
807
808
823
824
826
827
828
838
840
842
843
854
855
856
859 static_cast<bool>(Val & (1 << 0)), static_cast<bool>(Val & (1 << 1)),
860 static_cast<bool>(Val & (1 << 2)), static_cast<bool>(Val & (1 << 3)),
861 static_cast<bool>(Val & (1 << 4)), static_cast<bool>(Val & (1 << 5)),
862 static_cast<bool>(Val & (1 << 6)), static_cast<bool>(Val & (1 << 7))};
863 if (Feat.encode() != Val)
865 std::error_code(), "invalid encoding for BBAddrMap::Features: 0x%x",
866 Val);
867 return Feat;
868 }
869
878 };
879
880
884
885 bool HasTailCall : 1;
887 bool CanFallThrough : 1;
889
890
897
898
906
907
909 Metadata MD{static_cast<bool>(V & 1),
910 static_cast<bool>(V & (1 << 1)),
911 static_cast<bool>(V & (1 << 2)),
912 static_cast<bool>(V & (1 << 3)),
913 static_cast<bool>(V & (1 << 4))};
914 if (MD.encode() != V)
916 std::error_code(), "invalid encoding for BBEntry::Metadata: 0x%x",
917 V);
918 return MD;
919 }
920 };
921
927
930
935
937
943
949 };
950
951
952
956
957
961 Other.BBEntries.begin());
962 }
963 };
964
965
966
968
969
970
973 return BBRanges.front().BaseAddress;
974 }
975
976
978 size_t NumBBEntries = 0;
979 for (const auto &BBR : BBRanges)
980 NumBBEntries += BBR.BBEntries.size();
981 return NumBBEntries;
982 }
983
984
985
986 std::optional<size_t>
988 for (size_t I = 0; I < BBRanges.size(); ++I)
989 if (BBRanges[I].BaseAddress == BaseAddress)
990 return I;
991 return {};
992 }
993
994
996 return BBRanges.front().BBEntries;
997 }
998
1000
1001
1005};
1006
1007
1009
1010
1012
1013
1015
1017
1019
1020
1022
1027 };
1028
1029
1031
1032
1034
1036
1041 };
1042
1045
1046
1048
1051 std::tie(Other.FuncEntryCount, Other.BBEntries, Other.FeatEnable);
1052 }
1053};
1054
1055}
1056}
1057
1058#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static bool isMips64EL(const ELFYAML::Object &Obj)
#define LLVM_ELF_IMPORT_TYPES(E, W)
Definition ELFTypes.h:146
#define LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
Definition ELFTypes.h:107
Merge contiguous icmps into a memcmp
static SymbolRef::Type getType(const Symbol *Sym)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
constexpr size_t size() const
size - Get the string size.
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
An ELF note.
Definition ELFTypes.h:644
StringRef getDescAsStringRef(size_t Align) const
Get the note's descriptor as StringRef.
Definition ELFTypes.h:673
friend class Elf_Note_Iterator_Impl
Definition ELFTypes.h:649
Elf_Word getType() const
Get the note's type.
Definition ELFTypes.h:679
Elf_Note_Impl(const Elf_Nhdr_Impl< ELFT > &Nhdr)
Definition ELFTypes.h:652
StringRef getName() const
Get the note's name, excluding the terminating null byte.
Definition ELFTypes.h:655
ArrayRef< uint8_t > getDesc(size_t Align) const
Get the note's descriptor.
Definition ELFTypes.h:663
Definition ELFTypes.h:682
bool operator!=(Elf_Note_Iterator_Impl Other) const
Definition ELFTypes.h:754
std::forward_iterator_tag iterator_category
Definition ELFTypes.h:684
Elf_Note_Impl< ELFType< E, Is64 > > value_type
Definition ELFTypes.h:685
value_type * pointer
Definition ELFTypes.h:687
std::ptrdiff_t difference_type
Definition ELFTypes.h:686
Elf_Note_Impl< ELFT > operator*() const
Definition ELFTypes.h:757
Elf_Note_Iterator_Impl & operator++()
Definition ELFTypes.h:740
friend class ELFFile
Definition ELFTypes.h:697
value_type & reference
Definition ELFTypes.h:688
bool operator==(Elf_Note_Iterator_Impl Other) const
Definition ELFTypes.h:747
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
static const char ElfMagic[]
ELFType< llvm::endianness::big, true > ELF64BE
Definition ELFTypes.h:101
ELFType< llvm::endianness::little, false > ELF32LE
Definition ELFTypes.h:98
ELFType< llvm::endianness::little, true > ELF64LE
Definition ELFTypes.h:100
ELFType< llvm::endianness::big, false > ELF32BE
Definition ELFTypes.h:99
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
constexpr T alignToPowerOf2(U Value, V Align)
Will overflow only if result is not representable in T.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
void consumeError(Error Err)
Consume a Error without doing anything.
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition ELFTypes.h:882
static Expected< Metadata > decode(uint32_t V)
Definition ELFTypes.h:908
bool HasTailCall
Definition ELFTypes.h:885
uint32_t encode() const
Definition ELFTypes.h:899
bool CanFallThrough
Definition ELFTypes.h:887
bool HasIndirectBranch
Definition ELFTypes.h:888
bool HasReturn
Definition ELFTypes.h:883
bool IsEHPad
Definition ELFTypes.h:886
bool operator==(const Metadata &Other) const
Definition ELFTypes.h:891
BBEntry(uint32_t ID, uint32_t Offset, uint32_t Size, Metadata MD, SmallVector< uint32_t, 1 > CallsiteEndOffsets, uint64_t Hash)
Definition ELFTypes.h:931
uint32_t ID
Definition ELFTypes.h:922
bool hasReturn() const
Definition ELFTypes.h:944
Metadata MD
Definition ELFTypes.h:925
SmallVector< uint32_t, 1 > CallsiteEndOffsets
Definition ELFTypes.h:928
bool canFallThrough() const
Definition ELFTypes.h:947
bool isEHPad() const
Definition ELFTypes.h:946
uint32_t Offset
Definition ELFTypes.h:923
bool hasIndirectBranch() const
Definition ELFTypes.h:948
uint32_t Size
Definition ELFTypes.h:924
bool operator==(const BBEntry &Other) const
Definition ELFTypes.h:938
uint64_t Hash
Definition ELFTypes.h:929
UniqueBBID getID() const
Definition ELFTypes.h:936
bool hasTailCall() const
Definition ELFTypes.h:945
Definition ELFTypes.h:953
uint64_t BaseAddress
Definition ELFTypes.h:954
bool operator==(const BBRangeEntry &Other) const
Definition ELFTypes.h:958
std::vector< BBEntry > BBEntries
Definition ELFTypes.h:955
Definition ELFTypes.h:829
bool BBFreq
Definition ELFTypes.h:831
bool operator==(const Features &Other) const
Definition ELFTypes.h:870
bool PostLinkCfg
Definition ELFTypes.h:837
bool MultiBBRange
Definition ELFTypes.h:833
bool OmitBBEntries
Definition ELFTypes.h:834
bool BrProb
Definition ELFTypes.h:832
bool CallsiteEndOffsets
Definition ELFTypes.h:835
bool BBHash
Definition ELFTypes.h:836
bool hasPGOAnalysisBBData() const
Definition ELFTypes.h:841
bool FuncEntryCount
Definition ELFTypes.h:830
static Expected< Features > decode(uint16_t Val)
Definition ELFTypes.h:857
bool hasPGOAnalysis() const
Definition ELFTypes.h:839
uint16_t encode() const
Definition ELFTypes.h:844
Definition ELFTypes.h:825
const std::vector< BBRangeEntry > & getBBRanges() const
Definition ELFTypes.h:999
std::vector< BBRangeEntry > BBRanges
Definition ELFTypes.h:967
size_t getNumBBEntries() const
Definition ELFTypes.h:977
bool operator==(const BBAddrMap &Other) const
Definition ELFTypes.h:1002
const std::vector< BBEntry > & getBBEntries() const
Definition ELFTypes.h:995
uint64_t getFunctionAddress() const
Definition ELFTypes.h:971
std::optional< size_t > getBBRangeIndexForBaseAddress(uint64_t BaseAddress) const
Definition ELFTypes.h:987
Elf_Verdaux_Impl< ELFType< E, Is64 > > Verdaux
Definition ELFTypes.h:70
std::conditional_t< Is64, uint64_t, uint32_t > uint
Definition ELFTypes.h:59
Elf_Note_Impl< ELFType< E, Is64 > > Note
Definition ELFTypes.h:78
packed< int64_t > Sxword
Definition ELFTypes.h:93
Elf_Ehdr_Impl< ELFType< E, Is64 > > Ehdr
Definition ELFTypes.h:60
ArrayRef< Phdr > PhdrRange
Definition ELFTypes.h:87
packed< uint64_t > Xword
Definition ELFTypes.h:92
static const endianness Endianness
Definition ELFTypes.h:56
Elf_Dyn_Impl< ELFType< E, Is64 > > Dyn
Definition ELFTypes.h:63
Elf_Rel_Impl< ELFType< E, Is64 >, false > Rel
Definition ELFTypes.h:65
Elf_Versym_Impl< ELFType< E, Is64 > > Versym
Definition ELFTypes.h:73
Elf_Vernaux_Impl< ELFType< E, Is64 > > Vernaux
Definition ELFTypes.h:72
packed< uint16_t > Half
Definition ELFTypes.h:89
Elf_GnuHash_Impl< ELFType< E, Is64 > > GnuHash
Definition ELFTypes.h:75
packed< uint > Addr
Definition ELFTypes.h:94
Elf_Rel_Impl< ELFType< E, Is64 >, true > Rela
Definition ELFTypes.h:66
Elf_Note_Iterator_Impl< ELFType< E, Is64 > > NoteIterator
Definition ELFTypes.h:79
static const bool Is64Bits
Definition ELFTypes.h:57
packed< int32_t > Sword
Definition ELFTypes.h:91
ArrayRef< Shdr > ShdrRange
Definition ELFTypes.h:82
packed< uint > Relr
Definition ELFTypes.h:68
packed< uint > Off
Definition ELFTypes.h:95
Elf_CGProfile_Impl< ELFType< E, Is64 > > CGProfile
Definition ELFTypes.h:80
Elf_Nhdr_Impl< ELFType< E, Is64 > > Nhdr
Definition ELFTypes.h:77
Elf_Shdr_Impl< ELFType< E, Is64 > > Shdr
Definition ELFTypes.h:61
ArrayRef< Rel > RelRange
Definition ELFTypes.h:84
Elf_Crel_Impl< Is64 > Crel
Definition ELFTypes.h:67
ArrayRef< Sym > SymRange
Definition ELFTypes.h:83
ArrayRef< Dyn > DynRange
Definition ELFTypes.h:81
Elf_Verneed_Impl< ELFType< E, Is64 > > Verneed
Definition ELFTypes.h:71
Elf_Chdr_Impl< ELFType< E, Is64 > > Chdr
Definition ELFTypes.h:76
ArrayRef< Rela > RelaRange
Definition ELFTypes.h:85
Elf_Hash_Impl< ELFType< E, Is64 > > Hash
Definition ELFTypes.h:74
Elf_Sym_Impl< ELFType< E, Is64 > > Sym
Definition ELFTypes.h:62
ArrayRef< Relr > RelrRange
Definition ELFTypes.h:86
Elf_Verdef_Impl< ELFType< E, Is64 > > Verdef
Definition ELFTypes.h:69
Elf_Phdr_Impl< ELFType< E, Is64 > > Phdr
Definition ELFTypes.h:64
packed< uint32_t > Word
Definition ELFTypes.h:90
Definition ELFTypes.h:763
Elf_Xword cgp_weight
Definition ELFTypes.h:765
Elf_Word ch_type
Definition ELFTypes.h:607
Elf_Word ch_addralign
Definition ELFTypes.h:609
Elf_Word ch_size
Definition ELFTypes.h:608
Elf_Xword ch_size
Definition ELFTypes.h:617
Elf_Word ch_reserved
Definition ELFTypes.h:616
Elf_Word ch_type
Definition ELFTypes.h:615
Elf_Xword ch_addralign
Definition ELFTypes.h:618
Definition ELFTypes.h:489
uint32_t getType(bool) const
Definition ELFTypes.h:499
uint32_t r_symidx
Definition ELFTypes.h:494
uint r_offset
Definition ELFTypes.h:493
uint32_t r_type
Definition ELFTypes.h:495
std::conditional_t< Is64, uint64_t, uint32_t > uint
Definition ELFTypes.h:490
uint32_t getSymbol(bool) const
Definition ELFTypes.h:500
static const bool IsCrel
Definition ELFTypes.h:492
static const bool HasAddend
Definition ELFTypes.h:491
void setSymbolAndType(uint32_t s, unsigned char t, bool)
Definition ELFTypes.h:501
std::conditional_t< Is64, int64_t, int32_t > r_addend
Definition ELFTypes.h:496
Elf_Word d_val
Definition ELFTypes.h:361
Elf_Sword d_tag
Definition ELFTypes.h:359
Elf_Addr d_ptr
Definition ELFTypes.h:362
Elf_Xword d_val
Definition ELFTypes.h:371
Elf_Addr d_ptr
Definition ELFTypes.h:372
Elf_Sxword d_tag
Definition ELFTypes.h:369
Elf_Dyn_Base: This structure matches the form of entries in the dynamic table section (....
Definition ELFTypes.h:354
Elf_Dyn_Impl: This inherits from Elf_Dyn_Base, adding getters.
Definition ELFTypes.h:378
uintX_t getVal() const
Definition ELFTypes.h:384
std::conditional_t< ELFType< E, Is64 >::Is64Bits, int64_t, int32_t > intX_t
Definition ELFTypes.h:381
std::conditional_t< ELFType< E, Is64 >::Is64Bits, uint64_t, uint32_t > uintX_t
Definition ELFTypes.h:382
uintX_t getPtr() const
Definition ELFTypes.h:385
intX_t getTag() const
Definition ELFTypes.h:383
Definition ELFTypes.h:508
Elf_Off e_shoff
Definition ELFTypes.h:516
unsigned char getFileClass() const
Definition ELFTypes.h:530
Elf_Half e_phentsize
Definition ELFTypes.h:519
Elf_Half e_shentsize
Definition ELFTypes.h:521
Elf_Half e_shnum
Definition ELFTypes.h:522
unsigned char e_ident[ELF::EI_NIDENT]
Definition ELFTypes.h:510
Elf_Word e_version
Definition ELFTypes.h:513
Elf_Half e_machine
Definition ELFTypes.h:512
unsigned char getDataEncoding() const
Definition ELFTypes.h:531
Elf_Half e_phnum
Definition ELFTypes.h:520
Elf_Off e_phoff
Definition ELFTypes.h:515
Elf_Addr e_entry
Definition ELFTypes.h:514
Elf_Half e_shstrndx
Definition ELFTypes.h:523
Elf_Half e_type
Definition ELFTypes.h:511
Elf_Half e_ehsize
Definition ELFTypes.h:518
bool checkMagic() const
Definition ELFTypes.h:526
Elf_Word e_flags
Definition ELFTypes.h:517
Definition ELFTypes.h:579
Elf_Word symndx
Definition ELFTypes.h:582
ArrayRef< Elf_Word > values(unsigned DynamicSymCount) const
Definition ELFTypes.h:596
Elf_Word shift2
Definition ELFTypes.h:584
Elf_Word maskwords
Definition ELFTypes.h:583
Elf_Word nbuckets
Definition ELFTypes.h:581
ArrayRef< Elf_Word > buckets() const
Definition ELFTypes.h:591
ArrayRef< Elf_Off > filter() const
Definition ELFTypes.h:586
Definition ELFTypes.h:562
Elf_Word nbucket
Definition ELFTypes.h:564
ArrayRef< Elf_Word > chains() const
Definition ELFTypes.h:571
Elf_Word nchain
Definition ELFTypes.h:565
ArrayRef< Elf_Word > buckets() const
Definition ELFTypes.h:567
Definition ELFTypes.h:809
Elf_Word flags2
Definition ELFTypes.h:821
uint8_t fp_abi
Definition ELFTypes.h:817
Elf_Word isa_ext
Definition ELFTypes.h:818
Elf_Half version
Definition ELFTypes.h:811
uint8_t cpr2_size
Definition ELFTypes.h:816
Elf_Word flags1
Definition ELFTypes.h:820
uint8_t gpr_size
Definition ELFTypes.h:814
uint8_t isa_rev
Definition ELFTypes.h:813
uint8_t cpr1_size
Definition ELFTypes.h:815
uint8_t isa_level
Definition ELFTypes.h:812
Elf_Word ases
Definition ELFTypes.h:819
Definition ELFTypes.h:790
Elf_Word info
Definition ELFTypes.h:796
Elf_Half section
Definition ELFTypes.h:794
uint8_t size
Definition ELFTypes.h:793
const Elf_Mips_RegInfo< ELFT > & getRegInfo() const
Definition ELFTypes.h:803
Elf_Mips_RegInfo< ELFT > & getRegInfo()
Definition ELFTypes.h:798
uint8_t kind
Definition ELFTypes.h:792
Elf_Word ri_cprmask[4]
Definition ELFTypes.h:776
Elf_Addr ri_gp_value
Definition ELFTypes.h:777
Elf_Word ri_gprmask
Definition ELFTypes.h:775
Elf_Word ri_pad
Definition ELFTypes.h:784
Elf_Word ri_gprmask
Definition ELFTypes.h:783
Elf_Addr ri_gp_value
Definition ELFTypes.h:786
Elf_Word ri_cprmask[4]
Definition ELFTypes.h:785
Definition ELFTypes.h:770
Note header.
Definition ELFTypes.h:623
size_t getSize(size_t Align) const
Definition ELFTypes.h:633
Elf_Word n_descsz
Definition ELFTypes.h:626
Elf_Word n_namesz
Definition ELFTypes.h:625
Elf_Word n_type
Definition ELFTypes.h:627
Elf_Off p_offset
Definition ELFTypes.h:538
Elf_Word p_align
Definition ELFTypes.h:544
Elf_Word p_filesz
Definition ELFTypes.h:541
Elf_Word p_memsz
Definition ELFTypes.h:542
Elf_Word p_type
Definition ELFTypes.h:537
Elf_Addr p_paddr
Definition ELFTypes.h:540
Elf_Addr p_vaddr
Definition ELFTypes.h:539
Elf_Word p_flags
Definition ELFTypes.h:543
Elf_Addr p_paddr
Definition ELFTypes.h:554
Elf_Word p_flags
Definition ELFTypes.h:551
Elf_Off p_offset
Definition ELFTypes.h:552
Elf_Xword p_filesz
Definition ELFTypes.h:555
Elf_Word p_type
Definition ELFTypes.h:550
Elf_Xword p_align
Definition ELFTypes.h:557
Elf_Xword p_memsz
Definition ELFTypes.h:556
Elf_Addr p_vaddr
Definition ELFTypes.h:553
unsigned char getType(bool isMips64EL) const
Definition ELFTypes.h:410
static const bool HasAddend
Definition ELFTypes.h:391
void setType(unsigned char t, bool IsMips64EL)
Definition ELFTypes.h:416
void setRInfo(uint32_t R, bool IsMips64EL)
Definition ELFTypes.h:400
static const bool IsCrel
Definition ELFTypes.h:392
uint32_t getSymbol(bool isMips64EL) const
Definition ELFTypes.h:407
void setSymbolAndType(uint32_t s, unsigned char t, bool IsMips64EL)
Definition ELFTypes.h:419
void setSymbol(uint32_t s, bool IsMips64EL)
Definition ELFTypes.h:413
Elf_Word r_info
Definition ELFTypes.h:394
Elf_Addr r_offset
Definition ELFTypes.h:393
uint32_t getRInfo(bool isMips64EL) const
Definition ELFTypes.h:396
static const bool IsCrel
Definition ELFTypes.h:429
static const bool HasAddend
Definition ELFTypes.h:428
Elf_Sword r_addend
Definition ELFTypes.h:430
Elf_Xword r_info
Definition ELFTypes.h:439
Elf_Addr r_offset
Definition ELFTypes.h:438
void setType(uint32_t t, bool IsMips64EL)
Definition ELFTypes.h:471
static const bool HasAddend
Definition ELFTypes.h:436
static const bool IsCrel
Definition ELFTypes.h:437
void setSymbolAndType(uint32_t s, uint32_t t, bool IsMips64EL)
Definition ELFTypes.h:474
void setSymbol(uint32_t s, bool IsMips64EL)
Definition ELFTypes.h:468
uint32_t getSymbol(bool isMips64EL) const
Definition ELFTypes.h:462
void setRInfo(uint64_t R, bool IsMips64EL)
Definition ELFTypes.h:452
uint32_t getType(bool isMips64EL) const
Definition ELFTypes.h:465
uint64_t getRInfo(bool isMips64EL) const
Definition ELFTypes.h:441
static const bool HasAddend
Definition ELFTypes.h:483
static const bool IsCrel
Definition ELFTypes.h:484
Elf_Sxword r_addend
Definition ELFTypes.h:485
Elf_Word sh_info
Definition ELFTypes.h:162
Elf_Word sh_type
Definition ELFTypes.h:156
Elf_Word sh_name
Definition ELFTypes.h:155
Elf_Off sh_offset
Definition ELFTypes.h:159
Elf_Word sh_addralign
Definition ELFTypes.h:163
Elf_Addr sh_addr
Definition ELFTypes.h:158
Elf_Word sh_size
Definition ELFTypes.h:160
Elf_Word sh_link
Definition ELFTypes.h:161
Elf_Word sh_entsize
Definition ELFTypes.h:164
Elf_Word sh_flags
Definition ELFTypes.h:157
Elf_Xword sh_entsize
Definition ELFTypes.h:179
Elf_Word sh_type
Definition ELFTypes.h:171
Elf_Word sh_info
Definition ELFTypes.h:177
Elf_Xword sh_flags
Definition ELFTypes.h:172
Elf_Word sh_link
Definition ELFTypes.h:176
Elf_Xword sh_addralign
Definition ELFTypes.h:178
Elf_Off sh_offset
Definition ELFTypes.h:174
Elf_Word sh_name
Definition ELFTypes.h:170
Elf_Xword sh_size
Definition ELFTypes.h:175
Elf_Addr sh_addr
Definition ELFTypes.h:173
Definition ELFTypes.h:150
Definition ELFTypes.h:183
unsigned getEntityCount() const
Get the number of entities this section contains if it has any.
Definition ELFTypes.h:188
unsigned char st_other
Definition ELFTypes.h:204
unsigned char st_info
Definition ELFTypes.h:203
Elf_Addr st_value
Definition ELFTypes.h:201
Elf_Word st_name
Definition ELFTypes.h:200
Elf_Half st_shndx
Definition ELFTypes.h:205
Elf_Word st_size
Definition ELFTypes.h:202
Elf_Xword st_size
Definition ELFTypes.h:216
Elf_Addr st_value
Definition ELFTypes.h:215
Elf_Half st_shndx
Definition ELFTypes.h:214
Elf_Word st_name
Definition ELFTypes.h:211
unsigned char st_info
Definition ELFTypes.h:212
unsigned char st_other
Definition ELFTypes.h:213
Definition ELFTypes.h:195
Definition ELFTypes.h:220
void setBindingAndType(unsigned char b, unsigned char t)
Definition ELFTypes.h:234
bool isProcessorSpecific() const
Definition ELFTypes.h:257
void setBinding(unsigned char b)
Definition ELFTypes.h:231
unsigned char getBinding() const
Definition ELFTypes.h:228
bool isDefined() const
Definition ELFTypes.h:255
bool isAbsolute() const
Definition ELFTypes.h:249
Expected< StringRef > getName(StringRef StrTab) const
Definition ELFTypes.h:281
bool isOSSpecific() const
Definition ELFTypes.h:261
unsigned char getType() const
Definition ELFTypes.h:229
uint64_t getValue() const
Definition ELFTypes.h:230
void setVisibility(unsigned char v)
Definition ELFTypes.h:244
bool isExternal() const
Definition ELFTypes.h:273
void setType(unsigned char t)
Definition ELFTypes.h:232
bool isCommon() const
Definition ELFTypes.h:251
bool isUndefined() const
Definition ELFTypes.h:271
bool isReserved() const
Definition ELFTypes.h:265
unsigned char getVisibility() const
Access to the STV_xxx flag stored in the first two bits of st_other.
Definition ELFTypes.h:243
Elf_Verdaux: This is the structure of auxiliary data in the SHT_GNU_verdef section (....
Definition ELFTypes.h:322
Elf_Word vda_next
Definition ELFTypes.h:325
Elf_Word vda_name
Definition ELFTypes.h:324
Elf_Verdef: This is the structure of entries in the SHT_GNU_verdef section (.gnu.version_d).
Definition ELFTypes.h:303
Elf_Word vd_aux
Definition ELFTypes.h:310
Elf_Half vd_ndx
Definition ELFTypes.h:307
const Elf_Verdaux * getAux() const
Definition ELFTypes.h:314
Elf_Half vd_version
Definition ELFTypes.h:305
Elf_Word vd_next
Definition ELFTypes.h:311
Elf_Half vd_cnt
Definition ELFTypes.h:308
Elf_Half vd_flags
Definition ELFTypes.h:306
Elf_Word vd_hash
Definition ELFTypes.h:309
Elf_Vernaux: This is the structure of auxiliary data in SHT_GNU_verneed section (....
Definition ELFTypes.h:343
Elf_Word vna_next
Definition ELFTypes.h:349
Elf_Word vna_hash
Definition ELFTypes.h:345
Elf_Word vna_name
Definition ELFTypes.h:348
Elf_Half vna_flags
Definition ELFTypes.h:346
Elf_Half vna_other
Definition ELFTypes.h:347
Elf_Verneed: This is the structure of entries in the SHT_GNU_verneed section (.gnu....
Definition ELFTypes.h:331
Elf_Half vn_cnt
Definition ELFTypes.h:334
Elf_Word vn_file
Definition ELFTypes.h:335
Elf_Half vn_version
Definition ELFTypes.h:333
Elf_Word vn_aux
Definition ELFTypes.h:336
Elf_Word vn_next
Definition ELFTypes.h:337
Elf_Versym: This is the structure of entries in the SHT_GNU_versym section (.gnu.version).
Definition ELFTypes.h:295
Elf_Half vs_index
Definition ELFTypes.h:297
Single successor of a given basic block that contains the tag and branch probability associated with ...
Definition ELFTypes.h:1014
uint32_t ID
Unique ID of this successor basic block.
Definition ELFTypes.h:1016
BranchProbability Prob
Branch Probability of the edge to this successor taken from MBPI.
Definition ELFTypes.h:1018
bool operator==(const SuccessorEntry &Other) const
Definition ELFTypes.h:1023
uint64_t PostLinkFreq
Raw edge count from the post link profile (e.g., from bolt or propeller).
Definition ELFTypes.h:1021
Extra basic block data with fields for block frequency and branch probability.
Definition ELFTypes.h:1011
bool operator==(const PGOBBEntry &Other) const
Definition ELFTypes.h:1037
uint64_t PostLinkBlockFreq
Raw block count taken from the post link profile (e.g., from bolt or propeller).
Definition ELFTypes.h:1033
llvm::SmallVector< SuccessorEntry, 2 > Successors
List of successors of the current block.
Definition ELFTypes.h:1035
BlockFrequency BlockFreq
Block frequency taken from MBFI.
Definition ELFTypes.h:1030
A feature extension of BBAddrMap that holds information relevant to PGO.
Definition ELFTypes.h:1008
bool operator==(const PGOAnalysisMap &Other) const
Definition ELFTypes.h:1049
std::vector< PGOBBEntry > BBEntries
Definition ELFTypes.h:1044
uint64_t FuncEntryCount
Definition ELFTypes.h:1043
BBAddrMap::Features FeatEnable
Definition ELFTypes.h:1047