diff --git a/llvm/include/llvm/Object/XCOFFObjectFile.h b/llvm/include/llvm/Object/XCOFFObjectFile.h --- a/llvm/include/llvm/Object/XCOFFObjectFile.h +++ b/llvm/include/llvm/Object/XCOFFObjectFile.h @@ -183,6 +183,34 @@ uint8_t Pad[10]; }; +struct XCOFFSectAuxEntForDwarf32 { + support::ubig32_t PortionLength; + uint8_t ReservedZeros_1[4]; + support::ubig32_t NumberOfRelocEnt; + uint8_t ReservedZeros_2[4]; + uint8_t ReservedZeros_3[2]; +}; + +struct XCOFFSectAuxEntForDwarf64 { + support::ubig64_t PortionLength; + support::ubig64_t NumberOfRelocEnt; + uint8_t ReservedZeros[1]; + uint8_t AuxType; // Contains _AUX_SECT; Type of Auxillary entry +}; + +struct XCOFFBlockAuxEnt32 { + uint8_t ReservedZeros_1[2]; + support::ubig16_t LineNum_Hi; + support::ubig16_t LineNum_Lo; + uint8_t ReservedZeros_2[12]; +}; + +struct XCOFFBlockAuxEnt64 { + support::ubig32_t LineNum; + uint8_t ReservedZeros[13]; + uint8_t AuxType; // Contains _AUX_SYM; Type of auxiliary entry +}; + struct XCOFFRelocation32 { // Masks for packing/unpacking the r_rsize field of relocations. diff --git a/llvm/test/tools/llvm-readobj/XCOFF/Inputs/symbol-dwarf.o b/llvm/test/tools/llvm-readobj/XCOFF/Inputs/symbol-dwarf.o index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@ 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); +# } +# +# > clang -c test8.c -gdwarf-3 -o symbol-dwarf.o + +RUN: llvm-readobj --symbols %p/Inputs/symbol-dwarf.o | \ +RUN: FileCheck --check-prefix=SYMBOL32 %s + +SYMBOL32: File: {{.*}}symbol-dwarf.o +SYMBOL32-NEXT: Format: aixcoff-rs6000 +SYMBOL32-NEXT: Arch: powerpc +SYMBOL32-NEXT: AddressSize: 32bit +SYMBOL32-NEXT: Symbols [ +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 0 +SYMBOL32-NEXT: Name: .file +SYMBOL32-NEXT: Value (SymbolTableIndex): 0x0 +SYMBOL32-NEXT: Section: N_DEBUG +SYMBOL32-NEXT: Source Language ID: TB_C (0x0) +SYMBOL32-NEXT: CPU Version ID: TCPU_COM (0x3) +SYMBOL32-NEXT: StorageClass: C_FILE (0x67) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: File Auxiliary Entry { +SYMBOL32-NEXT: Index: 1 +SYMBOL32-NEXT: Name: 2.c +SYMBOL32-NEXT: Type: XFT_FN (0x0) +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 2 +SYMBOL32-NEXT: Name: .fun +SYMBOL32-NEXT: Value (RelocatableAddress): 0x0 +SYMBOL32-NEXT: Section: N_UNDEF +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_EXT (0x2) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 3 +SYMBOL32-NEXT: SectionLen: 0 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 0 +SYMBOL32-NEXT: SymbolType: XTY_ER (0x0) +SYMBOL32-NEXT: StorageMappingClass: XMC_PR (0x0) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 4 +SYMBOL32-NEXT: Name: i +SYMBOL32-NEXT: Value (RelocatableAddress): 0x0 +SYMBOL32-NEXT: Section: N_UNDEF +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_EXT (0x2) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 5 +SYMBOL32-NEXT: SectionLen: 0 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 0 +SYMBOL32-NEXT: SymbolType: XTY_ER (0x0) +SYMBOL32-NEXT: StorageMappingClass: XMC_UA (0x4) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 6 +SYMBOL32-NEXT: Name: fun +SYMBOL32-NEXT: Value (RelocatableAddress): 0x0 +SYMBOL32-NEXT: Section: N_UNDEF +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_EXT (0x2) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 7 +SYMBOL32-NEXT: SectionLen: 0 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 0 +SYMBOL32-NEXT: SymbolType: XTY_ER (0x0) +SYMBOL32-NEXT: StorageMappingClass: XMC_DS (0xA) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 8 +SYMBOL32-NEXT: Name: .dwline +SYMBOL32-NEXT: Value (OffsetInDWARF): 0x0 +SYMBOL32-NEXT: Section: .dwline +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_DWARF (0x70) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: Sect Auxiliary Entry For Dwarf { +SYMBOL32-NEXT: PortionLength: 276 +SYMBOL32-NEXT: NumberOfRelocEnt: 0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 10 +SYMBOL32-NEXT: Name: .dwinfo +SYMBOL32-NEXT: Value (OffsetInDWARF): 0x0 +SYMBOL32-NEXT: Section: .dwinfo +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_DWARF (0x70) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: Sect Auxiliary Entry For Dwarf { +SYMBOL32-NEXT: PortionLength: 153 +SYMBOL32-NEXT: NumberOfRelocEnt: 0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 12 +SYMBOL32-NEXT: Name: .dwabrev +SYMBOL32-NEXT: Value (OffsetInDWARF): 0x0 +SYMBOL32-NEXT: Section: .dwabrev +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_DWARF (0x70) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: Sect Auxiliary Entry For Dwarf { +SYMBOL32-NEXT: PortionLength: 129 +SYMBOL32-NEXT: NumberOfRelocEnt: 0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 14 +SYMBOL32-NEXT: Name: .dwstr +SYMBOL32-NEXT: Value (OffsetInDWARF): 0x0 +SYMBOL32-NEXT: Section: .dwstr +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_DWARF (0x70) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: Sect Auxiliary Entry For Dwarf { +SYMBOL32-NEXT: PortionLength: 207 +SYMBOL32-NEXT: NumberOfRelocEnt: 0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 16 +SYMBOL32-NEXT: Name: .text +SYMBOL32-NEXT: Value (RelocatableAddress): 0x0 +SYMBOL32-NEXT: Section: .text +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_HIDEXT (0x6B) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 17 +SYMBOL32-NEXT: SectionLen: 215 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 2 +SYMBOL32-NEXT: SymbolType: XTY_SD (0x1) +SYMBOL32-NEXT: StorageMappingClass: XMC_PR (0x0) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 18 +SYMBOL32-NEXT: Name: .fun1 +SYMBOL32-NEXT: Value (RelocatableAddress): 0x0 +SYMBOL32-NEXT: Section: .text +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_EXT (0x2) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 19 +SYMBOL32-NEXT: ContainingCsectSymbolIndex: 16 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 0 +SYMBOL32-NEXT: SymbolType: XTY_LD (0x2) +SYMBOL32-NEXT: StorageMappingClass: XMC_PR (0x0) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 20 +SYMBOL32-NEXT: Name: .main +SYMBOL32-NEXT: Value (RelocatableAddress): 0x60 +SYMBOL32-NEXT: Section: .text +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_EXT (0x2) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 21 +SYMBOL32-NEXT: ContainingCsectSymbolIndex: 16 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 0 +SYMBOL32-NEXT: SymbolType: XTY_LD (0x2) +SYMBOL32-NEXT: StorageMappingClass: XMC_PR (0x0) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 22 +SYMBOL32-NEXT: Name: .rodata.str1.1L...str +SYMBOL32-NEXT: Value (RelocatableAddress): 0xD8 +SYMBOL32-NEXT: Section: .text +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_HIDEXT (0x6B) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 23 +SYMBOL32-NEXT: SectionLen: 5 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 2 +SYMBOL32-NEXT: SymbolType: XTY_SD (0x1) +SYMBOL32-NEXT: StorageMappingClass: XMC_RO (0x1) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 24 +SYMBOL32-NEXT: Name: fun1 +SYMBOL32-NEXT: Value (RelocatableAddress): 0xE0 +SYMBOL32-NEXT: Section: .data +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_EXT (0x2) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 25 +SYMBOL32-NEXT: SectionLen: 12 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 2 +SYMBOL32-NEXT: SymbolType: XTY_SD (0x1) +SYMBOL32-NEXT: StorageMappingClass: XMC_DS (0xA) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 26 +SYMBOL32-NEXT: Name: main +SYMBOL32-NEXT: Value (RelocatableAddress): 0xEC +SYMBOL32-NEXT: Section: .data +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_EXT (0x2) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 27 +SYMBOL32-NEXT: SectionLen: 12 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 2 +SYMBOL32-NEXT: SymbolType: XTY_SD (0x1) +SYMBOL32-NEXT: StorageMappingClass: XMC_DS (0xA) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 28 +SYMBOL32-NEXT: Name: p +SYMBOL32-NEXT: Value (RelocatableAddress): 0xF8 +SYMBOL32-NEXT: Section: .data +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_EXT (0x2) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 29 +SYMBOL32-NEXT: SectionLen: 4 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 2 +SYMBOL32-NEXT: SymbolType: XTY_SD (0x1) +SYMBOL32-NEXT: StorageMappingClass: XMC_RW (0x5) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 30 +SYMBOL32-NEXT: Name: TOC +SYMBOL32-NEXT: Value (RelocatableAddress): 0xFC +SYMBOL32-NEXT: Section: .data +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_HIDEXT (0x6B) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 31 +SYMBOL32-NEXT: SectionLen: 0 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 2 +SYMBOL32-NEXT: SymbolType: XTY_SD (0x1) +SYMBOL32-NEXT: StorageMappingClass: XMC_TC0 (0xF) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 32 +SYMBOL32-NEXT: Name: static_i +SYMBOL32-NEXT: Value (RelocatableAddress): 0xFC +SYMBOL32-NEXT: Section: .data +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_HIDEXT (0x6B) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 33 +SYMBOL32-NEXT: SectionLen: 4 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 2 +SYMBOL32-NEXT: SymbolType: XTY_SD (0x1) +SYMBOL32-NEXT: StorageMappingClass: XMC_TC (0x3) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 34 +SYMBOL32-NEXT: Name: p +SYMBOL32-NEXT: Value (RelocatableAddress): 0x100 +SYMBOL32-NEXT: Section: .data +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_HIDEXT (0x6B) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 35 +SYMBOL32-NEXT: SectionLen: 4 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 2 +SYMBOL32-NEXT: SymbolType: XTY_SD (0x1) +SYMBOL32-NEXT: StorageMappingClass: XMC_TC (0x3) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 36 +SYMBOL32-NEXT: Name: i +SYMBOL32-NEXT: Value (RelocatableAddress): 0x104 +SYMBOL32-NEXT: Section: .data +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_HIDEXT (0x6B) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 37 +SYMBOL32-NEXT: SectionLen: 4 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 2 +SYMBOL32-NEXT: SymbolType: XTY_SD (0x1) +SYMBOL32-NEXT: StorageMappingClass: XMC_TC (0x3) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: Symbol { +SYMBOL32-NEXT: Index: 38 +SYMBOL32-NEXT: Name: static_i +SYMBOL32-NEXT: Value (RelocatableAddress): 0x108 +SYMBOL32-NEXT: Section: .bss +SYMBOL32-NEXT: Type: 0x0 +SYMBOL32-NEXT: StorageClass: C_HIDEXT (0x6B) +SYMBOL32-NEXT: NumberOfAuxEntries: 1 +SYMBOL32-NEXT: CSECT Auxiliary Entry { +SYMBOL32-NEXT: Index: 39 +SYMBOL32-NEXT: SectionLen: 4 +SYMBOL32-NEXT: ParameterHashIndex: 0x0 +SYMBOL32-NEXT: TypeChkSectNum: 0x0 +SYMBOL32-NEXT: SymbolAlignmentLog2: 2 +SYMBOL32-NEXT: SymbolType: XTY_CM (0x3) +SYMBOL32-NEXT: StorageMappingClass: XMC_BS (0x9) +SYMBOL32-NEXT: StabInfoIndex: 0x0 +SYMBOL32-NEXT: StabSectNum: 0x0 +SYMBOL32-NEXT: } +SYMBOL32-NEXT: } +SYMBOL32-NEXT: ] diff --git a/llvm/tools/llvm-readobj/XCOFFDumper.cpp b/llvm/tools/llvm-readobj/XCOFFDumper.cpp --- a/llvm/tools/llvm-readobj/XCOFFDumper.cpp +++ b/llvm/tools/llvm-readobj/XCOFFDumper.cpp @@ -42,6 +42,8 @@ void printFileAuxEnt(const XCOFFFileAuxEnt *AuxEntPtr); void printCsectAuxEnt32(const XCOFFCsectAuxEnt32 *AuxEntPtr); void printSectAuxEntForStat(const XCOFFSectAuxEntForStat *AuxEntPtr); + void printSectAuxEntForDwarf32(const XCOFFSectAuxEntForDwarf32 *AuxEntPtr); + void printBlockAuxEnt32(const XCOFFBlockAuxEnt32 *AuxEntPtr); void printSymbol(const SymbolRef &); void printRelocations(ArrayRef Sections); const XCOFFObjectFile &Obj; @@ -237,6 +239,23 @@ W.printNumber("NumberOfLineNum", AuxEntPtr->NumberOfLineNum); } +void XCOFFDumper::printSectAuxEntForDwarf32( + const XCOFFSectAuxEntForDwarf32 *AuxEntPtr) { + assert(!Obj.is64Bit() && "32-bit interface called on 64-bit object file."); + + DictScope SymDs(W, "Sect Auxiliary Entry For Dwarf"); + W.printNumber("PortionLength", AuxEntPtr->PortionLength); + W.printNumber("NumberOfRelocEnt", AuxEntPtr->NumberOfRelocEnt); +} + +void XCOFFDumper::printBlockAuxEnt32(const XCOFFBlockAuxEnt32 *AuxEntPtr) { + assert(!Obj.is64Bit() && "32-bit interface called on 64-bit object file."); + + DictScope SymDs(W, "Block Auxiliary Entry"); + W.printNumber("LineNumber_High16", AuxEntPtr->LineNum_Hi); + W.printNumber("LineNumber_Low16", AuxEntPtr->LineNum_Lo); +} + static const EnumEntry SymStorageClass[] = { #define ECase(X) \ { #X, XCOFF::X } @@ -262,11 +281,13 @@ case XCOFF::C_WEAKEXT: case XCOFF::C_HIDEXT: case XCOFF::C_STAT: + case XCOFF::C_FCN: + case XCOFF::C_BLOCK: return "Value (RelocatableAddress)"; case XCOFF::C_FILE: return "Value (SymbolTableIndex)"; - case XCOFF::C_FCN: - case XCOFF::C_BLOCK: + case XCOFF::C_DWARF: + return "Value (OffsetInDWARF)"; case XCOFF::C_FUN: case XCOFF::C_STSYM: case XCOFF::C_BINCL: @@ -278,7 +299,6 @@ case XCOFF::C_RPSYM: case XCOFF::C_RSYM: case XCOFF::C_ECOML: - case XCOFF::C_DWARF: assert(false && "This StorageClass for the symbol is not yet implemented."); return ""; default: @@ -390,10 +410,30 @@ printSectAuxEntForStat(StatAuxEntPtr); break; case XCOFF::C_DWARF: + if (NumberOfAuxEntries > 1) + report_fatal_error( + "C_DWARF symbol should not have more than 1 auxiliary entry."); + + const XCOFFSectAuxEntForDwarf32 *DwarfAuxEntPtr; + DwarfAuxEntPtr = + reinterpret_cast(SymbolEntPtr + 1); +#ifndef NDEBUG + Obj.checkSymbolEntryPointer(reinterpret_cast(DwarfAuxEntPtr)); +#endif + printSectAuxEntForDwarf32(DwarfAuxEntPtr); + break; case XCOFF::C_BLOCK: case XCOFF::C_FCN: - report_fatal_error("Symbol table entry printing for this storage class " - "type is unimplemented."); + // The Block Auxiliary Entry provides information associated with the begin + // and end blocks of functions. + for (int i = 1; i <= NumberOfAuxEntries; ++i) { + const XCOFFBlockAuxEnt32 *BlockAuxEntPtr = + reinterpret_cast(SymbolEntPtr + i); +#ifndef NDEBUG + Obj.checkSymbolEntryPointer(reinterpret_cast(BlockAuxEntPtr)); +#endif + printBlockAuxEnt32(BlockAuxEntPtr); + } break; default: for (int i = 1; i <= NumberOfAuxEntries; i++) {