Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 166 additions & 0 deletions llvm/test/tools/llvm-readobj/XCOFF/symbols.test
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,73 @@ Symbols:
StabInfoIndex: 44
StabSectNum: 55

- Name: bstat
Value: 0x0
Section: N_DEBUG
Type: 0x00
StorageClass: C_BSTAT

- Name: cfun
Value: 0x0
Section: N_DEBUG
Type: 0x00
StorageClass: C_FUN

- Name: stsym
Value: 0x05
Section: N_DEBUG
Type: 0x00
StorageClass: C_STSYM

- Name: bincl
Value: 0x06
Section: .text
Type: 0x00
StorageClass: C_BINCL

- Name: eincl
Value: 0x06
Section: .text
Type: 0x00
StorageClass: C_EINCL

- Name: lsym
Value: 0x07
Section: N_DEBUG
Type: 0x00
StorageClass: C_LSYM

- Name: psym
Value: 0x07
Section: N_DEBUG
Type: 0x00
StorageClass: C_PSYM

- Name: rsym
Value: 0x08
Section: N_DEBUG
Type: 0x00
StorageClass: C_RSYM

- Name: rpsym
Value: 0x08
Section: N_DEBUG
Type: 0x00
StorageClass: C_RPSYM

- Name: ecoml
Value: 0x09
Section: .text
Type: 0x00
StorageClass: C_ECOML

- Name: cinfo
Value: 0x02
Section: .text
Type: 0x00
StorageClass: C_INFO


# SYMBOL32: Symbols [
# SYMBOL32-NEXT: Symbol {
# SYMBOL32-NEXT: Index: 0
Expand Down Expand Up @@ -368,4 +435,103 @@ Symbols:
# SYMBOL32-NEXT: StabSectNum: 0x37
# SYMBOL32-NEXT: }
# SYMBOL32-NEXT: }
# SYMBOL32-NEXT: Symbol {
# SYMBOL32-NEXT: Index: 25
# SYMBOL32-NEXT: Name: Unimplemented Debug Name
# SYMBOL32-NEXT: Value (SymbolTableIndex): 0x0
# SYMBOL32-NEXT: Section: N_DEBUG
# SYMBOL32-NEXT: Type: 0x0
# SYMBOL32-NEXT: StorageClass: C_BSTAT (0x8F)
# SYMBOL32-NEXT: NumberOfAuxEntries: 0
# SYMBOL32-NEXT: }
# SYMBOL32-NEXT: Symbol {
# SYMBOL32-NEXT: Index: 26
# SYMBOL32-NEXT: Name: Unimplemented Debug Name
# SYMBOL32-NEXT: Value (OffsetInCSect): 0x0
# SYMBOL32-NEXT: Section: N_DEBUG
# SYMBOL32-NEXT: Type: 0x0
# SYMBOL32-NEXT: StorageClass: C_FUN (0x8E)
# SYMBOL32-NEXT: NumberOfAuxEntries: 0
# SYMBOL32-NEXT: }
# SYMBOL32-NEXT: Symbol {
# SYMBOL32-NEXT: Index: 27
# SYMBOL32-NEXT: Name: Unimplemented Debug Name
# SYMBOL32-NEXT: Value (OffsetInCSect): 0x5
# SYMBOL32-NEXT: Section: N_DEBUG
# SYMBOL32-NEXT: Type: 0x0
# SYMBOL32-NEXT: StorageClass: C_STSYM (0x85)
# SYMBOL32-NEXT: NumberOfAuxEntries: 0
# SYMBOL32-NEXT: }
# SYMBOL32-NEXT: Symbol {
# SYMBOL32-NEXT: Index: 28
# SYMBOL32-NEXT: Name: bincl
# SYMBOL32-NEXT: Value (OffsetInFile): 0x6
# SYMBOL32-NEXT: Section: .text
# SYMBOL32-NEXT: Type: 0x0
# SYMBOL32-NEXT: StorageClass: C_BINCL (0x6C)
# SYMBOL32-NEXT: NumberOfAuxEntries: 0
# SYMBOL32-NEXT: }
# SYMBOL32-NEXT: Symbol {
# SYMBOL32-NEXT: Index: 29
# SYMBOL32-NEXT: Name: eincl
# SYMBOL32-NEXT: Value (OffsetInFile): 0x6
# SYMBOL32-NEXT: Section: .text
# SYMBOL32-NEXT: Type: 0x0
# SYMBOL32-NEXT: StorageClass: C_EINCL (0x6D)
# SYMBOL32-NEXT: NumberOfAuxEntries: 0
# SYMBOL32-NEXT: }
# SYMBOL32-NEXT: Symbol {
# SYMBOL32-NEXT: Index: 30
# SYMBOL32-NEXT: Name: Unimplemented Debug Name
# SYMBOL32-NEXT: Value (OffsetRelToStackFrame): 0x7
# SYMBOL32-NEXT: Section: N_DEBUG
# SYMBOL32-NEXT: Type: 0x0
# SYMBOL32-NEXT: StorageClass: C_LSYM (0x81)
# SYMBOL32-NEXT: NumberOfAuxEntries: 0
# SYMBOL32-NEXT: }
# SYMBOL32-NEXT: Symbol {
# SYMBOL32-NEXT: Index: 31
# SYMBOL32-NEXT: Name: Unimplemented Debug Name
# SYMBOL32-NEXT: Value (OffsetRelToStackFrame): 0x7
# SYMBOL32-NEXT: Section: N_DEBUG
# SYMBOL32-NEXT: Type: 0x0
# SYMBOL32-NEXT: StorageClass: C_PSYM (0x82)
# SYMBOL32-NEXT: NumberOfAuxEntries: 0
# SYMBOL32-NEXT: }
# SYMBOL32-NEXT: Symbol {
# SYMBOL32-NEXT: Index: 32
# SYMBOL32-NEXT: Name: Unimplemented Debug Name
# SYMBOL32-NEXT: Value (RegisterNumber): 0x8
# SYMBOL32-NEXT: Section: N_DEBUG
# SYMBOL32-NEXT: Type: 0x0
# SYMBOL32-NEXT: StorageClass: C_RSYM (0x83)
# SYMBOL32-NEXT: NumberOfAuxEntries: 0
# SYMBOL32-NEXT: }
# SYMBOL32-NEXT: Symbol {
# SYMBOL32-NEXT: Index: 33
# SYMBOL32-NEXT: Name: Unimplemented Debug Name
# SYMBOL32-NEXT: Value (RegisterNumber): 0x8
# SYMBOL32-NEXT: Section: N_DEBUG
# SYMBOL32-NEXT: Type: 0x0
# SYMBOL32-NEXT: StorageClass: C_RPSYM (0x84)
# SYMBOL32-NEXT: NumberOfAuxEntries: 0
# SYMBOL32-NEXT: }
# SYMBOL32-NEXT: Symbol {
# SYMBOL32-NEXT: Index: 34
# SYMBOL32-NEXT: Name: Unimplemented Debug Name
# SYMBOL32-NEXT: Value (OffsetInCommBlock): 0x9
# SYMBOL32-NEXT: Section: .text
# SYMBOL32-NEXT: Type: 0x0
# SYMBOL32-NEXT: StorageClass: C_ECOML (0x88)
# SYMBOL32-NEXT: NumberOfAuxEntries: 0
# SYMBOL32-NEXT: }
# SYMBOL32-NEXT: Symbol {
# SYMBOL32-NEXT: Index: 35
# SYMBOL32-NEXT: Name: cinfo
# SYMBOL32-NEXT: Value (OffsetInCommentSection): 0x2
# SYMBOL32-NEXT: Section: .text
# SYMBOL32-NEXT: Type: 0x0
# SYMBOL32-NEXT: StorageClass: C_INFO (0x6E)
# SYMBOL32-NEXT: NumberOfAuxEntries: 0
# SYMBOL32-NEXT: }
# SYMBOL32-NEXT: ]
166 changes: 166 additions & 0 deletions llvm/test/tools/llvm-readobj/XCOFF/symbols64.test
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,73 @@ Symbols:
- Type: AUX_SYM
LineNum: 3

- Name: bstat
Value: 0x0
Section: N_DEBUG
Type: 0x00
StorageClass: C_BSTAT

- Name: cfun
Value: 0x0
Section: N_DEBUG
Type: 0x00
StorageClass: C_FUN

- Name: stsym
Value: 0x05
Section: N_DEBUG
Type: 0x00
StorageClass: C_STSYM

- Name: bincl
Value: 0x06
Section: .text
Type: 0x00
StorageClass: C_BINCL

- Name: eincl
Value: 0x06
Section: .text
Type: 0x00
StorageClass: C_EINCL

- Name: lsym
Value: 0x07
Section: N_DEBUG
Type: 0x00
StorageClass: C_LSYM

- Name: psym
Value: 0x07
Section: N_DEBUG
Type: 0x00
StorageClass: C_PSYM

- Name: rsym
Value: 0x08
Section: N_DEBUG
Type: 0x00
StorageClass: C_RSYM

- Name: rpsym
Value: 0x08
Section: N_DEBUG
Type: 0x00
StorageClass: C_RPSYM

- Name: ecoml
Value: 0x09
Section: .text
Type: 0x00
StorageClass: C_ECOML

- Name: cinfo
Value: 0x02
Section: .text
Type: 0x00
StorageClass: C_INFO


# SYMBOL64: Symbols [
# SYMBOL64-NEXT: Symbol {
# SYMBOL64-NEXT: Index: 0
Expand Down Expand Up @@ -326,4 +393,103 @@ Symbols:
# SYMBOL64-NEXT: Auxiliary Type: AUX_SYM (0xFD)
# SYMBOL64-NEXT: }
# SYMBOL64-NEXT: }
# SYMBOL64-NEXT: Symbol {
# SYMBOL64-NEXT: Index: 23
# SYMBOL64-NEXT: Name: Unimplemented Debug Name
# SYMBOL64-NEXT: Value (SymbolTableIndex): 0x0
# SYMBOL64-NEXT: Section: N_DEBUG
# SYMBOL64-NEXT: Type: 0x0
# SYMBOL64-NEXT: StorageClass: C_BSTAT (0x8F)
# SYMBOL64-NEXT: NumberOfAuxEntries: 0
# SYMBOL64-NEXT: }
# SYMBOL64-NEXT: Symbol {
# SYMBOL64-NEXT: Index: 24
# SYMBOL64-NEXT: Name: Unimplemented Debug Name
# SYMBOL64-NEXT: Value (OffsetInCSect): 0x0
# SYMBOL64-NEXT: Section: N_DEBUG
# SYMBOL64-NEXT: Type: 0x0
# SYMBOL64-NEXT: StorageClass: C_FUN (0x8E)
# SYMBOL64-NEXT: NumberOfAuxEntries: 0
# SYMBOL64-NEXT: }
# SYMBOL64-NEXT: Symbol {
# SYMBOL64-NEXT: Index: 25
# SYMBOL64-NEXT: Name: Unimplemented Debug Name
# SYMBOL64-NEXT: Value (OffsetInCSect): 0x5
# SYMBOL64-NEXT: Section: N_DEBUG
# SYMBOL64-NEXT: Type: 0x0
# SYMBOL64-NEXT: StorageClass: C_STSYM (0x85)
# SYMBOL64-NEXT: NumberOfAuxEntries: 0
# SYMBOL64-NEXT: }
# SYMBOL64-NEXT: Symbol {
# SYMBOL64-NEXT: Index: 26
# SYMBOL64-NEXT: Name: bincl
# SYMBOL64-NEXT: Value (OffsetInFile): 0x6
# SYMBOL64-NEXT: Section: .text
# SYMBOL64-NEXT: Type: 0x0
# SYMBOL64-NEXT: StorageClass: C_BINCL (0x6C)
# SYMBOL64-NEXT: NumberOfAuxEntries: 0
# SYMBOL64-NEXT: }
# SYMBOL64-NEXT: Symbol {
# SYMBOL64-NEXT: Index: 27
# SYMBOL64-NEXT: Name: eincl
# SYMBOL64-NEXT: Value (OffsetInFile): 0x6
# SYMBOL64-NEXT: Section: .text
# SYMBOL64-NEXT: Type: 0x0
# SYMBOL64-NEXT: StorageClass: C_EINCL (0x6D)
# SYMBOL64-NEXT: NumberOfAuxEntries: 0
# SYMBOL64-NEXT: }
# SYMBOL64-NEXT: Symbol {
# SYMBOL64-NEXT: Index: 28
# SYMBOL64-NEXT: Name: Unimplemented Debug Name
# SYMBOL64-NEXT: Value (OffsetRelToStackFrame): 0x7
# SYMBOL64-NEXT: Section: N_DEBUG
# SYMBOL64-NEXT: Type: 0x0
# SYMBOL64-NEXT: StorageClass: C_LSYM (0x81)
# SYMBOL64-NEXT: NumberOfAuxEntries: 0
# SYMBOL64-NEXT: }
# SYMBOL64-NEXT: Symbol {
# SYMBOL64-NEXT: Index: 29
# SYMBOL64-NEXT: Name: Unimplemented Debug Name
# SYMBOL64-NEXT: Value (OffsetRelToStackFrame): 0x7
# SYMBOL64-NEXT: Section: N_DEBUG
# SYMBOL64-NEXT: Type: 0x0
# SYMBOL64-NEXT: StorageClass: C_PSYM (0x82)
# SYMBOL64-NEXT: NumberOfAuxEntries: 0
# SYMBOL64-NEXT: }
# SYMBOL64-NEXT: Symbol {
# SYMBOL64-NEXT: Index: 30
# SYMBOL64-NEXT: Name: Unimplemented Debug Name
# SYMBOL64-NEXT: Value (RegisterNumber): 0x8
# SYMBOL64-NEXT: Section: N_DEBUG
# SYMBOL64-NEXT: Type: 0x0
# SYMBOL64-NEXT: StorageClass: C_RSYM (0x83)
# SYMBOL64-NEXT: NumberOfAuxEntries: 0
# SYMBOL64-NEXT: }
# SYMBOL64-NEXT: Symbol {
# SYMBOL64-NEXT: Index: 31
# SYMBOL64-NEXT: Name: Unimplemented Debug Name
# SYMBOL64-NEXT: Value (RegisterNumber): 0x8
# SYMBOL64-NEXT: Section: N_DEBUG
# SYMBOL64-NEXT: Type: 0x0
# SYMBOL64-NEXT: StorageClass: C_RPSYM (0x84)
# SYMBOL64-NEXT: NumberOfAuxEntries: 0
# SYMBOL64-NEXT: }
# SYMBOL64-NEXT: Symbol {
# SYMBOL64-NEXT: Index: 32
# SYMBOL64-NEXT: Name: Unimplemented Debug Name
# SYMBOL64-NEXT: Value (OffsetInCommBlock): 0x9
# SYMBOL64-NEXT: Section: .text
# SYMBOL64-NEXT: Type: 0x0
# SYMBOL64-NEXT: StorageClass: C_ECOML (0x88)
# SYMBOL64-NEXT: NumberOfAuxEntries: 0
# SYMBOL64-NEXT: }
# SYMBOL64-NEXT: Symbol {
# SYMBOL64-NEXT: Index: 33
# SYMBOL64-NEXT: Name: cinfo
# SYMBOL64-NEXT: Value (OffsetInCommentSection): 0x2
# SYMBOL64-NEXT: Section: .text
# SYMBOL64-NEXT: Type: 0x0
# SYMBOL64-NEXT: StorageClass: C_INFO (0x6E)
# SYMBOL64-NEXT: NumberOfAuxEntries: 0
# SYMBOL64-NEXT: }
# SYMBOL64-NEXT: ]
10 changes: 7 additions & 3 deletions llvm/tools/llvm-readobj/XCOFFDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,22 +692,26 @@ static StringRef GetSymbolValueName(XCOFF::StorageClass SC) {
case XCOFF::C_BLOCK:
return "Value (RelocatableAddress)";
case XCOFF::C_FILE:
case XCOFF::C_BSTAT:
return "Value (SymbolTableIndex)";
case XCOFF::C_DWARF:
return "Value (OffsetInDWARF)";
case XCOFF::C_FUN:
case XCOFF::C_STSYM:
return "Value (OffsetInCSect)";
case XCOFF::C_BINCL:
case XCOFF::C_EINCL:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No coverage for C_EINCL?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we has a test for C_BINCL and XCOFF::C_EINCL has the same code with XCOF:: C_BINCL , do we need to add a test for XCOFF::C_EINCL?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is quite a complex set of logic (lots of folded-together case statements), I think it makes sense to get 100% coverage on the whole switch.

return "Value (OffsetInFile)";
case XCOFF::C_INFO:
case XCOFF::C_BSTAT:
return "Value (OffsetInCommentSection)";
case XCOFF::C_LSYM:
case XCOFF::C_PSYM:
return "Value (OffsetRelToStackFrame)";
case XCOFF::C_RPSYM:
case XCOFF::C_RSYM:
return "Value (RegisterNumber)";
case XCOFF::C_ECOML:
assert(false && "This StorageClass for the symbol is not yet implemented.");
return "";
return "Value (OffsetInCommBlock)";
default:
return "Value";
}
Expand Down