2 # RUN: rm -rf %t; split-file %s %t
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %t/live.s -o %t/live.o
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %t/dead.s -o %t/dead.o
7 # RUN: not %lld -undefined bogus -o /dev/null %t/live.o 2>&1 | \
8 # RUN: FileCheck %s -check-prefix=UNKNOWN
9 # RUN: not %lld -undefined error -o /dev/null %t/live.o 2>&1 | \
10 # RUN: FileCheck %s -check-prefix=ERROR
12 # RUN: not %lld -undefined warning -o /dev/null %t/live.o 2>&1 | \
13 # RUN: FileCheck %s -check-prefix=INVAL-WARNING
14 # RUN: not %lld -undefined suppress -o /dev/null %t/live.o 2>&1 | \
15 # RUN: FileCheck %s -check-prefix=INVAL-SUPPRESS
16 # RUN: %lld -undefined dynamic_lookup -lSystem -o %t/live.out %t/live.o 2>&1 | count 0
17 # RUN: llvm-objdump --macho --lazy-bind %t/live.out \
18 # RUN: | FileCheck --check-prefix=BIND %s
20 # RUN: %no-fatal-warnings-lld -lSystem -flat_namespace -undefined warning \
21 # RUN: -o %t/live.out %t/live.o 2>&1 | \
22 # RUN: FileCheck %s -check-prefix=WARNING
23 # RUN: llvm-objdump --macho --lazy-bind %t/live.out \
24 # RUN: | FileCheck --check-prefix=BIND %s
25 # RUN: %lld -flat_namespace -lSystem -undefined suppress -o %t/live.out %t/live.o \
27 # RUN: llvm-objdump --macho --lazy-bind %t/live.out \
28 # RUN: | FileCheck --check-prefix=BIND %s
29 # RUN: %lld -flat_namespace -lSystem -undefined dynamic_lookup -o \
30 # RUN: %t/live.out %t/live.o 2>&1 | count 0
31 # RUN: llvm-objdump --macho --lazy-bind %t/live.out \
32 # RUN: | FileCheck --check-prefix=BIND %s
34 ## Undefined symbols in dead code should not raise an error iff
35 ## -dead_strip is enabled.
36 # RUN: not %lld -dylib -undefined error -o /dev/null %t/dead.o 2>&1 \
37 # RUN: | FileCheck --check-prefix=ERROR %s
38 # RUN: not %lld -dylib -dead_strip -undefined error -o /dev/null %t/live.o 2>&1\
39 # RUN: | FileCheck --check-prefix=ERROR %s
40 # RUN: %lld -dylib -dead_strip -undefined error -o /dev/null %t/dead.o
42 # ERROR: error: undefined symbol: _bar
43 # ERROR-NEXT: >>> referenced by
45 # INVAL-WARNING: error: '-undefined warning' only valid with '-flat_namespace'
46 # INVAL-WARNING-NOT: error: undefined symbol: _bar
48 # INVAL-SUPPRESS: error: '-undefined suppress' only valid with '-flat_namespace'
49 # INVAL-SUPPRESS-NOT: error: undefined symbol: _bar
51 # WARNING: warning: undefined symbol: _bar
52 # WARNING-NEXT: >>> referenced by
54 # UNKNOWN: unknown -undefined TREATMENT 'bogus'
55 # UNKNOWN-NEXT: error: undefined symbol: _bar
56 # UNKNOWN-NEXT: >>> referenced by
58 # BIND: Lazy bind table:
59 # BIND: __DATA __la_symbol_ptr 0x{{[0-9a-f]*}} flat-namespace _bar