xref: /aosp_15_r20/external/llvm/test/Object/nm-archive.test (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard WorkerRUN: llvm-nm -a %p/Inputs/archive-test.a-coff-i386 \
2*9880d681SAndroid Build Coastguard WorkerRUN:         | FileCheck %s -check-prefix COFF
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard WorkerCOFF: trivial-object-test.coff-i386:
5*9880d681SAndroid Build Coastguard WorkerCOFF-NEXT: 00000000 d .data
6*9880d681SAndroid Build Coastguard WorkerCOFF-NEXT: 00000000 t .text
7*9880d681SAndroid Build Coastguard WorkerCOFF-NEXT: 00000000 d L_.str
8*9880d681SAndroid Build Coastguard WorkerCOFF-NEXT:          U _SomeOtherFunction
9*9880d681SAndroid Build Coastguard WorkerCOFF-NEXT: 00000000 T _main
10*9880d681SAndroid Build Coastguard WorkerCOFF-NEXT:          U _puts
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard WorkerRUN: llvm-nm -a -o %p/Inputs/archive-test.a-coff-i386 \
13*9880d681SAndroid Build Coastguard WorkerRUN:         | FileCheck %s -check-prefix COFF-o
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard WorkerCOFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: 00000000 d .data
16*9880d681SAndroid Build Coastguard WorkerCOFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: 00000000 t .text
17*9880d681SAndroid Build Coastguard WorkerCOFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: 00000000 d L_.str
18*9880d681SAndroid Build Coastguard WorkerCOFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386:          U _SomeOtherFunction
19*9880d681SAndroid Build Coastguard WorkerCOFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386: 00000000 T _main
20*9880d681SAndroid Build Coastguard WorkerCOFF-o: {{.*}}/archive-test.a-coff-i386:trivial-object-test.coff-i386:          U _puts
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard WorkerRUN: llvm-as %p/Inputs/trivial.ll -o=%t1
23*9880d681SAndroid Build Coastguard WorkerRUN: rm -f %t2
24*9880d681SAndroid Build Coastguard WorkerRUN: llvm-ar rcs %t2 %t1
25*9880d681SAndroid Build Coastguard WorkerRUN: llvm-nm %t2 | FileCheck %s -check-prefix BITCODE
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard WorkerRUN: rm -f %t2
28*9880d681SAndroid Build Coastguard WorkerRUN: llvm-lib /out:%t2 %t1
29*9880d681SAndroid Build Coastguard WorkerRUN: llvm-nm %t2 | FileCheck %s -check-prefix BITCODE
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard WorkerRUN: rm -f %t2
32*9880d681SAndroid Build Coastguard WorkerRUN: echo /out:%t2 %t1 > %t.rsp
33*9880d681SAndroid Build Coastguard WorkerRUN: llvm-lib @%t.rsp
34*9880d681SAndroid Build Coastguard WorkerRUN: llvm-nm %t2 | FileCheck %s -check-prefix BITCODE
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard WorkerBITCODE:          U SomeOtherFunction
37*9880d681SAndroid Build Coastguard WorkerBITCODE-NEXT:          T main
38*9880d681SAndroid Build Coastguard WorkerBITCODE-NEXT:          U puts
39*9880d681SAndroid Build Coastguard WorkerBITCODE-NEXT:          D var
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard WorkerTest we don't error with an archive with no symtab.
43*9880d681SAndroid Build Coastguard WorkerRUN: llvm-nm %p/Inputs/archive-test.a-gnu-no-symtab
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard WorkerOr in an archive with no symtab or string table.
47*9880d681SAndroid Build Coastguard WorkerRUN: llvm-nm %p/Inputs/archive-test.a-gnu-minimal
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard WorkerAnd don't crash when asked to print a non-existing symtab.
51*9880d681SAndroid Build Coastguard WorkerRUN: llvm-nm -M %p/Inputs/archive-test.a-gnu-minimal
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard WorkerDon't reject an empty archive.
54*9880d681SAndroid Build Coastguard WorkerRUN: llvm-nm %p/Inputs/archive-test.a-empty
55*9880d681SAndroid Build Coastguard Worker
56*9880d681SAndroid Build Coastguard WorkerThis archive has an unaligned member and a unknown format member.
57*9880d681SAndroid Build Coastguard WorkerGNU AR is able to parse the unaligned member and warns about the member with
58*9880d681SAndroid Build Coastguard Workerthe unknown format. We should probably simply warn on both. For now we just
59*9880d681SAndroid Build Coastguard Workerproduce an error for the unknown format.
60*9880d681SAndroid Build Coastguard WorkerRUN: not llvm-nm %p/Inputs/corrupt-archive.a 2>&1 | FileCheck %s -check-prefix CORRUPT
61*9880d681SAndroid Build Coastguard WorkerCORRUPT: corrupt-archive.a(trivial-object-test2.elf-x86-64) Invalid data was encountered while parsing the file
62*9880d681SAndroid Build Coastguard Worker
63*9880d681SAndroid Build Coastguard Worker
64*9880d681SAndroid Build Coastguard WorkerRUN: llvm-nm %p/Inputs/thin.a | FileCheck %s -check-prefix THIN
65*9880d681SAndroid Build Coastguard Worker
66*9880d681SAndroid Build Coastguard WorkerTHIN: IsNAN.o:
67*9880d681SAndroid Build Coastguard WorkerTHIN: 00000014 T _ZN4llvm5IsNANEd
68*9880d681SAndroid Build Coastguard WorkerTHIN: 00000000 T _ZN4llvm5IsNANEf
69*9880d681SAndroid Build Coastguard WorkerTHIN:          U __isnan
70*9880d681SAndroid Build Coastguard WorkerTHIN:          U __isnanf
71