LLVM 22.0.0git
XCOFFObjectFile.h
Go to the documentation of this file.
1//===- XCOFFObjectFile.h - XCOFF object file implementation -----*- C++ -*-===//
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 declares the XCOFFObjectFile class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_OBJECT_XCOFFOBJECTFILE_H
14#define LLVM_OBJECT_XCOFFOBJECTFILE_H
15
22#include "llvm/Support/Endian.h"
23#include <limits>
24
25namespace llvm {
26namespace object {
27
28class xcoff_symbol_iterator;
29
33
34 // Unix time value, value of 0 indicates no timestamp.
35 // Negative values are reserved.
37
38 support::ubig32_t SymbolTableOffset; // File offset to symbol table.
42};
43
47
48 // Unix time value, value of 0 indicates no timestamp.
49 // Negative values are reserved.
51
52 support::ubig64_t SymbolTableOffset; // File offset to symbol table.
56};
57
58template <typename T> struct XCOFFAuxiliaryHeader {
59 static constexpr uint8_t AuxiHeaderFlagMask = 0xF0;
60 static constexpr uint8_t AuxiHeaderTDataAlignmentMask = 0x0F;
61
62public:
63 uint8_t getFlag() const {
64 return static_cast<const T *>(this)->FlagAndTDataAlignment &
66 }
67
69 return static_cast<const T *>(this)->FlagAndTDataAlignment &
71 }
72
73 uint16_t getVersion() const { return static_cast<const T *>(this)->Version; }
75 return static_cast<const T *>(this)->EntryPointAddr;
76 }
77};
78
79struct XCOFFAuxiliaryHeader32 : XCOFFAuxiliaryHeader<XCOFFAuxiliaryHeader32> {
81 AuxMagic; ///< If the value of the o_vstamp field is greater than 1, the
82 ///< o_mflags field is reserved for future use and it should
83 ///< contain 0. Otherwise, this field is not used.
85 Version; ///< The valid values are 1 and 2. When the o_vstamp field is 2
86 ///< in an XCOFF32 file, the new interpretation of the n_type
87 ///< field in the symbol table entry is used.
106 support::ubig32_t MaxStackSize; ///< If the value is 0, the system default
107 ///< maximum stack size is used.
108 support::ubig32_t MaxDataSize; ///< If the value is 0, the system default
109 ///< maximum data size is used.
111 ReservedForDebugger; ///< This field should contain 0. When a loaded
112 ///< program is being debugged, the memory image of
113 ///< this field may be modified by a debugger to
114 ///< insert a trap instruction.
115 uint8_t TextPageSize; ///< Specifies the size of pages for the exec text. The
116 ///< default value is 0 (system-selected page size).
117 uint8_t DataPageSize; ///< Specifies the size of pages for the exec data. The
118 ///< default value is 0 (system-selected page size).
119 uint8_t StackPageSize; ///< Specifies the size of pages for the stack. The
120 ///< default value is 0 (system-selected page size).
124};
125
126struct XCOFFAuxiliaryHeader64 : XCOFFAuxiliaryHeader<XCOFFAuxiliaryHeader64> {
157};
158
159template <typename T> struct XCOFFSectionHeader {
160 // The section flags definitions are the same in both 32- and 64-bit objects.
161 // Least significant 3 bits are reserved.
162 static constexpr unsigned SectionFlagsReservedMask = 0x7;
163
164 // The low order 16 bits of section flags denotes the section type.
165 // The high order 16 bits of section flags denotes the section subtype.
166 // For now, this is only used for DWARF sections.
167 static constexpr unsigned SectionFlagsTypeMask = 0xffffu;
168
169public:
170 StringRef getName() const;
171 uint16_t getSectionType() const;
173 bool isReservedSectionType() const;
174};
175
176// Explicit extern template declarations.
179extern template struct LLVM_TEMPLATE_ABI
181extern template struct LLVM_TEMPLATE_ABI
183
195};
196
208 char Padding[4];
209};
210
215 support::big32_t IsNameInStrTbl; // Zero indicates name in string table.
217 };
218
219 char SymbolName[XCOFF::NameSize];
220 support::ubig32_t Value; // The virtual address of the symbol.
226
228 getSymbolName(const LoaderSectionHeader32 *LoaderSecHeader) const;
229};
230
232 support::ubig64_t Value; // The virtual address of the symbol.
239
241 getSymbolName(const LoaderSectionHeader64 *LoaderSecHeader) const;
242};
243
249};
250
256};
257
267
269 return NumberOfSymTabEnt == 0 ? 0 : sizeof(LoaderSectionHeader32);
270 }
271
273 // Relocation table is after Symbol table.
274 return NumberOfRelTabEnt == 0
275 ? 0
276 : sizeof(LoaderSectionHeader32) +
277 sizeof(LoaderSectionSymbolEntry32) * NumberOfSymTabEnt;
278 }
279};
280
292
293 uint64_t getOffsetToSymTbl() const { return OffsetToSymTbl; }
294 uint64_t getOffsetToRelEnt() const { return OffsetToRelEnt; }
295};
296
297template <typename AddressType> struct ExceptionSectionEntry {
298 union {
300 AddressType TrapInstAddr;
301 };
304
306 assert(Reason == 0 && "Get symbol table index of the function only when "
307 "the e_reason field is 0.");
308 return SymbolIdx;
309 }
310
312 assert(Reason != 0 && "Zero is not a valid trap exception reason code.");
313 return TrapInstAddr;
314 }
315 uint8_t getLangID() const { return LangId; }
316 uint8_t getReason() const { return Reason; }
317};
318
321
322// Explicit extern template declarations.
323extern template struct LLVM_TEMPLATE_ABI
325extern template struct LLVM_TEMPLATE_ABI
327
330 const char *Data;
331};
332
341};
342
352};
353
355public:
356 static constexpr uint8_t SymbolTypeMask = 0x07;
357 static constexpr uint8_t SymbolAlignmentMask = 0xF8;
358 static constexpr size_t SymbolAlignmentBitOffset = 3;
359
360 XCOFFCsectAuxRef(const XCOFFCsectAuxEnt32 *Entry32) : Entry32(Entry32) {}
361 XCOFFCsectAuxRef(const XCOFFCsectAuxEnt64 *Entry64) : Entry64(Entry64) {}
362
363 // For getSectionOrLength(),
364 // If the symbol type is XTY_SD or XTY_CM, the csect length.
365 // If the symbol type is XTY_LD, the symbol table
366 // index of the containing csect.
367 // If the symbol type is XTY_ER, 0.
369 return Entry32 ? getSectionOrLength32() : getSectionOrLength64();
370 }
371
373 assert(Entry32 && "32-bit interface called on 64-bit object file.");
374 return Entry32->SectionOrLength;
375 }
376
378 assert(Entry64 && "64-bit interface called on 32-bit object file.");
379 return (static_cast<uint64_t>(Entry64->SectionOrLengthHighByte) << 32) |
380 Entry64->SectionOrLengthLowByte;
381 }
382
383#define GETVALUE(X) Entry32 ? Entry32->X : Entry64->X
384
386 return GETVALUE(ParameterHashIndex);
387 }
388
389 uint16_t getTypeChkSectNum() const { return GETVALUE(TypeChkSectNum); }
390
393 }
394
395 uintptr_t getEntryAddress() const {
396 return Entry32 ? reinterpret_cast<uintptr_t>(Entry32)
397 : reinterpret_cast<uintptr_t>(Entry64);
398 }
399
401 return (getSymbolAlignmentAndType() & SymbolAlignmentMask) >>
402 SymbolAlignmentBitOffset;
403 }
404
406 return getSymbolAlignmentAndType() & SymbolTypeMask;
407 }
408
409 bool isLabel() const { return getSymbolType() == XCOFF::XTY_LD; }
410
412 assert(Entry32 && "32-bit interface called on 64-bit object file.");
413 return Entry32->StabInfoIndex;
414 }
415
417 assert(Entry32 && "32-bit interface called on 64-bit object file.");
418 return Entry32->StabSectNum;
419 }
420
422 assert(Entry64 && "64-bit interface called on 32-bit object file.");
423 return Entry64->AuxType;
424 }
425
427 return GETVALUE(SymbolAlignmentAndType);
428 }
429
430#undef GETVALUE
431
432private:
433 const XCOFFCsectAuxEnt32 *Entry32 = nullptr;
434 const XCOFFCsectAuxEnt64 *Entry64 = nullptr;
435};
436
438 typedef struct {
439 support::big32_t Magic; // Zero indicates name in string table.
443 union {
446 };
449 XCOFF::SymbolAuxType AuxType; // 64-bit XCOFF file only.
450};
451
457}; // 32-bit XCOFF file only.
458
465};
466
472 XCOFF::SymbolAuxType AuxType; // Contains _AUX_FCN; Type of auxiliary entry
473};
474
480 XCOFF::SymbolAuxType AuxType; // Contains _AUX_EXCEPT; Type of auxiliary entry
481};
482
488};
489
493 XCOFF::SymbolAuxType AuxType; // Contains _AUX_SYM; Type of auxiliary entry
494};
495
501};
502
507 XCOFF::SymbolAuxType AuxType; // Contains _AUX_SECT; Type of Auxillary entry
508};
509
510template <typename AddressType> struct XCOFFRelocation {
511public:
512 AddressType VirtualAddress;
514
515 // Packed field, see XR_* masks for details of packing.
517
519
520public:
521 bool isRelocationSigned() const;
522 bool isFixupIndicated() const;
523
524 // Returns the number of bits being relocated.
526};
527
528extern template struct LLVM_TEMPLATE_ABI
530extern template struct LLVM_TEMPLATE_ABI
532
535
536class XCOFFSymbolRef;
537
539private:
540 const void *FileHeader = nullptr;
541 const void *AuxiliaryHeader = nullptr;
542 const void *SectionHeaderTable = nullptr;
543
544 const void *SymbolTblPtr = nullptr;
545 XCOFFStringTable StringTable = {0, nullptr};
546
547 const XCOFFSectionHeader32 *sectionHeaderTable32() const;
548 const XCOFFSectionHeader64 *sectionHeaderTable64() const;
549 template <typename T> const T *sectionHeaderTable() const;
550
551 size_t getFileHeaderSize() const;
552 size_t getSectionHeaderSize() const;
553
554 const XCOFFSectionHeader32 *toSection32(DataRefImpl Ref) const;
555 const XCOFFSectionHeader64 *toSection64(DataRefImpl Ref) const;
556 uintptr_t getSectionHeaderTableAddress() const;
557 uintptr_t getEndOfSymbolTableAddress() const;
558
559 DataRefImpl getSectionByType(XCOFF::SectionTypeFlags SectType) const;
560 uint64_t getSectionFileOffsetToRawData(DataRefImpl Sec) const;
561
562 // This returns a pointer to the start of the storage for the name field of
563 // the 32-bit or 64-bit SectionHeader struct. This string is *not* necessarily
564 // null-terminated.
565 const char *getSectionNameInternal(DataRefImpl Sec) const;
566
567 static bool isReservedSectionNumber(int16_t SectionNumber);
568
569 // Constructor and "create" factory function. The constructor is only a thin
570 // wrapper around the base constructor. The "create" function fills out the
571 // XCOFF-specific information and performs the error checking along the way.
572 XCOFFObjectFile(unsigned Type, MemoryBufferRef Object);
573 static Expected<std::unique_ptr<XCOFFObjectFile>> create(unsigned Type,
574 MemoryBufferRef MBR);
575
576 // Helper for parsing the StringTable. Returns an 'Error' if parsing failed
577 // and an XCOFFStringTable if parsing succeeded.
578 static Expected<XCOFFStringTable> parseStringTable(const XCOFFObjectFile *Obj,
580
581 // Make a friend so it can call the private 'create' function.
584
585 void checkSectionAddress(uintptr_t Addr, uintptr_t TableAddr) const;
586
587public:
588 static constexpr uint64_t InvalidRelocOffset =
589 std::numeric_limits<uint64_t>::max();
590
591 // Interface inherited from base classes.
592 void moveSymbolNext(DataRefImpl &Symb) const override;
593 Expected<uint32_t> getSymbolFlags(DataRefImpl Symb) const override;
594 basic_symbol_iterator symbol_begin() const override;
595 basic_symbol_iterator symbol_end() const override;
596
598 xcoff_symbol_iterator_range symbols() const;
599
600 bool is64Bit() const override;
601 Expected<StringRef> getSymbolName(DataRefImpl Symb) const override;
602 Expected<uint64_t> getSymbolAddress(DataRefImpl Symb) const override;
603 uint64_t getSymbolValueImpl(DataRefImpl Symb) const override;
604 uint32_t getSymbolAlignment(DataRefImpl Symb) const override;
605 uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override;
607 Expected<section_iterator> getSymbolSection(DataRefImpl Symb) const override;
608
609 void moveSectionNext(DataRefImpl &Sec) const override;
611 uint64_t getSectionAddress(DataRefImpl Sec) const override;
612 uint64_t getSectionIndex(DataRefImpl Sec) const override;
613 uint64_t getSectionSize(DataRefImpl Sec) const override;
615 getSectionContents(DataRefImpl Sec) const override;
616 uint64_t getSectionAlignment(DataRefImpl Sec) const override;
617 bool isSectionCompressed(DataRefImpl Sec) const override;
618 bool isSectionText(DataRefImpl Sec) const override;
619 bool isSectionData(DataRefImpl Sec) const override;
620 bool isSectionBSS(DataRefImpl Sec) const override;
621 bool isDebugSection(DataRefImpl Sec) const override;
622
623 bool isSectionVirtual(DataRefImpl Sec) const override;
624 relocation_iterator section_rel_begin(DataRefImpl Sec) const override;
625 relocation_iterator section_rel_end(DataRefImpl Sec) const override;
626
627 void moveRelocationNext(DataRefImpl &Rel) const override;
628
629 /// \returns the relocation offset with the base address of the containing
630 /// section as zero, or InvalidRelocOffset on errors (such as a relocation
631 /// that does not refer to an address in any section).
632 uint64_t getRelocationOffset(DataRefImpl Rel) const override;
633 symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override;
634 uint64_t getRelocationType(DataRefImpl Rel) const override;
635 void getRelocationTypeName(DataRefImpl Rel,
636 SmallVectorImpl<char> &Result) const override;
637
638 section_iterator section_begin() const override;
639 section_iterator section_end() const override;
640 uint8_t getBytesInAddress() const override;
641 StringRef getFileFormatName() const override;
642 Triple::ArchType getArch() const override;
644 Expected<uint64_t> getStartAddress() const override;
645 StringRef mapDebugSectionName(StringRef Name) const override;
646 bool isRelocatableObject() const override;
647
648 // Below here is the non-inherited interface.
649
650 Expected<StringRef> getRawData(const char *Start, uint64_t Size,
651 StringRef Name) const;
652
653 const XCOFFAuxiliaryHeader32 *auxiliaryHeader32() const;
654 const XCOFFAuxiliaryHeader64 *auxiliaryHeader64() const;
655
656 const void *getPointerToSymbolTable() const { return SymbolTblPtr; }
657
658 Expected<StringRef> getSymbolSectionName(XCOFFSymbolRef Ref) const;
659 unsigned getSymbolSectionID(SymbolRef Sym) const;
660 XCOFFSymbolRef toSymbolRef(DataRefImpl Ref) const;
661
662 // File header related interfaces.
663 const XCOFFFileHeader32 *fileHeader32() const;
664 const XCOFFFileHeader64 *fileHeader64() const;
665 uint16_t getMagic() const;
666 uint16_t getNumberOfSections() const;
667 int32_t getTimeStamp() const;
668
669 // Symbol table offset and entry count are handled differently between
670 // XCOFF32 and XCOFF64.
671 uint32_t getSymbolTableOffset32() const;
672 uint64_t getSymbolTableOffset64() const;
673
674 // Note that this value is signed and might return a negative value. Negative
675 // values are reserved for future use.
676 int32_t getRawNumberOfSymbolTableEntries32() const;
677
678 // The sanitized value appropriate to use as an index into the symbol table.
679 uint32_t getLogicalNumberOfSymbolTableEntries32() const;
680
681 uint32_t getNumberOfSymbolTableEntries64() const;
682
683 // Return getLogicalNumberOfSymbolTableEntries32 or
684 // getNumberOfSymbolTableEntries64 depending on the object mode.
685 uint32_t getNumberOfSymbolTableEntries() const;
686
687 uint32_t getSymbolIndex(uintptr_t SymEntPtr) const;
688 uint64_t getSymbolSize(DataRefImpl Symb) const;
689 uintptr_t getSymbolByIndex(uint32_t Idx) const {
690 return reinterpret_cast<uintptr_t>(SymbolTblPtr) +
692 }
693 uintptr_t getSymbolEntryAddressByIndex(uint32_t SymbolTableIndex) const;
694 Expected<StringRef> getSymbolNameByIndex(uint32_t SymbolTableIndex) const;
695
696 Expected<StringRef> getCFileName(const XCOFFFileAuxEnt *CFileEntPtr) const;
697 uint16_t getOptionalHeaderSize() const;
698 uint16_t getFlags() const;
699
700 // Section header table related interfaces.
701 ArrayRef<XCOFFSectionHeader32> sections32() const;
702 ArrayRef<XCOFFSectionHeader64> sections64() const;
703
704 int32_t getSectionFlags(DataRefImpl Sec) const;
705 Expected<DataRefImpl> getSectionByNum(int16_t Num) const;
706
708 getSectionFileOffsetToRawData(XCOFF::SectionTypeFlags SectType) const;
709
710 void checkSymbolEntryPointer(uintptr_t SymbolEntPtr) const;
711
712 // Relocation-related interfaces.
713 template <typename T>
715 getNumberOfRelocationEntries(const XCOFFSectionHeader<T> &Sec) const;
716
717 template <typename Shdr, typename Reloc>
718 Expected<ArrayRef<Reloc>> relocations(const Shdr &Sec) const;
719
720 // Loader section related interfaces.
721 Expected<StringRef> getImportFileTable() const;
722
723 // Exception-related interface.
724 template <typename ExceptEnt>
725 Expected<ArrayRef<ExceptEnt>> getExceptionEntries() const;
726
727 // This function returns string table entry.
728 Expected<StringRef> getStringTableEntry(uint32_t Offset) const;
729
730 // This function returns the string table.
731 StringRef getStringTable() const;
732
733 const XCOFF::SymbolAuxType *getSymbolAuxType(uintptr_t AuxEntryAddress) const;
734
735 static uintptr_t getAdvancedSymbolEntryAddress(uintptr_t CurrentAddress,
736 uint32_t Distance);
737
738 static bool classof(const Binary *B) { return B->isXCOFF(); }
739
740 std::optional<StringRef> tryGetCPUName() const override;
741}; // XCOFFObjectFile
742
743typedef struct {
747
749 typedef struct {
750 support::big32_t Magic; // Zero indicates name in string table.
753
754 union {
757 };
758
759 support::ubig32_t Value; // Symbol value; storage class-dependent.
761
762 union {
765 };
766
769};
770
772 support::ubig64_t Value; // Symbol value; storage class-dependent.
775
776 union {
779 };
780
783};
784
786XCOFFObjectFile::relocations<XCOFFSectionHeader32, XCOFFRelocation32>(
787 const XCOFFSectionHeader32 &Sec) const;
789XCOFFObjectFile::relocations<XCOFFSectionHeader64, XCOFFRelocation64>(
790 const XCOFFSectionHeader64 &Sec) const;
791
792class XCOFFSymbolRef : public SymbolRef {
793public:
794 enum { NAME_IN_STR_TBL_MAGIC = 0x0 };
795
797 const XCOFFObjectFile *OwningObjectPtr)
798 : SymbolRef(SymEntDataRef, OwningObjectPtr) {
799 assert(OwningObjectPtr && "OwningObjectPtr cannot be nullptr!");
800 assert(SymEntDataRef.p != 0 &&
801 "Symbol table entry pointer cannot be nullptr!");
802 }
803
805 return reinterpret_cast<const XCOFFSymbolEntry32 *>(getRawDataRefImpl().p);
806 }
807
809 return reinterpret_cast<const XCOFFSymbolEntry64 *>(getRawDataRefImpl().p);
810 }
811
813 return getObject()->is64Bit() ? getValue64() : getValue32();
814 }
815
817 return reinterpret_cast<const XCOFFSymbolEntry32 *>(getRawDataRefImpl().p)
818 ->Value;
819 }
820
822 return reinterpret_cast<const XCOFFSymbolEntry64 *>(getRawDataRefImpl().p)
823 ->Value;
824 }
825
827 return getObject()->getSymbolSize(getRawDataRefImpl());
828 }
829
830#define GETVALUE(X) \
831 getObject()->is64Bit() \
832 ? reinterpret_cast<const XCOFFSymbolEntry64 *>(getRawDataRefImpl().p)->X \
833 : reinterpret_cast<const XCOFFSymbolEntry32 *>(getRawDataRefImpl().p)->X
834
835 int16_t getSectionNumber() const { return GETVALUE(SectionNumber); }
836
838
841 "This interface is for C_FILE only.");
842 return GETVALUE(CFileLanguageIdAndTypeId.LanguageId);
843 }
844
847 "This interface is for C_FILE only.");
848 return GETVALUE(CFileLanguageIdAndTypeId.CpuTypeId);
849 }
850
852
853 uint8_t getNumberOfAuxEntries() const { return GETVALUE(NumberOfAuxEntries); }
854
855#undef GETVALUE
856
857 uintptr_t getEntryAddress() const {
858 return getRawDataRefImpl().p;
859 }
860
863 LLVM_ABI bool isCsectSymbol() const;
865
866private:
867 const XCOFFObjectFile *getObject() const {
868 return cast<XCOFFObjectFile>(BasicSymbolRef::getObject());
869 }
870};
871
873public:
875 : symbol_iterator(B) {}
876
878 : symbol_iterator(*Symbol) {}
879
880 const XCOFFSymbolRef *operator->() const {
881 return static_cast<const XCOFFSymbolRef *>(symbol_iterator::operator->());
882 }
883
884 const XCOFFSymbolRef &operator*() const {
885 return static_cast<const XCOFFSymbolRef &>(symbol_iterator::operator*());
886 }
887};
888
890 uint16_t Data;
891 SmallString<32> VecParmsInfo;
892
893 TBVectorExt(StringRef TBvectorStrRef, Error &Err);
894
895public:
896 LLVM_ABI static Expected<TBVectorExt> create(StringRef TBvectorStrRef);
898 LLVM_ABI bool isVRSavedOnStack() const;
899 LLVM_ABI bool hasVarArgs() const;
901 LLVM_ABI bool hasVMXInstruction() const;
902 SmallString<32> getVectorParmsInfo() const { return VecParmsInfo; };
903};
904
905/// This class provides methods to extract traceback table data from a buffer.
906/// The various accessors may reference the buffer provided via the constructor.
907
909 const uint8_t *const TBPtr;
910 bool Is64BitObj;
911 std::optional<SmallString<32>> ParmsType;
912 std::optional<uint32_t> TraceBackTableOffset;
913 std::optional<uint32_t> HandlerMask;
914 std::optional<uint32_t> NumOfCtlAnchors;
915 std::optional<SmallVector<uint32_t, 8>> ControlledStorageInfoDisp;
916 std::optional<StringRef> FunctionName;
917 std::optional<uint8_t> AllocaRegister;
918 std::optional<TBVectorExt> VecExt;
919 std::optional<uint8_t> ExtensionTable;
920 std::optional<uint64_t> EhInfoDisp;
921
923 bool Is64Bit = false);
924
925public:
926 /// Parse an XCOFF Traceback Table from \a Ptr with \a Size bytes.
927 /// Returns an XCOFFTracebackTable upon successful parsing, otherwise an
928 /// Error is returned.
929 ///
930 /// \param[in] Ptr
931 /// A pointer that points just past the initial 4 bytes of zeros at the
932 /// beginning of an XCOFF Traceback Table.
933 ///
934 /// \param[in, out] Size
935 /// A pointer that points to the length of the XCOFF Traceback Table.
936 /// If the XCOFF Traceback Table is not parsed successfully or there are
937 /// extra bytes that are not recognized, \a Size will be updated to be the
938 /// size up to the end of the last successfully parsed field of the table.
940 create(const uint8_t *Ptr, uint64_t &Size, bool Is64Bits = false);
943
944 LLVM_ABI bool isGlobalLinkage() const;
947 LLVM_ABI bool isInternalProcedure() const;
948 LLVM_ABI bool hasControlledStorage() const;
949 LLVM_ABI bool isTOCless() const;
950 LLVM_ABI bool isFloatingPointPresent() const;
952
953 LLVM_ABI bool isInterruptHandler() const;
954 LLVM_ABI bool isFuncNamePresent() const;
955 LLVM_ABI bool isAllocaUsed() const;
957 LLVM_ABI bool isCRSaved() const;
958 LLVM_ABI bool isLRSaved() const;
959
960 LLVM_ABI bool isBackChainStored() const;
961 LLVM_ABI bool isFixup() const;
963
964 LLVM_ABI bool hasVectorInfo() const;
965 LLVM_ABI bool hasExtensionTable() const;
967
969
971 LLVM_ABI bool hasParmsOnStack() const;
972
973 const std::optional<SmallString<32>> &getParmsType() const {
974 return ParmsType;
975 }
976 const std::optional<uint32_t> &getTraceBackTableOffset() const {
977 return TraceBackTableOffset;
978 }
979 const std::optional<uint32_t> &getHandlerMask() const { return HandlerMask; }
980 const std::optional<uint32_t> &getNumOfCtlAnchors() {
981 return NumOfCtlAnchors;
982 }
983 const std::optional<SmallVector<uint32_t, 8>> &
985 return ControlledStorageInfoDisp;
986 }
987 const std::optional<StringRef> &getFunctionName() const {
988 return FunctionName;
989 }
990 const std::optional<uint8_t> &getAllocaRegister() const {
991 return AllocaRegister;
992 }
993 const std::optional<TBVectorExt> &getVectorExt() const { return VecExt; }
994 const std::optional<uint8_t> &getExtensionTable() const {
995 return ExtensionTable;
996 }
997 const std::optional<uint64_t> &getEhInfoDisp() const { return EhInfoDisp; }
998};
999
1001} // namespace object
1002} // namespace llvm
1003
1004#endif // LLVM_OBJECT_XCOFFOBJECTFILE_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static StringRef getSymbolName(SymbolKind SymKind)
#define LLVM_ABI
Definition: Compiler.h:213
#define LLVM_TEMPLATE_ABI
Definition: Compiler.h:214
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Elf_Shdr Shdr
uint64_t Addr
std::string Name
uint64_t Size
static bool isDebugSection(const SectionBase &Sec)
Definition: ELFObjcopy.cpp:49
Symbol * Sym
Definition: ELF_riscv.cpp:479
static FeatureBitset getFeatures(MCSubtargetInfo &STI, StringRef CPU, StringRef TuneCPU, StringRef FS, ArrayRef< StringRef > ProcNames, ArrayRef< SubtargetSubTypeKV > ProcDesc, ArrayRef< SubtargetFeatureKV > ProcFeatures)
static uint32_t getSectionFlags(const MachOObjectFile &O, DataRefImpl Sec)
This file defines the SmallString class.
This file defines the SmallVector class.
static unsigned getSymbolSectionID(const ObjectFile &O, SymbolRef Sym)
Definition: SymbolSize.cpp:39
static uint32_t getFlags(const Symbol *Sym)
Definition: TapiFile.cpp:26
static std::unique_ptr< PDBSymbol > getSymbolType(const PDBSymbol &Symbol)
Definition: UDTLayout.cpp:35
static bool is64Bit(const char *name)
#define GETVALUE(X)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Lightweight error class with error context and mandatory checking.
Definition: Error.h:159
Tagged union holding either a T or a Error.
Definition: Error.h:485
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:26
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:574
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
A table of densely packed, null-terminated strings indexed by offset.
Definition: StringTable.h:33
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM Value Representation.
Definition: Value.h:75
A range adaptor for a pair of iterators.
const SymbolicFile * getObject() const
Definition: SymbolicFile.h:215
DataRefImpl getRawDataRefImpl() const
Definition: SymbolicFile.h:211
This class is the base class for all object file types.
Definition: ObjectFile.h:231
static Expected< std::unique_ptr< ObjectFile > > createXCOFFObjectFile(MemoryBufferRef Object, unsigned FileType)
This is a value type class that represents a single symbol in the list of symbols in the object file.
Definition: ObjectFile.h:170
SmallString< 32 > getVectorParmsInfo() const
LLVM_ABI uint8_t getNumberOfVectorParms() const
static LLVM_ABI Expected< TBVectorExt > create(StringRef TBvectorStrRef)
LLVM_ABI bool isVRSavedOnStack() const
LLVM_ABI uint8_t getNumberOfVRSaved() const
LLVM_ABI bool hasVarArgs() const
LLVM_ABI bool hasVMXInstruction() const
XCOFF::StorageMappingClass getStorageMappingClass() const
XCOFFCsectAuxRef(const XCOFFCsectAuxEnt32 *Entry32)
uint32_t getSectionOrLength32() const
uint32_t getParameterHashIndex() const
XCOFFCsectAuxRef(const XCOFFCsectAuxEnt64 *Entry64)
uint64_t getSectionOrLength64() const
XCOFF::SymbolAuxType getAuxType64() const
uint8_t getSymbolAlignmentAndType() const
const void * getPointerToSymbolTable() const
static bool classof(const Binary *B)
uintptr_t getSymbolByIndex(uint32_t Idx) const
bool is64Bit() const override
uint64_t getSymbolSize(DataRefImpl Symb) const
LLVM_ABI Expected< XCOFFCsectAuxRef > getXCOFFCsectAuxRef() const
LLVM_ABI Expected< bool > isFunction() const
LLVM_ABI bool isCsectSymbol() const
const XCOFFSymbolEntry64 * getSymbol64() const
XCOFFSymbolRef(DataRefImpl SymEntDataRef, const XCOFFObjectFile *OwningObjectPtr)
const XCOFFSymbolEntry32 * getSymbol32() const
LLVM_ABI Expected< StringRef > getName() const
uint8_t getCPUTypeIddForCFile() const
uint8_t getNumberOfAuxEntries() const
uintptr_t getEntryAddress() const
XCOFF::StorageClass getStorageClass() const
uint8_t getLanguageIdForCFile() const
This class provides methods to extract traceback table data from a buffer.
LLVM_ABI bool isOutOfLineEpilogOrPrologue() const
const std::optional< StringRef > & getFunctionName() const
const std::optional< uint64_t > & getEhInfoDisp() const
const std::optional< uint32_t > & getTraceBackTableOffset() const
LLVM_ABI uint8_t getNumOfGPRsSaved() const
LLVM_ABI bool hasTraceBackTableOffset() const
LLVM_ABI bool hasExtensionTable() const
const std::optional< SmallVector< uint32_t, 8 > > & getControlledStorageInfoDisp()
const std::optional< uint8_t > & getExtensionTable() const
const std::optional< SmallString< 32 > > & getParmsType() const
LLVM_ABI uint8_t getOnConditionDirective() const
LLVM_ABI uint8_t getLanguageID() const
LLVM_ABI uint8_t getNumOfFPRsSaved() const
LLVM_ABI bool isFloatingPointOperationLogOrAbortEnabled() const
LLVM_ABI uint8_t getNumberOfFPParms() const
LLVM_ABI bool isFuncNamePresent() const
const std::optional< uint32_t > & getNumOfCtlAnchors()
const std::optional< uint32_t > & getHandlerMask() const
LLVM_ABI bool isInternalProcedure() const
LLVM_ABI bool hasControlledStorage() const
LLVM_ABI bool isInterruptHandler() const
const std::optional< TBVectorExt > & getVectorExt() const
LLVM_ABI bool isFloatingPointPresent() const
LLVM_ABI uint8_t getVersion() const
static LLVM_ABI Expected< XCOFFTracebackTable > create(const uint8_t *Ptr, uint64_t &Size, bool Is64Bits=false)
Parse an XCOFF Traceback Table from Ptr with Size bytes.
LLVM_ABI bool isBackChainStored() const
const std::optional< uint8_t > & getAllocaRegister() const
LLVM_ABI uint8_t getNumberOfFixedParms() const
const SymbolRef * operator->() const
Definition: ObjectFile.h:217
const SymbolRef & operator*() const
Definition: ObjectFile.h:222
const XCOFFSymbolRef * operator->() const
const XCOFFSymbolRef & operator*() const
xcoff_symbol_iterator(const XCOFFSymbolRef *Symbol)
xcoff_symbol_iterator(const basic_symbol_iterator &B)
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
SymbolAuxType
Definition: XCOFF.h:366
RelocationType
Definition: XCOFF.h:263
constexpr size_t NameSize
Definition: XCOFF.h:30
CFileStringType
Definition: XCOFF.h:324
StorageClass
Definition: XCOFF.h:171
@ C_FILE
Definition: XCOFF.h:173
StorageMappingClass
Storage Mapping Class definitions.
Definition: XCOFF.h:104
constexpr size_t SymbolTableEntrySize
Definition: XCOFF.h:39
constexpr size_t FileNamePadSize
Definition: XCOFF.h:29
@ XTY_LD
Label definition.
Definition: XCOFF.h:244
SectionTypeFlags
Definition: XCOFF.h:135
static constexpr const StringLiteral & getSectionName(DebugSectionKind SectionKind)
Return the name of the section.
LLVM_ABI bool doesXCOFFTracebackTableBegin(ArrayRef< uint8_t > Bytes)
ExceptionSectionEntry< support::ubig64_t > ExceptionSectionEntry64
ExceptionSectionEntry< support::ubig32_t > ExceptionSectionEntry32
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:477
@ Ref
The access may reference the value stored in memory.
support::ubig32_t MaxStackSize
If the value is 0, the system default maximum stack size is used.
support::ubig16_t AuxMagic
If the value of the o_vstamp field is greater than 1, the o_mflags field is reserved for future use a...
uint8_t TextPageSize
Specifies the size of pages for the exec text.
uint8_t StackPageSize
Specifies the size of pages for the stack.
support::ubig32_t ReservedForDebugger
This field should contain 0.
support::ubig16_t Version
The valid values are 1 and 2.
uint8_t DataPageSize
Specifies the size of pages for the exec data.
support::ubig32_t MaxDataSize
If the value is 0, the system default maximum data size is used.
static constexpr uint8_t AuxiHeaderTDataAlignmentMask
static constexpr uint8_t AuxiHeaderFlagMask
XCOFF::StorageMappingClass StorageMappingClass
XCOFF::StorageMappingClass StorageMappingClass
support::ubig32_t SectionOrLengthLowByte
support::ubig32_t SectionOrLengthHighByte
XCOFF::SymbolAuxType AuxType
XCOFF::CFileStringType Type
char Name[XCOFF::NameSize+XCOFF::FileNamePadSize]
support::big32_t NumberOfSymTableEntries
support::ubig16_t NumberOfSections
support::ubig32_t SymbolTableOffset
support::ubig64_t SymbolTableOffset
support::ubig32_t NumberOfSymTableEntries
support::ubig16_t NumberOfSections
XCOFF::RelocationType Type
support::ubig32_t FileOffsetToLineNumberInfo
support::ubig32_t FileOffsetToRelocationInfo
static constexpr unsigned SectionFlagsReservedMask
static constexpr unsigned SectionFlagsTypeMask
CFileLanguageIdAndTypeIdType CFileLanguageIdAndTypeId
char SymbolName[XCOFF::NameSize]
CFileLanguageIdAndTypeIdType CFileLanguageIdAndTypeId