[all-commits] [llvm/llvm-project] 96fcaf: [openmp] Fix building for mingw targets after impo...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Tue Feb 14 14:49:10 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 96fcaf0cc06a6f442b3e67a936ca04806bde1f03
      https://github.com/llvm/llvm-project/commit/96fcaf0cc06a6f442b3e67a936ca04806bde1f03
  Author: Martin Storsjö <martin at martin.st>
  Date:   2023-02-15 (Wed, 15 Feb 2023)

  Changed paths:
    M openmp/runtime/cmake/LibompMicroTests.cmake
    M openmp/runtime/src/CMakeLists.txt

  Log Message:
  -----------
  [openmp] Fix building for mingw targets after import library changes

06d9bf5e64d472db5485815d9c3f70631064bb25 (https://reviews.llvm.org/D143431)
did a large restructuring of how the import library is created;
previously, a second step to tweak the import library was only
done for MSVC style targets, but after this commit, that logic
was applied for mingw targets too.

Since LIBOMP_GENERATED_IMP_LIB_FILENAME and LIBOMP_IMP_LIB_FILE
are equal on mingw targets (both are "libomp.dll.a", while they
are "libomp.dll.lib" and "libomp.lib" for MSVC targets), this caused
a conflict, with errors like this:

  ninja: error: build.ninja:875: multiple rules generate runtime/src/libomp.dll.a [-w dupbuild=err]

Skip the logic with a second step to recreate the import library
for mingw targets. The MSVC specific logic for this relies on
running the static archiver with CMAKE_LINK_DEF_FILE_FLAG, which
with MS lib.exe (and llvm-lib) ignore the input object files and
just generates an import library - but mingw style tools don't
support this mode of operation. (By attemptinig the same, mingw tools
would generate a static library with the def file as one member.)
With mingw tools, the same can be achieved by invoking the dlltool
executable instead.

Instead of adding alternative logic for invoking dlltool, just skip
the second import library step, since neither GNU nor LLVM mingw
tools actually generate import libraries that link by ordinal - so
there's no need for a second import library.

Differential Revision: https://reviews.llvm.org/D143992




More information about the All-commits mailing list