[llvm] Fix warnings while building llvm against emscripten for web assembly (PR #118262)

Anutosh Bhat via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 1 22:44:10 PST 2024


https://github.com/anutosh491 created https://github.com/llvm/llvm-project/pull/118262

Fixes #118048 

>From 62fcc4d9e104b5ce756269370931d239f083a8b7 Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat491 at gmail.com>
Date: Mon, 2 Dec 2024 12:09:54 +0530
Subject: [PATCH] Fix warnings while building llvm against emscripten for web
 assembly

---
 llvm/cmake/modules/AddLLVM.cmake | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 006dfb6de3a199..11ccd22fb4f2ea 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -636,10 +636,18 @@ function(llvm_add_library name)
   endif()
 
   if(ARG_MODULE)
-    add_library(${name} MODULE ${ALL_FILES})
+    if(EMSCRIPTEN)
+      add_library(${name} STATIC ${ALL_FILES})
+    else()
+      add_library(${name} MODULE ${ALL_FILES})
+    endif()
   elseif(ARG_SHARED)
     add_windows_version_resource_file(ALL_FILES ${ALL_FILES})
-    add_library(${name} SHARED ${ALL_FILES})
+    if(EMSCRIPTEN)
+      add_library(${name} STATIC ${ALL_FILES})
+    else()
+      add_library(${name} MODULE ${ALL_FILES})
+    endif()
   else()
     add_library(${name} STATIC ${ALL_FILES})
   endif()



More information about the llvm-commits mailing list