Skip to content

[flang][Driver] Support -Xlinker in flang #107472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 9, 2024

Conversation

tarunprabhu
Copy link
Contributor

@tarunprabhu tarunprabhu commented Sep 5, 2024

Partially addresses: #89888

@llvmbot llvmbot added clang Clang issues not falling into any other category flang:driver flang Flang issues not falling into any other category labels Sep 5, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 5, 2024

@llvm/pr-subscribers-flang-driver

@llvm/pr-subscribers-clang

Author: Tarun Prabhu (tarunprabhu)

Changes

Partially addresses: #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 --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

Tarun Prabhu added 2 commits September 9, 2024 09:22
…ensure

that the passed arguments are present on that line. Test this for a variety of
linkers and targets.
Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates. LGTM

@tarunprabhu
Copy link
Contributor Author

Thanks for the updates. LGTM

Thanks for the reviews, Tom :-)

@tarunprabhu tarunprabhu merged commit 5f74671 into llvm:main Sep 9, 2024
8 checks passed
@tarunprabhu tarunprabhu deleted the support-xlinker branch September 9, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category flang:driver flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants