Merge remote-tracking branch 'origin/14' into 15

This commit is contained in:
Sylvestre Ledru 2022-10-08 09:57:30 +02:00
commit ff4d2206cf
17 changed files with 197 additions and 18 deletions

16
debian/changelog vendored
View File

@ -154,9 +154,23 @@ llvm-toolchain-snapshot (1:15~++20220202093833+1a3137dc8451-1~exp1) experimental
-- Sylvestre Ledru <sylvestre@debian.org> 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 <sylvestre@debian.org> Tue, 30 Aug 2022 16:10:33 +0200

7
debian/control vendored
View File

@ -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

View File

@ -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

View File

@ -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

35
debian/patches/fix-typo.diff vendored Normal file
View File

@ -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<Formatting
template <> struct applicator<MiscFlags> {
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);
}
};

25
debian/patches/series vendored
View File

@ -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

View 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,

View File

@ -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

View File

@ -1357,6 +1357,23 @@ else
echo "clang-$VERSION-dbgsym isn't installed"
fi
if dpkg -l|grep -q wasi-libc; then
cat <<EOF > printf.c
#include <stdio.h>
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 <vector>
int main (void)

4
debian/rules vendored
View File

@ -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