Skip to content

Commit

Permalink
Add LTO build of wasi-libc
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt committed Jul 12, 2024
1 parent e5e7e82 commit 9255d10
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmake/wasi-sdk-sysroot.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,13 @@ function(define_wasi_libc target)

if(${target} MATCHES threads)
set(extra_make_flags THREAD_MODEL=posix)
set(extra_make_flags_lto LTO=full THREAD_MODEL=posix)
elseif(${target} MATCHES p2)
set(extra_make_flags WASI_SNAPSHOT=p2 default libc_so)
set(extra_make_flags_lto LTO=full WASI_SNAPSHOT=p2 default)
else()
set(extra_make_flags default libc_so)
set(extra_make_flags_lto LTO=full default)
endif()

string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
Expand All @@ -124,8 +127,17 @@ function(define_wasi_libc target)
NM=${CMAKE_NM}
SYSROOT=${wasi_sysroot}
EXTRA_CFLAGS=${extra_cflags}
TARGET_TRIPLE=${target}
TARGET_TRIPLE=${target}
${extra_make_flags}
COMMAND
${MAKE} -j8 -C ${build_dir}
CC=${CMAKE_C_COMPILER}
AR=${CMAKE_AR}
NM=${CMAKE_NM}
SYSROOT=${wasi_sysroot}
EXTRA_CFLAGS=${extra_cflags}
TARGET_TRIPLE=${target}
${extra_make_flags_lto}
INSTALL_COMMAND ""
DEPENDS compiler-rt
EXCLUDE_FROM_ALL ON
Expand Down

0 comments on commit 9255d10

Please sign in to comment.