[PATCH] D153293: [clang][WebAssembly] support wasm32-wasi shared libraries
Joel Dice via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 19 10:32:55 PDT 2023
dicej updated this revision to Diff 532705.
dicej added a comment.
generalize Wasm tests and release notes
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153293/new/
https://reviews.llvm.org/D153293
Files:
clang/docs/ReleaseNotes.rst
clang/test/Driver/wasm-toolchain.c
Index: clang/test/Driver/wasm-toolchain.c
===================================================================
--- clang/test/Driver/wasm-toolchain.c
+++ clang/test/Driver/wasm-toolchain.c
@@ -33,13 +33,20 @@
// LINK_KNOWN: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
// LINK_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
-// -shared should be passed through to `wasm-ld` and not include crt1.o
+// -shared should be passed through to `wasm-ld` and not include crt1.o with a known OS.
// RUN: %clang -### -shared --target=wasm32-wasi --sysroot=/foo %s 2>&1 \
// RUN: | FileCheck -check-prefix=LINK_KNOWN_SHARED %s
// LINK_KNOWN_SHARED: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
// LINK_KNOWN_SHARED: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "-shared" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
+// -shared should be passed through to `wasm-ld` and not include crt1.o with an unknown OS.
+
+// RUN: %clang -### -shared --target=wasm32-unknown-unknown --sysroot=/foo %s 2>&1 \
+// RUN: | FileCheck -check-prefix=LINK_UNKNOWN_SHARED %s
+// LINK_UNKNOWN_SHARED: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
+// LINK_UNKNOWN_SHARED: wasm-ld{{.*}}" "-shared" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
+
// A basic C link command-line with optimization with known OS.
// RUN: %clang -### -O2 --target=wasm32-wasi --sysroot=/foo %s 2>&1 \
@@ -53,11 +60,17 @@
// RUN: | FileCheck -check-prefix=COMPILE %s
// COMPILE: "-cc1" {{.*}} "-internal-isystem" "/foo/include/wasm32-wasi" "-internal-isystem" "/foo/include"
-// -fPIC should work for WASI
+// -fPIC should work on a known OS
// RUN: %clang -### -fPIC --target=wasm32-wasi --sysroot=/foo %s 2>&1 \
-// RUN: | FileCheck -check-prefix=COMPILE_PIC %s
-// COMPILE_PIC: "-cc1" {{.*}} "-mrelocation-model" "pic" "-pic-level" "2" {{.*}} "-internal-isystem" "/foo/include/wasm32-wasi" "-internal-isystem" "/foo/include"
+// RUN: | FileCheck -check-prefix=COMPILE_KNOWN_PIC %s
+// COMPILE_KNOWN_PIC: "-cc1" {{.*}} "-mrelocation-model" "pic" "-pic-level" "2" {{.*}} "-internal-isystem" "/foo/include/wasm32-wasi" "-internal-isystem" "/foo/include"
+
+// -fPIC should work on an unknown OS
+
+// RUN: %clang -### -fPIC --target=wasm32-unknown-unknown --sysroot=/foo %s 2>&1 \
+// RUN: | FileCheck -check-prefix=COMPILE_UNKNOWN_PIC %s
+// COMPILE_UNKNOWN_PIC: "-cc1" {{.*}} "-mrelocation-model" "pic" "-pic-level" "2"
// Thread-related command line tests.
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -701,8 +701,9 @@
WebAssembly Support
^^^^^^^^^^^^^^^^^^^
-- The `wasm32-wasi` target now supports `Emscripten-style shared libraries
- <https://github.com/WebAssembly/tool-conventions/blob/main/DynamicLinking.md>`_.
+- Shared library support (and PIC code generation) for WebAssembly is no longer
+ limited to the Emscripten target OS and now works with other targets such as
+ wasm32-wasi.
AVR Support
^^^^^^^^^^^
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153293.532705.patch
Type: text/x-patch
Size: 3144 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230619/1ff92ae4/attachment.bin>
More information about the llvm-commits
mailing list