Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
XCOFFObjectFile.cpp
Go to the documentation of this file.
1//===--- XCOFFObjectFile.cpp - XCOFF 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// This file defines the XCOFFObjectFile class.
10//
11//===----------------------------------------------------------------------===//
12
13#include "llvm/Object/XCOFFObjectFile.h"
14#include "llvm/ADT/StringSwitch.h"
15#include "llvm/Support/Compiler.h"
16#include "llvm/Support/DataExtractor.h"
17#include "llvm/TargetParser/SubtargetFeature.h"
18#include <cstddef>
19#include <cstring>
20
21namespacellvm {
22
23using namespaceXCOFF;
24
25namespaceobject {
26
27staticconstuint8_tFunctionSym = 0x20;
28staticconstuint16_tNoRelMask = 0x0001;
29staticconstsize_tSymbolAuxTypeOffset = 17;
30
31// Checks that [Ptr, Ptr + Size) bytes fall inside the memory buffer
32// 'M'. Returns a pointer to the underlying object on success.
33template <typename T>
34staticExpected<const T *>getObject(MemoryBufferRef M,constvoid *Ptr,
35constuint64_tSize =sizeof(T)) {
36 uintptr_tAddr =reinterpret_cast<uintptr_t>(Ptr);
37if (ErrorE =Binary::checkOffset(M,Addr,Size))
38return std::move(E);
39returnreinterpret_cast<constT *>(Addr);
40}
41
42static uintptr_tgetWithOffset(uintptr_tBase,ptrdiff_tOffset) {
43returnreinterpret_cast<uintptr_t>(reinterpret_cast<constchar *>(Base) +
44Offset);
45}
46
47template <typename T>staticconstT *viewAs(uintptr_t in) {
48returnreinterpret_cast<constT *>(in);
49}
50
51staticStringRefgenerateXCOFFFixedNameStringRef(constchar *Name) {
52auto NulCharPtr =
53static_cast<constchar *>(memchr(Name,'\0',XCOFF::NameSize));
54return NulCharPtr ?StringRef(Name, NulCharPtr -Name)
55 :StringRef(Name,XCOFF::NameSize);
56}
57
58template <typename T>StringRefXCOFFSectionHeader<T>::getName() const{
59constT &DerivedXCOFFSectionHeader =static_cast<constT &>(*this);
60returngenerateXCOFFFixedNameStringRef(DerivedXCOFFSectionHeader.Name);
61}
62
63template <typename T>uint16_tXCOFFSectionHeader<T>::getSectionType() const{
64constT &DerivedXCOFFSectionHeader =static_cast<constT &>(*this);
65return DerivedXCOFFSectionHeader.Flags & SectionFlagsTypeMask;
66}
67
68template <typename T>
69uint32_tXCOFFSectionHeader<T>::getSectionSubtype() const{
70constT &DerivedXCOFFSectionHeader =static_cast<constT &>(*this);
71return DerivedXCOFFSectionHeader.Flags & ~SectionFlagsTypeMask;
72}
73
74template <typename T>
75boolXCOFFSectionHeader<T>::isReservedSectionType() const{
76return getSectionType() & SectionFlagsReservedMask;
77}
78
79template <typename AddressType>
80boolXCOFFRelocation<AddressType>::isRelocationSigned() const{
81returnInfo &XR_SIGN_INDICATOR_MASK;
82}
83
84template <typename AddressType>
85boolXCOFFRelocation<AddressType>::isFixupIndicated() const{
86returnInfo &XR_FIXUP_INDICATOR_MASK;
87}
88
89template <typename AddressType>
90uint8_tXCOFFRelocation<AddressType>::getRelocatedLength() const{
91// The relocation encodes the bit length being relocated minus 1. Add back
92// the 1 to get the actual length being relocated.
93return (Info &XR_BIASED_LENGTH_MASK) + 1;
94}
95
96templatestructExceptionSectionEntry<support::ubig32_t>;
97templatestructExceptionSectionEntry<support::ubig64_t>;
98
99template <typename T>
100Expected<StringRef>getLoaderSecSymNameInStrTbl(constT *LoaderSecHeader,
101uint64_tOffset) {
102if (LoaderSecHeader->LengthOfStrTbl >Offset)
103return (reinterpret_cast<constchar *>(LoaderSecHeader) +
104 LoaderSecHeader->OffsetToStrTbl +Offset);
105
106returncreateError("entry with offset 0x" +Twine::utohexstr(Offset) +
107" in the loader section's string table with size 0x" +
108Twine::utohexstr(LoaderSecHeader->LengthOfStrTbl) +
109" is invalid");
110}
111
112Expected<StringRef>LoaderSectionSymbolEntry32::getSymbolName(
113constLoaderSectionHeader32 *LoaderSecHeader32) const{
114constNameOffsetInStrTbl *NameInStrTbl =
115reinterpret_cast<constNameOffsetInStrTbl *>(SymbolName);
116if (NameInStrTbl->IsNameInStrTbl !=XCOFFSymbolRef::NAME_IN_STR_TBL_MAGIC)
117returngenerateXCOFFFixedNameStringRef(SymbolName);
118
119returngetLoaderSecSymNameInStrTbl(LoaderSecHeader32, NameInStrTbl->Offset);
120}
121
122Expected<StringRef>LoaderSectionSymbolEntry64::getSymbolName(
123constLoaderSectionHeader64 *LoaderSecHeader64) const{
124returngetLoaderSecSymNameInStrTbl(LoaderSecHeader64,Offset);
125}
126
127uintptr_t
128XCOFFObjectFile::getAdvancedSymbolEntryAddress(uintptr_t CurrentAddress,
129uint32_t Distance) {
130returngetWithOffset(CurrentAddress, Distance *XCOFF::SymbolTableEntrySize);
131}
132
133constXCOFF::SymbolAuxType *
134XCOFFObjectFile::getSymbolAuxType(uintptr_t AuxEntryAddress) const{
135assert(is64Bit() &&"64-bit interface called on a 32-bit object file.");
136return viewAs<XCOFF::SymbolAuxType>(
137getWithOffset(AuxEntryAddress,SymbolAuxTypeOffset));
138}
139
140void XCOFFObjectFile::checkSectionAddress(uintptr_tAddr,
141 uintptr_t TableAddress) const{
142if (Addr < TableAddress)
143report_fatal_error("Section header outside of section header table.");
144
145 uintptr_tOffset =Addr - TableAddress;
146if (Offset >= getSectionHeaderSize() *getNumberOfSections())
147report_fatal_error("Section header outside of section header table.");
148
149if (Offset % getSectionHeaderSize() != 0)
150report_fatal_error(
151"Section header pointer does not point to a valid section header.");
152}
153
154const XCOFFSectionHeader32 *
155XCOFFObjectFile::toSection32(DataRefImplRef) const{
156assert(!is64Bit() &&"32-bit interface called on 64-bit object file.");
157#ifndef NDEBUG
158 checkSectionAddress(Ref.p, getSectionHeaderTableAddress());
159#endif
160return viewAs<XCOFFSectionHeader32>(Ref.p);
161}
162
163const XCOFFSectionHeader64 *
164XCOFFObjectFile::toSection64(DataRefImplRef) const{
165assert(is64Bit() &&"64-bit interface called on a 32-bit object file.");
166#ifndef NDEBUG
167 checkSectionAddress(Ref.p, getSectionHeaderTableAddress());
168#endif
169return viewAs<XCOFFSectionHeader64>(Ref.p);
170}
171
172XCOFFSymbolRefXCOFFObjectFile::toSymbolRef(DataRefImplRef) const{
173assert(Ref.p != 0 &&"Symbol table pointer can not be nullptr!");
174#ifndef NDEBUG
175checkSymbolEntryPointer(Ref.p);
176#endif
177returnXCOFFSymbolRef(Ref,this);
178}
179
180constXCOFFFileHeader32 *XCOFFObjectFile::fileHeader32() const{
181assert(!is64Bit() &&"32-bit interface called on 64-bit object file.");
182returnstatic_cast<constXCOFFFileHeader32 *>(FileHeader);
183}
184
185constXCOFFFileHeader64 *XCOFFObjectFile::fileHeader64() const{
186assert(is64Bit() &&"64-bit interface called on a 32-bit object file.");
187returnstatic_cast<constXCOFFFileHeader64 *>(FileHeader);
188}
189
190constXCOFFAuxiliaryHeader32 *XCOFFObjectFile::auxiliaryHeader32() const{
191assert(!is64Bit() &&"32-bit interface called on 64-bit object file.");
192returnstatic_cast<constXCOFFAuxiliaryHeader32 *>(AuxiliaryHeader);
193}
194
195constXCOFFAuxiliaryHeader64 *XCOFFObjectFile::auxiliaryHeader64() const{
196assert(is64Bit() &&"64-bit interface called on a 32-bit object file.");
197returnstatic_cast<constXCOFFAuxiliaryHeader64 *>(AuxiliaryHeader);
198}
199
200template <typename T>constT *XCOFFObjectFile::sectionHeaderTable() const{
201returnstatic_cast<constT *>(SectionHeaderTable);
202}
203
204const XCOFFSectionHeader32 *
205XCOFFObjectFile::sectionHeaderTable32() const{
206assert(!is64Bit() &&"32-bit interface called on 64-bit object file.");
207returnstatic_cast<constXCOFFSectionHeader32 *>(SectionHeaderTable);
208}
209
210const XCOFFSectionHeader64 *
211XCOFFObjectFile::sectionHeaderTable64() const{
212assert(is64Bit() &&"64-bit interface called on a 32-bit object file.");
213returnstatic_cast<constXCOFFSectionHeader64 *>(SectionHeaderTable);
214}
215
216voidXCOFFObjectFile::moveSymbolNext(DataRefImpl &Symb) const{
217 uintptr_t NextSymbolAddr =getAdvancedSymbolEntryAddress(
218 Symb.p,toSymbolRef(Symb).getNumberOfAuxEntries() + 1);
219#ifndef NDEBUG
220// This function is used by basic_symbol_iterator, which allows to
221// point to the end-of-symbol-table address.
222if (NextSymbolAddr != getEndOfSymbolTableAddress())
223checkSymbolEntryPointer(NextSymbolAddr);
224#endif
225 Symb.p = NextSymbolAddr;
226}
227
228Expected<StringRef>
229XCOFFObjectFile::getStringTableEntry(uint32_tOffset) const{
230// The byte offset is relative to the start of the string table.
231// A byte offset value of 0 is a null or zero-length symbol
232// name. A byte offset in the range 1 to 3 (inclusive) points into the length
233// field; as a soft-error recovery mechanism, we treat such cases as having an
234// offset of 0.
235if (Offset < 4)
236returnStringRef(nullptr, 0);
237
238if (StringTable.Data !=nullptr &&StringTable.Size >Offset)
239return (StringTable.Data +Offset);
240
241returncreateError("entry with offset 0x" +Twine::utohexstr(Offset) +
242" in a string table with size 0x" +
243Twine::utohexstr(StringTable.Size) +" is invalid");
244}
245
246StringRefXCOFFObjectFile::getStringTable() const{
247// If the size is less than or equal to 4, then the string table contains no
248// string data.
249returnStringRef(StringTable.Data,
250StringTable.Size <= 4 ? 0 :StringTable.Size);
251}
252
253Expected<StringRef>
254XCOFFObjectFile::getCFileName(constXCOFFFileAuxEnt *CFileEntPtr) const{
255if (CFileEntPtr->NameInStrTbl.Magic !=XCOFFSymbolRef::NAME_IN_STR_TBL_MAGIC)
256returngenerateXCOFFFixedNameStringRef(CFileEntPtr->Name);
257returngetStringTableEntry(CFileEntPtr->NameInStrTbl.Offset);
258}
259
260Expected<StringRef>XCOFFObjectFile::getSymbolName(DataRefImpl Symb) const{
261returntoSymbolRef(Symb).getName();
262}
263
264Expected<uint64_t>XCOFFObjectFile::getSymbolAddress(DataRefImpl Symb) const{
265returntoSymbolRef(Symb).getValue();
266}
267
268uint64_tXCOFFObjectFile::getSymbolValueImpl(DataRefImpl Symb) const{
269returntoSymbolRef(Symb).getValue();
270}
271
272uint32_tXCOFFObjectFile::getSymbolAlignment(DataRefImpl Symb) const{
273uint64_t Result = 0;
274XCOFFSymbolRef XCOFFSym =toSymbolRef(Symb);
275if (XCOFFSym.isCsectSymbol()) {
276Expected<XCOFFCsectAuxRef> CsectAuxRefOrError =
277 XCOFFSym.getXCOFFCsectAuxRef();
278if (!CsectAuxRefOrError)
279// TODO: report the error up the stack.
280consumeError(CsectAuxRefOrError.takeError());
281else
282 Result = 1ULL << CsectAuxRefOrError.get().getAlignmentLog2();
283 }
284return Result;
285}
286
287uint64_tXCOFFObjectFile::getCommonSymbolSizeImpl(DataRefImpl Symb) const{
288uint64_t Result = 0;
289XCOFFSymbolRef XCOFFSym =toSymbolRef(Symb);
290if (XCOFFSym.isCsectSymbol()) {
291Expected<XCOFFCsectAuxRef> CsectAuxRefOrError =
292 XCOFFSym.getXCOFFCsectAuxRef();
293if (!CsectAuxRefOrError)
294// TODO: report the error up the stack.
295consumeError(CsectAuxRefOrError.takeError());
296else {
297XCOFFCsectAuxRef CsectAuxRef = CsectAuxRefOrError.get();
298assert(CsectAuxRef.getSymbolType() ==XCOFF::XTY_CM);
299 Result = CsectAuxRef.getSectionOrLength();
300 }
301 }
302return Result;
303}
304
305Expected<SymbolRef::Type>
306XCOFFObjectFile::getSymbolType(DataRefImpl Symb) const{
307XCOFFSymbolRef XCOFFSym =toSymbolRef(Symb);
308
309Expected<bool> IsFunction = XCOFFSym.isFunction();
310if (!IsFunction)
311return IsFunction.takeError();
312
313if (*IsFunction)
314returnSymbolRef::ST_Function;
315
316if (XCOFF::C_FILE == XCOFFSym.getStorageClass())
317returnSymbolRef::ST_File;
318
319 int16_t SecNum = XCOFFSym.getSectionNumber();
320if (SecNum <= 0)
321returnSymbolRef::ST_Other;
322
323Expected<DataRefImpl> SecDRIOrErr =
324getSectionByNum(XCOFFSym.getSectionNumber());
325
326if (!SecDRIOrErr)
327return SecDRIOrErr.takeError();
328
329DataRefImpl SecDRI = SecDRIOrErr.get();
330
331Expected<StringRef> SymNameOrError = XCOFFSym.getName();
332if (SymNameOrError) {
333// The "TOC" symbol is treated as SymbolRef::ST_Other.
334if (SymNameOrError.get() =="TOC")
335returnSymbolRef::ST_Other;
336
337// The symbol for a section name is treated as SymbolRef::ST_Other.
338StringRef SecName;
339if (is64Bit())
340 SecName = XCOFFObjectFile::toSection64(SecDRIOrErr.get())->getName();
341else
342 SecName = XCOFFObjectFile::toSection32(SecDRIOrErr.get())->getName();
343
344if (SecName == SymNameOrError.get())
345returnSymbolRef::ST_Other;
346 }else
347return SymNameOrError.takeError();
348
349if (isSectionData(SecDRI) ||isSectionBSS(SecDRI))
350returnSymbolRef::ST_Data;
351
352if (isDebugSection(SecDRI))
353returnSymbolRef::ST_Debug;
354
355returnSymbolRef::ST_Other;
356}
357
358Expected<section_iterator>
359XCOFFObjectFile::getSymbolSection(DataRefImpl Symb) const{
360const int16_t SectNum =toSymbolRef(Symb).getSectionNumber();
361
362if (isReservedSectionNumber(SectNum))
363returnsection_end();
364
365Expected<DataRefImpl> ExpSec =getSectionByNum(SectNum);
366if (!ExpSec)
367return ExpSec.takeError();
368
369returnsection_iterator(SectionRef(ExpSec.get(),this));
370}
371
372voidXCOFFObjectFile::moveSectionNext(DataRefImpl &Sec) const{
373constchar *Ptr =reinterpret_cast<constchar *>(Sec.p);
374 Sec.p =reinterpret_cast<uintptr_t>(Ptr + getSectionHeaderSize());
375}
376
377Expected<StringRef>XCOFFObjectFile::getSectionName(DataRefImpl Sec) const{
378returngenerateXCOFFFixedNameStringRef(getSectionNameInternal(Sec));
379}
380
381uint64_tXCOFFObjectFile::getSectionAddress(DataRefImpl Sec) const{
382// Avoid ternary due to failure to convert the ubig32_t value to a unit64_t
383// with MSVC.
384if (is64Bit())
385return toSection64(Sec)->VirtualAddress;
386
387return toSection32(Sec)->VirtualAddress;
388}
389
390uint64_tXCOFFObjectFile::getSectionIndex(DataRefImpl Sec) const{
391// Section numbers in XCOFF are numbered beginning at 1. A section number of
392// zero is used to indicate that a symbol is being imported or is undefined.
393if (is64Bit())
394return toSection64(Sec) - sectionHeaderTable64() + 1;
395else
396return toSection32(Sec) - sectionHeaderTable32() + 1;
397}
398
399uint64_tXCOFFObjectFile::getSectionSize(DataRefImpl Sec) const{
400// Avoid ternary due to failure to convert the ubig32_t value to a unit64_t
401// with MSVC.
402if (is64Bit())
403return toSection64(Sec)->SectionSize;
404
405return toSection32(Sec)->SectionSize;
406}
407
408Expected<ArrayRef<uint8_t>>
409XCOFFObjectFile::getSectionContents(DataRefImpl Sec) const{
410if (isSectionVirtual(Sec))
411returnArrayRef<uint8_t>();
412
413uint64_t OffsetToRaw;
414if (is64Bit())
415 OffsetToRaw = toSection64(Sec)->FileOffsetToRawData;
416else
417 OffsetToRaw = toSection32(Sec)->FileOffsetToRawData;
418
419constuint8_t * ContentStart =base() + OffsetToRaw;
420uint64_t SectionSize =getSectionSize(Sec);
421if (ErrorE =Binary::checkOffset(
422Data,reinterpret_cast<uintptr_t>(ContentStart), SectionSize))
423returncreateError(
424toString(std::move(E)) +": section data with offset 0x" +
425Twine::utohexstr(OffsetToRaw) +" and size 0x" +
426Twine::utohexstr(SectionSize) +" goes past the end of the file");
427
428returnArrayRef(ContentStart, SectionSize);
429}
430
431uint64_tXCOFFObjectFile::getSectionAlignment(DataRefImpl Sec) const{
432uint64_t Result = 0;
433llvm_unreachable("Not yet implemented!");
434return Result;
435}
436
437uint64_t XCOFFObjectFile::getSectionFileOffsetToRawData(DataRefImpl Sec) const{
438if (is64Bit())
439return toSection64(Sec)->FileOffsetToRawData;
440
441return toSection32(Sec)->FileOffsetToRawData;
442}
443
444Expected<uintptr_t> XCOFFObjectFile::getSectionFileOffsetToRawData(
445XCOFF::SectionTypeFlags SectType) const{
446DataRefImpl DRI = getSectionByType(SectType);
447
448if (DRI.p == 0)// No section is not an error.
449return 0;
450
451uint64_t SectionOffset = getSectionFileOffsetToRawData(DRI);
452uint64_t SizeOfSection =getSectionSize(DRI);
453
454 uintptr_t SectionStart =reinterpret_cast<uintptr_t>(base() + SectionOffset);
455if (ErrorE =Binary::checkOffset(Data, SectionStart, SizeOfSection)) {
456SmallString<32> UnknownType;
457Twine(("<Unknown:") +Twine::utohexstr(SectType) +">")
458 .toVector(UnknownType);
459constchar *SectionName = UnknownType.c_str();
460
461switch (SectType) {
462#define ECASE(Value, String) \
463 case XCOFF::Value: \
464 SectionName = String; \
465 break
466
467ECASE(STYP_PAD,"pad");
468ECASE(STYP_DWARF,"dwarf");
469ECASE(STYP_TEXT,"text");
470ECASE(STYP_DATA,"data");
471ECASE(STYP_BSS,"bss");
472ECASE(STYP_EXCEPT,"expect");
473ECASE(STYP_INFO,"info");
474ECASE(STYP_TDATA,"tdata");
475ECASE(STYP_TBSS,"tbss");
476ECASE(STYP_LOADER,"loader");
477ECASE(STYP_DEBUG,"debug");
478ECASE(STYP_TYPCHK,"typchk");
479ECASE(STYP_OVRFLO,"ovrflo");
480#undef ECASE
481 }
482returncreateError(toString(std::move(E)) +": " +SectionName +
483" section with offset 0x" +
484Twine::utohexstr(SectionOffset) +" and size 0x" +
485Twine::utohexstr(SizeOfSection) +
486" goes past the end of the file");
487 }
488return SectionStart;
489}
490
491boolXCOFFObjectFile::isSectionCompressed(DataRefImpl Sec) const{
492returnfalse;
493}
494
495boolXCOFFObjectFile::isSectionText(DataRefImpl Sec) const{
496returngetSectionFlags(Sec) &XCOFF::STYP_TEXT;
497}
498
499boolXCOFFObjectFile::isSectionData(DataRefImpl Sec) const{
500uint32_t Flags =getSectionFlags(Sec);
501return Flags & (XCOFF::STYP_DATA |XCOFF::STYP_TDATA);
502}
503
504boolXCOFFObjectFile::isSectionBSS(DataRefImpl Sec) const{
505uint32_t Flags =getSectionFlags(Sec);
506return Flags & (XCOFF::STYP_BSS |XCOFF::STYP_TBSS);
507}
508
509boolXCOFFObjectFile::isDebugSection(DataRefImpl Sec) const{
510uint32_t Flags =getSectionFlags(Sec);
511return Flags & (XCOFF::STYP_DEBUG |XCOFF::STYP_DWARF);
512}
513
514boolXCOFFObjectFile::isSectionVirtual(DataRefImpl Sec) const{
515returnis64Bit() ? toSection64(Sec)->FileOffsetToRawData == 0
516 : toSection32(Sec)->FileOffsetToRawData == 0;
517}
518
519relocation_iteratorXCOFFObjectFile::section_rel_begin(DataRefImpl Sec) const{
520DataRefImpl Ret;
521if (is64Bit()) {
522constXCOFFSectionHeader64 *SectionEntPtr = toSection64(Sec);
523auto RelocationsOrErr =
524 relocations<XCOFFSectionHeader64, XCOFFRelocation64>(*SectionEntPtr);
525if (ErrorE = RelocationsOrErr.takeError()) {
526// TODO: report the error up the stack.
527consumeError(std::move(E));
528returnrelocation_iterator(RelocationRef());
529 }
530 Ret.p =reinterpret_cast<uintptr_t>(&*RelocationsOrErr.get().begin());
531 }else {
532constXCOFFSectionHeader32 *SectionEntPtr = toSection32(Sec);
533auto RelocationsOrErr =
534 relocations<XCOFFSectionHeader32, XCOFFRelocation32>(*SectionEntPtr);
535if (ErrorE = RelocationsOrErr.takeError()) {
536// TODO: report the error up the stack.
537consumeError(std::move(E));
538returnrelocation_iterator(RelocationRef());
539 }
540 Ret.p =reinterpret_cast<uintptr_t>(&*RelocationsOrErr.get().begin());
541 }
542returnrelocation_iterator(RelocationRef(Ret,this));
543}
544
545relocation_iteratorXCOFFObjectFile::section_rel_end(DataRefImpl Sec) const{
546DataRefImpl Ret;
547if (is64Bit()) {
548constXCOFFSectionHeader64 *SectionEntPtr = toSection64(Sec);
549auto RelocationsOrErr =
550 relocations<XCOFFSectionHeader64, XCOFFRelocation64>(*SectionEntPtr);
551if (ErrorE = RelocationsOrErr.takeError()) {
552// TODO: report the error up the stack.
553consumeError(std::move(E));
554returnrelocation_iterator(RelocationRef());
555 }
556 Ret.p =reinterpret_cast<uintptr_t>(&*RelocationsOrErr.get().end());
557 }else {
558constXCOFFSectionHeader32 *SectionEntPtr = toSection32(Sec);
559auto RelocationsOrErr =
560 relocations<XCOFFSectionHeader32, XCOFFRelocation32>(*SectionEntPtr);
561if (ErrorE = RelocationsOrErr.takeError()) {
562// TODO: report the error up the stack.
563consumeError(std::move(E));
564returnrelocation_iterator(RelocationRef());
565 }
566 Ret.p =reinterpret_cast<uintptr_t>(&*RelocationsOrErr.get().end());
567 }
568returnrelocation_iterator(RelocationRef(Ret,this));
569}
570
571voidXCOFFObjectFile::moveRelocationNext(DataRefImpl &Rel) const{
572if (is64Bit())
573 Rel.p =reinterpret_cast<uintptr_t>(viewAs<XCOFFRelocation64>(Rel.p) + 1);
574else
575 Rel.p =reinterpret_cast<uintptr_t>(viewAs<XCOFFRelocation32>(Rel.p) + 1);
576}
577
578uint64_tXCOFFObjectFile::getRelocationOffset(DataRefImpl Rel) const{
579if (is64Bit()) {
580constXCOFFRelocation64 *Reloc = viewAs<XCOFFRelocation64>(Rel.p);
581constXCOFFSectionHeader64 *Sec64 = sectionHeaderTable64();
582constuint64_t RelocAddress = Reloc->VirtualAddress;
583constuint16_t NumberOfSections =getNumberOfSections();
584for (uint16_tI = 0;I < NumberOfSections; ++I) {
585// Find which section this relocation belongs to, and get the
586// relocation offset relative to the start of the section.
587if (Sec64->VirtualAddress <= RelocAddress &&
588 RelocAddress < Sec64->VirtualAddress + Sec64->SectionSize) {
589return RelocAddress - Sec64->VirtualAddress;
590 }
591 ++Sec64;
592 }
593 }else {
594constXCOFFRelocation32 *Reloc = viewAs<XCOFFRelocation32>(Rel.p);
595constXCOFFSectionHeader32 *Sec32 = sectionHeaderTable32();
596constuint32_t RelocAddress = Reloc->VirtualAddress;
597constuint16_t NumberOfSections =getNumberOfSections();
598for (uint16_tI = 0;I < NumberOfSections; ++I) {
599// Find which section this relocation belongs to, and get the
600// relocation offset relative to the start of the section.
601if (Sec32->VirtualAddress <= RelocAddress &&
602 RelocAddress < Sec32->VirtualAddress + Sec32->SectionSize) {
603return RelocAddress - Sec32->VirtualAddress;
604 }
605 ++Sec32;
606 }
607 }
608returnInvalidRelocOffset;
609}
610
611symbol_iteratorXCOFFObjectFile::getRelocationSymbol(DataRefImpl Rel) const{
612uint32_tIndex;
613if (is64Bit()) {
614constXCOFFRelocation64 *Reloc = viewAs<XCOFFRelocation64>(Rel.p);
615Index = Reloc->SymbolIndex;
616
617if (Index >=getNumberOfSymbolTableEntries64())
618returnsymbol_end();
619 }else {
620constXCOFFRelocation32 *Reloc = viewAs<XCOFFRelocation32>(Rel.p);
621Index = Reloc->SymbolIndex;
622
623if (Index >=getLogicalNumberOfSymbolTableEntries32())
624returnsymbol_end();
625 }
626DataRefImpl SymDRI;
627 SymDRI.p =getSymbolEntryAddressByIndex(Index);
628returnsymbol_iterator(SymbolRef(SymDRI,this));
629}
630
631uint64_tXCOFFObjectFile::getRelocationType(DataRefImpl Rel) const{
632if (is64Bit())
633return viewAs<XCOFFRelocation64>(Rel.p)->Type;
634return viewAs<XCOFFRelocation32>(Rel.p)->Type;
635}
636
637voidXCOFFObjectFile::getRelocationTypeName(
638DataRefImpl Rel,SmallVectorImpl<char> &Result) const{
639StringRef Res;
640if (is64Bit()) {
641constXCOFFRelocation64 *Reloc = viewAs<XCOFFRelocation64>(Rel.p);
642 Res =XCOFF::getRelocationTypeString(Reloc->Type);
643 }else {
644constXCOFFRelocation32 *Reloc = viewAs<XCOFFRelocation32>(Rel.p);
645 Res =XCOFF::getRelocationTypeString(Reloc->Type);
646 }
647 Result.append(Res.begin(), Res.end());
648}
649
650Expected<uint32_t>XCOFFObjectFile::getSymbolFlags(DataRefImpl Symb) const{
651XCOFFSymbolRef XCOFFSym =toSymbolRef(Symb);
652uint32_t Result =SymbolRef::SF_None;
653
654if (XCOFFSym.getSectionNumber() ==XCOFF::N_ABS)
655 Result |=SymbolRef::SF_Absolute;
656
657XCOFF::StorageClass SC = XCOFFSym.getStorageClass();
658if (XCOFF::C_EXT == SC ||XCOFF::C_WEAKEXT == SC)
659 Result |=SymbolRef::SF_Global;
660
661if (XCOFF::C_WEAKEXT == SC)
662 Result |=SymbolRef::SF_Weak;
663
664if (XCOFFSym.isCsectSymbol()) {
665Expected<XCOFFCsectAuxRef> CsectAuxEntOrErr =
666 XCOFFSym.getXCOFFCsectAuxRef();
667if (CsectAuxEntOrErr) {
668if (CsectAuxEntOrErr.get().getSymbolType() ==XCOFF::XTY_CM)
669 Result |=SymbolRef::SF_Common;
670 }else
671return CsectAuxEntOrErr.takeError();
672 }
673
674if (XCOFFSym.getSectionNumber() ==XCOFF::N_UNDEF)
675 Result |=SymbolRef::SF_Undefined;
676
677// There is no visibility in old 32 bit XCOFF object file interpret.
678if (is64Bit() || (auxiliaryHeader32() && (auxiliaryHeader32()->getVersion() ==
679NEW_XCOFF_INTERPRET))) {
680uint16_t SymType = XCOFFSym.getSymbolType();
681if ((SymType &VISIBILITY_MASK) ==SYM_V_HIDDEN)
682 Result |=SymbolRef::SF_Hidden;
683
684if ((SymType &VISIBILITY_MASK) ==SYM_V_EXPORTED)
685 Result |=SymbolRef::SF_Exported;
686 }
687return Result;
688}
689
690basic_symbol_iteratorXCOFFObjectFile::symbol_begin() const{
691DataRefImpl SymDRI;
692 SymDRI.p =reinterpret_cast<uintptr_t>(SymbolTblPtr);
693returnbasic_symbol_iterator(SymbolRef(SymDRI,this));
694}
695
696basic_symbol_iteratorXCOFFObjectFile::symbol_end() const{
697DataRefImpl SymDRI;
698constuint32_t NumberOfSymbolTableEntries =getNumberOfSymbolTableEntries();
699 SymDRI.p =getSymbolEntryAddressByIndex(NumberOfSymbolTableEntries);
700returnbasic_symbol_iterator(SymbolRef(SymDRI,this));
701}
702
703XCOFFObjectFile::xcoff_symbol_iterator_rangeXCOFFObjectFile::symbols() const{
704returnxcoff_symbol_iterator_range(symbol_begin(),symbol_end());
705}
706
707section_iteratorXCOFFObjectFile::section_begin() const{
708DataRefImpl DRI;
709 DRI.p = getSectionHeaderTableAddress();
710returnsection_iterator(SectionRef(DRI,this));
711}
712
713section_iteratorXCOFFObjectFile::section_end() const{
714DataRefImpl DRI;
715 DRI.p =getWithOffset(getSectionHeaderTableAddress(),
716getNumberOfSections() * getSectionHeaderSize());
717returnsection_iterator(SectionRef(DRI,this));
718}
719
720uint8_tXCOFFObjectFile::getBytesInAddress() const{returnis64Bit() ? 8 : 4; }
721
722StringRefXCOFFObjectFile::getFileFormatName() const{
723returnis64Bit() ?"aix5coff64-rs6000" :"aixcoff-rs6000";
724}
725
726Triple::ArchTypeXCOFFObjectFile::getArch() const{
727returnis64Bit() ?Triple::ppc64 :Triple::ppc;
728}
729
730Expected<SubtargetFeatures>XCOFFObjectFile::getFeatures() const{
731returnSubtargetFeatures();
732}
733
734boolXCOFFObjectFile::isRelocatableObject() const{
735if (is64Bit())
736return !(fileHeader64()->Flags &NoRelMask);
737return !(fileHeader32()->Flags &NoRelMask);
738}
739
740Expected<uint64_t>XCOFFObjectFile::getStartAddress() const{
741if (AuxiliaryHeader ==nullptr)
742return 0;
743
744returnis64Bit() ?auxiliaryHeader64()->getEntryPointAddr()
745 :auxiliaryHeader32()->getEntryPointAddr();
746}
747
748StringRefXCOFFObjectFile::mapDebugSectionName(StringRefName) const{
749returnStringSwitch<StringRef>(Name)
750 .Case("dwinfo","debug_info")
751 .Case("dwline","debug_line")
752 .Case("dwpbnms","debug_pubnames")
753 .Case("dwpbtyp","debug_pubtypes")
754 .Case("dwarnge","debug_aranges")
755 .Case("dwabrev","debug_abbrev")
756 .Case("dwstr","debug_str")
757 .Case("dwrnges","debug_ranges")
758 .Case("dwloc","debug_loc")
759 .Case("dwframe","debug_frame")
760 .Case("dwmac","debug_macinfo")
761 .Default(Name);
762}
763
764size_t XCOFFObjectFile::getFileHeaderSize() const{
765returnis64Bit() ?sizeof(XCOFFFileHeader64) :sizeof(XCOFFFileHeader32);
766}
767
768size_t XCOFFObjectFile::getSectionHeaderSize() const{
769returnis64Bit() ?sizeof(XCOFFSectionHeader64) :
770sizeof(XCOFFSectionHeader32);
771}
772
773boolXCOFFObjectFile::is64Bit() const{
774returnBinary::ID_XCOFF64 ==getType();
775}
776
777Expected<StringRef>XCOFFObjectFile::getRawData(constchar *Start,
778uint64_tSize,
779StringRefName) const{
780 uintptr_t StartPtr =reinterpret_cast<uintptr_t>(Start);
781// TODO: this path is untested.
782if (ErrorE =Binary::checkOffset(Data, StartPtr,Size))
783returncreateError(toString(std::move(E)) +": " +Name.data() +
784" data with offset 0x" +Twine::utohexstr(StartPtr) +
785" and size 0x" +Twine::utohexstr(Size) +
786" goes past the end of the file");
787returnStringRef(Start,Size);
788}
789
790uint16_tXCOFFObjectFile::getMagic() const{
791returnis64Bit() ?fileHeader64()->Magic :fileHeader32()->Magic;
792}
793
794Expected<DataRefImpl>XCOFFObjectFile::getSectionByNum(int16_t Num) const{
795if (Num <= 0 || Num >getNumberOfSections())
796returncreateStringError(object_error::invalid_section_index,
797"the section index (" +Twine(Num) +
798") is invalid");
799
800DataRefImpl DRI;
801 DRI.p =getWithOffset(getSectionHeaderTableAddress(),
802 getSectionHeaderSize() * (Num - 1));
803return DRI;
804}
805
806DataRefImpl
807XCOFFObjectFile::getSectionByType(XCOFF::SectionTypeFlags SectType) const{
808DataRefImpl DRI;
809auto GetSectionAddr = [&](constauto &Sections) -> uintptr_t {
810for (constauto &Sec : Sections)
811if (Sec.getSectionType() == SectType)
812returnreinterpret_cast<uintptr_t>(&Sec);
813return uintptr_t(0);
814 };
815if (is64Bit())
816 DRI.p = GetSectionAddr(sections64());
817else
818 DRI.p = GetSectionAddr(sections32());
819return DRI;
820}
821
822Expected<StringRef>
823XCOFFObjectFile::getSymbolSectionName(XCOFFSymbolRef SymEntPtr) const{
824const int16_t SectionNum = SymEntPtr.getSectionNumber();
825
826switch (SectionNum) {
827caseXCOFF::N_DEBUG:
828return"N_DEBUG";
829caseXCOFF::N_ABS:
830return"N_ABS";
831caseXCOFF::N_UNDEF:
832return"N_UNDEF";
833default:
834Expected<DataRefImpl> SecRef =getSectionByNum(SectionNum);
835if (SecRef)
836returngenerateXCOFFFixedNameStringRef(
837 getSectionNameInternal(SecRef.get()));
838return SecRef.takeError();
839 }
840}
841
842unsignedXCOFFObjectFile::getSymbolSectionID(SymbolRefSym) const{
843XCOFFSymbolRef XCOFFSymRef(Sym.getRawDataRefImpl(),this);
844return XCOFFSymRef.getSectionNumber();
845}
846
847bool XCOFFObjectFile::isReservedSectionNumber(int16_t SectionNumber) {
848return (SectionNumber <= 0 && SectionNumber >= -2);
849}
850
851uint16_tXCOFFObjectFile::getNumberOfSections() const{
852returnis64Bit() ?fileHeader64()->NumberOfSections
853 :fileHeader32()->NumberOfSections;
854}
855
856int32_tXCOFFObjectFile::getTimeStamp() const{
857returnis64Bit() ?fileHeader64()->TimeStamp :fileHeader32()->TimeStamp;
858}
859
860uint16_tXCOFFObjectFile::getOptionalHeaderSize() const{
861returnis64Bit() ?fileHeader64()->AuxHeaderSize
862 :fileHeader32()->AuxHeaderSize;
863}
864
865uint32_tXCOFFObjectFile::getSymbolTableOffset32() const{
866returnfileHeader32()->SymbolTableOffset;
867}
868
869int32_tXCOFFObjectFile::getRawNumberOfSymbolTableEntries32() const{
870// As far as symbol table size is concerned, if this field is negative it is
871// to be treated as a 0. However since this field is also used for printing we
872// don't want to truncate any negative values.
873returnfileHeader32()->NumberOfSymTableEntries;
874}
875
876uint32_tXCOFFObjectFile::getLogicalNumberOfSymbolTableEntries32() const{
877return (fileHeader32()->NumberOfSymTableEntries >= 0
878 ?fileHeader32()->NumberOfSymTableEntries
879 : 0);
880}
881
882uint64_tXCOFFObjectFile::getSymbolTableOffset64() const{
883returnfileHeader64()->SymbolTableOffset;
884}
885
886uint32_tXCOFFObjectFile::getNumberOfSymbolTableEntries64() const{
887returnfileHeader64()->NumberOfSymTableEntries;
888}
889
890uint32_tXCOFFObjectFile::getNumberOfSymbolTableEntries() const{
891returnis64Bit() ?getNumberOfSymbolTableEntries64()
892 :getLogicalNumberOfSymbolTableEntries32();
893}
894
895uintptr_t XCOFFObjectFile::getEndOfSymbolTableAddress() const{
896constuint32_t NumberOfSymTableEntries =getNumberOfSymbolTableEntries();
897returngetWithOffset(reinterpret_cast<uintptr_t>(SymbolTblPtr),
898XCOFF::SymbolTableEntrySize * NumberOfSymTableEntries);
899}
900
901voidXCOFFObjectFile::checkSymbolEntryPointer(uintptr_t SymbolEntPtr) const{
902if (SymbolEntPtr <reinterpret_cast<uintptr_t>(SymbolTblPtr))
903report_fatal_error("Symbol table entry is outside of symbol table.");
904
905if (SymbolEntPtr >= getEndOfSymbolTableAddress())
906report_fatal_error("Symbol table entry is outside of symbol table.");
907
908ptrdiff_tOffset =reinterpret_cast<constchar *>(SymbolEntPtr) -
909reinterpret_cast<constchar *>(SymbolTblPtr);
910
911if (Offset %XCOFF::SymbolTableEntrySize != 0)
912report_fatal_error(
913"Symbol table entry position is not valid inside of symbol table.");
914}
915
916uint32_tXCOFFObjectFile::getSymbolIndex(uintptr_t SymbolEntPtr) const{
917return (reinterpret_cast<constchar *>(SymbolEntPtr) -
918reinterpret_cast<constchar *>(SymbolTblPtr)) /
919XCOFF::SymbolTableEntrySize;
920}
921
922uint64_tXCOFFObjectFile::getSymbolSize(DataRefImpl Symb) const{
923uint64_t Result = 0;
924XCOFFSymbolRef XCOFFSym =toSymbolRef(Symb);
925if (XCOFFSym.isCsectSymbol()) {
926Expected<XCOFFCsectAuxRef> CsectAuxRefOrError =
927 XCOFFSym.getXCOFFCsectAuxRef();
928if (!CsectAuxRefOrError)
929// TODO: report the error up the stack.
930consumeError(CsectAuxRefOrError.takeError());
931else {
932XCOFFCsectAuxRef CsectAuxRef = CsectAuxRefOrError.get();
933uint8_t SymType = CsectAuxRef.getSymbolType();
934if (SymType ==XCOFF::XTY_SD || SymType ==XCOFF::XTY_CM)
935 Result = CsectAuxRef.getSectionOrLength();
936 }
937 }
938return Result;
939}
940
941uintptr_tXCOFFObjectFile::getSymbolEntryAddressByIndex(uint32_tIndex) const{
942returngetAdvancedSymbolEntryAddress(
943reinterpret_cast<uintptr_t>(getPointerToSymbolTable()),Index);
944}
945
946Expected<StringRef>
947XCOFFObjectFile::getSymbolNameByIndex(uint32_tIndex) const{
948constuint32_t NumberOfSymTableEntries =getNumberOfSymbolTableEntries();
949
950if (Index >= NumberOfSymTableEntries)
951returncreateError("symbol index " +Twine(Index) +
952" exceeds symbol count " +
953Twine(NumberOfSymTableEntries));
954
955DataRefImpl SymDRI;
956 SymDRI.p =getSymbolEntryAddressByIndex(Index);
957returngetSymbolName(SymDRI);
958}
959
960uint16_tXCOFFObjectFile::getFlags() const{
961returnis64Bit() ?fileHeader64()->Flags :fileHeader32()->Flags;
962}
963
964constchar *XCOFFObjectFile::getSectionNameInternal(DataRefImpl Sec) const{
965returnis64Bit() ? toSection64(Sec)->Name : toSection32(Sec)->Name;
966}
967
968uintptr_t XCOFFObjectFile::getSectionHeaderTableAddress() const{
969returnreinterpret_cast<uintptr_t>(SectionHeaderTable);
970}
971
972int32_tXCOFFObjectFile::getSectionFlags(DataRefImpl Sec) const{
973returnis64Bit() ? toSection64(Sec)->Flags : toSection32(Sec)->Flags;
974}
975
976XCOFFObjectFile::XCOFFObjectFile(unsignedintType,MemoryBufferRef Object)
977 :ObjectFile(Type, Object) {
978assert(Type ==Binary::ID_XCOFF32 ||Type ==Binary::ID_XCOFF64);
979}
980
981ArrayRef<XCOFFSectionHeader64>XCOFFObjectFile::sections64() const{
982assert(is64Bit() &&"64-bit interface called for non 64-bit file.");
983constXCOFFSectionHeader64 *TablePtr = sectionHeaderTable64();
984returnArrayRef<XCOFFSectionHeader64>(TablePtr,
985 TablePtr +getNumberOfSections());
986}
987
988ArrayRef<XCOFFSectionHeader32>XCOFFObjectFile::sections32() const{
989assert(!is64Bit() &&"32-bit interface called for non 32-bit file.");
990constXCOFFSectionHeader32 *TablePtr = sectionHeaderTable32();
991returnArrayRef<XCOFFSectionHeader32>(TablePtr,
992 TablePtr +getNumberOfSections());
993}
994
995// In an XCOFF32 file, when the field value is 65535, then an STYP_OVRFLO
996// section header contains the actual count of relocation entries in the s_paddr
997// field. STYP_OVRFLO headers contain the section index of their corresponding
998// sections as their raw "NumberOfRelocations" field value.
999template <typename T>
1000Expected<uint32_t>XCOFFObjectFile::getNumberOfRelocationEntries(
1001constXCOFFSectionHeader<T> &Sec) const{
1002constT &Section =static_cast<constT &>(Sec);
1003if (is64Bit())
1004return Section.NumberOfRelocations;
1005
1006uint16_t SectionIndex = &Section - sectionHeaderTable<T>() + 1;
1007if (Section.NumberOfRelocations <XCOFF::RelocOverflow)
1008return Section.NumberOfRelocations;
1009for (constauto &Sec :sections32()) {
1010if (Sec.Flags ==XCOFF::STYP_OVRFLO &&
1011 Sec.NumberOfRelocations == SectionIndex)
1012return Sec.PhysicalAddress;
1013 }
1014returnerrorCodeToError(object_error::parse_failed);
1015}
1016
1017template <typename Shdr,typename Reloc>
1018Expected<ArrayRef<Reloc>>XCOFFObjectFile::relocations(constShdr &Sec) const{
1019 uintptr_t RelocAddr =getWithOffset(reinterpret_cast<uintptr_t>(FileHeader),
1020 Sec.FileOffsetToRelocationInfo);
1021auto NumRelocEntriesOrErr =getNumberOfRelocationEntries(Sec);
1022if (ErrorE = NumRelocEntriesOrErr.takeError())
1023return std::move(E);
1024
1025uint32_t NumRelocEntries = NumRelocEntriesOrErr.get();
1026static_assert((sizeof(Reloc) ==XCOFF::RelocationSerializationSize64 ||
1027sizeof(Reloc) ==XCOFF::RelocationSerializationSize32),
1028"Relocation structure is incorrect");
1029auto RelocationOrErr =
1030 getObject<Reloc>(Data,reinterpret_cast<void *>(RelocAddr),
1031 NumRelocEntries *sizeof(Reloc));
1032if (!RelocationOrErr)
1033returncreateError(
1034toString(RelocationOrErr.takeError()) +": relocations with offset 0x" +
1035Twine::utohexstr(Sec.FileOffsetToRelocationInfo) +" and size 0x" +
1036Twine::utohexstr(NumRelocEntries *sizeof(Reloc)) +
1037" go past the end of the file");
1038
1039const Reloc *StartReloc = RelocationOrErr.get();
1040
1041returnArrayRef<Reloc>(StartReloc, StartReloc + NumRelocEntries);
1042}
1043
1044template <typename ExceptEnt>
1045Expected<ArrayRef<ExceptEnt>>XCOFFObjectFile::getExceptionEntries() const{
1046assert((is64Bit() &&sizeof(ExceptEnt) ==sizeof(ExceptionSectionEntry64)) ||
1047 (!is64Bit() &&sizeof(ExceptEnt) ==sizeof(ExceptionSectionEntry32)));
1048
1049Expected<uintptr_t> ExceptionSectOrErr =
1050 getSectionFileOffsetToRawData(XCOFF::STYP_EXCEPT);
1051if (!ExceptionSectOrErr)
1052return ExceptionSectOrErr.takeError();
1053
1054DataRefImpl DRI = getSectionByType(XCOFF::STYP_EXCEPT);
1055if (DRI.p == 0)
1056returnArrayRef<ExceptEnt>();
1057
1058 ExceptEnt *ExceptEntStart =
1059reinterpret_cast<ExceptEnt *>(*ExceptionSectOrErr);
1060returnArrayRef<ExceptEnt>(
1061 ExceptEntStart, ExceptEntStart +getSectionSize(DRI) /sizeof(ExceptEnt));
1062}
1063
1064template LLVM_EXPORT_TEMPLATEExpected<ArrayRef<ExceptionSectionEntry32>>
1065XCOFFObjectFile::getExceptionEntries()const;
1066template LLVM_EXPORT_TEMPLATEExpected<ArrayRef<ExceptionSectionEntry64>>
1067XCOFFObjectFile::getExceptionEntries()const;
1068
1069Expected<XCOFFStringTable>
1070XCOFFObjectFile::parseStringTable(constXCOFFObjectFile *Obj,uint64_tOffset) {
1071// If there is a string table, then the buffer must contain at least 4 bytes
1072// for the string table's size. Not having a string table is not an error.
1073if (ErrorE =Binary::checkOffset(
1074 Obj->Data,reinterpret_cast<uintptr_t>(Obj->base() +Offset), 4)) {
1075consumeError(std::move(E));
1076returnXCOFFStringTable{0,nullptr};
1077 }
1078
1079// Read the size out of the buffer.
1080uint32_tSize =support::endian::read32be(Obj->base() +Offset);
1081
1082// If the size is less then 4, then the string table is just a size and no
1083// string data.
1084if (Size <= 4)
1085return XCOFFStringTable{4,nullptr};
1086
1087auto StringTableOrErr =
1088 getObject<char>(Obj->Data, Obj->base() +Offset,Size);
1089if (!StringTableOrErr)
1090returncreateError(toString(StringTableOrErr.takeError()) +
1091": string table with offset 0x" +
1092Twine::utohexstr(Offset) +" and size 0x" +
1093Twine::utohexstr(Size) +
1094" goes past the end of the file");
1095
1096constchar *StringTablePtr = StringTableOrErr.get();
1097if (StringTablePtr[Size - 1] !='\0')
1098returnerrorCodeToError(object_error::string_table_non_null_end);
1099
1100return XCOFFStringTable{Size, StringTablePtr};
1101}
1102
1103// This function returns the import file table. Each entry in the import file
1104// table consists of: "path_name\0base_name\0archive_member_name\0".
1105Expected<StringRef>XCOFFObjectFile::getImportFileTable() const{
1106Expected<uintptr_t> LoaderSectionAddrOrError =
1107 getSectionFileOffsetToRawData(XCOFF::STYP_LOADER);
1108if (!LoaderSectionAddrOrError)
1109return LoaderSectionAddrOrError.takeError();
1110
1111 uintptr_t LoaderSectionAddr = LoaderSectionAddrOrError.get();
1112if (!LoaderSectionAddr)
1113returnStringRef();
1114
1115uint64_t OffsetToImportFileTable = 0;
1116uint64_t LengthOfImportFileTable = 0;
1117if (is64Bit()) {
1118constLoaderSectionHeader64 *LoaderSec64 =
1119 viewAs<LoaderSectionHeader64>(LoaderSectionAddr);
1120 OffsetToImportFileTable = LoaderSec64->OffsetToImpid;
1121 LengthOfImportFileTable = LoaderSec64->LengthOfImpidStrTbl;
1122 }else {
1123constLoaderSectionHeader32 *LoaderSec32 =
1124 viewAs<LoaderSectionHeader32>(LoaderSectionAddr);
1125 OffsetToImportFileTable = LoaderSec32->OffsetToImpid;
1126 LengthOfImportFileTable = LoaderSec32->LengthOfImpidStrTbl;
1127 }
1128
1129auto ImportTableOrErr = getObject<char>(
1130Data,
1131reinterpret_cast<void *>(LoaderSectionAddr + OffsetToImportFileTable),
1132 LengthOfImportFileTable);
1133if (!ImportTableOrErr)
1134returncreateError(
1135toString(ImportTableOrErr.takeError()) +
1136": import file table with offset 0x" +
1137Twine::utohexstr(LoaderSectionAddr + OffsetToImportFileTable) +
1138" and size 0x" +Twine::utohexstr(LengthOfImportFileTable) +
1139" goes past the end of the file");
1140
1141constchar *ImportTablePtr = ImportTableOrErr.get();
1142if (ImportTablePtr[LengthOfImportFileTable - 1] !='\0')
1143returncreateError(
1144": import file name table with offset 0x" +
1145Twine::utohexstr(LoaderSectionAddr + OffsetToImportFileTable) +
1146" and size 0x" +Twine::utohexstr(LengthOfImportFileTable) +
1147" must end with a null terminator");
1148
1149returnStringRef(ImportTablePtr, LengthOfImportFileTable);
1150}
1151
1152Expected<std::unique_ptr<XCOFFObjectFile>>
1153XCOFFObjectFile::create(unsignedType,MemoryBufferRef MBR) {
1154// Can't use std::make_unique because of the private constructor.
1155 std::unique_ptr<XCOFFObjectFile> Obj;
1156 Obj.reset(newXCOFFObjectFile(Type, MBR));
1157
1158uint64_t CurOffset = 0;
1159constauto *Base = Obj->base();
1160MemoryBufferRefData = Obj->Data;
1161
1162// Parse file header.
1163auto FileHeaderOrErr =
1164 getObject<void>(Data,Base + CurOffset, Obj->getFileHeaderSize());
1165if (ErrorE = FileHeaderOrErr.takeError())
1166return std::move(E);
1167 Obj->FileHeader = FileHeaderOrErr.get();
1168
1169 CurOffset += Obj->getFileHeaderSize();
1170
1171if (Obj->getOptionalHeaderSize()) {
1172auto AuxiliaryHeaderOrErr =
1173 getObject<void>(Data,Base + CurOffset, Obj->getOptionalHeaderSize());
1174if (ErrorE = AuxiliaryHeaderOrErr.takeError())
1175return std::move(E);
1176 Obj->AuxiliaryHeader = AuxiliaryHeaderOrErr.get();
1177 }
1178
1179 CurOffset += Obj->getOptionalHeaderSize();
1180
1181// Parse the section header table if it is present.
1182if (Obj->getNumberOfSections()) {
1183uint64_t SectionHeadersSize =
1184 Obj->getNumberOfSections() * Obj->getSectionHeaderSize();
1185auto SecHeadersOrErr =
1186 getObject<void>(Data,Base + CurOffset, SectionHeadersSize);
1187if (!SecHeadersOrErr)
1188returncreateError(toString(SecHeadersOrErr.takeError()) +
1189": section headers with offset 0x" +
1190Twine::utohexstr(CurOffset) +" and size 0x" +
1191Twine::utohexstr(SectionHeadersSize) +
1192" go past the end of the file");
1193
1194 Obj->SectionHeaderTable = SecHeadersOrErr.get();
1195 }
1196
1197constuint32_t NumberOfSymbolTableEntries =
1198 Obj->getNumberOfSymbolTableEntries();
1199
1200// If there is no symbol table we are done parsing the memory buffer.
1201if (NumberOfSymbolTableEntries == 0)
1202return std::move(Obj);
1203
1204// Parse symbol table.
1205 CurOffset = Obj->is64Bit() ? Obj->getSymbolTableOffset64()
1206 : Obj->getSymbolTableOffset32();
1207constuint64_t SymbolTableSize =
1208static_cast<uint64_t>(XCOFF::SymbolTableEntrySize) *
1209 NumberOfSymbolTableEntries;
1210auto SymTableOrErr =
1211 getObject<void *>(Data,Base + CurOffset, SymbolTableSize);
1212if (!SymTableOrErr)
1213returncreateError(
1214toString(SymTableOrErr.takeError()) +": symbol table with offset 0x" +
1215Twine::utohexstr(CurOffset) +" and size 0x" +
1216Twine::utohexstr(SymbolTableSize) +" goes past the end of the file");
1217
1218 Obj->SymbolTblPtr = SymTableOrErr.get();
1219 CurOffset += SymbolTableSize;
1220
1221// Parse String table.
1222 Expected<XCOFFStringTable> StringTableOrErr =
1223 parseStringTable(Obj.get(), CurOffset);
1224if (ErrorE = StringTableOrErr.takeError())
1225return std::move(E);
1226 Obj->StringTable = StringTableOrErr.get();
1227
1228return std::move(Obj);
1229}
1230
1231Expected<std::unique_ptr<ObjectFile>>
1232ObjectFile::createXCOFFObjectFile(MemoryBufferRef MemBufRef,
1233unsigned FileType) {
1234return XCOFFObjectFile::create(FileType, MemBufRef);
1235}
1236
1237std::optional<StringRef>XCOFFObjectFile::tryGetCPUName() const{
1238returnStringRef("future");
1239}
1240
1241Expected<bool>XCOFFSymbolRef::isFunction() const{
1242if (!isCsectSymbol())
1243returnfalse;
1244
1245if (getSymbolType() &FunctionSym)
1246returntrue;
1247
1248Expected<XCOFFCsectAuxRef> ExpCsectAuxEnt =getXCOFFCsectAuxRef();
1249if (!ExpCsectAuxEnt)
1250return ExpCsectAuxEnt.takeError();
1251
1252constXCOFFCsectAuxRef CsectAuxRef = ExpCsectAuxEnt.get();
1253
1254if (CsectAuxRef.getStorageMappingClass() !=XCOFF::XMC_PR &&
1255 CsectAuxRef.getStorageMappingClass() !=XCOFF::XMC_GL)
1256returnfalse;
1257
1258// A function definition should not be a common type symbol or an external
1259// symbol.
1260if (CsectAuxRef.getSymbolType() ==XCOFF::XTY_CM ||
1261 CsectAuxRef.getSymbolType() ==XCOFF::XTY_ER)
1262returnfalse;
1263
1264// If the next symbol is an XTY_LD type symbol with the same address, this
1265// XTY_SD symbol is not a function. Otherwise this is a function symbol for
1266// -ffunction-sections.
1267if (CsectAuxRef.getSymbolType() ==XCOFF::XTY_SD) {
1268// If this is a csect with size 0, it won't be a function definition.
1269// This is used to work around the fact that LLVM always generates below
1270// symbol for -ffunction-sections:
1271// m 0x00000000 .text 1 unamex **No Symbol**
1272// a4 0x00000000 0 0 SD PR 0 0
1273// FIXME: remove or replace this meaningless symbol.
1274if (getSize() == 0)
1275returnfalse;
1276
1277xcoff_symbol_iterator NextIt(this);
1278// If this is the last main symbol table entry, there won't be an XTY_LD
1279// type symbol below.
1280if (++NextIt == getObject()->symbol_end())
1281returntrue;
1282
1283if (cantFail(getAddress()) !=cantFail(NextIt->getAddress()))
1284returntrue;
1285
1286// Check next symbol is XTY_LD. If so, this symbol is not a function.
1287Expected<XCOFFCsectAuxRef> NextCsectAuxEnt = NextIt->getXCOFFCsectAuxRef();
1288if (!NextCsectAuxEnt)
1289return NextCsectAuxEnt.takeError();
1290
1291if (NextCsectAuxEnt.get().getSymbolType() ==XCOFF::XTY_LD)
1292returnfalse;
1293
1294returntrue;
1295 }
1296
1297if (CsectAuxRef.getSymbolType() ==XCOFF::XTY_LD)
1298returntrue;
1299
1300returncreateError(
1301"symbol csect aux entry with index " +
1302Twine(getObject()->getSymbolIndex(CsectAuxRef.getEntryAddress())) +
1303" has invalid symbol type " +
1304Twine::utohexstr(CsectAuxRef.getSymbolType()));
1305}
1306
1307boolXCOFFSymbolRef::isCsectSymbol() const{
1308XCOFF::StorageClass SC =getStorageClass();
1309return (SC ==XCOFF::C_EXT || SC ==XCOFF::C_WEAKEXT ||
1310 SC ==XCOFF::C_HIDEXT);
1311}
1312
1313Expected<XCOFFCsectAuxRef>XCOFFSymbolRef::getXCOFFCsectAuxRef() const{
1314assert(isCsectSymbol() &&
1315"Calling csect symbol interface with a non-csect symbol.");
1316
1317uint8_t NumberOfAuxEntries =getNumberOfAuxEntries();
1318
1319Expected<StringRef> NameOrErr =getName();
1320if (auto Err = NameOrErr.takeError())
1321return std::move(Err);
1322
1323uint32_t SymbolIdx = getObject()->getSymbolIndex(getEntryAddress());
1324if (!NumberOfAuxEntries) {
1325returncreateError("csect symbol \"" + *NameOrErr +"\" with index " +
1326Twine(SymbolIdx) +" contains no auxiliary entry");
1327 }
1328
1329if (!getObject()->is64Bit()) {
1330// In XCOFF32, the csect auxilliary entry is always the last auxiliary
1331// entry for the symbol.
1332 uintptr_t AuxAddr =XCOFFObjectFile::getAdvancedSymbolEntryAddress(
1333getEntryAddress(), NumberOfAuxEntries);
1334returnXCOFFCsectAuxRef(viewAs<XCOFFCsectAuxEnt32>(AuxAddr));
1335 }
1336
1337// XCOFF64 uses SymbolAuxType to identify the auxiliary entry type.
1338// We need to iterate through all the auxiliary entries to find it.
1339for (uint8_tIndex = NumberOfAuxEntries;Index > 0; --Index) {
1340 uintptr_t AuxAddr =XCOFFObjectFile::getAdvancedSymbolEntryAddress(
1341getEntryAddress(),Index);
1342if (*getObject()->getSymbolAuxType(AuxAddr) ==
1343XCOFF::SymbolAuxType::AUX_CSECT) {
1344#ifndef NDEBUG
1345 getObject()->checkSymbolEntryPointer(AuxAddr);
1346#endif
1347returnXCOFFCsectAuxRef(viewAs<XCOFFCsectAuxEnt64>(AuxAddr));
1348 }
1349 }
1350
1351returncreateError(
1352"a csect auxiliary entry has not been found for symbol \"" + *NameOrErr +
1353"\" with index " +Twine(SymbolIdx));
1354}
1355
1356Expected<StringRef>XCOFFSymbolRef::getName() const{
1357// A storage class value with the high-order bit on indicates that the name is
1358// a symbolic debugger stabstring.
1359if (getStorageClass() & 0x80)
1360returnStringRef("Unimplemented Debug Name");
1361
1362if (!getObject()->is64Bit()) {
1363if (getSymbol32()->NameInStrTbl.Magic !=
1364XCOFFSymbolRef::NAME_IN_STR_TBL_MAGIC)
1365returngenerateXCOFFFixedNameStringRef(getSymbol32()->SymbolName);
1366
1367return getObject()->getStringTableEntry(getSymbol32()->NameInStrTbl.Offset);
1368 }
1369
1370return getObject()->getStringTableEntry(getSymbol64()->Offset);
1371}
1372
1373// Explicitly instantiate template classes.
1374templatestructXCOFFSectionHeader<XCOFFSectionHeader32>;
1375templatestructXCOFFSectionHeader<XCOFFSectionHeader64>;
1376
1377templatestructXCOFFRelocation<llvm::support::ubig32_t>;
1378templatestructXCOFFRelocation<llvm::support::ubig64_t>;
1379
1380template LLVM_EXPORT_TEMPLATE
1381llvm::Expected<llvm::ArrayRef<llvm::object::XCOFFRelocation64>>
1382llvm::object::XCOFFObjectFile::relocations<
1383llvm::object::XCOFFSectionHeader64,llvm::object::XCOFFRelocation64>(
1384llvm::object::XCOFFSectionHeader64const &)const;
1385template LLVM_EXPORT_TEMPLATE
1386llvm::Expected<llvm::ArrayRef<llvm::object::XCOFFRelocation32>>
1387llvm::object::XCOFFObjectFile::relocations<
1388llvm::object::XCOFFSectionHeader32,llvm::object::XCOFFRelocation32>(
1389llvm::object::XCOFFSectionHeader32const &)const;
1390
1391booldoesXCOFFTracebackTableBegin(ArrayRef<uint8_t> Bytes) {
1392if (Bytes.size() < 4)
1393returnfalse;
1394
1395returnsupport::endian::read32be(Bytes.data()) == 0;
1396}
1397
1398#define GETVALUEWITHMASK(X) (Data & (TracebackTable::X))
1399#define GETVALUEWITHMASKSHIFT(X, S) \
1400 ((Data & (TracebackTable::X)) >> (TracebackTable::S))
1401
1402Expected<TBVectorExt>TBVectorExt::create(StringRef TBvectorStrRef) {
1403Error Err =Error::success();
1404TBVectorExt TBTVecExt(TBvectorStrRef, Err);
1405if (Err)
1406return std::move(Err);
1407return TBTVecExt;
1408}
1409
1410TBVectorExt::TBVectorExt(StringRef TBvectorStrRef,Error &Err) {
1411constuint8_t *Ptr =reinterpret_cast<constuint8_t *>(TBvectorStrRef.data());
1412 Data =support::endian::read16be(Ptr);
1413uint32_t VecParmsTypeValue =support::endian::read32be(Ptr + 2);
1414unsigned ParmsNum =
1415GETVALUEWITHMASKSHIFT(NumberOfVectorParmsMask, NumberOfVectorParmsShift);
1416
1417ErrorAsOutParameter EAO(Err);
1418Expected<SmallString<32>> VecParmsTypeOrError =
1419parseVectorParmsType(VecParmsTypeValue, ParmsNum);
1420if (!VecParmsTypeOrError)
1421 Err = VecParmsTypeOrError.takeError();
1422else
1423 VecParmsInfo = VecParmsTypeOrError.get();
1424}
1425
1426uint8_tTBVectorExt::getNumberOfVRSaved() const{
1427returnGETVALUEWITHMASKSHIFT(NumberOfVRSavedMask, NumberOfVRSavedShift);
1428}
1429
1430boolTBVectorExt::isVRSavedOnStack() const{
1431returnGETVALUEWITHMASK(IsVRSavedOnStackMask);
1432}
1433
1434boolTBVectorExt::hasVarArgs() const{
1435returnGETVALUEWITHMASK(HasVarArgsMask);
1436}
1437
1438uint8_tTBVectorExt::getNumberOfVectorParms() const{
1439returnGETVALUEWITHMASKSHIFT(NumberOfVectorParmsMask,
1440 NumberOfVectorParmsShift);
1441}
1442
1443boolTBVectorExt::hasVMXInstruction() const{
1444returnGETVALUEWITHMASK(HasVMXInstructionMask);
1445}
1446#undef GETVALUEWITHMASK
1447#undef GETVALUEWITHMASKSHIFT
1448
1449Expected<XCOFFTracebackTable>
1450XCOFFTracebackTable::create(constuint8_t *Ptr,uint64_t &Size,bool Is64Bit) {
1451Error Err =Error::success();
1452XCOFFTracebackTable TBT(Ptr,Size, Err, Is64Bit);
1453if (Err)
1454return std::move(Err);
1455return TBT;
1456}
1457
1458XCOFFTracebackTable::XCOFFTracebackTable(constuint8_t *Ptr,uint64_t &Size,
1459Error &Err,bool Is64Bit)
1460 : TBPtr(Ptr), Is64BitObj(Is64Bit) {
1461ErrorAsOutParameter EAO(Err);
1462DataExtractor DE(ArrayRef<uint8_t>(Ptr,Size),/*IsLittleEndian=*/false,
1463/*AddressSize=*/0);
1464DataExtractor::Cursor Cur(/*Offset=*/0);
1465
1466// Skip 8 bytes of mandatory fields.
1467 DE.getU64(Cur);
1468
1469unsigned FixedParmsNum =getNumberOfFixedParms();
1470unsigned FloatingParmsNum =getNumberOfFPParms();
1471uint32_t ParamsTypeValue = 0;
1472
1473// Begin to parse optional fields.
1474if (Cur && (FixedParmsNum + FloatingParmsNum) > 0)
1475 ParamsTypeValue = DE.getU32(Cur);
1476
1477if (Cur &&hasTraceBackTableOffset())
1478 TraceBackTableOffset = DE.getU32(Cur);
1479
1480if (Cur &&isInterruptHandler())
1481 HandlerMask = DE.getU32(Cur);
1482
1483if (Cur &&hasControlledStorage()) {
1484 NumOfCtlAnchors = DE.getU32(Cur);
1485if (Cur && NumOfCtlAnchors) {
1486SmallVector<uint32_t, 8> Disp;
1487 Disp.reserve(*NumOfCtlAnchors);
1488for (uint32_tI = 0;I < NumOfCtlAnchors && Cur; ++I)
1489 Disp.push_back(DE.getU32(Cur));
1490if (Cur)
1491 ControlledStorageInfoDisp = std::move(Disp);
1492 }
1493 }
1494
1495if (Cur &&isFuncNamePresent()) {
1496uint16_t FunctionNameLen = DE.getU16(Cur);
1497if (Cur)
1498 FunctionName = DE.getBytes(Cur, FunctionNameLen);
1499 }
1500
1501if (Cur &&isAllocaUsed())
1502 AllocaRegister = DE.getU8(Cur);
1503
1504unsigned VectorParmsNum = 0;
1505if (Cur &&hasVectorInfo()) {
1506 StringRef VectorExtRef = DE.getBytes(Cur, 6);
1507if (Cur) {
1508 Expected<TBVectorExt> TBVecExtOrErr =TBVectorExt::create(VectorExtRef);
1509if (!TBVecExtOrErr) {
1510 Err = TBVecExtOrErr.takeError();
1511return;
1512 }
1513 VecExt = TBVecExtOrErr.get();
1514 VectorParmsNum = VecExt->getNumberOfVectorParms();
1515// Skip two bytes of padding after vector info.
1516 DE.skip(Cur, 2);
1517 }
1518 }
1519
1520// As long as there is no fixed-point or floating-point parameter, this
1521// field remains not present even when hasVectorInfo gives true and
1522// indicates the presence of vector parameters.
1523if (Cur && (FixedParmsNum + FloatingParmsNum) > 0) {
1524 Expected<SmallString<32>> ParmsTypeOrError =
1525hasVectorInfo()
1526 ?parseParmsTypeWithVecInfo(ParamsTypeValue, FixedParmsNum,
1527 FloatingParmsNum, VectorParmsNum)
1528 :parseParmsType(ParamsTypeValue, FixedParmsNum, FloatingParmsNum);
1529
1530if (!ParmsTypeOrError) {
1531 Err = ParmsTypeOrError.takeError();
1532return;
1533 }
1534 ParmsType = ParmsTypeOrError.get();
1535 }
1536
1537if (Cur &&hasExtensionTable()) {
1538 ExtensionTable = DE.getU8(Cur);
1539
1540if (*ExtensionTable & ExtendedTBTableFlag::TB_EH_INFO) {
1541// eh_info displacement must be 4-byte aligned.
1542 Cur.seek(alignTo(Cur.tell(), 4));
1543 EhInfoDisp = Is64BitObj ? DE.getU64(Cur) : DE.getU32(Cur);
1544 }
1545 }
1546if (!Cur)
1547 Err = Cur.takeError();
1548
1549Size = Cur.tell();
1550}
1551
1552#define GETBITWITHMASK(P, X) \
1553 (support::endian::read32be(TBPtr + (P)) & (TracebackTable::X))
1554#define GETBITWITHMASKSHIFT(P, X, S) \
1555 ((support::endian::read32be(TBPtr + (P)) & (TracebackTable::X)) >> \
1556 (TracebackTable::S))
1557
1558uint8_tXCOFFTracebackTable::getVersion() const{
1559returnGETBITWITHMASKSHIFT(0, VersionMask, VersionShift);
1560}
1561
1562uint8_tXCOFFTracebackTable::getLanguageID() const{
1563returnGETBITWITHMASKSHIFT(0, LanguageIdMask, LanguageIdShift);
1564}
1565
1566boolXCOFFTracebackTable::isGlobalLinkage() const{
1567returnGETBITWITHMASK(0, IsGlobaLinkageMask);
1568}
1569
1570boolXCOFFTracebackTable::isOutOfLineEpilogOrPrologue() const{
1571returnGETBITWITHMASK(0, IsOutOfLineEpilogOrPrologueMask);
1572}
1573
1574boolXCOFFTracebackTable::hasTraceBackTableOffset() const{
1575returnGETBITWITHMASK(0, HasTraceBackTableOffsetMask);
1576}
1577
1578boolXCOFFTracebackTable::isInternalProcedure() const{
1579returnGETBITWITHMASK(0, IsInternalProcedureMask);
1580}
1581
1582boolXCOFFTracebackTable::hasControlledStorage() const{
1583returnGETBITWITHMASK(0, HasControlledStorageMask);
1584}
1585
1586boolXCOFFTracebackTable::isTOCless() const{
1587returnGETBITWITHMASK(0, IsTOClessMask);
1588}
1589
1590boolXCOFFTracebackTable::isFloatingPointPresent() const{
1591returnGETBITWITHMASK(0, IsFloatingPointPresentMask);
1592}
1593
1594boolXCOFFTracebackTable::isFloatingPointOperationLogOrAbortEnabled() const{
1595returnGETBITWITHMASK(0, IsFloatingPointOperationLogOrAbortEnabledMask);
1596}
1597
1598boolXCOFFTracebackTable::isInterruptHandler() const{
1599returnGETBITWITHMASK(0, IsInterruptHandlerMask);
1600}
1601
1602boolXCOFFTracebackTable::isFuncNamePresent() const{
1603returnGETBITWITHMASK(0, IsFunctionNamePresentMask);
1604}
1605
1606boolXCOFFTracebackTable::isAllocaUsed() const{
1607returnGETBITWITHMASK(0, IsAllocaUsedMask);
1608}
1609
1610uint8_tXCOFFTracebackTable::getOnConditionDirective() const{
1611returnGETBITWITHMASKSHIFT(0, OnConditionDirectiveMask,
1612 OnConditionDirectiveShift);
1613}
1614
1615boolXCOFFTracebackTable::isCRSaved() const{
1616returnGETBITWITHMASK(0, IsCRSavedMask);
1617}
1618
1619boolXCOFFTracebackTable::isLRSaved() const{
1620returnGETBITWITHMASK(0, IsLRSavedMask);
1621}
1622
1623boolXCOFFTracebackTable::isBackChainStored() const{
1624returnGETBITWITHMASK(4, IsBackChainStoredMask);
1625}
1626
1627boolXCOFFTracebackTable::isFixup() const{
1628returnGETBITWITHMASK(4, IsFixupMask);
1629}
1630
1631uint8_tXCOFFTracebackTable::getNumOfFPRsSaved() const{
1632returnGETBITWITHMASKSHIFT(4, FPRSavedMask, FPRSavedShift);
1633}
1634
1635boolXCOFFTracebackTable::hasExtensionTable() const{
1636returnGETBITWITHMASK(4, HasExtensionTableMask);
1637}
1638
1639boolXCOFFTracebackTable::hasVectorInfo() const{
1640returnGETBITWITHMASK(4, HasVectorInfoMask);
1641}
1642
1643uint8_tXCOFFTracebackTable::getNumOfGPRsSaved() const{
1644returnGETBITWITHMASKSHIFT(4, GPRSavedMask, GPRSavedShift);
1645}
1646
1647uint8_tXCOFFTracebackTable::getNumberOfFixedParms() const{
1648returnGETBITWITHMASKSHIFT(4, NumberOfFixedParmsMask,
1649 NumberOfFixedParmsShift);
1650}
1651
1652uint8_tXCOFFTracebackTable::getNumberOfFPParms() const{
1653returnGETBITWITHMASKSHIFT(4, NumberOfFloatingPointParmsMask,
1654 NumberOfFloatingPointParmsShift);
1655}
1656
1657boolXCOFFTracebackTable::hasParmsOnStack() const{
1658returnGETBITWITHMASK(4, HasParmsOnStackMask);
1659}
1660
1661#undef GETBITWITHMASK
1662#undef GETBITWITHMASKSHIFT
1663}// namespace object
1664}// namespace llvm
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Info
Analysis containing CSE Info
Definition:CSEInfo.cpp:27
Compiler.h
DataExtractor.h
Shdr
Elf_Shdr Shdr
Definition:ELFObjHandler.cpp:78
Addr
uint64_t Addr
Definition:ELFObjHandler.cpp:79
Name
std::string Name
Definition:ELFObjHandler.cpp:77
Index
uint32_t Index
Definition:ELFObjHandler.cpp:83
Size
uint64_t Size
Definition:ELFObjHandler.cpp:81
Sym
Symbol * Sym
Definition:ELF_riscv.cpp:479
I
#define I(x, y, z)
Definition:MD5.cpp:58
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringSwitch.h
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
SubtargetFeature.h
Ptr
@ Ptr
Definition:TargetLibraryInfo.cpp:77
is64Bit
static bool is64Bit(const char *name)
Definition:X86Disassembler.cpp:1085
GETVALUEWITHMASKSHIFT
#define GETVALUEWITHMASKSHIFT(X, S)
Definition:XCOFFObjectFile.cpp:1399
GETVALUEWITHMASK
#define GETVALUEWITHMASK(X)
Definition:XCOFFObjectFile.cpp:1398
GETBITWITHMASKSHIFT
#define GETBITWITHMASKSHIFT(P, X, S)
Definition:XCOFFObjectFile.cpp:1554
GETBITWITHMASK
#define GETBITWITHMASK(P, X)
Definition:XCOFFObjectFile.cpp:1552
ECASE
#define ECASE(Value, String)
XCOFFObjectFile.h
T
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition:ArrayRef.h:168
llvm::ArrayRef::data
const T * data() const
Definition:ArrayRef.h:165
llvm::DataExtractor::Cursor
A class representing a position in a DataExtractor, as well as any error encountered during extractio...
Definition:DataExtractor.h:54
llvm::DataExtractor
Definition:DataExtractor.h:41
llvm::ErrorAsOutParameter
Helper for Errors used as out-parameters.
Definition:Error.h:1130
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition:Error.h:160
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition:Error.h:337
llvm::Expected
Tagged union holding either a T or a Error.
Definition:Error.h:481
llvm::Expected::takeError
Error takeError()
Take ownership of the stored error.
Definition:Error.h:608
llvm::Expected::get
reference get()
Returns a reference to the stored T value.
Definition:Error.h:578
llvm::MemoryBufferRef
Definition:MemoryBufferRef.h:22
llvm::SmallString
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition:SmallString.h:26
llvm::SmallString::c_str
const char * c_str()
Definition:SmallString.h:259
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition:SmallVector.h:573
llvm::SmallVectorImpl::reserve
void reserve(size_type N)
Definition:SmallVector.h:663
llvm::SmallVectorTemplateBase::push_back
void push_back(const T &Elt)
Definition:SmallVector.h:413
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition:SmallVector.h:1196
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::StringRef::begin
iterator begin() const
Definition:StringRef.h:116
llvm::StringRef::data
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition:StringRef.h:144
llvm::StringRef::end
iterator end() const
Definition:StringRef.h:118
llvm::StringSwitch
A switch()-like statement whose cases are string literals.
Definition:StringSwitch.h:44
llvm::StringSwitch::Case
StringSwitch & Case(StringLiteral S, T Value)
Definition:StringSwitch.h:69
llvm::StringSwitch::Default
R Default(T Value)
Definition:StringSwitch.h:182
llvm::StringTable
A table of densely packed, null-terminated strings indexed by offset.
Definition:StringTable.h:33
llvm::SubtargetFeatures
Manages the enabling and disabling of subtarget specific features.
Definition:SubtargetFeature.h:174
llvm::Triple::ArchType
ArchType
Definition:Triple.h:46
llvm::Triple::ppc64
@ ppc64
Definition:Triple.h:71
llvm::Triple::ppc
@ ppc
Definition:Triple.h:69
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition:Twine.h:81
llvm::Twine::utohexstr
static Twine utohexstr(const uint64_t &Val)
Definition:Twine.h:416
llvm::Twine::toVector
void toVector(SmallVectorImpl< char > &Out) const
Append the concatenated string into the given SmallString or SmallVector.
Definition:Twine.cpp:32
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:Type.h:45
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition:iterator_range.h:42
llvm::object::BasicSymbolRef::SF_Global
@ SF_Global
Definition:SymbolicFile.h:111
llvm::object::BasicSymbolRef::SF_Hidden
@ SF_Hidden
Definition:SymbolicFile.h:120
llvm::object::BasicSymbolRef::SF_Exported
@ SF_Exported
Definition:SymbolicFile.h:116
llvm::object::BasicSymbolRef::SF_Common
@ SF_Common
Definition:SymbolicFile.h:114
llvm::object::BasicSymbolRef::SF_Weak
@ SF_Weak
Definition:SymbolicFile.h:112
llvm::object::BasicSymbolRef::SF_Absolute
@ SF_Absolute
Definition:SymbolicFile.h:113
llvm::object::BasicSymbolRef::SF_Undefined
@ SF_Undefined
Definition:SymbolicFile.h:110
llvm::object::BasicSymbolRef::SF_None
@ SF_None
Definition:SymbolicFile.h:109
llvm::object::Binary::Data
MemoryBufferRef Data
Definition:Binary.h:37
llvm::object::Binary::ID_XCOFF32
@ ID_XCOFF32
Definition:Binary.h:59
llvm::object::Binary::ID_XCOFF64
@ ID_XCOFF64
Definition:Binary.h:60
llvm::object::Binary::getType
unsigned int getType() const
Definition:Binary.h:104
llvm::object::Binary::checkOffset
static Error checkOffset(MemoryBufferRef M, uintptr_t Addr, const uint64_t Size)
Definition:Binary.h:175
llvm::object::ObjectFile
This class is the base class for all object file types.
Definition:ObjectFile.h:229
llvm::object::ObjectFile::RelocationRef
friend class RelocationRef
Definition:ObjectFile.h:287
llvm::object::ObjectFile::SymbolRef
friend class SymbolRef
Definition:ObjectFile.h:247
llvm::object::ObjectFile::SectionRef
friend class SectionRef
Definition:ObjectFile.h:261
llvm::object::ObjectFile::base
const uint8_t * base() const
Definition:ObjectFile.h:235
llvm::object::ObjectFile::createXCOFFObjectFile
static Expected< std::unique_ptr< ObjectFile > > createXCOFFObjectFile(MemoryBufferRef Object, unsigned FileType)
Definition:XCOFFObjectFile.cpp:1232
llvm::object::SymbolRef
This is a value type class that represents a single symbol in the list of symbols in the object file.
Definition:ObjectFile.h:168
llvm::object::SymbolRef::ST_Other
@ ST_Other
Definition:ObjectFile.h:174
llvm::object::SymbolRef::ST_Function
@ ST_Function
Definition:ObjectFile.h:178
llvm::object::SymbolRef::ST_File
@ ST_File
Definition:ObjectFile.h:177
llvm::object::SymbolRef::ST_Data
@ ST_Data
Definition:ObjectFile.h:175
llvm::object::SymbolRef::ST_Debug
@ ST_Debug
Definition:ObjectFile.h:176
llvm::object::SymbolRef::getAddress
Expected< uint64_t > getAddress() const
Returns the symbol virtual address (i.e.
Definition:ObjectFile.h:464
llvm::object::TBVectorExt
Definition:XCOFFObjectFile.h:883
llvm::object::TBVectorExt::getNumberOfVectorParms
uint8_t getNumberOfVectorParms() const
Definition:XCOFFObjectFile.cpp:1438
llvm::object::TBVectorExt::create
static Expected< TBVectorExt > create(StringRef TBvectorStrRef)
Definition:XCOFFObjectFile.cpp:1402
llvm::object::TBVectorExt::isVRSavedOnStack
bool isVRSavedOnStack() const
Definition:XCOFFObjectFile.cpp:1430
llvm::object::TBVectorExt::getNumberOfVRSaved
uint8_t getNumberOfVRSaved() const
Definition:XCOFFObjectFile.cpp:1426
llvm::object::TBVectorExt::hasVarArgs
bool hasVarArgs() const
Definition:XCOFFObjectFile.cpp:1434
llvm::object::TBVectorExt::hasVMXInstruction
bool hasVMXInstruction() const
Definition:XCOFFObjectFile.cpp:1443
llvm::object::XCOFFCsectAuxRef
Definition:XCOFFObjectFile.h:350
llvm::object::XCOFFCsectAuxRef::getStorageMappingClass
XCOFF::StorageMappingClass getStorageMappingClass() const
Definition:XCOFFObjectFile.h:387
llvm::object::XCOFFCsectAuxRef::getSymbolType
uint8_t getSymbolType() const
Definition:XCOFFObjectFile.h:401
llvm::object::XCOFFCsectAuxRef::getEntryAddress
uintptr_t getEntryAddress() const
Definition:XCOFFObjectFile.h:391
llvm::object::XCOFFCsectAuxRef::getSectionOrLength
uint64_t getSectionOrLength() const
Definition:XCOFFObjectFile.h:364
llvm::object::XCOFFObjectFile
Definition:XCOFFObjectFile.h:532
llvm::object::XCOFFObjectFile::getSectionByNum
Expected< DataRefImpl > getSectionByNum(int16_t Num) const
Definition:XCOFFObjectFile.cpp:794
llvm::object::XCOFFObjectFile::getBytesInAddress
uint8_t getBytesInAddress() const override
The number of bytes used to represent an address in this object file format.
Definition:XCOFFObjectFile.cpp:720
llvm::object::XCOFFObjectFile::getPointerToSymbolTable
const void * getPointerToSymbolTable() const
Definition:XCOFFObjectFile.h:650
llvm::object::XCOFFObjectFile::section_begin
section_iterator section_begin() const override
Definition:XCOFFObjectFile.cpp:707
llvm::object::XCOFFObjectFile::getSymbolIndex
uint32_t getSymbolIndex(uintptr_t SymEntPtr) const
Definition:XCOFFObjectFile.cpp:916
llvm::object::XCOFFObjectFile::section_rel_end
relocation_iterator section_rel_end(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:545
llvm::object::XCOFFObjectFile::getCFileName
Expected< StringRef > getCFileName(const XCOFFFileAuxEnt *CFileEntPtr) const
Definition:XCOFFObjectFile.cpp:254
llvm::object::XCOFFObjectFile::getSymbolEntryAddressByIndex
uintptr_t getSymbolEntryAddressByIndex(uint32_t SymbolTableIndex) const
Definition:XCOFFObjectFile.cpp:941
llvm::object::XCOFFObjectFile::isDebugSection
bool isDebugSection(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:509
llvm::object::XCOFFObjectFile::auxiliaryHeader32
const XCOFFAuxiliaryHeader32 * auxiliaryHeader32() const
Definition:XCOFFObjectFile.cpp:190
llvm::object::XCOFFObjectFile::sections32
ArrayRef< XCOFFSectionHeader32 > sections32() const
Definition:XCOFFObjectFile.cpp:988
llvm::object::XCOFFObjectFile::getRelocationTypeName
void getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl< char > &Result) const override
Definition:XCOFFObjectFile.cpp:637
llvm::object::XCOFFObjectFile::fileHeader64
const XCOFFFileHeader64 * fileHeader64() const
Definition:XCOFFObjectFile.cpp:185
llvm::object::XCOFFObjectFile::sections64
ArrayRef< XCOFFSectionHeader64 > sections64() const
Definition:XCOFFObjectFile.cpp:981
llvm::object::XCOFFObjectFile::getStartAddress
Expected< uint64_t > getStartAddress() const override
Definition:XCOFFObjectFile.cpp:740
llvm::object::XCOFFObjectFile::getExceptionEntries
Expected< ArrayRef< ExceptEnt > > getExceptionEntries() const
Definition:XCOFFObjectFile.cpp:1045
llvm::object::XCOFFObjectFile::getSymbolFlags
Expected< uint32_t > getSymbolFlags(DataRefImpl Symb) const override
Definition:XCOFFObjectFile.cpp:650
llvm::object::XCOFFObjectFile::getSymbolTableOffset32
uint32_t getSymbolTableOffset32() const
Definition:XCOFFObjectFile.cpp:865
llvm::object::XCOFFObjectFile::isSectionVirtual
bool isSectionVirtual(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:514
llvm::object::XCOFFObjectFile::isSectionBSS
bool isSectionBSS(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:504
llvm::object::XCOFFObjectFile::getSectionName
Expected< StringRef > getSectionName(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:377
llvm::object::XCOFFObjectFile::getNumberOfSymbolTableEntries
uint32_t getNumberOfSymbolTableEntries() const
Definition:XCOFFObjectFile.cpp:890
llvm::object::XCOFFObjectFile::isSectionData
bool isSectionData(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:499
llvm::object::XCOFFObjectFile::getRelocationOffset
uint64_t getRelocationOffset(DataRefImpl Rel) const override
Definition:XCOFFObjectFile.cpp:578
llvm::object::XCOFFObjectFile::getSectionSize
uint64_t getSectionSize(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:399
llvm::object::XCOFFObjectFile::getRelocationSymbol
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override
Definition:XCOFFObjectFile.cpp:611
llvm::object::XCOFFObjectFile::getSectionFlags
int32_t getSectionFlags(DataRefImpl Sec) const
Definition:XCOFFObjectFile.cpp:972
llvm::object::XCOFFObjectFile::getSymbolName
Expected< StringRef > getSymbolName(DataRefImpl Symb) const override
Definition:XCOFFObjectFile.cpp:260
llvm::object::XCOFFObjectFile::fileHeader32
const XCOFFFileHeader32 * fileHeader32() const
Definition:XCOFFObjectFile.cpp:180
llvm::object::XCOFFObjectFile::getRawNumberOfSymbolTableEntries32
int32_t getRawNumberOfSymbolTableEntries32() const
Definition:XCOFFObjectFile.cpp:869
llvm::object::XCOFFObjectFile::getSymbolType
Expected< SymbolRef::Type > getSymbolType(DataRefImpl Symb) const override
Definition:XCOFFObjectFile.cpp:306
llvm::object::XCOFFObjectFile::getNumberOfSymbolTableEntries64
uint32_t getNumberOfSymbolTableEntries64() const
Definition:XCOFFObjectFile.cpp:886
llvm::object::XCOFFObjectFile::xcoff_symbol_iterator_range
iterator_range< xcoff_symbol_iterator > xcoff_symbol_iterator_range
Definition:XCOFFObjectFile.h:591
llvm::object::XCOFFObjectFile::auxiliaryHeader64
const XCOFFAuxiliaryHeader64 * auxiliaryHeader64() const
Definition:XCOFFObjectFile.cpp:195
llvm::object::XCOFFObjectFile::getOptionalHeaderSize
uint16_t getOptionalHeaderSize() const
Definition:XCOFFObjectFile.cpp:860
llvm::object::XCOFFObjectFile::getCommonSymbolSizeImpl
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override
Definition:XCOFFObjectFile.cpp:287
llvm::object::XCOFFObjectFile::toSymbolRef
XCOFFSymbolRef toSymbolRef(DataRefImpl Ref) const
Definition:XCOFFObjectFile.cpp:172
llvm::object::XCOFFObjectFile::symbol_begin
basic_symbol_iterator symbol_begin() const override
Definition:XCOFFObjectFile.cpp:690
llvm::object::XCOFFObjectFile::getSymbolNameByIndex
Expected< StringRef > getSymbolNameByIndex(uint32_t SymbolTableIndex) const
Definition:XCOFFObjectFile.cpp:947
llvm::object::XCOFFObjectFile::getSymbolSectionID
unsigned getSymbolSectionID(SymbolRef Sym) const
Definition:XCOFFObjectFile.cpp:842
llvm::object::XCOFFObjectFile::getSymbolTableOffset64
uint64_t getSymbolTableOffset64() const
Definition:XCOFFObjectFile.cpp:882
llvm::object::XCOFFObjectFile::getSymbolValueImpl
uint64_t getSymbolValueImpl(DataRefImpl Symb) const override
Definition:XCOFFObjectFile.cpp:268
llvm::object::XCOFFObjectFile::getNumberOfSections
uint16_t getNumberOfSections() const
Definition:XCOFFObjectFile.cpp:851
llvm::object::XCOFFObjectFile::moveRelocationNext
void moveRelocationNext(DataRefImpl &Rel) const override
Definition:XCOFFObjectFile.cpp:571
llvm::object::XCOFFObjectFile::getImportFileTable
Expected< StringRef > getImportFileTable() const
Definition:XCOFFObjectFile.cpp:1105
llvm::object::XCOFFObjectFile::getFileFormatName
StringRef getFileFormatName() const override
Definition:XCOFFObjectFile.cpp:722
llvm::object::XCOFFObjectFile::getNumberOfRelocationEntries
Expected< uint32_t > getNumberOfRelocationEntries(const XCOFFSectionHeader< T > &Sec) const
Definition:XCOFFObjectFile.cpp:1000
llvm::object::XCOFFObjectFile::isSectionCompressed
bool isSectionCompressed(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:491
llvm::object::XCOFFObjectFile::getSymbolSectionName
Expected< StringRef > getSymbolSectionName(XCOFFSymbolRef Ref) const
Definition:XCOFFObjectFile.cpp:823
llvm::object::XCOFFObjectFile::getStringTableEntry
Expected< StringRef > getStringTableEntry(uint32_t Offset) const
Definition:XCOFFObjectFile.cpp:229
llvm::object::XCOFFObjectFile::InvalidRelocOffset
static constexpr uint64_t InvalidRelocOffset
Definition:XCOFFObjectFile.h:582
llvm::object::XCOFFObjectFile::getSectionAddress
uint64_t getSectionAddress(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:381
llvm::object::XCOFFObjectFile::getSectionContents
Expected< ArrayRef< uint8_t > > getSectionContents(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:409
llvm::object::XCOFFObjectFile::getFeatures
Expected< SubtargetFeatures > getFeatures() const override
Definition:XCOFFObjectFile.cpp:730
llvm::object::XCOFFObjectFile::section_rel_begin
relocation_iterator section_rel_begin(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:519
llvm::object::XCOFFObjectFile::getMagic
uint16_t getMagic() const
Definition:XCOFFObjectFile.cpp:790
llvm::object::XCOFFObjectFile::getSectionAlignment
uint64_t getSectionAlignment(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:431
llvm::object::XCOFFObjectFile::checkSymbolEntryPointer
void checkSymbolEntryPointer(uintptr_t SymbolEntPtr) const
Definition:XCOFFObjectFile.cpp:901
llvm::object::XCOFFObjectFile::mapDebugSectionName
StringRef mapDebugSectionName(StringRef Name) const override
Maps a debug section name to a standard DWARF section name.
Definition:XCOFFObjectFile.cpp:748
llvm::object::XCOFFObjectFile::symbol_end
basic_symbol_iterator symbol_end() const override
Definition:XCOFFObjectFile.cpp:696
llvm::object::XCOFFObjectFile::getAdvancedSymbolEntryAddress
static uintptr_t getAdvancedSymbolEntryAddress(uintptr_t CurrentAddress, uint32_t Distance)
Definition:XCOFFObjectFile.cpp:128
llvm::object::XCOFFObjectFile::is64Bit
bool is64Bit() const override
Definition:XCOFFObjectFile.cpp:773
llvm::object::XCOFFObjectFile::getSymbolAuxType
const XCOFF::SymbolAuxType * getSymbolAuxType(uintptr_t AuxEntryAddress) const
Definition:XCOFFObjectFile.cpp:134
llvm::object::XCOFFObjectFile::getArch
Triple::ArchType getArch() const override
Definition:XCOFFObjectFile.cpp:726
llvm::object::XCOFFObjectFile::getRelocationType
uint64_t getRelocationType(DataRefImpl Rel) const override
Definition:XCOFFObjectFile.cpp:631
llvm::object::XCOFFObjectFile::tryGetCPUName
std::optional< StringRef > tryGetCPUName() const override
Definition:XCOFFObjectFile.cpp:1237
llvm::object::XCOFFObjectFile::isSectionText
bool isSectionText(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:495
llvm::object::XCOFFObjectFile::getRawData
Expected< StringRef > getRawData(const char *Start, uint64_t Size, StringRef Name) const
Definition:XCOFFObjectFile.cpp:777
llvm::object::XCOFFObjectFile::getFlags
uint16_t getFlags() const
Definition:XCOFFObjectFile.cpp:960
llvm::object::XCOFFObjectFile::getSymbolSize
uint64_t getSymbolSize(DataRefImpl Symb) const
Definition:XCOFFObjectFile.cpp:922
llvm::object::XCOFFObjectFile::getTimeStamp
int32_t getTimeStamp() const
Definition:XCOFFObjectFile.cpp:856
llvm::object::XCOFFObjectFile::moveSymbolNext
void moveSymbolNext(DataRefImpl &Symb) const override
Definition:XCOFFObjectFile.cpp:216
llvm::object::XCOFFObjectFile::relocations
Expected< ArrayRef< Reloc > > relocations(const Shdr &Sec) const
Definition:XCOFFObjectFile.cpp:1018
llvm::object::XCOFFObjectFile::getSectionIndex
uint64_t getSectionIndex(DataRefImpl Sec) const override
Definition:XCOFFObjectFile.cpp:390
llvm::object::XCOFFObjectFile::isRelocatableObject
bool isRelocatableObject() const override
True if this is a relocatable object (.o/.obj).
Definition:XCOFFObjectFile.cpp:734
llvm::object::XCOFFObjectFile::moveSectionNext
void moveSectionNext(DataRefImpl &Sec) const override
Definition:XCOFFObjectFile.cpp:372
llvm::object::XCOFFObjectFile::getSymbolSection
Expected< section_iterator > getSymbolSection(DataRefImpl Symb) const override
Definition:XCOFFObjectFile.cpp:359
llvm::object::XCOFFObjectFile::section_end
section_iterator section_end() const override
Definition:XCOFFObjectFile.cpp:713
llvm::object::XCOFFObjectFile::getLogicalNumberOfSymbolTableEntries32
uint32_t getLogicalNumberOfSymbolTableEntries32() const
Definition:XCOFFObjectFile.cpp:876
llvm::object::XCOFFObjectFile::symbols
xcoff_symbol_iterator_range symbols() const
Definition:XCOFFObjectFile.cpp:703
llvm::object::XCOFFObjectFile::getSymbolAlignment
uint32_t getSymbolAlignment(DataRefImpl Symb) const override
Definition:XCOFFObjectFile.cpp:272
llvm::object::XCOFFObjectFile::getSymbolAddress
Expected< uint64_t > getSymbolAddress(DataRefImpl Symb) const override
Definition:XCOFFObjectFile.cpp:264
llvm::object::XCOFFObjectFile::getStringTable
StringRef getStringTable() const
Definition:XCOFFObjectFile.cpp:246
llvm::object::XCOFFSymbolRef
Definition:XCOFFObjectFile.h:786
llvm::object::XCOFFSymbolRef::getXCOFFCsectAuxRef
Expected< XCOFFCsectAuxRef > getXCOFFCsectAuxRef() const
Definition:XCOFFObjectFile.cpp:1313
llvm::object::XCOFFSymbolRef::isFunction
Expected< bool > isFunction() const
Definition:XCOFFObjectFile.cpp:1241
llvm::object::XCOFFSymbolRef::getSectionNumber
int16_t getSectionNumber() const
Definition:XCOFFObjectFile.h:829
llvm::object::XCOFFSymbolRef::isCsectSymbol
bool isCsectSymbol() const
Definition:XCOFFObjectFile.cpp:1307
llvm::object::XCOFFSymbolRef::getSize
uint64_t getSize() const
Definition:XCOFFObjectFile.h:820
llvm::object::XCOFFSymbolRef::getSymbol64
const XCOFFSymbolEntry64 * getSymbol64() const
Definition:XCOFFObjectFile.h:802
llvm::object::XCOFFSymbolRef::getSymbol32
const XCOFFSymbolEntry32 * getSymbol32() const
Definition:XCOFFObjectFile.h:798
llvm::object::XCOFFSymbolRef::NAME_IN_STR_TBL_MAGIC
@ NAME_IN_STR_TBL_MAGIC
Definition:XCOFFObjectFile.h:788
llvm::object::XCOFFSymbolRef::getSymbolType
uint16_t getSymbolType() const
Definition:XCOFFObjectFile.h:831
llvm::object::XCOFFSymbolRef::getValue
uint64_t getValue() const
Definition:XCOFFObjectFile.h:806
llvm::object::XCOFFSymbolRef::getName
Expected< StringRef > getName() const
Definition:XCOFFObjectFile.cpp:1356
llvm::object::XCOFFSymbolRef::getNumberOfAuxEntries
uint8_t getNumberOfAuxEntries() const
Definition:XCOFFObjectFile.h:847
llvm::object::XCOFFSymbolRef::getEntryAddress
uintptr_t getEntryAddress() const
Definition:XCOFFObjectFile.h:851
llvm::object::XCOFFSymbolRef::getStorageClass
XCOFF::StorageClass getStorageClass() const
Definition:XCOFFObjectFile.h:845
llvm::object::XCOFFTracebackTable
This class provides methods to extract traceback table data from a buffer.
Definition:XCOFFObjectFile.h:902
llvm::object::XCOFFTracebackTable::isOutOfLineEpilogOrPrologue
bool isOutOfLineEpilogOrPrologue() const
Definition:XCOFFObjectFile.cpp:1570
llvm::object::XCOFFTracebackTable::getNumOfGPRsSaved
uint8_t getNumOfGPRsSaved() const
Definition:XCOFFObjectFile.cpp:1643
llvm::object::XCOFFTracebackTable::hasTraceBackTableOffset
bool hasTraceBackTableOffset() const
Definition:XCOFFObjectFile.cpp:1574
llvm::object::XCOFFTracebackTable::hasParmsOnStack
bool hasParmsOnStack() const
Definition:XCOFFObjectFile.cpp:1657
llvm::object::XCOFFTracebackTable::hasExtensionTable
bool hasExtensionTable() const
Definition:XCOFFObjectFile.cpp:1635
llvm::object::XCOFFTracebackTable::getOnConditionDirective
uint8_t getOnConditionDirective() const
Definition:XCOFFObjectFile.cpp:1610
llvm::object::XCOFFTracebackTable::getLanguageID
uint8_t getLanguageID() const
Definition:XCOFFObjectFile.cpp:1562
llvm::object::XCOFFTracebackTable::getNumOfFPRsSaved
uint8_t getNumOfFPRsSaved() const
Definition:XCOFFObjectFile.cpp:1631
llvm::object::XCOFFTracebackTable::isFloatingPointOperationLogOrAbortEnabled
bool isFloatingPointOperationLogOrAbortEnabled() const
Definition:XCOFFObjectFile.cpp:1594
llvm::object::XCOFFTracebackTable::isLRSaved
bool isLRSaved() const
Definition:XCOFFObjectFile.cpp:1619
llvm::object::XCOFFTracebackTable::getNumberOfFPParms
uint8_t getNumberOfFPParms() const
Definition:XCOFFObjectFile.cpp:1652
llvm::object::XCOFFTracebackTable::isFuncNamePresent
bool isFuncNamePresent() const
Definition:XCOFFObjectFile.cpp:1602
llvm::object::XCOFFTracebackTable::isAllocaUsed
bool isAllocaUsed() const
Definition:XCOFFObjectFile.cpp:1606
llvm::object::XCOFFTracebackTable::isGlobalLinkage
bool isGlobalLinkage() const
Definition:XCOFFObjectFile.cpp:1566
llvm::object::XCOFFTracebackTable::isInternalProcedure
bool isInternalProcedure() const
Definition:XCOFFObjectFile.cpp:1578
llvm::object::XCOFFTracebackTable::hasControlledStorage
bool hasControlledStorage() const
Definition:XCOFFObjectFile.cpp:1582
llvm::object::XCOFFTracebackTable::isInterruptHandler
bool isInterruptHandler() const
Definition:XCOFFObjectFile.cpp:1598
llvm::object::XCOFFTracebackTable::isFixup
bool isFixup() const
Definition:XCOFFObjectFile.cpp:1627
llvm::object::XCOFFTracebackTable::isFloatingPointPresent
bool isFloatingPointPresent() const
Definition:XCOFFObjectFile.cpp:1590
llvm::object::XCOFFTracebackTable::getVersion
uint8_t getVersion() const
Definition:XCOFFObjectFile.cpp:1558
llvm::object::XCOFFTracebackTable::create
static Expected< XCOFFTracebackTable > create(const uint8_t *Ptr, uint64_t &Size, bool Is64Bits=false)
Parse an XCOFF Traceback Table from Ptr with Size bytes.
Definition:XCOFFObjectFile.cpp:1450
llvm::object::XCOFFTracebackTable::isBackChainStored
bool isBackChainStored() const
Definition:XCOFFObjectFile.cpp:1623
llvm::object::XCOFFTracebackTable::getNumberOfFixedParms
uint8_t getNumberOfFixedParms() const
Definition:XCOFFObjectFile.cpp:1647
llvm::object::XCOFFTracebackTable::isCRSaved
bool isCRSaved() const
Definition:XCOFFObjectFile.cpp:1615
llvm::object::XCOFFTracebackTable::isTOCless
bool isTOCless() const
Definition:XCOFFObjectFile.cpp:1586
llvm::object::XCOFFTracebackTable::hasVectorInfo
bool hasVectorInfo() const
Definition:XCOFFObjectFile.cpp:1639
llvm::object::content_iterator
Definition:SymbolicFile.h:69
llvm::object::symbol_iterator
Definition:ObjectFile.h:208
llvm::object::xcoff_symbol_iterator
Definition:XCOFFObjectFile.h:866
ptrdiff_t
uint16_t
uint32_t
uint64_t
uint8_t
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition:ErrorHandling.h:143
llvm::XCOFF::XR_BIASED_LENGTH_MASK
static constexpr uint8_t XR_BIASED_LENGTH_MASK
Definition:XCOFF.h:60
llvm::XCOFF::RelocationSerializationSize32
constexpr size_t RelocationSerializationSize32
Definition:XCOFF.h:39
llvm::XCOFF::XR_FIXUP_INDICATOR_MASK
static constexpr uint8_t XR_FIXUP_INDICATOR_MASK
Definition:XCOFF.h:57
llvm::XCOFF::VISIBILITY_MASK
constexpr uint16_t VISIBILITY_MASK
Definition:XCOFF.h:259
llvm::XCOFF::parseParmsTypeWithVecInfo
Expected< SmallString< 32 > > parseParmsTypeWithVecInfo(uint32_t Value, unsigned FixedParmsNum, unsigned FloatingParmsNum, unsigned VectorParmsNum)
Definition:XCOFF.cpp:247
llvm::XCOFF::XR_SIGN_INDICATOR_MASK
static constexpr uint8_t XR_SIGN_INDICATOR_MASK
Definition:XCOFF.h:54
llvm::XCOFF::getRelocationTypeString
StringRef getRelocationTypeString(XCOFF::RelocationType Type)
Definition:XCOFF.cpp:55
llvm::XCOFF::parseParmsType
Expected< SmallString< 32 > > parseParmsType(uint32_t Value, unsigned FixedParmsNum, unsigned FloatingParmsNum)
Definition:XCOFF.cpp:169
llvm::XCOFF::RelocationSerializationSize64
constexpr size_t RelocationSerializationSize64
Definition:XCOFF.h:40
llvm::XCOFF::parseVectorParmsType
Expected< SmallString< 32 > > parseVectorParmsType(uint32_t Value, unsigned ParmsNum)
Definition:XCOFF.cpp:299
llvm::XCOFF::SymbolAuxType
SymbolAuxType
Definition:XCOFF.h:365
llvm::XCOFF::AUX_CSECT
@ AUX_CSECT
Identifies a csect auxiliary entry.
Definition:XCOFF.h:370
llvm::XCOFF::SYM_V_HIDDEN
@ SYM_V_HIDDEN
Definition:XCOFF.h:254
llvm::XCOFF::SYM_V_EXPORTED
@ SYM_V_EXPORTED
Definition:XCOFF.h:256
llvm::XCOFF::NameSize
constexpr size_t NameSize
Definition:XCOFF.h:29
llvm::XCOFF::RelocOverflow
constexpr uint16_t RelocOverflow
Definition:XCOFF.h:43
llvm::XCOFF::N_DEBUG
@ N_DEBUG
Definition:XCOFF.h:46
llvm::XCOFF::N_UNDEF
@ N_UNDEF
Definition:XCOFF.h:46
llvm::XCOFF::N_ABS
@ N_ABS
Definition:XCOFF.h:46
llvm::XCOFF::StorageClass
StorageClass
Definition:XCOFF.h:170
llvm::XCOFF::C_EXT
@ C_EXT
Definition:XCOFF.h:198
llvm::XCOFF::C_WEAKEXT
@ C_WEAKEXT
Definition:XCOFF.h:199
llvm::XCOFF::C_FILE
@ C_FILE
Definition:XCOFF.h:172
llvm::XCOFF::C_HIDEXT
@ C_HIDEXT
Definition:XCOFF.h:206
llvm::XCOFF::XMC_GL
@ XMC_GL
Global Linkage (Interfile Interface Code)
Definition:XCOFF.h:108
llvm::XCOFF::XMC_PR
@ XMC_PR
Program Code.
Definition:XCOFF.h:105
llvm::XCOFF::NEW_XCOFF_INTERPRET
@ NEW_XCOFF_INTERPRET
Definition:XCOFF.h:75
llvm::XCOFF::SymbolTableEntrySize
constexpr size_t SymbolTableEntrySize
Definition:XCOFF.h:38
llvm::XCOFF::XTY_CM
@ XTY_CM
Common csect definition. For uninitialized storage.
Definition:XCOFF.h:245
llvm::XCOFF::XTY_SD
@ XTY_SD
Csect definition for initialized storage.
Definition:XCOFF.h:242
llvm::XCOFF::XTY_LD
@ XTY_LD
Label definition.
Definition:XCOFF.h:243
llvm::XCOFF::XTY_ER
@ XTY_ER
External reference.
Definition:XCOFF.h:241
llvm::XCOFF::SectionTypeFlags
SectionTypeFlags
Definition:XCOFF.h:134
llvm::XCOFF::STYP_TYPCHK
@ STYP_TYPCHK
Definition:XCOFF.h:146
llvm::XCOFF::STYP_LOADER
@ STYP_LOADER
Definition:XCOFF.h:144
llvm::XCOFF::STYP_DWARF
@ STYP_DWARF
Definition:XCOFF.h:136
llvm::XCOFF::STYP_DATA
@ STYP_DATA
Definition:XCOFF.h:138
llvm::XCOFF::STYP_INFO
@ STYP_INFO
Definition:XCOFF.h:141
llvm::XCOFF::STYP_TDATA
@ STYP_TDATA
Definition:XCOFF.h:142
llvm::XCOFF::STYP_TEXT
@ STYP_TEXT
Definition:XCOFF.h:137
llvm::XCOFF::STYP_DEBUG
@ STYP_DEBUG
Definition:XCOFF.h:145
llvm::XCOFF::STYP_PAD
@ STYP_PAD
Definition:XCOFF.h:135
llvm::XCOFF::STYP_EXCEPT
@ STYP_EXCEPT
Definition:XCOFF.h:140
llvm::XCOFF::STYP_OVRFLO
@ STYP_OVRFLO
Definition:XCOFF.h:147
llvm::XCOFF::STYP_BSS
@ STYP_BSS
Definition:XCOFF.h:139
llvm::XCOFF::STYP_TBSS
@ STYP_TBSS
Definition:XCOFF.h:143
llvm::object::getObject
static Expected< const T * > getObject(MemoryBufferRef M, const void *Ptr, const uint64_t Size=sizeof(T))
Definition:XCOFFObjectFile.cpp:34
llvm::object::doesXCOFFTracebackTableBegin
bool doesXCOFFTracebackTableBegin(ArrayRef< uint8_t > Bytes)
Definition:XCOFFObjectFile.cpp:1391
llvm::object::createError
Error createError(const Twine &Err)
Definition:Error.h:84
llvm::object::getLoaderSecSymNameInStrTbl
Expected< StringRef > getLoaderSecSymNameInStrTbl(const T *LoaderSecHeader, uint64_t Offset)
Definition:XCOFFObjectFile.cpp:100
llvm::object::SymbolAuxTypeOffset
static const size_t SymbolAuxTypeOffset
Definition:XCOFFObjectFile.cpp:29
llvm::object::NoRelMask
static const uint16_t NoRelMask
Definition:XCOFFObjectFile.cpp:28
llvm::object::object_error::invalid_section_index
@ invalid_section_index
llvm::object::object_error::string_table_non_null_end
@ string_table_non_null_end
llvm::object::object_error::parse_failed
@ parse_failed
llvm::object::section_iterator
content_iterator< SectionRef > section_iterator
Definition:ObjectFile.h:47
llvm::object::FunctionSym
static const uint8_t FunctionSym
Definition:XCOFFObjectFile.cpp:27
llvm::object::relocation_iterator
content_iterator< RelocationRef > relocation_iterator
Definition:ObjectFile.h:77
llvm::object::basic_symbol_iterator
content_iterator< BasicSymbolRef > basic_symbol_iterator
Definition:SymbolicFile.h:143
llvm::object::getWithOffset
static uintptr_t getWithOffset(uintptr_t Base, ptrdiff_t Offset)
Definition:XCOFFObjectFile.cpp:42
llvm::object::generateXCOFFFixedNameStringRef
static StringRef generateXCOFFFixedNameStringRef(const char *Name)
Definition:XCOFFObjectFile.cpp:51
llvm::object::viewAs
static const T * viewAs(uintptr_t in)
Definition:XCOFFObjectFile.cpp:47
llvm::sampleprof::Base
@ Base
Definition:Discriminator.h:58
llvm::support::endian::read32be
uint32_t read32be(const void *P)
Definition:Endian.h:434
llvm::support::endian::read16be
uint16_t read16be(const void *P)
Definition:Endian.h:431
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::Offset
@ Offset
Definition:DWP.cpp:480
llvm::createStringError
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Definition:Error.h:1291
llvm::report_fatal_error
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition:Error.cpp:167
llvm::ModRefInfo::Ref
@ Ref
The access may reference the value stored in memory.
llvm::cantFail
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
Definition:Error.h:756
llvm::alignTo
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition:Alignment.h:155
llvm::toString
const char * toString(DWARFSectionKind Kind)
Definition:DWARFUnitIndex.h:67
llvm::errorCodeToError
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
Definition:Error.cpp:111
llvm::consumeError
void consumeError(Error Err)
Consume a Error without doing anything.
Definition:Error.h:1069
llvm::SectionName
Definition:DWARFSection.h:21
llvm::object::ExceptionSectionEntry
Definition:XCOFFObjectFile.h:295
llvm::object::LoaderSectionHeader32
Definition:XCOFFObjectFile.h:256
llvm::object::LoaderSectionHeader32::LengthOfImpidStrTbl
support::ubig32_t LengthOfImpidStrTbl
Definition:XCOFFObjectFile.h:260
llvm::object::LoaderSectionHeader32::OffsetToImpid
support::big32_t OffsetToImpid
Definition:XCOFFObjectFile.h:262
llvm::object::LoaderSectionHeader64
Definition:XCOFFObjectFile.h:279
llvm::object::LoaderSectionHeader64::LengthOfImpidStrTbl
support::ubig32_t LengthOfImpidStrTbl
Definition:XCOFFObjectFile.h:283
llvm::object::LoaderSectionHeader64::OffsetToImpid
support::big64_t OffsetToImpid
Definition:XCOFFObjectFile.h:286
llvm::object::LoaderSectionSymbolEntry32::NameOffsetInStrTbl
Definition:XCOFFObjectFile.h:212
llvm::object::LoaderSectionSymbolEntry32::NameOffsetInStrTbl::Offset
support::ubig32_t Offset
Definition:XCOFFObjectFile.h:214
llvm::object::LoaderSectionSymbolEntry32::NameOffsetInStrTbl::IsNameInStrTbl
support::big32_t IsNameInStrTbl
Definition:XCOFFObjectFile.h:213
llvm::object::LoaderSectionSymbolEntry32::getSymbolName
Expected< StringRef > getSymbolName(const LoaderSectionHeader32 *LoaderSecHeader) const
Definition:XCOFFObjectFile.cpp:112
llvm::object::LoaderSectionSymbolEntry32::SymbolName
char SymbolName[XCOFF::NameSize]
Definition:XCOFFObjectFile.h:217
llvm::object::LoaderSectionSymbolEntry64::Offset
support::ubig32_t Offset
Definition:XCOFFObjectFile.h:231
llvm::object::LoaderSectionSymbolEntry64::getSymbolName
Expected< StringRef > getSymbolName(const LoaderSectionHeader64 *LoaderSecHeader) const
Definition:XCOFFObjectFile.cpp:122
llvm::object::XCOFFAuxiliaryHeader32
Definition:XCOFFObjectFile.h:79
llvm::object::XCOFFAuxiliaryHeader64
Definition:XCOFFObjectFile.h:126
llvm::object::XCOFFAuxiliaryHeader::getEntryPointAddr
uint64_t getEntryPointAddr() const
Definition:XCOFFObjectFile.h:74
llvm::object::XCOFFFileAuxEnt::NameInStrTblType::Magic
support::big32_t Magic
Definition:XCOFFObjectFile.h:435
llvm::object::XCOFFFileAuxEnt::NameInStrTblType::Offset
support::ubig32_t Offset
Definition:XCOFFObjectFile.h:436
llvm::object::XCOFFFileAuxEnt
Definition:XCOFFObjectFile.h:433
llvm::object::XCOFFFileAuxEnt::NameInStrTbl
NameInStrTblType NameInStrTbl
Definition:XCOFFObjectFile.h:441
llvm::object::XCOFFFileAuxEnt::Name
char Name[XCOFF::NameSize+XCOFF::FileNamePadSize]
Definition:XCOFFObjectFile.h:440
llvm::object::XCOFFFileHeader32
Definition:XCOFFObjectFile.h:30
llvm::object::XCOFFFileHeader32::Magic
support::ubig16_t Magic
Definition:XCOFFObjectFile.h:31
llvm::object::XCOFFFileHeader32::NumberOfSymTableEntries
support::big32_t NumberOfSymTableEntries
Definition:XCOFFObjectFile.h:39
llvm::object::XCOFFFileHeader32::TimeStamp
support::big32_t TimeStamp
Definition:XCOFFObjectFile.h:36
llvm::object::XCOFFFileHeader32::AuxHeaderSize
support::ubig16_t AuxHeaderSize
Definition:XCOFFObjectFile.h:40
llvm::object::XCOFFFileHeader32::NumberOfSections
support::ubig16_t NumberOfSections
Definition:XCOFFObjectFile.h:32
llvm::object::XCOFFFileHeader32::Flags
support::ubig16_t Flags
Definition:XCOFFObjectFile.h:41
llvm::object::XCOFFFileHeader32::SymbolTableOffset
support::ubig32_t SymbolTableOffset
Definition:XCOFFObjectFile.h:38
llvm::object::XCOFFFileHeader64
Definition:XCOFFObjectFile.h:44
llvm::object::XCOFFFileHeader64::TimeStamp
support::big32_t TimeStamp
Definition:XCOFFObjectFile.h:50
llvm::object::XCOFFFileHeader64::Flags
support::ubig16_t Flags
Definition:XCOFFObjectFile.h:54
llvm::object::XCOFFFileHeader64::AuxHeaderSize
support::ubig16_t AuxHeaderSize
Definition:XCOFFObjectFile.h:53
llvm::object::XCOFFFileHeader64::SymbolTableOffset
support::ubig64_t SymbolTableOffset
Definition:XCOFFObjectFile.h:52
llvm::object::XCOFFFileHeader64::NumberOfSymTableEntries
support::ubig32_t NumberOfSymTableEntries
Definition:XCOFFObjectFile.h:55
llvm::object::XCOFFFileHeader64::NumberOfSections
support::ubig16_t NumberOfSections
Definition:XCOFFObjectFile.h:46
llvm::object::XCOFFFileHeader64::Magic
support::ubig16_t Magic
Definition:XCOFFObjectFile.h:45
llvm::object::XCOFFRelocation32
Definition:XCOFFObjectFile.h:527
llvm::object::XCOFFRelocation64
Definition:XCOFFObjectFile.h:528
llvm::object::XCOFFRelocation
Definition:XCOFFObjectFile.h:506
llvm::object::XCOFFRelocation::Type
XCOFF::RelocationType Type
Definition:XCOFFObjectFile.h:514
llvm::object::XCOFFRelocation::VirtualAddress
AddressType VirtualAddress
Definition:XCOFFObjectFile.h:508
llvm::object::XCOFFRelocation::isFixupIndicated
bool isFixupIndicated() const
Definition:XCOFFObjectFile.cpp:85
llvm::object::XCOFFRelocation::SymbolIndex
support::ubig32_t SymbolIndex
Definition:XCOFFObjectFile.h:509
llvm::object::XCOFFRelocation::getRelocatedLength
uint8_t getRelocatedLength() const
Definition:XCOFFObjectFile.cpp:90
llvm::object::XCOFFRelocation::isRelocationSigned
bool isRelocationSigned() const
Definition:XCOFFObjectFile.cpp:80
llvm::object::XCOFFSectionHeader32
Definition:XCOFFObjectFile.h:182
llvm::object::XCOFFSectionHeader32::FileOffsetToRawData
support::ubig32_t FileOffsetToRawData
Definition:XCOFFObjectFile.h:187
llvm::object::XCOFFSectionHeader32::SectionSize
support::ubig32_t SectionSize
Definition:XCOFFObjectFile.h:186
llvm::object::XCOFFSectionHeader32::Name
char Name[XCOFF::NameSize]
Definition:XCOFFObjectFile.h:183
llvm::object::XCOFFSectionHeader32::VirtualAddress
support::ubig32_t VirtualAddress
Definition:XCOFFObjectFile.h:185
llvm::object::XCOFFSectionHeader32::Flags
support::big32_t Flags
Definition:XCOFFObjectFile.h:192
llvm::object::XCOFFSectionHeader64
Definition:XCOFFObjectFile.h:195
llvm::object::XCOFFSectionHeader64::VirtualAddress
support::ubig64_t VirtualAddress
Definition:XCOFFObjectFile.h:198
llvm::object::XCOFFSectionHeader64::SectionSize
support::ubig64_t SectionSize
Definition:XCOFFObjectFile.h:199
llvm::object::XCOFFSectionHeader64::Flags
support::big32_t Flags
Definition:XCOFFObjectFile.h:205
llvm::object::XCOFFSectionHeader64::FileOffsetToRawData
support::big64_t FileOffsetToRawData
Definition:XCOFFObjectFile.h:200
llvm::object::XCOFFSectionHeader64::Name
char Name[XCOFF::NameSize]
Definition:XCOFFObjectFile.h:196
llvm::object::XCOFFSectionHeader
Definition:XCOFFObjectFile.h:159
llvm::object::XCOFFSectionHeader::isReservedSectionType
bool isReservedSectionType() const
Definition:XCOFFObjectFile.cpp:75
llvm::object::XCOFFSectionHeader::getName
StringRef getName() const
Definition:XCOFFObjectFile.cpp:58
llvm::object::XCOFFSectionHeader::getSectionSubtype
uint32_t getSectionSubtype() const
Definition:XCOFFObjectFile.cpp:69
llvm::object::XCOFFSectionHeader::getSectionType
uint16_t getSectionType() const
Definition:XCOFFObjectFile.cpp:63
llvm::object::XCOFFStringTable
Definition:XCOFFObjectFile.h:324
llvm::object::DataRefImpl
Definition:SymbolicFile.h:35
llvm::object::DataRefImpl::p
uintptr_t p
Definition:SymbolicFile.h:41

Generated on Fri Jul 18 2025 11:46:03 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp