[flang-commits] [clang] [flang] [flang][Driver] Support -Xlinker in flang (PR #107472)

via flang-commits flang-commits at lists.llvm.org
Thu Sep 5 14:46:11 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-driver

@llvm/pr-subscribers-clang

Author: Tarun Prabhu (tarunprabhu)

<details>
<summary>Changes</summary>

Partially addresses: https://github.com/llvm/llvm-project/issues/89888

---
Full diff: https://github.com/llvm/llvm-project/pull/107472.diff


2 Files Affected:

- (modified) clang/include/clang/Driver/Options.td (+1) 
- (added) flang/test/Driver/xlinker.f90 (+6) 


``````````diff
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 1b9b3f2c6600a3..136d979ed7200e 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1051,6 +1051,7 @@ def z : Separate<["-"], "z">, Flags<[LinkerInput]>,
 def offload_link : Flag<["--"], "offload-link">, Group<Link_Group>,
   HelpText<"Use the new offloading linker to perform the link job.">;
 def Xlinker : Separate<["-"], "Xlinker">, Flags<[LinkerInput, RenderAsInput]>,
+  Visibility<[ClangOption, CLOption, FlangOption, DXCOption]>,
   HelpText<"Pass <arg> to the linker">, MetaVarName<"<arg>">,
   Group<Link_Group>;
 def Xoffload_linker : JoinedAndSeparate<["-"], "Xoffload-linker">,
diff --git a/flang/test/Driver/xlinker.f90 b/flang/test/Driver/xlinker.f90
new file mode 100644
index 00000000000000..8bb1f7e99ae238
--- /dev/null
+++ b/flang/test/Driver/xlinker.f90
@@ -0,0 +1,6 @@
+! RUN: %flang -### -o /dev/null %s -Xlinker -rpath=/not/a/real/path 2>&1 | FileCheck %s
+
+! CHECK: "-fc1"
+! CHECK-NEXT: "-rpath=/not/a/real/path"
+
+end program

``````````

</details>


https://github.com/llvm/llvm-project/pull/107472


More information about the flang-commits mailing list