[flang-commits] [flang] [clang] [flang][Driver] Support -rpath, -shared, and -static in the frontend (PR #66702)

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Tue Nov 14 07:41:26 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"
----------------
tarunprabhu wrote:

>     I would separate the two things into different files.

Done.

>     * Why would we test `-shared` and `-static` in one invocation?

This was because of a suggestion by @MaskRay [in an earlier comment](https://github.com/llvm/llvm-project/pull/66702#discussion_r1331136897)

>     * We should make sure that what's being tested is indeed the linker invocation.

Done.



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


More information about the flang-commits mailing list