57 lines · c
1// REQUIRES: lld2 3/// Check DTLTO options are forwarded to the linker.4 5/// Check that options are forwarded as expected with --thinlto-distributor=.6// RUN: %python %S/Inputs/dtlto-helper.py %clang %llvm-driver > %t_forward.log7// RUN: %clang -flto=thin %s -### -fuse-ld=lld --target=x86_64-linux-gnu \8// RUN: -Xthinlto-distributor=a1 -Xthinlto-distributor=a2,a3 \9// RUN: -fthinlto-distributor=d.exe -Werror >>%t_forward.log 2>&110// RUN: FileCheck %s --input-file=%t_forward.log --check-prefix=FORWARD11 12// FORWARD: clang-name:[[CLANG:.*]]13// FORWARD-NEXT: prepend-arg:[[PREPEND_ARG:.*]]14// FORWARD: ld.lld15// FORWARD-SAME: "--thinlto-distributor=d.exe"16// FORWARD-SAME: "--thinlto-remote-compiler={{[^"]*}}[[CLANG]]"17// FORWARD-SAME: [[PREPEND_ARG]]18// FORWARD-SAME: "--thinlto-distributor-arg=a1"19// FORWARD-SAME: "--thinlto-distributor-arg=a2"20// FORWARD-SAME: "--thinlto-distributor-arg=a3"21 22/// Check that options are not added without --thinlto-distributor= and23/// that a warning is issued for unused -Xthinlto-distributor options.24// RUN: %clang -flto=thin %s -### -fuse-ld=lld --target=x86_64-linux-gnu \25// RUN: -Xthinlto-distributor=a1 -Xthinlto-distributor=a2,a3 2>&1 | \26// RUN: FileCheck %s --check-prefix=NODIST --implicit-check-not=distributor \27// RUN: --implicit-check-not=remote-compiler28 29// NODIST: warning: argument unused during compilation: '-Xthinlto-distributor=a1'30// NODIST: warning: argument unused during compilation: '-Xthinlto-distributor=a2,a3'31// NODIST: ld.lld32 33/// Check the expected arguments are forwarded by default with only34/// --thinlto-distributor=.35// RUN: %python %S/Inputs/dtlto-helper.py %clang %llvm-driver > %t_default.log36// RUN: %clang -flto=thin %s -### -fuse-ld=lld --target=x86_64-linux-gnu \37// RUN: -fthinlto-distributor=d.exe -Werror >>%t_default.log 2>&138// RUN: FileCheck %s --input-file=%t_default.log --check-prefix=DEFAULT \39// RUN: --implicit-check-not=distributor --implicit-check-not=remote-compiler40 41// DEFAULT: clang-name:[[CLANG:.*]]42// DEFAULT-NEXT: prepend-arg:[[PREPEND_ARG:.*]]43// DEFAULT: ld.lld44// DEFAULT-SAME: "--thinlto-distributor=d.exe"45// DEFAULT-SAME: "--thinlto-remote-compiler={{[^"]*}}[[CLANG]]"46// DEFAULT-SAME: [[PREPEND_ARG]]47 48/// Check that nothing is forwarded when the compiler is not in LTO mode, and that49/// appropriate unused option warnings are issued.50// RUN: %clang %s -### -fuse-ld=lld --target=x86_64-linux-gnu \51// RUN: -fthinlto-distributor=d.exe 2>&1 | \52// RUN: FileCheck %s --check-prefix=NOFLTO --implicit-check-not=distributor \53// RUN: --implicit-check-not=remote-compiler54 55// NOFLTO: warning: argument unused during compilation: '-fthinlto-distributor=d.exe'56// NOFLTO: ld.lld57