31 lines · plain
1# REQUIRES: x862## Test we ignore some LTO related options from clang/GCC collect2.3 4# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o5 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=-lc18 19## Clang LTO passes several options to the linker, which are intended to be consumed by20## LLVMgold.so. We need to ignore them.21# RUN: ld.lld %t.o -o /dev/null -plugin /path/to/LLVMgold.so -plugin-opt=thinlto22 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 %s25# 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'27 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 %s30# GOLD: ld.lld: error: -plugin-opt=: unknown plugin option 'LLVMgold-feature'31