Index: devel/wasi-libc/Makefile
===================================================================
--- devel/wasi-libc/Makefile
+++ devel/wasi-libc/Makefile
@@ -1,10 +1,10 @@
 PORTNAME=	wasi-libc
-DISTVERSION=	g20210923
+PORTVERSION=	17
 CATEGORIES=	devel
 
 MAINTAINER=	vishwin@FreeBSD.org
 COMMENT=	C standard library for WebAssembly System Interface
-WWW=		https://github.com/CraneStation/wasi-libc
+WWW=		https://github.com/WebAssembly/wasi-libc
 
 LICENSE=	APACHE20 MIT LLVM2
 LICENSE_COMB=	multi
@@ -14,33 +14,34 @@
 LICENSE_NAME_LLVM2=	Apache License 2.0 with LLVM Exceptions
 LICENSE_PERMS_LLVM2=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
 
-BUILD_DEPENDS=	clang${LLVM_VERSION}:devel/llvm${LLVM_VERSION}
-
-USES=		gmake
+USES=		gmake llvm:min=12
 USE_GITHUB=	yes
 GH_ACCOUNT=	WebAssembly
-GH_TAGNAME=	ad5133410f66b93a2381db5b542aad5e0964db96
-GH_TUPLE=	WebAssembly:WASI:ef8c1a53fe:wasi/tools/wasi-headers/WASI
+GH_TAGNAME=	wasi-sdk-${PORTVERSION}
+GH_TUPLE=	WebAssembly:WASI:59cbe14:wasi/tools/wasi-headers/WASI
 NO_ARCH=	yes
-LLVM_VERSION?=	13
 
 ALL_TARGET=	finish
 
-# NOTE: matches the https://github.com/CraneStation/wasi-sdk
+# NOTE: matches the https://github.com/WebAssembly/wasi-sdk
 WASI_SYSROOT=	${PREFIX}/share/wasi-sysroot
 
 # NOTE: our llvm ports don't ship stdarg/stddef clang headers, so they're in FILESDIR
 #       and we install them to the sysroot
 
+CC=	${LOCALBASE}/bin/clang${LLVM_VERSION}
 MAKE_ENV=	INSTALL_DIR=${STAGEDIR}${WASI_SYSROOT} \
-		WASM_AR=${LOCALBASE}/bin/llvm-ar${LLVM_VERSION} \
-		WASM_CC=${LOCALBASE}/bin/clang${LLVM_VERSION} \
-		WASM_CFLAGS="-O2 -DNDEBUG -isystem ${FILESDIR}" \
-		WASM_NM=${LOCALBASE}/bin/llvm-nm${LLVM_VERSION}
+		EXTRA_CFLAGS="-O2 -DNDEBUG -isystem ${FILESDIR}" \
+		AR=${LOCALBASE}/bin/llvm-ar${LLVM_VERSION} \
+		NM=${LOCALBASE}/bin/llvm-nm${LLVM_VERSION} \
+# https://bugzilla.mozilla.org/show_bug.cgi?id=1773200#c4
+MAKE_ENV+=	BULK_MEMORY_SOURCES=
 
-# NOTE: phony targets cause make install to rebuild everything
-#       https://github.com/CraneStation/wasi-libc/issues/156
 post-patch:
+	${REINPLACE_CMD} -e 's|BULK_MEMORY_SOURCES =|BULK_MEMORY_SOURCES ?=|' \
+		${WRKSRC}/Makefile
+# NOTE: phony targets cause make install to rebuild everything
+#       https://github.com/WebAssembly/wasi-libc/issues/156
 	${REINPLACE_CMD} -e 's|install: finish|install:|' ${WRKSRC}/Makefile
 
 post-install:
Index: devel/wasi-libc/distinfo
===================================================================
--- devel/wasi-libc/distinfo
+++ devel/wasi-libc/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1633602535
-SHA256 (WebAssembly-wasi-libc-g20210923-ad5133410f66b93a2381db5b542aad5e0964db96_GH0.tar.gz) = 085ab45e0591041a8dc104978ad3ff72589072161a922011762d53bf07169ac2
-SIZE (WebAssembly-wasi-libc-g20210923-ad5133410f66b93a2381db5b542aad5e0964db96_GH0.tar.gz) = 1251318
-SHA256 (WebAssembly-WASI-ef8c1a53fe_GH0.tar.gz) = 38be36dc47d79f60aadd1bb3deff391594ff6797260c4810cec0e781ad90ec3c
-SIZE (WebAssembly-WASI-ef8c1a53fe_GH0.tar.gz) = 334921
+TIMESTAMP = 1672194968
+SHA256 (WebAssembly-wasi-libc-17-wasi-sdk-17_GH0.tar.gz) = ba9e49ba3daa82f27d3ab1f65937e160a719bbe20b9c5d264448a42d6c47130a
+SIZE (WebAssembly-wasi-libc-17-wasi-sdk-17_GH0.tar.gz) = 1309369
+SHA256 (WebAssembly-WASI-59cbe14_GH0.tar.gz) = 4e36c4add2421b44ccdded83d442d9aadf02ffa8b534d94016fad2bb7b781cc6
+SIZE (WebAssembly-WASI-59cbe14_GH0.tar.gz) = 162059
Index: devel/wasi-libc/files/patch-Makefile
===================================================================
--- devel/wasi-libc/files/patch-Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-complains about: __arraycount
-
---- Makefile.orig	2020-05-16 19:12:43 UTC
-+++ Makefile
-@@ -515,7 +515,7 @@ finish: startup_files libc
- 
- 	# Check that the computed metadata matches the expected metadata.
- 	# This ignores whitespace because on Windows the output has CRLF line endings.
--	diff -wur "$(CURDIR)/expected/$(MULTIARCH_TRIPLE)" "$(SYSROOT_SHARE)"
-+	# diff -wur "$(CURDIR)/expected/$(MULTIARCH_TRIPLE)" "$(SYSROOT_SHARE)"
- 
- 	#
- 	# The build succeeded! The generated sysroot is in $(SYSROOT).