[clang] ac835ec - [Fuchsia] Set /winsysroot in Windows runtimes linker flags

Haowei Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 14 13:31:59 PST 2023


Author: Haowei Wu
Date: 2023-02-14T13:31:48-08:00
New Revision: ac835ecb5feacdbf3fd9fcfc72fd2972067c26b4

URL: https://github.com/llvm/llvm-project/commit/ac835ecb5feacdbf3fd9fcfc72fd2972067c26b4
DIFF: https://github.com/llvm/llvm-project/commit/ac835ecb5feacdbf3fd9fcfc72fd2972067c26b4.diff

LOG: [Fuchsia] Set /winsysroot in Windows runtimes linker flags

This patch sets '/winsysroot' flag when building Windows runtimes so we
don't have to explicitly set Windows library search paths.

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

Added: 
    

Modified: 
    clang/cmake/caches/Fuchsia-stage2.cmake

Removed: 
    


################################################################################
diff  --git a/clang/cmake/caches/Fuchsia-stage2.cmake b/clang/cmake/caches/Fuchsia-stage2.cmake
index 5a9681a7cbae0..5a7cf6cf2c887 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -88,14 +88,13 @@ if(WIN32 OR LLVM_WINSYSROOT)
       ${LLVM_WINSYSROOT})
     string(REPLACE ";" " " WINDOWS_COMPILER_FLAGS "${WINDOWS_COMPILER_FLAGS}")
     set(WINDOWS_LINK_FLAGS
-        /vfsoverlay:${LLVM_VFSOVERLAY}
-        # TODO: On Windows, linker is invoked by cmake instead of the clang-cl driver,
-        # so we have to manually set the libpath. We use clang-cl driver if we can
-        # and remove these libpath flags.
-        -libpath:"${LLVM_WINSYSROOT}/VC/Tools/MSVC/14.34.31933/lib/x64"
-        -libpath:"${LLVM_WINSYSROOT}/VC/Tools/MSVC/14.34.31933/atlmfc/lib/x64"
-        -libpath:"${LLVM_WINSYSROOT}/Windows Kits/10/Lib/10.0.19041.0/ucrt/x64"
-        -libpath:"${LLVM_WINSYSROOT}/Windows Kits/10/Lib/10.0.19041.0/um/x64")
+      # TODO: lld-link has a bug that it cannot infer the machine type
+      # correctly when /winsysroot is set while Windows libraries search paths
+      # are not explicitly defined.
+      # Explicitly set the machine type for now.
+      /machine:X64
+      /vfsoverlay:${LLVM_VFSOVERLAY}
+      /winsysroot:${LLVM_WINSYSROOT})
     string(REPLACE ";" " " WINDOWS_LINK_FLAGS "${WINDOWS_LINK_FLAGS}")
   endif()
 


        


More information about the cfe-commits mailing list