Index: llvm/include/llvm/BinaryFormat/XCOFF.h =================================================================== --- llvm/include/llvm/BinaryFormat/XCOFF.h +++ llvm/include/llvm/BinaryFormat/XCOFF.h @@ -292,6 +292,15 @@ TCPU_970 = 19 ///< PPC970 - PowerPC 64-bit architecture. }; +enum SymbolAuxType : uint8_t { + _AUX_EXCEPT = 255, ///< Identifies an exception auxiliary entry. + _AUX_FCN = 254, ///< Identifies a function auxiliary entry. + _AUX_SYM = 253, ///< Identifies a symbol auxiliary entry. + _AUX_FILE = 252, ///< Identifies a file auxiliary entry. + _AUX_CSECT = 251, ///< Identifies a csect auxiliary entry. + _AUX_SECT = 250 ///< Identifies a SECT auxiliary entry. +}; // 64-bit XCOFF file only. + StringRef getMappingClassString(XCOFF::StorageMappingClass SMC); StringRef getRelocationTypeString(XCOFF::RelocationType Type); Index: llvm/include/llvm/Object/XCOFFObjectFile.h =================================================================== --- llvm/include/llvm/Object/XCOFFObjectFile.h +++ llvm/include/llvm/Object/XCOFFObjectFile.h @@ -107,14 +107,25 @@ uint8_t CpuTypeId; } CFileLanguageIdAndTypeIdType; + typedef struct { + union { + char SymbolName[XCOFF::NameSize]; + NameInStrTblType NameInStrTbl; + }; + support::ubig32_t Value; // Symbol value; storage class-dependent. + } Entry32Type; + + typedef struct { + support::ubig64_t Value; // Symbol value; storage class-dependent. + support::ubig32_t Offset; + } Entry64Type; + union { - char SymbolName[XCOFF::NameSize]; - NameInStrTblType NameInStrTbl; + Entry32Type Obj32; // 32-bit XCOFF file only. + Entry64Type Obj64; // 64-bit XCOFF file only. }; - support::ubig32_t Value; // Symbol value; storage class-dependent. support::big16_t SectionNumber; - union { support::ubig16_t SymbolType; CFileLanguageIdAndTypeIdType CFileLanguageIdAndTypeId; @@ -129,23 +140,44 @@ const char *Data; }; -struct XCOFFCsectAuxEnt32 { +struct XCOFFCsectAuxEnt { static constexpr uint8_t SymbolTypeMask = 0x07; static constexpr uint8_t SymbolAlignmentMask = 0xF8; static constexpr size_t SymbolAlignmentBitOffset = 3; - - support::ubig32_t - SectionOrLength; // If the symbol type is XTY_SD or XTY_CM, the csect - // length. - // If the symbol type is XTY_LD, the symbol table - // index of the containing csect. - // If the symbol type is XTY_ER, 0. + typedef struct { + uint8_t Pad; + XCOFF::SymbolAuxType AuxType; + } PadAndAuxType; + + // For SectionOrLength32 in 32-bit, SectionOrLengthLowByte64 and + // SectionOrLengthHighByte64 in 64-bit: + // If the symbol type is XTY_SD or XTY_CM, the csect length. + // If the symbol type is XTY_LD, the symbol table + // index of the containing csect. + // If the symbol type is XTY_ER, 0. + union { + support::ubig32_t SectionOrLength32; // 32-bit XCOFF file only. + support::ubig32_t SectionOrLengthLowByte64; // 64-bit XCOFF file only. + }; support::ubig32_t ParameterHashIndex; support::ubig16_t TypeChkSectNum; uint8_t SymbolAlignmentAndType; XCOFF::StorageMappingClass StorageMappingClass; - support::ubig32_t StabInfoIndex; - support::ubig16_t StabSectNum; + union { + support::ubig32_t StabInfoIndex32; // 32-bit XCOFF file only. + support::ubig32_t SectionOrLengthHighByte64; // 64-bit XCOFF file only. + }; + union { + support::ubig16_t StabSectNum32; // 32-bit XCOFF file only. + PadAndAuxType PadAndAux64; // 64-bit XCOFF file only. + }; + + uint32_t getSectionOrLength32() const { return SectionOrLength32; } + + uint64_t getSectionOrLength64() const { + return (static_cast(SectionOrLengthHighByte64) << 32) | + SectionOrLengthLowByte64; + } uint16_t getAlignmentLog2() const { return (SymbolAlignmentAndType & SymbolAlignmentMask) >> @@ -171,7 +203,7 @@ }; XCOFF::CFileStringType Type; uint8_t ReservedZeros[2]; - uint8_t AuxType; // 64-bit XCOFF file only. + XCOFF::SymbolAuxType AuxType; // 64-bit XCOFF file only. }; struct XCOFFSectAuxEntForStat { @@ -179,7 +211,7 @@ support::ubig16_t NumberOfRelocEnt; support::ubig16_t NumberOfLineNum; uint8_t Pad[10]; -}; +}; // 32-bit XCOFF file only. struct XCOFFRelocation32 { // Masks for packing/unpacking the r_rsize field of relocations. @@ -321,7 +353,6 @@ bool is64Bit() const; const XCOFFSymbolEntry *getPointerToSymbolTable() const { - assert(!is64Bit() && "Symbol table handling not supported yet."); return SymbolTblPtr; } @@ -383,7 +414,7 @@ XCOFF::StorageClass getStorageClass() const; uint8_t getNumberOfAuxEntries() const; - const XCOFFCsectAuxEnt32 *getXCOFFCsectAuxEnt32() const; + Expected getXCOFFCsectAuxEnt() const; uint16_t getType() const; int16_t getSectionNumber() const; Index: llvm/lib/Object/XCOFFObjectFile.cpp =================================================================== --- llvm/lib/Object/XCOFFObjectFile.cpp +++ llvm/lib/Object/XCOFFObjectFile.cpp @@ -21,6 +21,7 @@ static const uint8_t FunctionSym = 0x20; static const uint8_t SymTypeMask = 0x07; static const uint16_t NoRelMask = 0x0001; +static const size_t SymbolAuxTypeOffset = 17; // Checks that [Ptr, Ptr + Size) bytes fall inside the memory buffer // 'M'. Returns a pointer to the underlying object on success. @@ -111,7 +112,6 @@ } const XCOFFSymbolEntry *XCOFFObjectFile::toSymbolEntry(DataRefImpl Ref) const { - assert(!is64Bit() && "Symbol table support not implemented for 64-bit."); assert(Ref.p != 0 && "Symbol table pointer can not be nullptr!"); #ifndef NDEBUG checkSymbolEntryPointer(Ref.p); @@ -187,20 +187,28 @@ if (SymEntPtr->StorageClass & 0x80) return StringRef("Unimplemented Debug Name"); - if (SymEntPtr->NameInStrTbl.Magic != XCOFFSymbolEntry::NAME_IN_STR_TBL_MAGIC) - return generateXCOFFFixedNameStringRef(SymEntPtr->SymbolName); + if (is64Bit()) + return getStringTableEntry(SymEntPtr->Obj64.Offset); + + if (SymEntPtr->Obj32.NameInStrTbl.Magic != + XCOFFSymbolEntry::NAME_IN_STR_TBL_MAGIC) + return generateXCOFFFixedNameStringRef(SymEntPtr->Obj32.SymbolName); - return getStringTableEntry(SymEntPtr->NameInStrTbl.Offset); + return getStringTableEntry(SymEntPtr->Obj32.NameInStrTbl.Offset); } Expected XCOFFObjectFile::getSymbolAddress(DataRefImpl Symb) const { - assert(!is64Bit() && "Symbol table support not implemented for 64-bit."); - return toSymbolEntry(Symb)->Value; + if (is64Bit()) + return toSymbolEntry(Symb)->Obj64.Value; + + return toSymbolEntry(Symb)->Obj32.Value; } uint64_t XCOFFObjectFile::getSymbolValueImpl(DataRefImpl Symb) const { - assert(!is64Bit() && "Symbol table support not implemented for 64-bit."); - return toSymbolEntry(Symb)->Value; + if (is64Bit()) + return toSymbolEntry(Symb)->Obj64.Value; + + return toSymbolEntry(Symb)->Obj32.Value; } uint64_t XCOFFObjectFile::getCommonSymbolSizeImpl(DataRefImpl Symb) const { @@ -399,19 +407,18 @@ } basic_symbol_iterator XCOFFObjectFile::symbol_begin() const { - if (is64Bit()) - report_fatal_error("64-bit support not implemented yet"); DataRefImpl SymDRI; SymDRI.p = reinterpret_cast(SymbolTblPtr); return basic_symbol_iterator(SymbolRef(SymDRI, this)); } basic_symbol_iterator XCOFFObjectFile::symbol_end() const { - if (is64Bit()) - report_fatal_error("64-bit support not implemented yet"); DataRefImpl SymDRI; - SymDRI.p = reinterpret_cast( - SymbolTblPtr + getLogicalNumberOfSymbolTableEntries32()); + const uint32_t NumberOfSymbolTableEntries = + is64Bit() ? getNumberOfSymbolTableEntries64() + : getLogicalNumberOfSymbolTableEntries32(); + SymDRI.p = + reinterpret_cast(SymbolTblPtr + NumberOfSymbolTableEntries); return basic_symbol_iterator(SymbolRef(SymDRI, this)); } @@ -483,7 +490,6 @@ Expected XCOFFObjectFile::getSymbolSectionName(const XCOFFSymbolEntry *SymEntPtr) const { - assert(!is64Bit() && "Symbol table support not implemented for 64-bit."); int16_t SectionNum = SymEntPtr->SectionNumber; switch (SectionNum) { @@ -576,10 +582,11 @@ Expected XCOFFObjectFile::getSymbolNameByIndex(uint32_t Index) const { - if (is64Bit()) - report_fatal_error("64-bit symbol table support not implemented yet."); + const uint32_t NumberOfSymTableEntries = + is64Bit() ? getNumberOfSymbolTableEntries64() + : getLogicalNumberOfSymbolTableEntries32(); - if (Index >= getLogicalNumberOfSymbolTableEntries32()) + if (Index >= NumberOfSymTableEntries) return errorCodeToError(object_error::invalid_symbol_index); DataRefImpl SymDRI; @@ -725,18 +732,18 @@ Obj->SectionHeaderTable = SecHeadersOrErr.get(); } - // 64-bit object supports only file header and section headers for now. - if (Obj->is64Bit()) - return std::move(Obj); - + const uint32_t NumberOfSymbolTableEntries = + Obj->is64Bit() ? Obj->getNumberOfSymbolTableEntries64() + : Obj->getLogicalNumberOfSymbolTableEntries32(); // If there is no symbol table we are done parsing the memory buffer. - if (Obj->getLogicalNumberOfSymbolTableEntries32() == 0) + if (NumberOfSymbolTableEntries == 0) return std::move(Obj); // Parse symbol table. - CurOffset = Obj->fileHeader32()->SymbolTableOffset; - uint64_t SymbolTableSize = (uint64_t)(sizeof(XCOFFSymbolEntry)) * - Obj->getLogicalNumberOfSymbolTableEntries32(); + CurOffset = Obj->is64Bit() ? Obj->getSymbolTableOffset64() + : Obj->getSymbolTableOffset32(); + uint64_t SymbolTableSize = static_cast(sizeof(XCOFFSymbolEntry)) * + NumberOfSymbolTableEntries; auto SymTableOrErr = getObject(Data, Base + CurOffset, SymbolTableSize); if (Error E = SymTableOrErr.takeError()) @@ -768,23 +775,45 @@ return OwningObjectPtr->toSymbolEntry(SymEntDataRef)->NumberOfAuxEntries; } -// TODO: The function needs to return an error if there is no csect auxiliary -// entry. -const XCOFFCsectAuxEnt32 *XCOFFSymbolRef::getXCOFFCsectAuxEnt32() const { - assert(!OwningObjectPtr->is64Bit() && - "32-bit interface called on 64-bit object file."); - assert(hasCsectAuxEnt() && "No Csect Auxiliary Entry is found."); +Expected XCOFFSymbolRef::getXCOFFCsectAuxEnt() const { + if (!hasCsectAuxEnt()) + return errorCodeToError(object_error::parse_failed); // In XCOFF32, the csect auxilliary entry is always the last auxiliary // entry for the symbol. uintptr_t AuxAddr = getWithOffset( SymEntDataRef.p, XCOFF::SymbolTableEntrySize * getNumberOfAuxEntries()); + auto getSymbolAuxType = [this](uintptr_t AuxAddr) { + return viewAs( + getWithOffset(AuxAddr, SymbolAuxTypeOffset)); + }; + + // XCOFF64 uses SymbolAuxType to identify the auxiliary entry type. + // If the last auxiliary entry is not the csect auxiliary entry, + // then we need to iterate through all the auxiliary entries to find it. + if (OwningObjectPtr->is64Bit() && + *getSymbolAuxType(AuxAddr) != XCOFF::SymbolAuxType::_AUX_CSECT) { + uintptr_t AuxAddr64 = 0; + for (int Index = 1; Index <= getNumberOfAuxEntries(); ++Index) { + AuxAddr64 = + getWithOffset(SymEntDataRef.p, XCOFF::SymbolTableEntrySize * Index); + if (*getSymbolAuxType(AuxAddr64) == XCOFF::SymbolAuxType::_AUX_CSECT) + break; + } + // If both address is equal, it means we did not found an csect + // auxiliary entry during our iteration. + if (AuxAddr64 == AuxAddr) + return errorCodeToError(object_error::parse_failed); + + AuxAddr = AuxAddr64; + } + #ifndef NDEBUG OwningObjectPtr->checkSymbolEntryPointer(AuxAddr); #endif - return reinterpret_cast(AuxAddr); + return reinterpret_cast(AuxAddr); } uint16_t XCOFFSymbolRef::getType() const { @@ -804,16 +833,17 @@ } bool XCOFFSymbolRef::isFunction() const { - if (OwningObjectPtr->is64Bit()) - report_fatal_error("64-bit support is unimplemented yet."); - if (getType() & FunctionSym) return true; if (!hasCsectAuxEnt()) return false; - const XCOFFCsectAuxEnt32 *CsectAuxEnt = getXCOFFCsectAuxEnt32(); + Expected ExpCsectAuxEnt = getXCOFFCsectAuxEnt(); + if (!ExpCsectAuxEnt) + return false; + + const XCOFFCsectAuxEnt *CsectAuxEnt = ExpCsectAuxEnt.get(); // A function definition should be a label definition. if ((CsectAuxEnt->SymbolAlignmentAndType & SymTypeMask) != XCOFF::XTY_LD) Index: llvm/test/tools/llvm-objdump/XCOFF/disassemble-symbol-description64.test =================================================================== --- /dev/null +++ llvm/test/tools/llvm-objdump/XCOFF/disassemble-symbol-description64.test @@ -0,0 +1,96 @@ +# REQUIRES: powerpc-registered-target + +# RUN: llvm-objdump -D %p/Inputs/xcoff-section-headers64.o | \ +# RUN: FileCheck --check-prefixes=COMMON,PLAIN %s + +# RUN: llvm-objdump -D --symbol-description %p/Inputs/xcoff-section-headers64.o | \ +# RUN: FileCheck --check-prefixes=COMMON,DESC %s + +# RUN: not --crash llvm-objdump -D -r --symbol-description %p/Inputs/xcoff-section-headers64.o 2>&1 | \ +# RUN: FileCheck --check-prefix=ERROR %s +# ERROR: 64-bit support not implemented yet + +## xcoff-section-headers64.o Compiled with IBM XL C/C++ for AIX, V16.1.0 +## compiler command: xlc -q64 -qtls -o xcoff-section-headers64.o -c test.c + +## test.c: +## int a; +## int b = 12345; +## __thread int c; +## __thread double d = 3.14159; +## +## int func(void) { +## return a; +## } + +COMMON: Inputs/xcoff-section-headers64.o: file format aix5coff64-rs6000 +COMMON: Disassembly of section .text: +COMMON-EMPTY: +PLAIN: 0000000000000000 <.func>: +DESC: 0000000000000000 (idx: 6) .func: +COMMON-NEXT: 0: e8 62 00 08 ld 3, 8(2) +COMMON-NEXT: 4: e8 63 00 02 lwa 3, 0(3) +COMMON-NEXT: 8: 4e 80 00 20 blr +COMMON-NEXT: c: 00 00 00 00 +COMMON-NEXT: 10: 00 00 20 40 +COMMON-NEXT: 14: 00 00 00 01 +COMMON-NEXT: 18: 00 00 00 0c +COMMON-NEXT: 1c: 00 04 66 75 +COMMON-NEXT: 20: 6e 63 00 00 xoris 3, 19, 0 +COMMON-NEXT: ... +COMMON-EMPTY: +COMMON-NEXT: Disassembly of section .data: +COMMON-EMPTY: +PLAIN: 0000000000000080 : +DESC: 0000000000000080 (idx: 12) func[TC]: +COMMON-NEXT: 80: 00 00 00 00 +COMMON-NEXT: 84: 00 00 00 a8 +COMMON-EMPTY: +PLAIN: 0000000000000088 : +DESC: 0000000000000088 (idx: 16) a[TC]: +COMMON-NEXT: 88: 00 00 00 00 +COMMON-NEXT: 8c: 00 00 00 c8 +COMMON-EMPTY: +PLAIN: 0000000000000090 : +DESC: 0000000000000090 (idx: 20) b[TC]: +COMMON-NEXT: 90: 00 00 00 00 +COMMON-NEXT: 94: 00 00 00 c0 +COMMON-EMPTY: +PLAIN: 0000000000000098 : +DESC: 0000000000000098 (idx: 24) c[TC]: +COMMON-NEXT: 98: 00 00 00 00 +COMMON-NEXT: 9c: 00 00 00 08 +COMMON-EMPTY: +PLAIN: 00000000000000a0 : +DESC: 00000000000000a0 (idx: 28) d[TC]: +COMMON-NEXT: ... +COMMON-EMPTY: +PLAIN: 00000000000000a8 : +DESC: 00000000000000a8 (idx: 10) func[DS]: +COMMON-NEXT: ... +COMMON-NEXT: b4: 00 00 00 80 +COMMON-NEXT: ... +COMMON-EMPTY: +PLAIN: 00000000000000c0 : +DESC: 00000000000000c0 (idx: 18) b[RW]: +COMMON-NEXT: c0: 00 00 30 39 +COMMON-NEXT: c4: 00 00 00 00 +COMMON-EMPTY: +COMMON-NEXT: Disassembly of section .bss: +COMMON-EMPTY: +PLAIN: 00000000000000c8 : +DESC: 00000000000000c8 (idx: 14) a[RW]: +COMMON-NEXT: ... +COMMON-EMPTY: +COMMON-NEXT: Disassembly of section .tdata: +COMMON-EMPTY: +PLAIN: 0000000000000000 : +DESC: 0000000000000000 (idx: 26) d[TL]: +COMMON-NEXT: 0: 40 09 21 f9 bdnzfl 9, 0x21f8 +COMMON-NEXT: 4: f0 1b 86 6e +COMMON-EMPTY: +COMMON-NEXT: Disassembly of section .tbss: +COMMON-EMPTY: +PLAIN: 0000000000000008 : +DESC: 0000000000000008 (idx: 22) c[UL]: +COMMON-NEXT: ... Index: llvm/test/tools/llvm-readobj/XCOFF/symbols64.test =================================================================== --- /dev/null +++ llvm/test/tools/llvm-readobj/XCOFF/symbols64.test @@ -0,0 +1,387 @@ +## This file tests the ability of llvm-readobj to display the symbol table for a +## 64-bit XCOFF object file. +## The object file used is generated by the following source file +## and command on AIX: +## +## > cat test8.c +## +## extern int i; +## extern int TestforXcoff; +## extern int fun(int i); +## static int static_i; +## char* p="abcd"; +## int fun1(int j) { +## static_i++; +## j++; +## j=j+*p; +## return j; +## } +## +## int main() { +## i++; +## fun(i); +## return fun1(i); +## } +## +## > xlc -q64 -c test8.c -o symbol64.o + +# RUN: llvm-readobj --symbols %p/Inputs/symbol64.o | \ +# RUN: FileCheck --check-prefix=SYMBOL64 %s + +# SYMBOL64: File: {{.*}}symbol64.o +# SYMBOL64-NEXT: Format: aix5coff64-rs6000 +# SYMBOL64-NEXT: Arch: powerpc64 +# SYMBOL64-NEXT: AddressSize: 64bit +# SYMBOL64-NEXT: Symbols [ +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 0 +# SYMBOL64-NEXT: Name: .file +# SYMBOL64-NEXT: Value (SymbolTableIndex): 0x0 +# SYMBOL64-NEXT: Section: N_DEBUG +# SYMBOL64-NEXT: Source Language ID: TB_C (0x0) +# SYMBOL64-NEXT: CPU Version ID: TCPU_PPC64 (0x2) +# SYMBOL64-NEXT: StorageClass: C_FILE (0x67) +# SYMBOL64-NEXT: NumberOfAuxEntries: 3 +# SYMBOL64-NEXT: File Auxiliary Entry { +# SYMBOL64-NEXT: Index: 1 +# SYMBOL64-NEXT: Name: test64.c +# SYMBOL64-NEXT: Type: XFT_FN (0x0) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_FILE (0xFC) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: File Auxiliary Entry { +# SYMBOL64-NEXT: Index: 2 +# SYMBOL64-NEXT: Name: Mon Aug 10 16:07:48 2020 +# SYMBOL64-NEXT: Type: XFT_CT (0x1) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_FILE (0xFC) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: File Auxiliary Entry { +# SYMBOL64-NEXT: Index: 3 +# SYMBOL64-NEXT: Name: IBM XL C for AIX, Version 16.1.0.6 +# SYMBOL64-NEXT: Type: XFT_CV (0x2) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_FILE (0xFC) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 4 +# SYMBOL64-NEXT: Name: +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x0 +# SYMBOL64-NEXT: Section: .text +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_HIDEXT (0x6B) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 5 +# SYMBOL64-NEXT: SectionLen: 256 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 7 +# SYMBOL64-NEXT: SymbolType: XTY_SD (0x1) +# SYMBOL64-NEXT: StorageMappingClass: XMC_PR (0x0) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 6 +# SYMBOL64-NEXT: Name: .fun1 +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x0 +# SYMBOL64-NEXT: Section: .text +# SYMBOL64-NEXT: Type: 0x20 +# SYMBOL64-NEXT: StorageClass: C_EXT (0x2) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 7 +# SYMBOL64-NEXT: ContainingCsectSymbolIndex: 4 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 0 +# SYMBOL64-NEXT: SymbolType: XTY_LD (0x2) +# SYMBOL64-NEXT: StorageMappingClass: XMC_PR (0x0) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 8 +# SYMBOL64-NEXT: Name: .main +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x80 +# SYMBOL64-NEXT: Section: .text +# SYMBOL64-NEXT: Type: 0x20 +# SYMBOL64-NEXT: StorageClass: C_EXT (0x2) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 9 +# SYMBOL64-NEXT: ContainingCsectSymbolIndex: 4 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 0 +# SYMBOL64-NEXT: SymbolType: XTY_LD (0x2) +# SYMBOL64-NEXT: StorageMappingClass: XMC_PR (0x0) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 10 +# SYMBOL64-NEXT: Name: TOC +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x100 +# SYMBOL64-NEXT: Section: .data +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_HIDEXT (0x6B) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 11 +# SYMBOL64-NEXT: SectionLen: 0 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 2 +# SYMBOL64-NEXT: SymbolType: XTY_SD (0x1) +# SYMBOL64-NEXT: StorageMappingClass: XMC_TC0 (0xF) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 12 +# SYMBOL64-NEXT: Name: +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x128 +# SYMBOL64-NEXT: Section: .data +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_HIDEXT (0x6B) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 13 +# SYMBOL64-NEXT: SectionLen: 8 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 3 +# SYMBOL64-NEXT: SymbolType: XTY_SD (0x1) +# SYMBOL64-NEXT: StorageMappingClass: XMC_TC (0x3) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 14 +# SYMBOL64-NEXT: Name: +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x168 +# SYMBOL64-NEXT: Section: .data +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_HIDEXT (0x6B) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 15 +# SYMBOL64-NEXT: SectionLen: 5 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 3 +# SYMBOL64-NEXT: SymbolType: XTY_SD (0x1) +# SYMBOL64-NEXT: StorageMappingClass: XMC_RO (0x1) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 16 +# SYMBOL64-NEXT: Name: _$STATIC_BSS +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x170 +# SYMBOL64-NEXT: Section: .bss +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_HIDEXT (0x6B) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 17 +# SYMBOL64-NEXT: SectionLen: 4 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 2 +# SYMBOL64-NEXT: SymbolType: XTY_CM (0x3) +# SYMBOL64-NEXT: StorageMappingClass: XMC_RW (0x5) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 18 +# SYMBOL64-NEXT: Name: _$STATIC_BSS +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x108 +# SYMBOL64-NEXT: Section: .data +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_HIDEXT (0x6B) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 19 +# SYMBOL64-NEXT: SectionLen: 8 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 3 +# SYMBOL64-NEXT: SymbolType: XTY_SD (0x1) +# SYMBOL64-NEXT: StorageMappingClass: XMC_TC (0x3) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 20 +# SYMBOL64-NEXT: Name: fun1 +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x130 +# SYMBOL64-NEXT: Section: .data +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_EXT (0x2) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 21 +# SYMBOL64-NEXT: SectionLen: 24 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 3 +# SYMBOL64-NEXT: SymbolType: XTY_SD (0x1) +# SYMBOL64-NEXT: StorageMappingClass: XMC_DS (0xA) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 22 +# SYMBOL64-NEXT: Name: fun1 +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x100 +# SYMBOL64-NEXT: Section: .data +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_HIDEXT (0x6B) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 23 +# SYMBOL64-NEXT: SectionLen: 8 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 3 +# SYMBOL64-NEXT: SymbolType: XTY_SD (0x1) +# SYMBOL64-NEXT: StorageMappingClass: XMC_TC (0x3) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 24 +# SYMBOL64-NEXT: Name: p +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x160 +# SYMBOL64-NEXT: Section: .data +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_EXT (0x2) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 25 +# SYMBOL64-NEXT: SectionLen: 8 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 3 +# SYMBOL64-NEXT: SymbolType: XTY_SD (0x1) +# SYMBOL64-NEXT: StorageMappingClass: XMC_RW (0x5) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 26 +# SYMBOL64-NEXT: Name: p +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x110 +# SYMBOL64-NEXT: Section: .data +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_HIDEXT (0x6B) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 27 +# SYMBOL64-NEXT: SectionLen: 8 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 3 +# SYMBOL64-NEXT: SymbolType: XTY_SD (0x1) +# SYMBOL64-NEXT: StorageMappingClass: XMC_TC (0x3) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 28 +# SYMBOL64-NEXT: Name: main +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x148 +# SYMBOL64-NEXT: Section: .data +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_EXT (0x2) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 29 +# SYMBOL64-NEXT: SectionLen: 24 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 3 +# SYMBOL64-NEXT: SymbolType: XTY_SD (0x1) +# SYMBOL64-NEXT: StorageMappingClass: XMC_DS (0xA) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 30 +# SYMBOL64-NEXT: Name: main +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x118 +# SYMBOL64-NEXT: Section: .data +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_HIDEXT (0x6B) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 31 +# SYMBOL64-NEXT: SectionLen: 8 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 3 +# SYMBOL64-NEXT: SymbolType: XTY_SD (0x1) +# SYMBOL64-NEXT: StorageMappingClass: XMC_TC (0x3) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 32 +# SYMBOL64-NEXT: Name: i +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x0 +# SYMBOL64-NEXT: Section: N_UNDEF +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_EXT (0x2) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 33 +# SYMBOL64-NEXT: SectionLen: 0 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 0 +# SYMBOL64-NEXT: SymbolType: XTY_ER (0x0) +# SYMBOL64-NEXT: StorageMappingClass: XMC_UA (0x4) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 34 +# SYMBOL64-NEXT: Name: i +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x120 +# SYMBOL64-NEXT: Section: .data +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_HIDEXT (0x6B) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 35 +# SYMBOL64-NEXT: SectionLen: 8 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 3 +# SYMBOL64-NEXT: SymbolType: XTY_SD (0x1) +# SYMBOL64-NEXT: StorageMappingClass: XMC_TC (0x3) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: Symbol { +# SYMBOL64-NEXT: Index: 36 +# SYMBOL64-NEXT: Name: .fun +# SYMBOL64-NEXT: Value (RelocatableAddress): 0x0 +# SYMBOL64-NEXT: Section: N_UNDEF +# SYMBOL64-NEXT: Type: 0x0 +# SYMBOL64-NEXT: StorageClass: C_EXT (0x2) +# SYMBOL64-NEXT: NumberOfAuxEntries: 1 +# SYMBOL64-NEXT: CSECT Auxiliary Entry { +# SYMBOL64-NEXT: Index: 37 +# SYMBOL64-NEXT: SectionLen: 0 +# SYMBOL64-NEXT: ParameterHashIndex: 0x0 +# SYMBOL64-NEXT: TypeChkSectNum: 0x0 +# SYMBOL64-NEXT: SymbolAlignmentLog2: 0 +# SYMBOL64-NEXT: SymbolType: XTY_ER (0x0) +# SYMBOL64-NEXT: StorageMappingClass: XMC_PR (0x0) +# SYMBOL64-NEXT: Auxiliary Type: _AUX_CSECT (0xFB) +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: } +# SYMBOL64-NEXT: ] Index: llvm/tools/llvm-objdump/XCOFFDump.cpp =================================================================== --- llvm/tools/llvm-objdump/XCOFFDump.cpp +++ llvm/tools/llvm-objdump/XCOFFDump.cpp @@ -48,20 +48,30 @@ const SymbolRef &Sym) { XCOFFSymbolRef SymRef(Sym.getRawDataRefImpl(), Obj); - if (SymRef.hasCsectAuxEnt()) - return SymRef.getXCOFFCsectAuxEnt32()->StorageMappingClass; - - return None; + if (!SymRef.hasCsectAuxEnt()) + return None; + + Expected CsectAuxEntOrErr = + SymRef.getXCOFFCsectAuxEnt(); + if (!CsectAuxEntOrErr) + return None; + + return CsectAuxEntOrErr.get()->StorageMappingClass; } bool objdump::isLabel(const XCOFFObjectFile *Obj, const SymbolRef &Sym) { XCOFFSymbolRef SymRef(Sym.getRawDataRefImpl(), Obj); - if (SymRef.hasCsectAuxEnt()) - return SymRef.getXCOFFCsectAuxEnt32()->isLabel(); - - return false; + if (!SymRef.hasCsectAuxEnt()) + return false; + + Expected CsectAuxEntOrErr = + SymRef.getXCOFFCsectAuxEnt(); + if (!CsectAuxEntOrErr) + return false; + + return CsectAuxEntOrErr.get()->isLabel(); } std::string objdump::getXCOFFSymbolDescription(const SymbolInfoTy &SymbolInfo, Index: llvm/tools/llvm-readobj/XCOFFDumper.cpp =================================================================== --- llvm/tools/llvm-readobj/XCOFFDumper.cpp +++ llvm/tools/llvm-readobj/XCOFFDumper.cpp @@ -41,7 +41,7 @@ template void printGenericSectionHeader(T &Sec) const; template void printOverflowSectionHeader(T &Sec) const; void printFileAuxEnt(const XCOFFFileAuxEnt *AuxEntPtr); - void printCsectAuxEnt32(const XCOFFCsectAuxEnt32 *AuxEntPtr); + void printCsectAuxEnt(const XCOFFCsectAuxEnt *AuxEntPtr); void printSectAuxEntForStat(const XCOFFSectAuxEntForStat *AuxEntPtr); void printSymbol(const SymbolRef &); void printRelocations(ArrayRef Sections); @@ -165,10 +165,15 @@ #undef ECase }; +static const EnumEntry SymAuxType[] = { +#define ECase(X) \ + { #X, XCOFF::X } + ECase(_AUX_EXCEPT), ECase(_AUX_FCN), ECase(_AUX_SYM), ECase(_AUX_FILE), + ECase(_AUX_CSECT), ECase(_AUX_SECT) +#undef ECase +}; + void XCOFFDumper::printFileAuxEnt(const XCOFFFileAuxEnt *AuxEntPtr) { - if (Obj.is64Bit()) - report_fatal_error( - "Printing for File Auxiliary Entry in 64-bit is unimplemented."); StringRef FileName = unwrapOrError(Obj.getFileName(), Obj.getCFileName(AuxEntPtr)); DictScope SymDs(W, "File Auxiliary Entry"); @@ -177,6 +182,12 @@ W.printString("Name", FileName); W.printEnum("Type", static_cast(AuxEntPtr->Type), makeArrayRef(FileStringType)); + if (Obj.is64Bit()) { + if (AuxEntPtr->AuxType != XCOFF::_AUX_FILE) + W.startLine() << "!Mismatched auxiliary type: "; + W.printEnum("Auxiliary Type", static_cast(AuxEntPtr->AuxType), + makeArrayRef(SymAuxType)); + } } static const EnumEntry CsectStorageMappingClass[] = @@ -200,16 +211,14 @@ #undef ECase }; -void XCOFFDumper::printCsectAuxEnt32(const XCOFFCsectAuxEnt32 *AuxEntPtr) { - assert(!Obj.is64Bit() && "32-bit interface called on 64-bit object file."); - +void XCOFFDumper::printCsectAuxEnt(const XCOFFCsectAuxEnt *AuxEntPtr) { DictScope SymDs(W, "CSECT Auxiliary Entry"); W.printNumber("Index", Obj.getSymbolIndex(reinterpret_cast(AuxEntPtr))); - if (AuxEntPtr->isLabel()) - W.printNumber("ContainingCsectSymbolIndex", AuxEntPtr->SectionOrLength); - else - W.printNumber("SectionLen", AuxEntPtr->SectionOrLength); + W.printNumber(AuxEntPtr->isLabel() ? "ContainingCsectSymbolIndex" + : "SectionLen", + Obj.is64Bit() ? AuxEntPtr->getSectionOrLength64() + : AuxEntPtr->getSectionOrLength32()); W.printHex("ParameterHashIndex", AuxEntPtr->ParameterHashIndex); W.printHex("TypeChkSectNum", AuxEntPtr->TypeChkSectNum); // Print out symbol alignment and type. @@ -219,8 +228,17 @@ W.printEnum("StorageMappingClass", static_cast(AuxEntPtr->StorageMappingClass), makeArrayRef(CsectStorageMappingClass)); - W.printHex("StabInfoIndex", AuxEntPtr->StabInfoIndex); - W.printHex("StabSectNum", AuxEntPtr->StabSectNum); + + if (Obj.is64Bit()) { + const XCOFF::SymbolAuxType AuxType = AuxEntPtr->PadAndAux64.AuxType; + if (AuxType != XCOFF::_AUX_CSECT) + W.startLine() << "!Mismatched auxiliary type: "; + W.printEnum("Auxiliary Type", static_cast(AuxType), + makeArrayRef(SymAuxType)); + } else { + W.printHex("StabInfoIndex", AuxEntPtr->StabInfoIndex32); + W.printHex("StabSectNum", AuxEntPtr->StabSectNum32); + } } void XCOFFDumper::printSectAuxEntForStat( @@ -302,9 +320,6 @@ }; void XCOFFDumper::printSymbol(const SymbolRef &S) { - if (Obj.is64Bit()) - report_fatal_error("64-bit support is unimplemented."); - DataRefImpl SymbolDRI = S.getRawDataRefImpl(); const XCOFFSymbolEntry *SymbolEntPtr = Obj.toSymbolEntry(SymbolDRI); @@ -320,7 +335,8 @@ Obj.getSymbolIndex(reinterpret_cast(SymbolEntPtr))); W.printString("Name", SymbolName); W.printHex(GetSymbolValueName(SymbolEntPtr->StorageClass), - SymbolEntPtr->Value); + Obj.is64Bit() ? SymbolEntPtr->Obj64.Value + : SymbolEntPtr->Obj32.Value); StringRef SectionName = unwrapOrError(Obj.getFileName(), Obj.getSymbolSectionName(SymbolEntPtr)); @@ -374,8 +390,7 @@ XCOFF::SymbolTableEntrySize)); } - // The symbol's last auxiliary entry is a CSECT Auxiliary Entry. - printCsectAuxEnt32(XCOFFSymRef.getXCOFFCsectAuxEnt32()); + printCsectAuxEnt(unwrapOrError(Obj.getFileName(), XCOFFSymRef.getXCOFFCsectAuxEnt())); break; case XCOFF::C_STAT: if (NumberOfAuxEntries > 1) Index: llvm/tools/obj2yaml/xcoff2yaml.cpp =================================================================== --- llvm/tools/obj2yaml/xcoff2yaml.cpp +++ llvm/tools/obj2yaml/xcoff2yaml.cpp @@ -64,7 +64,7 @@ } Sym.SymbolName = SymNameRefOrErr.get(); - Sym.Value = SymbolEntPtr->Value; + Sym.Value = SymbolEntPtr->Obj32.Value; Expected SectionNameRefOrErr = Obj.getSymbolSectionName(SymbolEntPtr);