xref: /llvm-project/flang/test/Driver/dynamic-linker.f90 (revision 5d33010f5edee8030d7b7d78c6e6f6992b659082)
1! Verify that certain linker flags are known to the frontend and are passed on
2! to the linker.
3
4! RUN: %flang -### --target=x86_64-linux-gnu -rpath /path/to/dir -shared \
5! RUN:     -static %s 2>&1 | FileCheck \
6! RUN:     --check-prefixes=GNU-LINKER-OPTIONS \
7! RUN:     --implicit-check-not=GNU-LINKER-OPTIONS-NOT %s
8! RUN: %flang -### --target=x86_64-windows-msvc -rpath /path/to/dir -shared \
9! RUN:     -static %s 2>&1 | FileCheck \
10! RUN:     --check-prefixes=MSVC-LINKER-OPTIONS \
11! RUN:     --implicit-check-not=MSVC-LINKER-OPTIONS-NOT %s
12! RUN: %flang -### --target=aarch64-linux-none -rdynamic %s 2>&1 | FileCheck --check-prefixes=RDYNAMIC-LINKER-OPTION %s
13
14! TODO: Could the linker have an extension or a suffix?
15! GNU-LINKER-OPTIONS: "{{.*}}ld{{(.exe)?}}"
16! GNU-LINKER-OPTIONS-SAME: "-shared"
17! GNU-LINKER-OPTIONS-SAME: "-static"
18! GNU-LINKER-OPTIONS-SAME: "-rpath" "/path/to/dir"
19
20! RDYNAMIC-LINKER-OPTION: "{{.*}}ld{{(\.lld)?(\.exe)?}}"
21! RDYNAMIC-LINKER-OPTION-SAME: "-export-dynamic"
22
23! For MSVC, adding -static does not add any additional linker options.
24! MSVC-LINKER-OPTIONS: "{{.*}}link{{(.exe)?}}"
25! MSVC-LINKER-OPTIONS-SAME: "-dll"
26! MSVC-LINKER-OPTIONS-SAME: "-rpath" "/path/to/dir"
27