Skip to content

Commit 394162f

Browse files
authored
[Clang] Fix 'nvlink-wrapper' not ignoring -plugin like lld does (#104056)
Summary: This caused issues with https://gitlab.e4s.io/uo-public/llvm-openmp-offloading/-/jobs/301520 because adding `-flto` caused it to pass `-plugin` sometimes, which isn't supported.
1 parent 74d23f1 commit 394162f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

clang/test/Driver/nvlink-wrapper.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,10 @@ int baz() { return y + x; }
7878
// RUN: --lto-debug-pass-manager --lto-newpm-passes=forceattrs \
7979
// RUN: -arch sm_52 -o a.out 2>&1 | FileCheck %s --check-prefix=PASSES
8080
// PASSES: Running pass: ForceFunctionAttrsPass
81+
82+
//
83+
// Check that '-plugin` is ingored like in `ld.lld`
84+
//
85+
// RUN: clang-nvlink-wrapper --dry-run %t.o -plugin -arch sm_52 -o a.out \
86+
// RUN: 2>&1 | FileCheck %s --check-prefix=PLUGIN
87+
// PLUGIN-NOT: -plugin

clang/tools/clang-nvlink-wrapper/NVLinkOpts.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ def library_S : Separate<["--", "-"], "library">, Flags<[HelpHidden]>,
3939
def library_EQ : Joined<["--", "-"], "library=">, Flags<[HelpHidden]>,
4040
Alias<library_path>;
4141

42+
def plugin : Joined<["--", "-"], "plugin">,
43+
Flags<[HelpHidden, WrapperOnlyOption]>;
44+
4245
def arch : Separate<["--", "-"], "arch">,
4346
HelpText<"Specify the 'sm_' name of the target architecture.">;
4447
def : Joined<["--", "-"], "plugin-opt=mcpu=">,

0 commit comments

Comments
 (0)