mirror of
https://git.proxmox.com/git/llvm-toolchain
synced 2025-06-15 12:35:11 +00:00

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.
32 lines
1.3 KiB
Diff
32 lines
1.3 KiB
Diff
--- 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,
|