2 ## Test we ignore some LTO related options from clang/GCC collect2.
4 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
6 ## GCC collect2 passes several LTO related options to the linker even if -flto is not used.
7 ## We need to ignore them. Note that the lto-wrapper path can be relative.
8 # RUN: ld.lld %t.o -o /dev/null \
9 # RUN: -plugin path/to/liblto_plugin.so \
10 # RUN: -plugin-opt=/path/to/lto-wrapper \
11 # RUN: -plugin-opt=/path/to/lto-wrapper.exe \
12 # RUN: -plugin-opt=relative/path/to/lto-wrapper \
13 # RUN: -plugin-opt=relative/path/to/lto-wrapper.exe \
14 # RUN: -plugin-opt=-fresolution=zed \
15 # RUN: -plugin-opt=-pass-through=-lgcc \
16 # RUN: -plugin-opt=-pass-through=-lgcc_eh \
17 # RUN: -plugin-opt=-pass-through=-lc
19 ## Clang LTO passes several options to the linker, which are intended to be consumed by
20 ## LLVMgold.so. We need to ignore them.
21 # RUN: ld.lld %t.o -o /dev/null -plugin /path/to/LLVMgold.so -plugin-opt=thinlto
23 ## Other -plugin-opt=- prefixed options are passed through to cl::ParseCommandLineOptions.
24 # RUN: not ld.lld %t.o -o /dev/null -plugin-opt=-abc -plugin-opt=-xyz 2>&1 | FileCheck %s
25 # CHECK: ld.lld: error: -plugin-opt=-: ld.lld{{.*}}: Unknown command line argument '-abc'
26 # CHECK: ld.lld: error: -plugin-opt=-: ld.lld{{.*}}: Unknown command line argument '-xyz'
28 ## Error if the option is an unhandled LLVMgold.so feature.
29 # RUN: not ld.lld %t.o -o /dev/null -plugin-opt=LLVMgold-feature 2>&1 | FileCheck --check-prefix=GOLD %s
30 # GOLD: ld.lld: error: -plugin-opt=: unknown plugin option 'LLVMgold-feature'