From 6ba6091ca0e17890e7e4aef3a1b77e03dd3af0e0 Mon Sep 17 00:00:00 2001 From: Faidon Liambotis Date: Fri, 7 Oct 2022 15:30:35 +0300 Subject: [PATCH 01/20] Fix NJOBS when DEB_BUILD_OPTIONS is not present NJOBS is supposed to have the -j argument (as in the DEB_BUILD_OPTIONS case) --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index a9909b98..d6399a25 100755 --- a/debian/rules +++ b/debian/rules @@ -31,7 +31,7 @@ DEBIAN_REVISION := $(shell dpkg-parsechangelog | sed -rne "s,^Version: 1:([0-9. ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) else - NJOBS := $(shell nproc) + NJOBS := -j $(shell nproc) endif VENDOR=$(shell lsb_release -is) From 50a54f4edc2cedb570a3bbd287df3541e0dd5778 Mon Sep 17 00:00:00 2001 From: Faidon Liambotis Date: Fri, 7 Oct 2022 15:33:03 +0300 Subject: [PATCH 02/20] Build compiler-rt for wasm32 and wasm64 Current shortcomings/future work: * Unfortunately this currently takes the form of a separate, standalone build (with the just-built stage2 toolchain), which makes this a little more convoluted. The upstream compiler-rt build system does not have a way (that I could find) to manually add additional targets to the build. * GNU strip (binutils) does not understand the WebAssembly binary, so dh_strip fails. llvm-strip does, but a) does not understand all the arguments that dh_strip passes (e.g. -N), b) fails with "invalid relocation offset" on --strip-debug (but works with --strip-all). This currently passes -X to dh_strip to exclude them from being stripped entirely. Invoking llvm-strip manually with --strip-all can be considered in the future. * The wasm32/wasm64 binaries are, by design, architecture-independent. With this commit, they are being built in every architecture, and shipped in the libclang-common-X.Y-dev package, which is arch: any, but ships both architecture-dependent (native/host compiler-rt) and architecture-independent files (include headers etc.). In a future iteration, the wasm32/wasm64 compiler-rt library could be factored out to a separate (arch: all) package. This is left outstanding because it should probably happen alongside a different split for libclang-common-X.Y-dev that will include splitting the native libclang-rt as well. Closes: #1010932 --- debian/rules | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/debian/rules b/debian/rules index d6399a25..7f9bcd4c 100755 --- a/debian/rules +++ b/debian/rules @@ -679,7 +679,38 @@ debian-libclc-build: ninja $(NJOBS) $(VERBOSE) touch $@ -override_dh_auto_build: debian-full-build debian-libfuzzer-build debian-libclc-build +debian-rtlib-wasm-build: + echo "Using cmake: $(CMAKE_BIN)" + for build in wasm32 wasm64; do \ + mkdir -p build-compiler-rt-$$build; \ + $(CMAKE_BIN) -B build-compiler-rt-$$build -S compiler-rt/lib/builtins/ \ + -G Ninja \ + -DCMAKE_C_COMPILER_TARGET=$$build-unknown-unknown \ + -DCMAKE_CXX_COMPILER_TARGET=$$build-unknown-unknown \ + -DCMAKE_ASM_COMPILER_TARGET=$$build-unknown-unknown \ + -DCMAKE_C_COMPILER=$(STAGE_2_BIN_DIR)/clang \ + -DCMAKE_CXX_COMPILER=$(STAGE_2_BIN_DIR)/clang++ \ + -DCMAKE_C_FLAGS="$(opt_flags) $(STAGE_2_CFLAGS)" \ + -DCMAKE_CXX_FLAGS="$(opt_flags) $(STAGE_2_CXXFLAGS)" \ + -DCMAKE_SHARED_LINKER_FLAGS="$(STAGE_2_LDFLAGS) -L$(STAGE_2_LIB_DIR)" \ + -DCMAKE_MODULE_LINKER_FLAGS="$(STAGE_2_LDFLAGS) -L$(STAGE_2_LIB_DIR)" \ + -DCMAKE_EXE_LINKER_FLAGS="$(STAGE_2_LDFLAGS) -L$(STAGE_2_LIB_DIR)" \ + -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-$(LLVM_VERSION)/lib/clang/$(LLVM_VERSION_FULL) \ + -DCMAKE_INSTALL_DATADIR=lib \ + -DCMAKE_INSTALL_INCLUDEDIR=include \ + -DLLVM_CONFIG_PATH=$(STAGE_2_BIN_DIR)/llvm-config \ + -DCOMPILER_RT_STANDALONE_BUILD=ON \ + -DCOMPILER_RT_BAREMETAL_BUILD=ON \ + -DCOMPILER_RT_INCLUDE_TESTS=OFF \ + -DCOMPILER_RT_USE_LIBCXX=OFF \ + -DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \ + -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=$$build-unknown-unknown \ + -DCOMPILER_RT_OS_DIR=wasi; \ + ninja -C build-compiler-rt-$$build $(NJOBS) $(VERBOSE); \ + done + touch $@ + +override_dh_auto_build: debian-full-build debian-libfuzzer-build debian-libclc-build debian-rtlib-wasm-build override_dh_prep: build_doc dh_prep @@ -819,6 +850,9 @@ endif DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C libclc/build install + DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-compiler-rt-wasm32 install + DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-compiler-rt-wasm64 install + # Rename binaries mkdir -p $(DEB_INST)/usr/bin/ cd $(DEB_INST)/usr/bin/; \ @@ -964,7 +998,9 @@ ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' bin : # for some reasons, the +x might be removed chmod -f +x $(CURDIR)/debian/*/usr/lib/llvm-$(LLVM_VERSION)/bin/* || true else - dh_strip -a -v + # GNU strip doesn't recognize WebAssembly binaries, and actually corrupts them. + # llvm-strip (as of 15.0.2) fails with --strip-debug (but works with --strip-all) + dh_strip -a -v -Xlibclang_rt.builtins-wasm32.a -Xlibclang_rt.builtins-wasm64.a endif override_dh_install: @@ -1098,6 +1134,7 @@ override_dh_auto_clean: rm -f $(CURDIR)/clang/tools/clang-format/clang-format-diff-$(LLVM_VERSION) rm -f $(CURDIR)/clang/tools/clang-format/clang-format-$(LLVM_VERSION).py rm -rf libclc/build + rm -rf build-compiler-rt-wasm32 build-compiler-rt-wasm64 if test -f lld/docs/ld.lld-$(LLVM_VERSION).1; then \ mv lld/docs/ld.lld-$(LLVM_VERSION).1 lld/docs/ld.lld.1; \ fi @@ -1113,4 +1150,4 @@ override_dh_auto_clean: : # remove extra stamps rm -f debian-*-build -.PHONY: override_dh_strip preconfigure debian-full-build debian-libfuzzer-build debian-libclc-build +.PHONY: override_dh_strip preconfigure debian-full-build debian-libfuzzer-build debian-libclc-build debian-rtlib-wasm-build From 076705fe8e5e3013141a436884f1468a1a3acd02 Mon Sep 17 00:00:00 2001 From: Faidon Liambotis Date: Fri, 7 Oct 2022 15:45:21 +0300 Subject: [PATCH 03/20] 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. --- debian/patches/series | 2 ++ debian/patches/wasm-compiler-rt-default.diff | 31 ++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 debian/patches/wasm-compiler-rt-default.diff diff --git a/debian/patches/series b/debian/patches/series index fda038f5..1faf4424 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -148,6 +148,8 @@ compilerrt-builtins-arch-fix-armhf.diff compilerrt-build-scudo-standalone-option.diff wasm-ld-path.diff python3-scan-build.py +wasm-compiler-rt-default.diff +issue-54242.diff revert-update-doc.diff fix-typo.diff ubuntu-kinetic.patch diff --git a/debian/patches/wasm-compiler-rt-default.diff b/debian/patches/wasm-compiler-rt-default.diff new file mode 100644 index 00000000..351fcc79 --- /dev/null +++ b/debian/patches/wasm-compiler-rt-default.diff @@ -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, From 649278148fdd1ca10916b47f38bb876b325eb519 Mon Sep 17 00:00:00 2001 From: Faidon Liambotis Date: Fri, 7 Oct 2022 15:48:50 +0300 Subject: [PATCH 04/20] Add support for loading wasi-libc from /usr The WebAssembly target seems to have been designed to be always passed a --sysroot, likely because of being tested to work only with the WASI-SDK. This results into passing bare, non-existing paths in include paths, such as: -internal-isystem /include/wasm32-wasi -internal-isystem /include (and similar for /lib/). In Debian, the wasi-libc package ships its files in /usr/include/wasm32-wasi, /usr/lib/wasm32-wasi etc. Add support in the target for including paths from /usr as well. To avoid changing the code in more intrusive ways (to do e.g. what the Linux target does) add a bit of an indirection where the "sysroot" defaults to "/usr" instead of the empty string. This should probably be adjusted a bit if it were to be upstreamed. Closes: #1020746 --- debian/patches/series | 1 + debian/patches/wasm-sysroot-usr.diff | 62 ++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 debian/patches/wasm-sysroot-usr.diff diff --git a/debian/patches/series b/debian/patches/series index 1faf4424..7dc3a8ca 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -149,6 +149,7 @@ compilerrt-build-scudo-standalone-option.diff wasm-ld-path.diff python3-scan-build.py wasm-compiler-rt-default.diff +wasm-sysroot-usr.diff issue-54242.diff revert-update-doc.diff fix-typo.diff diff --git a/debian/patches/wasm-sysroot-usr.diff b/debian/patches/wasm-sysroot-usr.diff new file mode 100644 index 00000000..ae73057b --- /dev/null +++ b/debian/patches/wasm-sysroot-usr.diff @@ -0,0 +1,62 @@ +--- a/clang/lib/Driver/ToolChains/WebAssembly.cpp ++++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp +@@ -174,7 +174,7 @@ WebAssembly::WebAssembly(const Driver &D + + getProgramPaths().push_back(getDriver().getInstalledDir()); + +- auto SysRoot = getDriver().SysRoot; ++ std::string SysRoot = computeSysRoot(); + if (getTriple().getOS() == llvm::Triple::UnknownOS) { + // Theoretically an "unknown" OS should mean no standard libraries, however + // it could also mean that a custom set of libraries is in use, so just add +@@ -402,6 +402,7 @@ void WebAssembly::AddClangSystemIncludeA + return; + + const Driver &D = getDriver(); ++ std::string SysRoot = computeSysRoot(); + + if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { + SmallString<128> P(D.ResourceDir); +@@ -427,10 +428,10 @@ void WebAssembly::AddClangSystemIncludeA + + if (getTriple().getOS() != llvm::Triple::UnknownOS) { + const std::string MultiarchTriple = +- getMultiarchTriple(D, getTriple(), D.SysRoot); +- addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/include/" + MultiarchTriple); ++ getMultiarchTriple(D, getTriple(), SysRoot); ++ addSystemInclude(DriverArgs, CC1Args, SysRoot + "/include/" + MultiarchTriple); + } +- addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/include"); ++ addSystemInclude(DriverArgs, CC1Args, SysRoot + "/include"); + } + + void WebAssembly::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, +@@ -478,6 +479,17 @@ Tool *WebAssembly::buildLinker() const { + return new tools::wasm::Linker(*this); + } + ++std::string WebAssembly::computeSysRoot() const { ++ if (!getDriver().SysRoot.empty()) ++ return getDriver().SysRoot; ++ ++ std::string Path = "/usr"; ++ if (getVFS().exists(Path)) ++ return Path; ++ ++ return std::string(); ++} ++ + void WebAssembly::addLibCxxIncludePaths( + const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const { +--- a/clang/lib/Driver/ToolChains/WebAssembly.h ++++ b/clang/lib/Driver/ToolChains/WebAssembly.h +@@ -89,6 +89,8 @@ private: + llvm::opt::ArgStringList &CC1Args) const; + void addLibStdCXXIncludePaths(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const; ++ ++ std::string computeSysRoot() const override; + }; + + } // end namespace toolchains From 26d4b8da0553a7de865acbc8c60dc40a6f76d21d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 15:57:43 +0200 Subject: [PATCH 05/20] Fix more typo --- debian/patches/fix-typo.diff | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/debian/patches/fix-typo.diff b/debian/patches/fix-typo.diff index 42ba97da..4692f8b3 100644 --- a/debian/patches/fix-typo.diff +++ b/debian/patches/fix-typo.diff @@ -1,8 +1,8 @@ -Index: llvm-toolchain-13-13.0.1/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h +Index: llvm-toolchain-14-14.0.6/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h =================================================================== ---- llvm-toolchain-13-13.0.1.orig/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h -+++ llvm-toolchain-13-13.0.1/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h -@@ -79,7 +79,7 @@ protected: +--- llvm-toolchain-14-14.0.6.orig/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h ++++ llvm-toolchain-14-14.0.6/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h +@@ -84,7 +84,7 @@ protected: #ifndef NDEBUG ~RefCountedBase() { assert(RefCount == 0 && @@ -11,7 +11,7 @@ Index: llvm-toolchain-13-13.0.1/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h } #else // Default the destructor in release builds, A trivial destructor may enable -@@ -110,7 +110,7 @@ protected: +@@ -115,7 +115,7 @@ protected: #ifndef NDEBUG ~ThreadSafeRefCountedBase() { assert(RefCount == 0 && @@ -20,3 +20,16 @@ Index: llvm-toolchain-13-13.0.1/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h } #else // Default the destructor in release builds, A trivial destructor may enable +Index: llvm-toolchain-14-14.0.6/llvm/include/llvm/Support/CommandLine.h +=================================================================== +--- llvm-toolchain-14-14.0.6.orig/llvm/include/llvm/Support/CommandLine.h ++++ llvm-toolchain-14-14.0.6/llvm/include/llvm/Support/CommandLine.h +@@ -1308,7 +1308,7 @@ template <> struct applicator struct applicator { + static void opt(MiscFlags MF, Option &O) { + assert((MF != Grouping || O.ArgStr.size() == 1) && +- "cl::Grouping can only apply to single charater Options."); ++ "cl::Grouping can only apply to single character Options."); + O.setMiscFlag(MF); + } + }; From f6300a1af19414eda4a77924f1495a4d5ce491be Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 15:57:57 +0200 Subject: [PATCH 06/20] Document Faidon's patches --- debian/changelog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/changelog b/debian/changelog index bb6868da..d3c4075e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,16 @@ llvm-toolchain-14 (1:14.0.6-3) UNRELEASED; urgency=medium * Fix a typo to silent lintian (Closes: #1018770) + [ Faidon Liamboti ] + * Add better support for the WebAssembly (wasm32/wasm64) targets: + - Ship compiler-rt for the wasm32 and wasm64 targets. (Closes: #1010932) + - Add patch wasm-compiler-rt-default.diff to default to compiler-rt for + these targets. libgcc does not currently exist for WebAssembly in neither + Debian nor upstream, and therefore compiler-rt is the only option. + - Add patch wasm-sysroot-usr.diff to support a system-installed (i.e. shipped + in /usr) wasi-libc. (Closes: #1020746) + + -- Sylvestre Ledru Tue, 30 Aug 2022 16:10:33 +0200 llvm-toolchain-14 (1:14.0.6-2) unstable; urgency=medium From 86285b0da4660d4646366f1cd453c231fb59f133 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 16:02:10 +0200 Subject: [PATCH 07/20] add a check for Faidon's change --- debian/qualify-clang.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/debian/qualify-clang.sh b/debian/qualify-clang.sh index e36ebf70..bcae9150 100755 --- a/debian/qualify-clang.sh +++ b/debian/qualify-clang.sh @@ -1357,6 +1357,17 @@ else echo "clang-$VERSION-dbgsym isn't installed" fi +if dpkg -l|grep -q wasi-libc; then + cat < printf.c + #include + int main(int argc, char *argv[]) + { + printf("%s\n", "Hello world!"); + } +EOF + clang-$VERSION -target wasm32-unknown-wasi -o printf printf.c +fi + echo ' #include int main (void) From 2084cb707a465ea695d5104b1560190403201d74 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 16:07:22 +0200 Subject: [PATCH 08/20] rebase + move wasm patches --- debian/patches/series | 9 +++-- .../{ => wasm}/wasm-compiler-rt-default.diff | 0 debian/patches/{ => wasm}/wasm-ld-path.diff | 0 .../patches/{ => wasm}/wasm-sysroot-usr.diff | 34 ++++++++++--------- 4 files changed, 24 insertions(+), 19 deletions(-) rename debian/patches/{ => wasm}/wasm-compiler-rt-default.diff (100%) rename debian/patches/{ => wasm}/wasm-ld-path.diff (100%) rename debian/patches/{ => wasm}/wasm-sysroot-usr.diff (58%) diff --git a/debian/patches/series b/debian/patches/series index 7dc3a8ca..5254f8bf 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -146,10 +146,13 @@ libcxxabi-fix-link-builtins.diff llvm-runtimes-builtins-build-check.diff compilerrt-builtins-arch-fix-armhf.diff compilerrt-build-scudo-standalone-option.diff -wasm-ld-path.diff python3-scan-build.py -wasm-compiler-rt-default.diff -wasm-sysroot-usr.diff + +# wasm patches +wasm/wasm-ld-path.diff +wasm/wasm-compiler-rt-default.diff +wasm/wasm-sysroot-usr.diff + issue-54242.diff revert-update-doc.diff fix-typo.diff diff --git a/debian/patches/wasm-compiler-rt-default.diff b/debian/patches/wasm/wasm-compiler-rt-default.diff similarity index 100% rename from debian/patches/wasm-compiler-rt-default.diff rename to debian/patches/wasm/wasm-compiler-rt-default.diff diff --git a/debian/patches/wasm-ld-path.diff b/debian/patches/wasm/wasm-ld-path.diff similarity index 100% rename from debian/patches/wasm-ld-path.diff rename to debian/patches/wasm/wasm-ld-path.diff diff --git a/debian/patches/wasm-sysroot-usr.diff b/debian/patches/wasm/wasm-sysroot-usr.diff similarity index 58% rename from debian/patches/wasm-sysroot-usr.diff rename to debian/patches/wasm/wasm-sysroot-usr.diff index ae73057b..8dc42e07 100644 --- a/debian/patches/wasm-sysroot-usr.diff +++ b/debian/patches/wasm/wasm-sysroot-usr.diff @@ -1,6 +1,8 @@ ---- a/clang/lib/Driver/ToolChains/WebAssembly.cpp -+++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp -@@ -174,7 +174,7 @@ WebAssembly::WebAssembly(const Driver &D +Index: llvm-toolchain-14-14.0.6/clang/lib/Driver/ToolChains/WebAssembly.cpp +=================================================================== +--- llvm-toolchain-14-14.0.6.orig/clang/lib/Driver/ToolChains/WebAssembly.cpp ++++ llvm-toolchain-14-14.0.6/clang/lib/Driver/ToolChains/WebAssembly.cpp +@@ -172,7 +172,7 @@ WebAssembly::WebAssembly(const Driver &D getProgramPaths().push_back(getDriver().getInstalledDir()); @@ -9,7 +11,7 @@ if (getTriple().getOS() == llvm::Triple::UnknownOS) { // Theoretically an "unknown" OS should mean no standard libraries, however // it could also mean that a custom set of libraries is in use, so just add -@@ -402,6 +402,7 @@ void WebAssembly::AddClangSystemIncludeA +@@ -396,6 +396,7 @@ void WebAssembly::AddClangSystemIncludeA return; const Driver &D = getDriver(); @@ -17,7 +19,7 @@ if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { SmallString<128> P(D.ResourceDir); -@@ -427,10 +428,10 @@ void WebAssembly::AddClangSystemIncludeA +@@ -421,10 +422,10 @@ void WebAssembly::AddClangSystemIncludeA if (getTriple().getOS() != llvm::Triple::UnknownOS) { const std::string MultiarchTriple = @@ -31,10 +33,11 @@ } void WebAssembly::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, -@@ -478,6 +479,17 @@ Tool *WebAssembly::buildLinker() const { +@@ -467,3 +468,15 @@ SanitizerMask WebAssembly::getSupportedS + Tool *WebAssembly::buildLinker() const { return new tools::wasm::Linker(*this); } - ++ +std::string WebAssembly::computeSysRoot() const { + if (!getDriver().SysRoot.empty()) + return getDriver().SysRoot; @@ -46,15 +49,14 @@ + return std::string(); +} + - void WebAssembly::addLibCxxIncludePaths( - const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const { ---- a/clang/lib/Driver/ToolChains/WebAssembly.h -+++ b/clang/lib/Driver/ToolChains/WebAssembly.h -@@ -89,6 +89,8 @@ private: - llvm::opt::ArgStringList &CC1Args) const; - void addLibStdCXXIncludePaths(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const; +Index: llvm-toolchain-14-14.0.6/clang/lib/Driver/ToolChains/WebAssembly.h +=================================================================== +--- llvm-toolchain-14-14.0.6.orig/clang/lib/Driver/ToolChains/WebAssembly.h ++++ llvm-toolchain-14-14.0.6/clang/lib/Driver/ToolChains/WebAssembly.h +@@ -80,6 +80,8 @@ private: + std::string getMultiarchTriple(const Driver &D, + const llvm::Triple &TargetTriple, + StringRef SysRoot) const override; + + std::string computeSysRoot() const override; }; From e84ec84c0136a9d0d77276f8e0c882e99d2a3f04 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 16:08:44 +0200 Subject: [PATCH 09/20] move libcxx patches --- debian/patches/{ => libcxx}/libcxx-armhf-ftbfs.diff | 0 .../{ => libcxx}/libcxx-libatomic-only-with-gcc-rtlib.diff | 0 .../patches/{ => libcxx}/libcxxabi-fix-link-builtins.diff | 0 debian/patches/series | 6 +++--- 4 files changed, 3 insertions(+), 3 deletions(-) rename debian/patches/{ => libcxx}/libcxx-armhf-ftbfs.diff (100%) rename debian/patches/{ => libcxx}/libcxx-libatomic-only-with-gcc-rtlib.diff (100%) rename debian/patches/{ => libcxx}/libcxxabi-fix-link-builtins.diff (100%) diff --git a/debian/patches/libcxx-armhf-ftbfs.diff b/debian/patches/libcxx/libcxx-armhf-ftbfs.diff similarity index 100% rename from debian/patches/libcxx-armhf-ftbfs.diff rename to debian/patches/libcxx/libcxx-armhf-ftbfs.diff diff --git a/debian/patches/libcxx-libatomic-only-with-gcc-rtlib.diff b/debian/patches/libcxx/libcxx-libatomic-only-with-gcc-rtlib.diff similarity index 100% rename from debian/patches/libcxx-libatomic-only-with-gcc-rtlib.diff rename to debian/patches/libcxx/libcxx-libatomic-only-with-gcc-rtlib.diff diff --git a/debian/patches/libcxxabi-fix-link-builtins.diff b/debian/patches/libcxx/libcxxabi-fix-link-builtins.diff similarity index 100% rename from debian/patches/libcxxabi-fix-link-builtins.diff rename to debian/patches/libcxx/libcxxabi-fix-link-builtins.diff diff --git a/debian/patches/series b/debian/patches/series index 5254f8bf..fb67b84f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -73,6 +73,9 @@ libcxx/libcxxabi-arm-ehabi-fix.patch libcxx/libcxx-silent-test-libcxx.diff libcxx/libcxx-silent-failure-ppc64el.diff libcxx/libcxx-silent-failure-arm64.diff +libcxx/libcxx-libatomic-only-with-gcc-rtlib.diff +libcxx/libcxxabi-fix-link-builtins.diff +libcxx/libcxx-armhf-ftbfs.diff # Change default optims mips/mips-fpxx-enable.diff @@ -129,7 +132,6 @@ x86-fuzzer.patch python3-shebang.patch print-lldb-path.patch -libcxx-armhf-ftbfs.diff lower-python-dep.diff scan-build-py-fix-default-bin.diff @@ -141,8 +143,6 @@ llvm-fix-lld-linker-check.diff compilerrt-fix-warn-xray-testing.diff openmp-fix-runtimes-build.diff libclc-fix-prepare_builtins-rpath.diff -libcxx-libatomic-only-with-gcc-rtlib.diff -libcxxabi-fix-link-builtins.diff llvm-runtimes-builtins-build-check.diff compilerrt-builtins-arch-fix-armhf.diff compilerrt-build-scudo-standalone-option.diff From 990e0ee145277bb25422cb962be5d8c32421a1ce Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 16:10:13 +0200 Subject: [PATCH 10/20] move compiler-rt patches --- .../compilerrt-build-scudo-standalone-option.diff | 0 .../compilerrt-builtins-arch-fix-armhf.diff | 0 .../compilerrt-fix-warn-xray-testing.diff | 0 debian/patches/series | 9 ++++++--- 4 files changed, 6 insertions(+), 3 deletions(-) rename debian/patches/{ => compiler-rt}/compilerrt-build-scudo-standalone-option.diff (100%) rename debian/patches/{ => compiler-rt}/compilerrt-builtins-arch-fix-armhf.diff (100%) rename debian/patches/{ => compiler-rt}/compilerrt-fix-warn-xray-testing.diff (100%) diff --git a/debian/patches/compilerrt-build-scudo-standalone-option.diff b/debian/patches/compiler-rt/compilerrt-build-scudo-standalone-option.diff similarity index 100% rename from debian/patches/compilerrt-build-scudo-standalone-option.diff rename to debian/patches/compiler-rt/compilerrt-build-scudo-standalone-option.diff diff --git a/debian/patches/compilerrt-builtins-arch-fix-armhf.diff b/debian/patches/compiler-rt/compilerrt-builtins-arch-fix-armhf.diff similarity index 100% rename from debian/patches/compilerrt-builtins-arch-fix-armhf.diff rename to debian/patches/compiler-rt/compilerrt-builtins-arch-fix-armhf.diff diff --git a/debian/patches/compilerrt-fix-warn-xray-testing.diff b/debian/patches/compiler-rt/compilerrt-fix-warn-xray-testing.diff similarity index 100% rename from debian/patches/compilerrt-fix-warn-xray-testing.diff rename to debian/patches/compiler-rt/compilerrt-fix-warn-xray-testing.diff diff --git a/debian/patches/series b/debian/patches/series index fb67b84f..b92ce396 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -140,14 +140,17 @@ omp-riscv64.patch test-disable-lldb-i386.diff unbreak-atomic-mips.diff llvm-fix-lld-linker-check.diff -compilerrt-fix-warn-xray-testing.diff openmp-fix-runtimes-build.diff libclc-fix-prepare_builtins-rpath.diff llvm-runtimes-builtins-build-check.diff -compilerrt-builtins-arch-fix-armhf.diff -compilerrt-build-scudo-standalone-option.diff python3-scan-build.py +# compiler-rt +compiler-rt/compilerrt-fix-warn-xray-testing.diff +compiler-rt/compilerrt-builtins-arch-fix-armhf.diff +compiler-rt/compilerrt-build-scudo-standalone-option.diff + + # wasm patches wasm/wasm-ld-path.diff wasm/wasm-compiler-rt-default.diff From 14a1616e7126c7a3dfc304485c59f18d776ea5bf Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 16:10:23 +0200 Subject: [PATCH 11/20] prepare upload --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index d3c4075e..e30ce440 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -llvm-toolchain-14 (1:14.0.6-3) UNRELEASED; urgency=medium +llvm-toolchain-14 (1:14.0.6-3) unstable; urgency=medium * Fix a typo to silent lintian (Closes: #1018770) From 1acd3cdd416d6fdfc8bb52e35448c393cf6e0a19 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 16:11:21 +0200 Subject: [PATCH 12/20] remove old patch --- debian/patches/series | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/patches/series b/debian/patches/series index b92ce396..d2389a5a 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -156,7 +156,6 @@ wasm/wasm-ld-path.diff wasm/wasm-compiler-rt-default.diff wasm/wasm-sysroot-usr.diff -issue-54242.diff revert-update-doc.diff fix-typo.diff ubuntu-kinetic.patch From cd3fb411f74b7e42e04c3e1379e370b705f0fbe7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 16:13:56 +0200 Subject: [PATCH 13/20] fix a typo --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index e30ce440..852e7d94 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ llvm-toolchain-14 (1:14.0.6-3) unstable; urgency=medium * Fix a typo to silent lintian (Closes: #1018770) - [ Faidon Liamboti ] + [ Faidon Liambotis ] * Add better support for the WebAssembly (wasm32/wasm64) targets: - Ship compiler-rt for the wasm32 and wasm64 targets. (Closes: #1010932) - Add patch wasm-compiler-rt-default.diff to default to compiler-rt for From dc10170928c22f260f54237af43e9f58dd2c0afc Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 16:16:36 +0200 Subject: [PATCH 14/20] Fix some hardcoded paths (Closes: #1020847) --- debian/changelog | 14 ++++++++++++++ debian/libc++-X.Y-dev.links.in | 4 ++-- debian/libunwind-X.Y-dev.links.in | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 852e7d94..c22c9597 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ llvm-toolchain-14 (1:14.0.6-3) unstable; urgency=medium +<<<<<<< * Fix a typo to silent lintian (Closes: #1018770) [ Faidon Liambotis ] @@ -10,6 +11,19 @@ llvm-toolchain-14 (1:14.0.6-3) unstable; urgency=medium Debian nor upstream, and therefore compiler-rt is the only option. - Add patch wasm-sysroot-usr.diff to support a system-installed (i.e. shipped in /usr) wasi-libc. (Closes: #1020746) +======= + * Fix a typo to silent lintian (Closes: #1018770) + * Fix some hardcoded paths (Closes: #1020847) + + [ Faidon Liamboti ] + * Add better support for the WebAssembly (wasm32/wasm64) targets: + - Ship compiler-rt for the wasm32 and wasm64 targets. (Closes: #1010932) + - Add patch wasm-compiler-rt-default.diff to default to compiler-rt for + these targets. libgcc does not currently exist for WebAssembly in neither + Debian nor upstream, and therefore compiler-rt is the only option. + - Add patch wasm-sysroot-usr.diff to support a system-installed (i.e. shipped + in /usr) wasi-libc. (Closes: #1020746) +>>>>>>> -- Sylvestre Ledru Tue, 30 Aug 2022 16:10:33 +0200 diff --git a/debian/libc++-X.Y-dev.links.in b/debian/libc++-X.Y-dev.links.in index 90e84641..854e14b7 100644 --- a/debian/libc++-X.Y-dev.links.in +++ b/debian/libc++-X.Y-dev.links.in @@ -1,3 +1,3 @@ -usr/lib/llvm-@LLVM_VERSION@/lib/libc++.so /usr/lib/x86_64-linux-gnu/libc++.so -usr/lib/llvm-@LLVM_VERSION@/lib/libc++.a /usr/lib/x86_64-linux-gnu/libc++.a +usr/lib/llvm-@LLVM_VERSION@/lib/libc++.so /usr/lib/@DEB_HOST_MULTIARCH@/libc++.so +usr/lib/llvm-@LLVM_VERSION@/lib/libc++.a /usr/lib/@DEB_HOST_MULTIARCH@/libc++.a usr/lib/llvm-@LLVM_VERSION@/include/c++/v1 /usr/include/c++/v1 diff --git a/debian/libunwind-X.Y-dev.links.in b/debian/libunwind-X.Y-dev.links.in index 062eac8a..d6d6103a 100644 --- a/debian/libunwind-X.Y-dev.links.in +++ b/debian/libunwind-X.Y-dev.links.in @@ -1,2 +1,2 @@ -usr/lib/llvm-@LLVM_VERSION@/lib/libunwind.so /usr/lib/x86_64-linux-gnu/libunwind.so -usr/lib/llvm-@LLVM_VERSION@/lib/libunwind.a /usr/lib/x86_64-linux-gnu/libunwind.a +usr/lib/llvm-@LLVM_VERSION@/lib/libunwind.so /usr/lib/@DEB_HOST_MULTIARCH@/libunwind.so +usr/lib/llvm-@LLVM_VERSION@/lib/libunwind.a /usr/lib/@DEB_HOST_MULTIARCH@/libunwind.a From 2d7818bea0c39f441c8ee0932e518aef00998581 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 16:20:03 +0200 Subject: [PATCH 15/20] Fix conflict --- debian/changelog | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/debian/changelog b/debian/changelog index c22c9597..f57065cb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,7 @@ llvm-toolchain-14 (1:14.0.6-3) unstable; urgency=medium -<<<<<<< * Fix a typo to silent lintian (Closes: #1018770) + * Fix some hardcoded paths (Closes: #1020847) [ Faidon Liambotis ] * Add better support for the WebAssembly (wasm32/wasm64) targets: @@ -11,20 +11,6 @@ llvm-toolchain-14 (1:14.0.6-3) unstable; urgency=medium Debian nor upstream, and therefore compiler-rt is the only option. - Add patch wasm-sysroot-usr.diff to support a system-installed (i.e. shipped in /usr) wasi-libc. (Closes: #1020746) -======= - * Fix a typo to silent lintian (Closes: #1018770) - * Fix some hardcoded paths (Closes: #1020847) - - [ Faidon Liamboti ] - * Add better support for the WebAssembly (wasm32/wasm64) targets: - - Ship compiler-rt for the wasm32 and wasm64 targets. (Closes: #1010932) - - Add patch wasm-compiler-rt-default.diff to default to compiler-rt for - these targets. libgcc does not currently exist for WebAssembly in neither - Debian nor upstream, and therefore compiler-rt is the only option. - - Add patch wasm-sysroot-usr.diff to support a system-installed (i.e. shipped - in /usr) wasi-libc. (Closes: #1020746) ->>>>>>> - -- Sylvestre Ledru Tue, 30 Aug 2022 16:10:33 +0200 From 1c709f18fdefb13fa1b2b53c364d68f3698d7c0a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 17:09:09 +0200 Subject: [PATCH 16/20] add missing header? --- debian/patches/wasm/wasm-sysroot-usr.diff | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/debian/patches/wasm/wasm-sysroot-usr.diff b/debian/patches/wasm/wasm-sysroot-usr.diff index 8dc42e07..f24ec1fc 100644 --- a/debian/patches/wasm/wasm-sysroot-usr.diff +++ b/debian/patches/wasm/wasm-sysroot-usr.diff @@ -2,7 +2,15 @@ Index: llvm-toolchain-14-14.0.6/clang/lib/Driver/ToolChains/WebAssembly.cpp =================================================================== --- llvm-toolchain-14-14.0.6.orig/clang/lib/Driver/ToolChains/WebAssembly.cpp +++ llvm-toolchain-14-14.0.6/clang/lib/Driver/ToolChains/WebAssembly.cpp -@@ -172,7 +172,7 @@ WebAssembly::WebAssembly(const Driver &D +@@ -16,6 +16,7 @@ + #include "clang/Driver/Options.h" + #include "llvm/Support/FileSystem.h" + #include "llvm/Support/Path.h" ++#include "llvm/Support/VirtualFileSystem.h" + #include "llvm/Option/ArgList.h" + + using namespace clang::driver; +@@ -172,7 +173,7 @@ WebAssembly::WebAssembly(const Driver &D getProgramPaths().push_back(getDriver().getInstalledDir()); @@ -11,7 +19,7 @@ Index: llvm-toolchain-14-14.0.6/clang/lib/Driver/ToolChains/WebAssembly.cpp if (getTriple().getOS() == llvm::Triple::UnknownOS) { // Theoretically an "unknown" OS should mean no standard libraries, however // it could also mean that a custom set of libraries is in use, so just add -@@ -396,6 +396,7 @@ void WebAssembly::AddClangSystemIncludeA +@@ -396,6 +397,7 @@ void WebAssembly::AddClangSystemIncludeA return; const Driver &D = getDriver(); @@ -19,7 +27,7 @@ Index: llvm-toolchain-14-14.0.6/clang/lib/Driver/ToolChains/WebAssembly.cpp if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { SmallString<128> P(D.ResourceDir); -@@ -421,10 +422,10 @@ void WebAssembly::AddClangSystemIncludeA +@@ -421,10 +423,10 @@ void WebAssembly::AddClangSystemIncludeA if (getTriple().getOS() != llvm::Triple::UnknownOS) { const std::string MultiarchTriple = @@ -33,7 +41,7 @@ Index: llvm-toolchain-14-14.0.6/clang/lib/Driver/ToolChains/WebAssembly.cpp } void WebAssembly::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, -@@ -467,3 +468,15 @@ SanitizerMask WebAssembly::getSupportedS +@@ -467,3 +469,15 @@ SanitizerMask WebAssembly::getSupportedS Tool *WebAssembly::buildLinker() const { return new tools::wasm::Linker(*this); } From ddab807aab9a425ffb8cf098004ba8a2c83fd507 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 19:36:46 +0200 Subject: [PATCH 17/20] Allow libunwind-dev to be coinstallable (Closes: #1004112) --- debian/changelog | 3 +++ debian/control | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index f57065cb..5cc4a653 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ llvm-toolchain-14 (1:14.0.6-3) unstable; urgency=medium * Fix a typo to silent lintian (Closes: #1018770) * Fix some hardcoded paths (Closes: #1020847) + [ Witold Baryluk ] + * Allow libunwind-dev to be coinstallable (Closes: #1004112) + [ Faidon Liambotis ] * Add better support for the WebAssembly (wasm32/wasm64) targets: - Ship compiler-rt for the wasm32 and wasm64 targets. (Closes: #1010932) diff --git a/debian/control b/debian/control index b8227dd9..41e54809 100644 --- a/debian/control +++ b/debian/control @@ -750,9 +750,8 @@ Multi-Arch: same Depends: ${misc:Depends}, libunwind-14 (= ${binary:Version}) -Breaks: libunwind-dev -Provides: libunwind-x.y-dev -Conflicts: libunwind-x.y-dev +Provides: libunwind-dev, libunwind-x.y-dev +Conflicts: libunwind-dev, libunwind-x.y-dev Replaces: libunwind-dev, libunwind-x.y-dev Description: production-quality unwinder libunwind is a production-quality unwinder, with platform support for DWARF From 7e49b818269c24f307675b94d92988d0cf25f139 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 19:36:59 +0200 Subject: [PATCH 18/20] suggest wasi-libc for the compiler --- debian/changelog | 1 + debian/control | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 5cc4a653..1af59750 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ llvm-toolchain-14 (1:14.0.6-3) unstable; urgency=medium * Fix a typo to silent lintian (Closes: #1018770) * Fix some hardcoded paths (Closes: #1020847) + * Suggest wasi-libc for clang [ Witold Baryluk ] * Allow libunwind-dev to be coinstallable (Closes: #1004112) diff --git a/debian/control b/debian/control index 41e54809..6d2770de 100644 --- a/debian/control +++ b/debian/control @@ -47,7 +47,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ${dep:devlibs}, Provides: c-compiler, objc-compiler, c++-compiler Recommends: llvm-14-dev, python3 # libomp-14-dev -Suggests: clang-14-doc +Suggests: clang-14-doc, wasi-libc Description: C, C++ and Objective-C compiler Clang project is a C, C++, Objective C and Objective C++ front-end based on the LLVM compiler. Its goal is to offer a replacement to the From 6c7377e2992bb0fbde3ae9a79393c9c8df012203 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 20:20:12 +0200 Subject: [PATCH 19/20] remove unused stuff for mlir/cmake --- debian/rules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/rules b/debian/rules index 7f9bcd4c..fe14e2c0 100755 --- a/debian/rules +++ b/debian/rules @@ -897,6 +897,7 @@ endif # Also disable mlir-* checks in the cmake sed -i '/_IMPORT_CHECK_TARGETS \(mlir-\|MLIR\)/ {s|^|#|}' $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/cmake/llvm/LLVMExports-*.cmake + sed -i '/_cmake_import_check_files_for_mli/ {s|^|#|}' /usr/lib/llvm-$(LLVM_VERSION)/lib/cmake/llvm/LLVMExports-release.cmake # Disable CMake's package validation checks for binaries that may not be installed sed -i 's|.*_IMPORT_CHECK_FILES_FOR_.*/bin/.*)|#&|' $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/cmake/clang/ClangTargets-*.cmake From 8681b0ebb18d6b65a2fee7af6cfac0c53fa04c83 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 7 Oct 2022 20:20:31 +0200 Subject: [PATCH 20/20] improve the wasm check --- debian/qualify-clang.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/qualify-clang.sh b/debian/qualify-clang.sh index bcae9150..79a7908b 100755 --- a/debian/qualify-clang.sh +++ b/debian/qualify-clang.sh @@ -1366,6 +1366,12 @@ if dpkg -l|grep -q wasi-libc; then } EOF clang-$VERSION -target wasm32-unknown-wasi -o printf printf.c + file printf &> foo.log + if ! grep -q "WebAssembly" foo.log; then + echo "the generated file isn't a WebAssembly file?" + exit 1 + fi + rm -f printf.c printf fi echo '