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

Leandro Lupori via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 17 05:44:25 PDT 2023


================
@@ -50,3 +50,12 @@
 ! 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 -### -rpath /path/to/dir -shared -static %s 2>&1 \
+! RUN:   | FileCheck --check-prefix=CHECK-LINKER-OPTIONS %s
+! CHECK-LINKER-OPTIONS-DAG: "-rpath" "/path/to/dir"
+! CHECK-LINKER-OPTIONS-DAG: "-shared"
+! CHECK-LINKER-OPTIONS-DAG: "-static"
----------------
luporl wrote:

```suggestion
! 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"
```

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


More information about the cfe-commits mailing list