[llvm] r371237 - [PowerPC][XCOFF] Verify symbol table in xcoff object files. [NFC]

Sean Fertile via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 11:56:14 PDT 2019


Author: sfertile
Date: Fri Sep  6 11:56:14 2019
New Revision: 371237

URL: http://llvm.org/viewvc/llvm-project?rev=371237&view=rev
Log:
[PowerPC][XCOFF] Verify symbol table in xcoff object files. [NFC]

Extend the common/local-common testing for object files to also verify the
symbol table now that the needed functionality has landed in llvm-readobj.

Differential Revision: https://reviews.llvm.org/D66944

Modified:
    llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-common.ll
    llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll

Modified: llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-common.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-common.ll?rev=371237&r1=371236&r2=371237&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-common.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-common.ll Fri Sep  6 11:56:14 2019
@@ -3,6 +3,7 @@
 ; RUN: llc -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
 ; RUN: llvm-readobj --section-headers --file-header %t.o | \
 ; RUN: FileCheck --check-prefix=OBJ %s
+; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYMS %s
 
 ; RUN: not llc -mtriple powerpc64-ibm-aix-xcoff -filetype=obj -o %t.o 2>&1 \
 ; RUN: < %s | FileCheck --check-prefix=XCOFF64 %s
@@ -58,3 +59,150 @@
 ; OBJ-NEXT:     Type: STYP_BSS (0x80)
 ; OBJ-NEXT:   }
 ; OBJ-NEXT: ]
+
+; SYMS:      File: {{.*}}aix-xcoff-common.ll.tmp.o
+; SYMS-NEXT: Format: aixcoff-rs6000
+; SYMS-NEXT: Arch: powerpc
+; SYMS-NEXT: AddressSize: 32bit
+; SYMS-NEXT: Symbols [
+; SYMS-NEXT:   Symbol {
+; SYMS-NEXT:     Index: [[#Index:]]
+; SYMS-NEXT:     Name: a
+; SYMS-NEXT:     Value (RelocatableAddress): 0x0
+; SYMS-NEXT:     Section: .bss
+; SYMS-NEXT:     Type: 0x0
+; SYMS-NEXT:     StorageClass: C_EXT (0x2)
+; SYMS-NEXT:     NumberOfAuxEntries: 1
+; SYMS-NEXT:     CSECT Auxiliary Entry {
+; SYMS-NEXT:       Index: [[#Index + 1]]
+; SYMS-NEXT:       SectionLen: 4
+; SYMS-NEXT:       ParameterHashIndex: 0x0
+; SYMS-NEXT:       TypeChkSectNum: 0x0
+; SYMS-NEXT:       SymbolAlignmentLog2: 2
+; SYMS-NEXT:       SymbolType: XTY_CM (0x3)
+; SYMS-NEXT:       StorageMappingClass: XMC_RW (0x5)
+; SYMS-NEXT:       StabInfoIndex: 0x0
+; SYMS-NEXT:       StabSectNum: 0x0
+; SYMS-NEXT:     }
+; SYMS-NEXT:   }
+; SYMS-NEXT:   Symbol {
+; SYMS-NEXT:     Index: [[#Index + 2]]
+; SYMS-NEXT:     Name: b
+; SYMS-NEXT:     Value (RelocatableAddress): 0x8
+; SYMS-NEXT:     Section: .bss
+; SYMS-NEXT:     Type: 0x0
+; SYMS-NEXT:     StorageClass: C_EXT (0x2)
+; SYMS-NEXT:     NumberOfAuxEntries: 1
+; SYMS-NEXT:     CSECT Auxiliary Entry {
+; SYMS-NEXT:       Index: [[#Index + 3]]
+; SYMS-NEXT:       SectionLen: 8
+; SYMS-NEXT:       ParameterHashIndex: 0x0
+; SYMS-NEXT:       TypeChkSectNum: 0x0
+; SYMS-NEXT:       SymbolAlignmentLog2: 3
+; SYMS-NEXT:       SymbolType: XTY_CM (0x3)
+; SYMS-NEXT:       StorageMappingClass: XMC_RW (0x5)
+; SYMS-NEXT:       StabInfoIndex: 0x0
+; SYMS-NEXT:       StabSectNum: 0x0
+; SYMS-NEXT:     }
+; SYMS-NEXT:   }
+; SYMS-NEXT:   Symbol {
+; SYMS-NEXT:     Index: [[#Index + 4]]
+; SYMS-NEXT:     Name: c
+; SYMS-NEXT:     Value (RelocatableAddress): 0x10
+; SYMS-NEXT:     Section: .bss
+; SYMS-NEXT:     Type: 0x0
+; SYMS-NEXT:     StorageClass: C_EXT (0x2)
+; SYMS-NEXT:     NumberOfAuxEntries: 1
+; SYMS-NEXT:     CSECT Auxiliary Entry {
+; SYMS-NEXT:       Index: [[#Index + 5]]
+; SYMS-NEXT:       SectionLen: 2
+; SYMS-NEXT:       ParameterHashIndex: 0x0
+; SYMS-NEXT:       TypeChkSectNum: 0x0
+; SYMS-NEXT:       SymbolAlignmentLog2: 1
+; SYMS-NEXT:       SymbolType: XTY_CM (0x3)
+; SYMS-NEXT:       StorageMappingClass: XMC_RW (0x5)
+; SYMS-NEXT:       StabInfoIndex: 0x0
+; SYMS-NEXT:       StabSectNum: 0x0
+; SYMS-NEXT:     }
+; SYMS-NEXT:   }
+; SYMS-NEXT:   Symbol {
+; SYMS-NEXT:     Index: [[#Index + 6]]
+; SYMS-NEXT:     Name: d
+; SYMS-NEXT:     Value (RelocatableAddress): 0x18
+; SYMS-NEXT:     Section: .bss
+; SYMS-NEXT:     Type: 0x0
+; SYMS-NEXT:     StorageClass: C_EXT (0x2)
+; SYMS-NEXT:     NumberOfAuxEntries: 1
+; SYMS-NEXT:     CSECT Auxiliary Entry {
+; SYMS-NEXT:       Index: [[#Index + 7]]
+; SYMS-NEXT:       SectionLen: 8
+; SYMS-NEXT:       ParameterHashIndex: 0x0
+; SYMS-NEXT:       TypeChkSectNum: 0x0
+; SYMS-NEXT:       SymbolAlignmentLog2: 3
+; SYMS-NEXT:       SymbolType: XTY_CM (0x3)
+; SYMS-NEXT:       StorageMappingClass: XMC_RW (0x5)
+; SYMS-NEXT:       StabInfoIndex: 0x0
+; SYMS-NEXT:       StabSectNum: 0x0
+; SYMS-NEXT:     }
+; SYMS-NEXT:   }
+; SYMS-NEXT:   Symbol {
+; SYMS-NEXT:     Index: [[#Index + 8]]
+; SYMS-NEXT:     Name: f
+; SYMS-NEXT:     Value (RelocatableAddress): 0x20
+; SYMS-NEXT:     Section: .bss
+; SYMS-NEXT:     Type: 0x0
+; SYMS-NEXT:     StorageClass: C_EXT (0x2)
+; SYMS-NEXT:     NumberOfAuxEntries: 1
+; SYMS-NEXT:     CSECT Auxiliary Entry {
+; SYMS-NEXT:       Index: [[#Index + 9]]
+; SYMS-NEXT:       SectionLen: 4
+; SYMS-NEXT:       ParameterHashIndex: 0x0
+; SYMS-NEXT:       TypeChkSectNum: 0x0
+; SYMS-NEXT:       SymbolAlignmentLog2: 2
+; SYMS-NEXT:       SymbolType: XTY_CM (0x3)
+; SYMS-NEXT:       StorageMappingClass: XMC_RW (0x5)
+; SYMS-NEXT:       StabInfoIndex: 0x0
+; SYMS-NEXT:       StabSectNum: 0x0
+; SYMS-NEXT:     }
+; SYMS-NEXT:   }
+; SYMS-NEXT:   Symbol {
+; SYMS-NEXT:     Index: [[#Index + 10]]
+; SYMS-NEXT:     Name: over_aligned
+; SYMS-NEXT:     Value (RelocatableAddress): 0x40
+; SYMS-NEXT:     Section: .bss
+; SYMS-NEXT:     Type: 0x0
+; SYMS-NEXT:     StorageClass: C_EXT (0x2)
+; SYMS-NEXT:     NumberOfAuxEntries: 1
+; SYMS-NEXT:     CSECT Auxiliary Entry {
+; SYMS-NEXT:       Index: [[#Index + 11]]
+; SYMS-NEXT:       SectionLen: 8
+; SYMS-NEXT:       ParameterHashIndex: 0x0
+; SYMS-NEXT:       TypeChkSectNum: 0x0
+; SYMS-NEXT:       SymbolAlignmentLog2: 5
+; SYMS-NEXT:       SymbolType: XTY_CM (0x3)
+; SYMS-NEXT:       StorageMappingClass: XMC_RW (0x5)
+; SYMS-NEXT:       StabInfoIndex: 0x0
+; SYMS-NEXT:       StabSectNum: 0x0
+; SYMS-NEXT:     }
+; SYMS-NEXT:   }
+; SYMS-NEXT:   Symbol {
+; SYMS-NEXT:     Index: [[#Index + 12]]
+; SYMS-NEXT:     Name: array
+; SYMS-NEXT:     Value (RelocatableAddress): 0x48
+; SYMS-NEXT:     Section: .bss
+; SYMS-NEXT:     Type: 0x0
+; SYMS-NEXT:     StorageClass: C_EXT (0x2)
+; SYMS-NEXT:     NumberOfAuxEntries: 1
+; SYMS-NEXT:     CSECT Auxiliary Entry {
+; SYMS-NEXT:       Index: [[#Index + 13]]
+; SYMS-NEXT:       SectionLen: 33
+; SYMS-NEXT:       ParameterHashIndex: 0x0
+; SYMS-NEXT:       TypeChkSectNum: 0x0
+; SYMS-NEXT:       SymbolAlignmentLog2: 0
+; SYMS-NEXT:       SymbolType: XTY_CM (0x3)
+; SYMS-NEXT:       StorageMappingClass: XMC_RW (0x5)
+; SYMS-NEXT:       StabInfoIndex: 0x0
+; SYMS-NEXT:       StabSectNum: 0x0
+; SYMS-NEXT:     }
+; SYMS-NEXT:   }
+; SYMS-NEXT: ]

Modified: llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll?rev=371237&r1=371236&r2=371237&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll Fri Sep  6 11:56:14 2019
@@ -4,6 +4,7 @@
 ; RUN: llc -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
 ; RUN: llvm-readobj --section-headers --file-header %t.o | \
 ; RUN: FileCheck --check-prefix=OBJ %s
+; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefix=SYMS %s
 
 ; RUN: not llc -mtriple powerpc64-ibm-aix-xcoff -filetype=obj < %s 2>&1 | \
 ; RUN: FileCheck --check-prefix=OBJ64 %s
@@ -45,3 +46,70 @@
 ; OBJ-NEXT:     Type: STYP_BSS (0x80)
 ; OBJ-NEXT:   }
 ; OBJ-NEXT: ]
+
+; SYMS:      File: {{.*}}aix-xcoff-lcomm.ll.tmp.o
+; SYMS-NEXT: Format: aixcoff-rs6000
+; SYMS-NEXT: Arch: powerpc
+; SYMS-NEXT: AddressSize: 32bit
+; SYMS-NEXT: Symbols [
+; SYMS-NEXT:   Symbol {
+; SYMS-NEXT:     Index: [[#Index:]]
+; SYMS-NEXT:     Name: a
+; SYMS-NEXT:     Value (RelocatableAddress): 0x0
+; SYMS-NEXT:     Section: .bss
+; SYMS-NEXT:     Type: 0x0
+; SYMS-NEXT:     StorageClass: C_HIDEXT (0x6B)
+; SYMS-NEXT:     NumberOfAuxEntries: 1
+; SYMS-NEXT:     CSECT Auxiliary Entry {
+; SYMS-NEXT:       Index: [[#Index + 1]]
+; SYMS-NEXT:       SectionLen: 4
+; SYMS-NEXT:       ParameterHashIndex: 0x0
+; SYMS-NEXT:       TypeChkSectNum: 0x0
+; SYMS-NEXT:       SymbolAlignmentLog2: 2
+; SYMS-NEXT:       SymbolType: XTY_CM (0x3)
+; SYMS-NEXT:       StorageMappingClass: XMC_BS (0x9)
+; SYMS-NEXT:       StabInfoIndex: 0x0
+; SYMS-NEXT:       StabSectNum: 0x0
+; SYMS-NEXT:     }
+; SYMS-NEXT:   }
+; SYMS-NEXT:   Symbol {
+; SYMS-NEXT:     Index: [[#Index + 2]]
+; SYMS-NEXT:     Name: b
+; SYMS-NEXT:     Value (RelocatableAddress): 0x8
+; SYMS-NEXT:     Section: .bss
+; SYMS-NEXT:     Type: 0x0
+; SYMS-NEXT:     StorageClass: C_HIDEXT (0x6B)
+; SYMS-NEXT:     NumberOfAuxEntries: 1
+; SYMS-NEXT:     CSECT Auxiliary Entry {
+; SYMS-NEXT:       Index: [[#Index + 3]]
+; SYMS-NEXT:       SectionLen: 8
+; SYMS-NEXT:       ParameterHashIndex: 0x0
+; SYMS-NEXT:       TypeChkSectNum: 0x0
+; SYMS-NEXT:       SymbolAlignmentLog2: 3
+; SYMS-NEXT:       SymbolType: XTY_CM (0x3)
+; SYMS-NEXT:       StorageMappingClass: XMC_BS (0x9)
+; SYMS-NEXT:       StabInfoIndex: 0x0
+; SYMS-NEXT:       StabSectNum: 0x0
+; SYMS-NEXT:     }
+; SYMS-NEXT:   }
+; SYMS-NEXT:   Symbol {
+; SYMS-NEXT:     Index: [[#Index + 4]]
+; SYMS-NEXT:     Name: c
+; SYMS-NEXT:     Value (RelocatableAddress): 0x10
+; SYMS-NEXT:     Section: .bss
+; SYMS-NEXT:     Type: 0x0
+; SYMS-NEXT:     StorageClass: C_HIDEXT (0x6B)
+; SYMS-NEXT:     NumberOfAuxEntries: 1
+; SYMS-NEXT:     CSECT Auxiliary Entry {
+; SYMS-NEXT:       Index: [[#Index + 5]]
+; SYMS-NEXT:       SectionLen: 2
+; SYMS-NEXT:       ParameterHashIndex: 0x0
+; SYMS-NEXT:       TypeChkSectNum: 0x0
+; SYMS-NEXT:       SymbolAlignmentLog2: 1
+; SYMS-NEXT:       SymbolType: XTY_CM (0x3)
+; SYMS-NEXT:       StorageMappingClass: XMC_BS (0x9)
+; SYMS-NEXT:       StabInfoIndex: 0x0
+; SYMS-NEXT:       StabSectNum: 0x0
+; SYMS-NEXT:     }
+; SYMS-NEXT:   }
+; SYMS-NEXT: ]




More information about the llvm-commits mailing list