[PATCH] D126291: [flang][Driver] Update link job on windows

Markus Mützel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 11 02:33:05 PDT 2022


mmuetzel added a comment.

Possible alternative version of `linker-flags-windows.f90` that also tests MinGW and takes the feedback by @mstorsjo into account:

  ! Verify that the Fortran runtime libraries are present in the linker
  ! invocation. These libraries are added on top of other standard runtime
  ! libraries that the Clang driver will include.
  
  ! -----------
  ! target MSVC
  ! -----------
  
  ! NOTE: The additional linker flags tested here are currently specified in
  ! clang/lib/Driver/Toolchains/MSVC.cpp.
  
  !------------
  ! RUN COMMAND
  !------------
  ! RUN: %flang -### -target x86_64-windows-msvc -flang-experimental-exec %S/Inputs/hello.f90 2>&1 | FileCheck %s
  
  !----------------
  ! EXPECTED OUTPUT
  !----------------
  ! Compiler invocation to generate the object file
  ! CHECK-LABEL: {{.*}} "-emit-obj"
  ! CHECK-SAME:  "-o" "[[object_file:.*]]" {{.*}}Inputs/hello.f90
  
  ! Linker invocation to generate the executable
  ! NOTE: This check should also match if the default linker is lld-link.exe
  ! CHECK-LABEL: link.exe
  ! CHECK-NOT: libcmt
  ! CHECK-NOT: oldnames
  ! CHECK-SAME: Fortran_main.lib
  ! CHECK-SAME: FortranRuntime.lib
  ! CHECK-SAME: FortranDecimal.lib
  ! CHECK-SAME: /subsystem:console
  ! CHECK-SAME: "[[object_file]]"
  
  ! ------------
  ! target MinGW
  ! ------------
  
  ! NOTE: The additional linker flags tested here are currently specified in
  ! clang/lib/Driver/Toolchains/MinGW.cpp.
  
  !------------
  ! RUN COMMAND
  !------------
  ! RUN: %flang -### -target x86_64-windows-gnu -flang-experimental-exec %S/Inputs/hello.f90 2>&1 | FileCheck %s
  
  !----------------
  ! EXPECTED OUTPUT
  !----------------
  ! Compiler invocation to generate the object file
  ! CHECK-LABEL: {{.*}} "-emit-obj"
  ! CHECK-SAME:  "-o" "[[object_file:.*]]" {{.*}}Inputs/hello.f90
  
  ! Linker invocation to generate the executable
  ! CHECK-SAME: "[[object_file]]"
  ! CHECK-SAME: -lFortran_main
  ! CHECK-SAME: -lFortranRuntime
  ! CHECK-SAME: -lFortranDecimal


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126291/new/

https://reviews.llvm.org/D126291



More information about the cfe-commits mailing list