[flang-commits] [flang] [clang] [flang][Driver] Support -rpath, -shared, and -static in the frontend (PR #66702)
Andrzej WarzyĆski via flang-commits
flang-commits at lists.llvm.org
Mon Nov 13 14:25:10 PST 2023
================
@@ -48,3 +48,17 @@
! MSVC-SAME: FortranDecimal.lib
! MSVC-SAME: /subsystem:console
! MSVC-SAME: "[[object_file]]"
+
+! Verify that certain linker flags are known to the frontend and are passed on
+! to the linker.
+
+! RUN: %flang -### --target=x86_64-linux-gnu -rpath /path/to/dir -shared \
+! RUN: -static %s 2>&1 | FileCheck \
+! RUN: --check-prefixes=CHECK-LINKER-OPTIONS,GNU-LINKER-OPTIONS %s
+! RUN: %flang -### --target=x86_64-windows-msvc -rpath /path/to/dir -shared \
+! RUN: -static %s 2>&1 | FileCheck \
+! RUN: --check-prefixes=CHECK-LINKER-OPTIONS,MSVC-LINKER-OPTIONS %s
+! CHECK-LINKER-OPTIONS-DAG: "-rpath" "/path/to/dir"
+! GNU-LINKER-OPTIONS-DAG: "-shared"
+! MSVC-LINKER-OPTIONS-DAG: "-dll"
+! GNU-LINKER-OPTIONS-DAG: "-static"
----------------
banach-space wrote:
I have a few suggestions:
* The tests above this block test for default (i.e. generated by the driver automatically) linker flags when generating an executable. This block does something very different. I would separate the two things into different files.
* Why would we test `-shared` and `-static` in one invocation?
* We should make sure that what's being tested is indeed the linker invocation. This can be done by e.g. adding something akin `! UNIX-LABEL: "{{.*}}ld{{(\.exe)?}}"` to make sure that it's indeed the linker invocation that's being matched.
https://github.com/llvm/llvm-project/pull/66702
More information about the flang-commits
mailing list