diff --git a/debian/changelog b/debian/changelog index 8b47e430..f6706053 100644 --- a/debian/changelog +++ b/debian/changelog @@ -154,9 +154,23 @@ llvm-toolchain-snapshot (1:15~++20220202093833+1a3137dc8451-1~exp1) experimental -- Sylvestre Ledru Sun, 13 Feb 2022 23:25:57 +0100 -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) + * Fix some hardcoded paths (Closes: #1020847) + * Suggest wasi-libc for clang + + [ 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) + - 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/control b/debian/control index 42b3955c..a8c24c89 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-15-dev, python3 # libomp-15-dev -Suggests: clang-15-doc +Suggests: clang-15-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 @@ -748,9 +748,8 @@ Multi-Arch: same Depends: ${misc:Depends}, libunwind-15 (= ${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 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 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/fix-typo.diff b/debian/patches/fix-typo.diff new file mode 100644 index 00000000..4692f8b3 --- /dev/null +++ b/debian/patches/fix-typo.diff @@ -0,0 +1,35 @@ +Index: llvm-toolchain-14-14.0.6/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h +=================================================================== +--- 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 && +- "Destruction occured when there are still references to this."); ++ "Destruction occurred when there are still references to this."); + } + #else + // Default the destructor in release builds, A trivial destructor may enable +@@ -115,7 +115,7 @@ protected: + #ifndef NDEBUG + ~ThreadSafeRefCountedBase() { + assert(RefCount == 0 && +- "Destruction occured when there are still references to this."); ++ "Destruction occurred when there are still references to this."); + } + #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); + } + }; 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 fd314c94..16d89566 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -72,6 +72,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 @@ -120,7 +123,6 @@ bootstrap-fix-include-next.diff python3-shebang.patch print-lldb-path.patch -libcxx-armhf-ftbfs.diff lower-python-dep.diff scan-build-py-fix-default-bin.diff @@ -129,18 +131,23 @@ 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 -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 -wasm-ld-path.diff -wasm-compiler-rt-default.diff -wasm-sysroot-usr.diff issue-54242.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 +wasm/wasm-sysroot-usr.diff + revert-update-doc.diff unwind-force-pthread-dl.diff force-sse2-compiler-rt.diff diff --git a/debian/patches/wasm/wasm-compiler-rt-default.diff b/debian/patches/wasm/wasm-compiler-rt-default.diff new file mode 100644 index 00000000..351fcc79 --- /dev/null +++ b/debian/patches/wasm/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, 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/wasm-sysroot-usr.diff b/debian/patches/wasm/wasm-sysroot-usr.diff new file mode 100644 index 00000000..f24ec1fc --- /dev/null +++ b/debian/patches/wasm/wasm-sysroot-usr.diff @@ -0,0 +1,72 @@ +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 +@@ -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()); + +- 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 +@@ -396,6 +397,7 @@ void WebAssembly::AddClangSystemIncludeA + return; + + const Driver &D = getDriver(); ++ std::string SysRoot = computeSysRoot(); + + if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { + SmallString<128> P(D.ResourceDir); +@@ -421,10 +423,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, +@@ -467,3 +469,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; ++ ++ std::string Path = "/usr"; ++ if (getVFS().exists(Path)) ++ return Path; ++ ++ return std::string(); ++} ++ +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; + }; + + } // end namespace toolchains diff --git a/debian/qualify-clang.sh b/debian/qualify-clang.sh index e36ebf70..79a7908b 100755 --- a/debian/qualify-clang.sh +++ b/debian/qualify-clang.sh @@ -1357,6 +1357,23 @@ 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 + 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 ' #include int main (void) diff --git a/debian/rules b/debian/rules index 78e0581e..056b7e9d 100755 --- a/debian/rules +++ b/debian/rules @@ -894,6 +894,9 @@ endif DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-compiler-rt-wasm32 install DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-compiler-rt-wasm64 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/; \ @@ -940,6 +943,7 @@ endif sed -i '/_IMPORT_CHECK_TARGETS \(mlir-\|MLIR\)/ {s|^|#|}' $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/cmake/llvm/LLVMExports-*.cmake sed -i '/_IMPORT_CHECK_TARGETS tblgen-lsp-server/ {s|^|#|}' $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/cmake/llvm/LLVMExports-*.cmake sed -i '/_IMPORT_CHECK_FILES_FOR_\(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