[PATCH] D134165: [llvm] prefix linker flag on non-MSVC compilers with `-Wl,`

Ashay Rane via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 16:01:20 PDT 2022


ashay-github updated this revision to Diff 461745.
ashay-github added a comment.

Updated flag to permit building under MingW


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134165

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -128,8 +128,14 @@
       VERBATIM
       COMMENT "Creating export file for ${target_name}")
     set(export_file_linker_flag "${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
-    if(MSVC)
-      set(export_file_linker_flag "/DEF:\"${export_file_linker_flag}\"")
+    if(WIN32)
+      if(MINGW)
+        set(export_file_linker_flag "-Wl,\"${export_file_linker_flag}\"")
+      elseif(MSVC)
+        set(export_file_linker_flag "/DEF:\"${export_file_linker_flag}\"")
+      else()
+        set(export_file_linker_flag "-Wl,/DEF:\"${export_file_linker_flag}\"")
+      endif()
     endif()
     set_property(TARGET ${target_name} APPEND_STRING PROPERTY
                  LINK_FLAGS " ${export_file_linker_flag}")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134165.461745.patch
Type: text/x-patch
Size: 899 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220920/ac072e7a/attachment.bin>


More information about the llvm-commits mailing list