mirror of
https://git.proxmox.com/git/llvm-toolchain
synced 2025-06-15 03:01:34 +00:00
Default to compiler-rt for WebAssembly (wasm32/64)
Our packaging overrides the upstream choice for rtlib to default always to libgcc. Unfortunately, libgcc is not available for WebAssembly (wasm32/wasm64 targets). This makes every build to -target wasm32-unknown-wasi fail, unless one passes --rtlib=compiler-rt. Patch the upstream source to default, and only accept, compiler-rt for the WebAssembly target to make everything work out of the box. This mirrors similar code that the upstream Darwin and Fuchsia targets have. GCC seems fairly far from supporting WebAssembly. If/when that day comes, this patch can be dropped.
This commit is contained in:
parent
bcf5c6f89b
commit
a94a2fe7c3
1
debian/patches/series
vendored
1
debian/patches/series
vendored
@ -138,6 +138,7 @@ llvm-runtimes-builtins-build-check.diff
|
||||
compilerrt-builtins-arch-fix-armhf.diff
|
||||
compilerrt-build-scudo-standalone-option.diff
|
||||
wasm-ld-path.diff
|
||||
wasm-compiler-rt-default.diff
|
||||
issue-54242.diff
|
||||
revert-update-doc.diff
|
||||
unwind-force-pthread-dl.diff
|
||||
|
31
debian/patches/wasm-compiler-rt-default.diff
vendored
Normal file
31
debian/patches/wasm-compiler-rt-default.diff
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
--- a/clang/lib/Driver/ToolChains/WebAssembly.cpp
|
||||
+++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp
|
||||
@@ -369,6 +369,18 @@ ToolChain::RuntimeLibType WebAssembly::G
|
||||
return ToolChain::RLT_CompilerRT;
|
||||
}
|
||||
|
||||
+ToolChain::RuntimeLibType WebAssembly::GetRuntimeLibType(
|
||||
+ const ArgList &Args) const {
|
||||
+ if (Arg *A = Args.getLastArg(options::OPT_rtlib_EQ)) {
|
||||
+ StringRef Value = A->getValue();
|
||||
+ if (Value != "compiler-rt")
|
||||
+ getDriver().Diag(clang::diag::err_drv_unsupported_rtlib_for_platform)
|
||||
+ << Value << "WebAssembly";
|
||||
+ }
|
||||
+
|
||||
+ return ToolChain::RLT_CompilerRT;
|
||||
+}
|
||||
+
|
||||
ToolChain::CXXStdlibType
|
||||
WebAssembly::GetCXXStdlibType(const ArgList &Args) const {
|
||||
if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) {
|
||||
--- a/clang/lib/Driver/ToolChains/WebAssembly.h
|
||||
+++ b/clang/lib/Driver/ToolChains/WebAssembly.h
|
||||
@@ -61,6 +61,7 @@ private:
|
||||
llvm::opt::ArgStringList &CC1Args,
|
||||
Action::OffloadKind DeviceOffloadKind) const override;
|
||||
RuntimeLibType GetDefaultRuntimeLibType() const override;
|
||||
+ RuntimeLibType GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
|
||||
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
|
||||
void
|
||||
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
Loading…
Reference in New Issue
Block a user