xref: /llvm-project/llvm/test/Object/bigarchive-symboltable.test (revision 38d3c6cb9b9dc67a8a5460aa241824be3240b81e)
1## Test global symbal table of big archive.
2
3# RUN: rm -rf %t && mkdir %t && cd %t
4# RUN: yaml2obj --docnum=1 -DFLAG=0x1DF %s -o t32_1.o
5# RUN: yaml2obj --docnum=1 -DFLAG=0x1F7 %s -o t64_1.o
6# RUN: yaml2obj --docnum=2 -DFLAG=0x1DF %s -o t32_2.o
7# RUN: yaml2obj --docnum=2 -DFLAG=0x1F7 %s -o t64_2.o
8# RUN: llvm-as -o 32.bc %p/Inputs/bitcode-sym32.ll
9# RUN: llvm-as -o 64.bc %p/Inputs/bitcode-sym64.ll
10
11## Test printing a big archive which only has 32-bits symbol names
12# RUN: llvm-ar q t32.a t32_1.o t32_2.o 32.bc
13# RUN: llvm-nm --print-armap t32.a 2>&1 | FileCheck --check-prefixes=GLOB32,NOGL64 %s
14
15## Test printing a big archive which only has 64-bits symbol names
16# RUN: llvm-ar q t64.a t64_1.o t64_2.o 64.bc
17# RUN: llvm-nm --print-armap t64.a 2>&1 | FileCheck --check-prefixes=GLOB64,NOGL32 %s
18
19## Test printing all 32-bits symbol names first and then 64-bits
20# RUN: llvm-ar q t32_64_all.a t32_1.o t64_1.o t32_2.o t64_2.o 32.bc 64.bc
21
22# RUN: llvm-nm --print-armap t32_64_all.a 2>&1 | FileCheck --check-prefixes=GLOB32,GLOB64 %s
23
24#GLOB32:      var_0x1DF in t32_1.o
25#GLOB32-NEXT: array_0x1DF in t32_1.o
26#GLOB32-NEXT: func_0x1DF in t32_2.o
27#GLOB32-NEXT: bar_0x1DF in t32_2.o
28#GLOB32-NEXT: foo32 in 32.bc
29#GLOB32-NEXT: C32 in 32.bc
30
31#NOGL32-NOT: var_0x1DF in t32_1.o
32#NOGL32-NOT:  array_0x1DF in t32_1.o
33#NOGL32-NOT:  func_0x1DF in t32_2.o
34#NOGL32-NOT:  bar_0x1DF in t32_2.o
35#NOGL32-NOT:  foo32 in 32.bc
36#NOGL32-NOT:  C32 in 32.bc
37
38#GLOB64:      var_0x1F7 in t64_1.o
39#GLOB64-NEXT: array_0x1F7 in t64_1.o
40#GLOB64-NEXT: func_0x1F7 in t64_2.o
41#GLOB64-NEXT: bar_0x1F7 in t64_2.o
42#GLOB64-NEXT: bar64 in 64.bc
43#GLOB64-NEXT: C64 in 64.bc
44
45#NOGL64-NOT: var_0x1F7 in t64_1.o
46#NOGL64-NOT: array_0x1F7 in t64_1.o
47#NOGL64-NOT: func_0x1F7 in t64_2.o
48#NOGL64-NOT: bar_0x1F7 in t64_2.o
49#NOGL64-NOT: bar64 in 64.bc
50#NOGL64-NOT: C64 in 64.bc
51
52--- !XCOFF
53FileHeader:
54  MagicNumber:       [[FLAG]]
55Sections:
56  - Name:            .data
57    Flags:           [ STYP_DATA ]
58Symbols:
59  - Name:            var_[[FLAG]]
60    Section:         .data
61    Type:            0x4000
62    StorageClass:    C_EXT
63    AuxEntries:
64     - Type:                   AUX_CSECT
65       SymbolAlignmentAndType: 0x09
66       StorageMappingClass:    XMC_RW
67  - Name:            array_[[FLAG]]
68    Section:         .data
69    Type:            0x4000
70    StorageClass:    C_EXT
71    AuxEntries:
72     - Type:                   AUX_CSECT
73       SymbolAlignmentAndType: 0x09
74       StorageMappingClass:    XMC_RW
75
76--- !XCOFF
77FileHeader:
78  MagicNumber:       [[FLAG]]
79Sections:
80  - Name:            .text
81    Flags:           [ STYP_DATA ]
82Symbols:
83  - Name:            func_[[FLAG]]
84    Section:         .text
85    Type:            0x4000
86    StorageClass:    C_EXT
87    AuxEntries:
88     - Type:                   AUX_CSECT
89       SymbolAlignmentAndType: 0x09
90       StorageMappingClass:    XMC_PR
91  - Name:            bar_[[FLAG]]
92    Section:         .text
93    Type:            0x4000
94    StorageClass:    C_EXT
95    AuxEntries:
96     - Type:                   AUX_CSECT
97       SymbolAlignmentAndType: 0x09
98       StorageMappingClass:    XMC_PR
99