llvm-project/llvm/test/Object/bigarchive-symboltable.test
zhijian 38d3c6cb9b [AIX] support 64bit global symbol table for big archive
Summary:

In big archive , there is 32bit global symbol table and 64 bit global symbol table. llvm-ar only support 32bit global symbol table this moment, we need to support the 64 bit global symbol table.

https://www.ibm.com/docs/en/aix/7.2?topic=formats-ar-file-format-big

Global Symbol Tables

Immediately following the member table, the archive file contains two global symbol tables. The first global symbol table locates 32-bit file members that define global symbols; the second global symbol table does the same for 64-bit file members. If the archive has no 32-bit or 64-bit file members, the respective global symbol table is omitted. The strip command can be used to delete one or both global symbol tables from the archive. The fl_gstoff field in the fixed-length header contains the offset to the 32-bit global symbol table, and the fl_gst64off contains the offset to the 64-bit global symbol table.

Reviewers: James Henderson,Stephen Peckham
Differential Revision: https://reviews.llvm.org/D142479
2023-05-18 10:54:14 -04:00

99 lines
3.0 KiB
Plaintext

## Test global symbal table of big archive.
# RUN: rm -rf %t && mkdir %t && cd %t
# RUN: yaml2obj --docnum=1 -DFLAG=0x1DF %s -o t32_1.o
# RUN: yaml2obj --docnum=1 -DFLAG=0x1F7 %s -o t64_1.o
# RUN: yaml2obj --docnum=2 -DFLAG=0x1DF %s -o t32_2.o
# RUN: yaml2obj --docnum=2 -DFLAG=0x1F7 %s -o t64_2.o
# RUN: llvm-as -o 32.bc %p/Inputs/bitcode-sym32.ll
# RUN: llvm-as -o 64.bc %p/Inputs/bitcode-sym64.ll
## Test printing a big archive which only has 32-bits symbol names
# RUN: llvm-ar q t32.a t32_1.o t32_2.o 32.bc
# RUN: llvm-nm --print-armap t32.a 2>&1 | FileCheck --check-prefixes=GLOB32,NOGL64 %s
## Test printing a big archive which only has 64-bits symbol names
# RUN: llvm-ar q t64.a t64_1.o t64_2.o 64.bc
# RUN: llvm-nm --print-armap t64.a 2>&1 | FileCheck --check-prefixes=GLOB64,NOGL32 %s
## Test printing all 32-bits symbol names first and then 64-bits
# RUN: llvm-ar q t32_64_all.a t32_1.o t64_1.o t32_2.o t64_2.o 32.bc 64.bc
# RUN: llvm-nm --print-armap t32_64_all.a 2>&1 | FileCheck --check-prefixes=GLOB32,GLOB64 %s
#GLOB32: var_0x1DF in t32_1.o
#GLOB32-NEXT: array_0x1DF in t32_1.o
#GLOB32-NEXT: func_0x1DF in t32_2.o
#GLOB32-NEXT: bar_0x1DF in t32_2.o
#GLOB32-NEXT: foo32 in 32.bc
#GLOB32-NEXT: C32 in 32.bc
#NOGL32-NOT: var_0x1DF in t32_1.o
#NOGL32-NOT: array_0x1DF in t32_1.o
#NOGL32-NOT: func_0x1DF in t32_2.o
#NOGL32-NOT: bar_0x1DF in t32_2.o
#NOGL32-NOT: foo32 in 32.bc
#NOGL32-NOT: C32 in 32.bc
#GLOB64: var_0x1F7 in t64_1.o
#GLOB64-NEXT: array_0x1F7 in t64_1.o
#GLOB64-NEXT: func_0x1F7 in t64_2.o
#GLOB64-NEXT: bar_0x1F7 in t64_2.o
#GLOB64-NEXT: bar64 in 64.bc
#GLOB64-NEXT: C64 in 64.bc
#NOGL64-NOT: var_0x1F7 in t64_1.o
#NOGL64-NOT: array_0x1F7 in t64_1.o
#NOGL64-NOT: func_0x1F7 in t64_2.o
#NOGL64-NOT: bar_0x1F7 in t64_2.o
#NOGL64-NOT: bar64 in 64.bc
#NOGL64-NOT: C64 in 64.bc
--- !XCOFF
FileHeader:
MagicNumber: [[FLAG]]
Sections:
- Name: .data
Flags: [ STYP_DATA ]
Symbols:
- Name: var_[[FLAG]]
Section: .data
Type: 0x4000
StorageClass: C_EXT
AuxEntries:
- Type: AUX_CSECT
SymbolAlignmentAndType: 0x09
StorageMappingClass: XMC_RW
- Name: array_[[FLAG]]
Section: .data
Type: 0x4000
StorageClass: C_EXT
AuxEntries:
- Type: AUX_CSECT
SymbolAlignmentAndType: 0x09
StorageMappingClass: XMC_RW
--- !XCOFF
FileHeader:
MagicNumber: [[FLAG]]
Sections:
- Name: .text
Flags: [ STYP_DATA ]
Symbols:
- Name: func_[[FLAG]]
Section: .text
Type: 0x4000
StorageClass: C_EXT
AuxEntries:
- Type: AUX_CSECT
SymbolAlignmentAndType: 0x09
StorageMappingClass: XMC_PR
- Name: bar_[[FLAG]]
Section: .text
Type: 0x4000
StorageClass: C_EXT
AuxEntries:
- Type: AUX_CSECT
SymbolAlignmentAndType: 0x09
StorageMappingClass: XMC_PR