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

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 14:08:41 PDT 2022


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: llvm/cmake/modules/AddLLVM.cmake:133
       set(export_file_linker_flag "/DEF:\"${export_file_linker_flag}\"")
+    elseif(WIN32)
+      # If we're compiling on Windows and the compiler is not Visual Studio,
----------------
ashay-github wrote:
> beanz wrote:
> > Does the same issue occur if you use compilers other than clang? I'm wondering if this change should be clang-specific.
> Since both gcc and clang use `-Wl` to pass flags to the linker, I imagine that this problem is not clang specific. Unfortunately, I don't have gcc/MinGW setup to try this out.
I think if one configured a cmake project with clang-cl, CMake would invoke the linker directly, and it would go down the `if (MSVC)` codepath above. The linker would directly understand the /def flag.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134165



More information about the llvm-commits mailing list