[LLVM] Fix Maintainers.md formatting (NFC)
[llvm-project.git] / flang / test / Driver / linker-flags.f90
blobac9500d7c45cecd55ed7efbb7ed6d44caf706c55
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.
5 ! RUN: %flang -### --target=ppc64le-linux-gnu %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
6 ! RUN: %flang -### --target=aarch64-apple-darwin %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,DARWIN,DARWIN-F128%f128-lib
7 ! RUN: %flang -### --target=sparc-sun-solaris2.11 %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,UNIX,SOLARIS-F128%f128-lib
8 ! RUN: %flang -### --target=x86_64-unknown-freebsd %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
9 ! RUN: %flang -### --target=x86_64-unknown-netbsd %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
10 ! RUN: %flang -### --target=x86_64-unknown-openbsd %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
11 ! RUN: %flang -### --target=x86_64-unknown-dragonfly %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
12 ! RUN: %flang -### --target=x86_64-unknown-haiku %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,HAIKU,HAIKU-F128%f128-lib
13 ! RUN: %flang -### --target=x86_64-windows-gnu %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,MINGW,MINGW-F128%f128-lib
14 ! RUN: %flang -### -rtlib=compiler-rt --target=aarch64-linux-gnu %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,UNIX,COMPILER-RT
16 ! NOTE: Clang's driver library, clangDriver, usually adds 'oldnames' on Windows,
17 ! but it is not needed when compiling Fortran code and they might bring in
18 ! additional dependencies. Make sure its not added.
19 ! RUN: %flang -### --target=aarch64-windows-msvc -fuse-ld= %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,MSVC --implicit-check-not oldnames
21 ! Compiler invocation to generate the object file
22 ! CHECK-LABEL: {{.*}} "-emit-obj"
23 ! CHECK-SAME: "-o" "[[object_file:.*\.o]]" {{.*}}Inputs/hello.f90
25 ! Linker invocation to generate the executable
26 ! NOTE: Since we are cross-compiling, the host toolchain executables may
27 ! run on any other platform, such as Windows that use a .exe
28 ! suffix. Clang's driver will try to resolve the path to the ld
29 ! executable and may find the GNU linker from MinGW or Cygwin.
30 ! UNIX-LABEL: "{{.*}}ld{{(\.exe)?}}"
31 ! UNIX-SAME: "[[object_file]]"
32 ! UNIX-F128NONE-NOT: FortranFloat128Math
33 ! SOLARIS-F128NONE-NOT: FortranFloat128Math
34 ! UNIX-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" "--no-as-needed"
35 ! SOLARIS-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "-z" "ignore" "-lquadmath" "-z" "record"
36 ! UNIX-SAME: "-lFortranRuntime" "-lFortranDecimal" "-lm"
37 ! COMPILER-RT: "{{.*}}{{\\|/}}libclang_rt.builtins.a"
39 ! DARWIN-LABEL: "{{.*}}ld{{(\.exe)?}}"
40 ! DARWIN-SAME: "[[object_file]]"
41 ! DARWIN-F128NONE-NOT: FortranFloat128Math
42 ! DARWIN-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" "--no-as-needed"
43 ! DARWIN-SAME: -lFortranRuntime
44 ! DARWIN-SAME: -lFortranDecimal
46 ! HAIKU-LABEL: "{{.*}}ld{{(\.exe)?}}"
47 ! HAIKU-SAME: "[[object_file]]"
48 ! HAIKU-F128NONE-NOT: FortranFloat128Math
49 ! HAIKU-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" "--no-as-needed"
50 ! HAIKU-SAME: "-lFortranRuntime" "-lFortranDecimal"
52 ! MINGW-LABEL: "{{.*}}ld{{(\.exe)?}}"
53 ! MINGW-SAME: "[[object_file]]"
54 ! MINGW-F128NONE-NOT: FortranFloat128Math
55 ! MINGW-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" "--no-as-needed"
56 ! MINGW-SAME: -lFortranRuntime
57 ! MINGW-SAME: -lFortranDecimal
59 ! NOTE: This also matches lld-link (when CLANG_DEFAULT_LINKER=lld) and
60 ! any .exe suffix that is added when resolving to the full path of
61 ! (lld-)link.exe on Windows platforms. The suffix may not be added
62 ! when the executable is not found or on non-Windows platforms.
63 ! MSVC-LABEL: link
64 ! MSVC-SAME: /subsystem:console
65 ! MSVC-SAME: "[[object_file]]"
67 ! COMPILER-RT-NOT: "-lgcc"
68 ! COMPILER-RT-NOT: "-lgcc_s"