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