1! Verify that the Fortran runtime libraries are present in the linker
2! invocation. These libraries are added on top of other standard runtime
3! libraries that the Clang driver will include.
4
5! RUN: %flang -### -flang-experimental-exec -target ppc64le-linux-gnu %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,GNU
6! RUN: %flang -### -flang-experimental-exec -target aarch64-apple-darwin %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,DARWIN
7! RUN: %flang -### -flang-experimental-exec -target x86_64-windows-gnu %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,MINGW
8
9! NOTE: Clang's driver library, clangDriver, usually adds 'libcmt' and
10!       'oldnames' on Windows, but they are not needed when compiling
11!       Fortran code and they might bring in additional dependencies.
12!       Make sure they're not added.
13! RUN: %flang -### -flang-experimental-exec -target aarch64-windows-msvc %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,MSVC --implicit-check-not libcmt --implicit-check-not oldnames
14
15! Compiler invocation to generate the object file
16! CHECK-LABEL: {{.*}} "-emit-obj"
17! CHECK-SAME:  "-o" "[[object_file:.*\.o]]" {{.*}}Inputs/hello.f90
18
19! Linker invocation to generate the executable
20! GNU-LABEL:  "{{.*}}ld"
21! GNU-SAME: "[[object_file]]"
22! GNU-SAME: -lFortran_main
23! GNU-SAME: -lFortranRuntime
24! GNU-SAME: -lFortranDecimal
25! GNU-SAME: -lm
26
27! DARWIN-LABEL:  "{{.*}}ld"
28! DARWIN-SAME: "[[object_file]]"
29! DARWIN-SAME: -lFortran_main
30! DARWIN-SAME: -lFortranRuntime
31! DARWIN-SAME: -lFortranDecimal
32
33! MINGW-LABEL:  "{{.*}}ld"
34! MINGW-SAME: "[[object_file]]"
35! MINGW-SAME: -lFortran_main
36! MINGW-SAME: -lFortranRuntime
37! MINGW-SAME: -lFortranDecimal
38
39! NOTE: This check should also match if the default linker is lld-link.exe
40! MSVC-LABEL: link.exe
41! MSVC-SAME: Fortran_main.lib
42! MSVC-SAME: FortranRuntime.lib
43! MSVC-SAME: FortranDecimal.lib
44! MSVC-SAME: /subsystem:console
45! MSVC-SAME: "[[object_file]]"
46