[clang] 394162f - [Clang] Fix 'nvlink-wrapper' not ignoring `-plugin` like lld does (#104056)

via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 11:39:17 PDT 2024


Author: Joseph Huber
Date: 2024-08-14T13:39:13-05:00
New Revision: 394162f356069ddccf1f941abf20959809644926

URL: https://github.com/llvm/llvm-project/commit/394162f356069ddccf1f941abf20959809644926
DIFF: https://github.com/llvm/llvm-project/commit/394162f356069ddccf1f941abf20959809644926.diff

LOG: [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.

Added: 
    

Modified: 
    clang/test/Driver/nvlink-wrapper.c
    clang/tools/clang-nvlink-wrapper/NVLinkOpts.td

Removed: 
    


################################################################################
diff  --git a/clang/test/Driver/nvlink-wrapper.c b/clang/test/Driver/nvlink-wrapper.c
index 5d835d8d6cb2a2..2ef09b699eccb8 100644
--- a/clang/test/Driver/nvlink-wrapper.c
+++ b/clang/test/Driver/nvlink-wrapper.c
@@ -78,3 +78,10 @@ int baz() { return y + x; }
 // RUN:   --lto-debug-pass-manager --lto-newpm-passes=forceattrs \
 // RUN:   -arch sm_52 -o a.out 2>&1 | FileCheck %s --check-prefix=PASSES
 // PASSES: Running pass: ForceFunctionAttrsPass
+
+//
+// Check that '-plugin` is ingored like in `ld.lld`
+//
+// RUN: clang-nvlink-wrapper --dry-run %t.o -plugin -arch sm_52 -o a.out \
+// RUN:   2>&1 | FileCheck %s --check-prefix=PLUGIN
+// PLUGIN-NOT: -plugin

diff  --git a/clang/tools/clang-nvlink-wrapper/NVLinkOpts.td b/clang/tools/clang-nvlink-wrapper/NVLinkOpts.td
index a97190b7a614cc..ef1a7542e49502 100644
--- a/clang/tools/clang-nvlink-wrapper/NVLinkOpts.td
+++ b/clang/tools/clang-nvlink-wrapper/NVLinkOpts.td
@@ -39,6 +39,9 @@ def library_S : Separate<["--", "-"], "library">, Flags<[HelpHidden]>,
 def library_EQ : Joined<["--", "-"], "library=">, Flags<[HelpHidden]>,
   Alias<library_path>;
 
+def plugin : Joined<["--", "-"], "plugin">, 
+  Flags<[HelpHidden, WrapperOnlyOption]>;
+
 def arch : Separate<["--", "-"], "arch">,
   HelpText<"Specify the 'sm_' name of the target architecture.">;
 def : Joined<["--", "-"], "plugin-opt=mcpu=">,


        


More information about the cfe-commits mailing list