[llvm] Set Support system_libs if WIN32, not just MSVC or MINGW (PR #95505)
Jeremy Day via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 13 22:09:57 PDT 2024
https://github.com/z2oh created https://github.com/llvm/llvm-project/pull/95505
The previous check was false when compiling with `clang++`, which prevented `ntdll` from being specified as a link library, causing an undefined symbol error when trying to resolve `RtlGetLastNtStatus`. Since we always want to link these libraries on Windows, the check can be simplified to just `if( WIN32 )`.
I added the reference to `RtlGetLastNtStatus` in https://github.com/llvm/llvm-project/pull/90655.
I tried building with clang++ without this change, saw the undefined symbol error, then tried building again with `if( WIN32 )` here and was able to build successfully.
Thanks @mstorsjo for suggesting this straightforward fix.
>From 8d9b1ac88f0e28552bff848e50aae6f0fcb307b9 Mon Sep 17 00:00:00 2001
From: Jeremy Day <jeremy at thebrowser.company>
Date: Thu, 13 Jun 2024 22:05:45 -0700
Subject: [PATCH] Set Support system_libs if WIN32, not just MSVC or MINGW
The previous check was false when compiling with clang++, which prevented ntdll from being specified as a link library, causing an undefined symbol error when trying to resolve RtlGetLastNtStatus. Since we always want these libs on Windows, the check can be simplified to just if(WIN32).
---
llvm/lib/Support/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index c7f8ac325a97a..4d8ce329029d0 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -37,7 +37,7 @@ if(LLVM_ENABLE_ZSTD)
list(APPEND imported_libs ${zstd_target})
endif()
-if( MSVC OR MINGW )
+if( WIN32 )
# libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc.
# advapi32 required for CryptAcquireContextW in lib/Support/Windows/Path.inc.
# ntdll required for RtlGetLastNtStatus in lib/Support/ErrorHandling.cpp.
@@ -72,7 +72,7 @@ elseif( CMAKE_HOST_UNIX )
add_compile_definitions(_BSD_SOURCE)
set(system_libs ${system_libs} bsd network)
endif()
-endif( MSVC OR MINGW )
+endif( WIN32 )
# Delay load shell32.dll if possible to speed up process startup.
set (delayload_flags)
More information about the llvm-commits
mailing list