xref: /llvm-project/llvm/test/tools/llvm-libtool-darwin/no-symbols-warning.test (revision 4c12a75e69927c40b992d568187504b2ee268e92)
1## This test verifies that the tool emits a warning for object files
2## without symbols.
3
4# RUN: yaml2obj --docnum=1 %s -o %t-x86_64-empty.o
5# RUN: yaml2obj --docnum=2 %s -o %t-armv7-empty.o
6# RUN: echo 'target triple = "arm64-apple-ios8.0.0"' | llvm-as -o %t-empty.bc
7# RUN: yaml2obj %S/Inputs/input1.yaml -o %t-non-empty.o
8
9# RUN: llvm-libtool-darwin -static -o %t.lib %t-x86_64-empty.o 2>&1 | \
10# RUN:   FileCheck --check-prefix=WARNING %s -DPREFIX=%basename_t.tmp
11
12# WARNING: warning: '[[PREFIX]]-x86_64-empty.o': has no symbols for architecture x86_64
13
14# RUN: not llvm-libtool-darwin -static -warnings_as_errors -o %t-error.lib %t-x86_64-empty.o 2>&1 | \
15# RUN:   FileCheck --check-prefix=ERROR %s -DPREFIX=%basename_t.tmp
16
17# ERROR: error: '[[PREFIX]]-x86_64-empty.o': has no symbols for architecture x86_64
18
19# RUN: llvm-libtool-darwin -no_warning_for_no_symbols -static -o %t.lib \
20# RUN:   %t-x86_64-empty.o 2>&1 | \
21# RUN:   FileCheck %s --allow-empty --implicit-check-not='warning:'
22
23# RUN: llvm-libtool-darwin -static -o %t.lib %t-non-empty.o 2>&1 | \
24# RUN:   FileCheck %s --allow-empty --implicit-check-not='warning:'
25
26# RUN: llvm-libtool-darwin -arch_only x86_64 -static -o %t.lib \
27# RUN:   %t-non-empty.o %t-armv7-empty.o 2>&1 | \
28# RUN:   FileCheck %s --allow-empty --implicit-check-not='warning:'
29
30# RUN: llvm-libtool-darwin -static -o %t.lib %t-empty.bc 2>&1 | \
31# RUN:   FileCheck %s --allow-empty --implicit-check-not='warning:'
32
33## x86_64
34--- !mach-o
35FileHeader:
36  magic:           0xFEEDFACF
37  cputype:         0x1000007
38  cpusubtype:      0x3
39  filetype:        0x1
40  ncmds:           0
41  sizeofcmds:      0
42  flags:           0x2000
43  reserved:        0x0
44...
45
46## armv7
47--- !mach-o
48FileHeader:
49  magic:           0xFEEDFACE
50  cputype:         0x0000000C
51  cpusubtype:      0x00000009
52  filetype:        0x00000001
53  ncmds:           0
54  sizeofcmds:      0
55  flags:           0x00002000
56