From ba4fb0b8e5617d822132bb8e1efe12625c87fb90 Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Sun, 4 Dec 2022 09:08:45 +0100 Subject: [PATCH] Upload 1:14.0.6-9 to sid, fixing the various RC bugs --- debian/changelog | 29 ++-- debian/control | 43 ----- debian/libc++-X.Y-dev-wasm32.install.in | 3 - debian/libc++-X.Y-dev-wasm32.links.in | 2 - ...libc++-X.Y-dev-wasm32.lintian-overrides.in | 1 - debian/libc++abi-X.Y-dev-wasm32.install.in | 1 - debian/libc++abi-X.Y-dev-wasm32.links.in | 1 - ...c++abi-X.Y-dev-wasm32.lintian-overrides.in | 1 - debian/patches/basic_string.patch | 87 ++++++++++ debian/patches/series | 1 + debian/patches/wasm/wasm-sysroot-usr.diff | 39 +---- debian/qualify-clang.sh | 26 +-- debian/rules | 154 ++++-------------- 13 files changed, 142 insertions(+), 246 deletions(-) delete mode 100644 debian/libc++-X.Y-dev-wasm32.install.in delete mode 100644 debian/libc++-X.Y-dev-wasm32.links.in delete mode 100644 debian/libc++-X.Y-dev-wasm32.lintian-overrides.in delete mode 100644 debian/libc++abi-X.Y-dev-wasm32.install.in delete mode 100644 debian/libc++abi-X.Y-dev-wasm32.links.in delete mode 100644 debian/libc++abi-X.Y-dev-wasm32.lintian-overrides.in create mode 100644 debian/patches/basic_string.patch diff --git a/debian/changelog b/debian/changelog index 42560da0..1d9830da 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,27 +1,13 @@ -llvm-toolchain-14 (1:14.0.6-10~exp1) experimental; urgency=medium - - * More WebAssembly (wasm32/wasm64) work: - - Update patch wasm-sysroot-usr to stop including /usr/include when - building for the non-OS (unknown) wasm targets, to avoid inadvertently - including the host's (glibc) headers. - - Re-enable builds on all architectures, previously disabled for - arm64 armel mips64el mipsel ppc64el armhf in 1:14.0.6-4, due to an FTBFS - related to the /usr/include issue above. - - Update patch wasm-sysroot-usr to adjust system include paths for C++ - headers as well. - - Build libc++ and libc++abi for wasm32-wasi, generating two new binary - packages, and introducing a build dependency on wasi-libc. - - Misc code organization fixes to debian/rules. - - -- Faidon Liambotis Fri, 18 Nov 2022 08:21:02 +0200 - llvm-toolchain-14 (1:14.0.6-9) unstable; urgency=medium + * Cherry-pick upstream commit c081bf4098c729afacf20303cc9df62bf13c3362 + to fix chromium failure in basic_string (Closes: #1025394) * Disable the MLIR testsuite run because of a freeze (Closes: #1024154) See https://github.com/llvm/llvm-project/issues/58357 + * Disable wasm on riscv64 - -- Sylvestre Ledru Tue, 15 Nov 2022 18:23:44 +0100 + -- Gianfranco Costamagna Sun, 04 Dec 2022 09:03:06 +0100 llvm-toolchain-14 (1:14.0.6-8) unstable; urgency=medium @@ -1873,6 +1859,13 @@ llvm-toolchain-snapshot (1:11~++20200621103028+10b0539772d-1~exp1) UNRELEASED; u * Upstream change ad97ccf6b26a29262c9cbf5b3e7f6e84c6dcf55f broke clangd-atomic-cmake.patch causing some undef symbol on i386 and atomic + * experimental New snapshot release + * experimental New snapshot release + * experimental New snapshot release + * experimental New snapshot release + * experimental New snapshot release + * experimental New snapshot release + * experimental New snapshot release -- Sylvestre Ledru Sun, 21 Jun 2020 10:33:23 +0200 diff --git a/debian/control b/debian/control index 9883345b..58f91da2 100644 --- a/debian/control +++ b/debian/control @@ -24,7 +24,6 @@ Build-Depends: debhelper (>= 10.0), cmake, ninja-build, libpfm4-dev [linux-any], python3-setuptools, libz3-dev, llvm-spirv-14 [ amd64 arm64 armel armhf mips64el mipsel ppc64el s390x ] | hello [!i386], spirv-tools [ linux-any ] | hello [ !i386], - wasi-libc, libcurl4-dev, libgrpc++-dev [amd64 arm64 armel armhf mips64el mipsel ppc64 ppc64el powerpc riscv64 s390x], protobuf-compiler-grpc [amd64 arm64 armel armhf mips64el mipsel ppc64 ppc64el powerpc riscv64 s390x], @@ -649,29 +648,6 @@ Description: LLVM C++ Standard library (development files) as exception objects, rtti and memory allocation. * Extensive unit tests. -Package: libc++-14-dev-wasm32 -Section: libdevel -Architecture: all -Multi-Arch: foreign -Depends: wasi-libc, libc++abi-14-dev-wasm32, ${misc:Depends} -Provides: libc++-x.y-dev-wasm32 -Conflicts: libc++-x.y-dev-wasm32 -Replaces: libc++-x.y-dev-wasm32 -Description: LLVM C++ Standard library (WASI) - libc++ is another implementation of the C++ standard library - . - Features and Goals - . - * Correctness as defined by the C++ standards. - * Fast execution. - * Minimal memory use. - * Fast compile times. - * ABI compatibility with gcc's libstdc++ for some low-level features such - as exception objects, rtti and memory allocation. - * Extensive unit tests. - . - This package provides a version for the 32-bit WebAssembly System Interface. - # ------------- libcxxabi ------------- Package: libc++abi1-14 @@ -711,25 +687,6 @@ Description: LLVM low level support for a standard C++ library (development file * Correctness as defined by the C++ standards. * Provide a portable sublayer to ease the porting of libc++ -Package: libc++abi-14-dev-wasm32 -Section: libdevel -Architecture: all -Multi-Arch: foreign -Depends: wasi-libc, ${misc:Depends} -Provides: libc++abi-x.y-dev-wasm32 -Conflicts: libc++abi-x.y-dev-wasm32 -Replaces: libc++abi-x.y-dev-wasm32 -Description: LLVM low level support for a standard C++ library (WASI) - libc++abi is another implementation of low level support for a standard C++ - library. - . - Features and Goals - . - * Correctness as defined by the C++ standards. - * Provide a portable sublayer to ease the porting of libc++ - . - This package provides a version for the 32-bit WebAssembly System Interface. - # ------------- libclc ------------- Package: libclc-14 diff --git a/debian/libc++-X.Y-dev-wasm32.install.in b/debian/libc++-X.Y-dev-wasm32.install.in deleted file mode 100644 index 13c31f09..00000000 --- a/debian/libc++-X.Y-dev-wasm32.install.in +++ /dev/null @@ -1,3 +0,0 @@ -usr/lib/llvm-@LLVM_VERSION@/lib/wasm32-wasi/libc++.a -usr/lib/llvm-@LLVM_VERSION@/include/wasm32-wasi/c++/ -usr/lib/llvm-@LLVM_VERSION@/include/wasm32-wasi/c++/v1/ diff --git a/debian/libc++-X.Y-dev-wasm32.links.in b/debian/libc++-X.Y-dev-wasm32.links.in deleted file mode 100644 index 465536e9..00000000 --- a/debian/libc++-X.Y-dev-wasm32.links.in +++ /dev/null @@ -1,2 +0,0 @@ -usr/lib/llvm-@LLVM_VERSION@/lib/wasm32-wasi/libc++.a /usr/lib/wasm32-wasi/libc++.a -usr/lib/llvm-@LLVM_VERSION@/include/wasm32-wasi/c++/v1 /usr/include/wasm32-wasi/c++/v1 diff --git a/debian/libc++-X.Y-dev-wasm32.lintian-overrides.in b/debian/libc++-X.Y-dev-wasm32.lintian-overrides.in deleted file mode 100644 index 4cad189a..00000000 --- a/debian/libc++-X.Y-dev-wasm32.lintian-overrides.in +++ /dev/null @@ -1 +0,0 @@ -libc++-@LLVM_VERSION@-dev-wasm32: arch-independent-package-contains-binary-or-object usr/lib/llvm-@LLVM_VERSION@/lib/wasm32-wasi/libc++.a \ No newline at end of file diff --git a/debian/libc++abi-X.Y-dev-wasm32.install.in b/debian/libc++abi-X.Y-dev-wasm32.install.in deleted file mode 100644 index 1d6e8500..00000000 --- a/debian/libc++abi-X.Y-dev-wasm32.install.in +++ /dev/null @@ -1 +0,0 @@ -usr/lib/llvm-@LLVM_VERSION@/lib/wasm32-wasi/libc++abi.a diff --git a/debian/libc++abi-X.Y-dev-wasm32.links.in b/debian/libc++abi-X.Y-dev-wasm32.links.in deleted file mode 100644 index c1655fbf..00000000 --- a/debian/libc++abi-X.Y-dev-wasm32.links.in +++ /dev/null @@ -1 +0,0 @@ -usr/lib/llvm-@LLVM_VERSION@/lib/wasm32-wasi/libc++abi.a /usr/lib/wasm32-wasi/libc++abi.a diff --git a/debian/libc++abi-X.Y-dev-wasm32.lintian-overrides.in b/debian/libc++abi-X.Y-dev-wasm32.lintian-overrides.in deleted file mode 100644 index 76ba43d2..00000000 --- a/debian/libc++abi-X.Y-dev-wasm32.lintian-overrides.in +++ /dev/null @@ -1 +0,0 @@ -libc++abi-@LLVM_VERSION@-dev-wasm32: arch-independent-package-contains-binary-or-object usr/lib/llvm-@LLVM_VERSION@/lib/wasm32-wasi/libc++abi.a \ No newline at end of file diff --git a/debian/patches/basic_string.patch b/debian/patches/basic_string.patch new file mode 100644 index 00000000..ceefe082 --- /dev/null +++ b/debian/patches/basic_string.patch @@ -0,0 +1,87 @@ +From c081bf4098c729afacf20303cc9df62bf13c3362 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Sat, 18 Jun 2022 13:48:41 +0200 +Subject: [PATCH] [clang] Enforce instantiation of constexpr template functions + during non-constexpr evaluation + +Otherwise these functions are not instantiated and we end up with an undefined +symbol. + +Fix #55560 + +Differential Revision: https://reviews.llvm.org/D128119 +--- + clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 5 +++-- + .../CodeGenCXX/constexpr-late-instantiation.cpp | 17 +++++++++++++++++ + .../SemaCXX/constexpr-late-instantiation.cpp | 15 +++++++++++++++ + 3 files changed, 35 insertions(+), 2 deletions(-) + create mode 100644 clang/test/CodeGenCXX/constexpr-late-instantiation.cpp + create mode 100644 clang/test/SemaCXX/constexpr-late-instantiation.cpp + +diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +index 467372c71496a..293782822e839 100644 +--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp ++++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +@@ -4826,7 +4826,8 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, + /*Complain*/DefinitionRequired)) { + if (DefinitionRequired) + Function->setInvalidDecl(); +- else if (TSK == TSK_ExplicitInstantiationDefinition) { ++ else if (TSK == TSK_ExplicitInstantiationDefinition || ++ (Function->isConstexpr() && !Recursive)) { + // Try again at the end of the translation unit (at which point a + // definition will be required). + assert(!Recursive); +@@ -4841,7 +4842,7 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, + Diag(PatternDecl->getLocation(), diag::note_forward_template_decl); + if (getLangOpts().CPlusPlus11) + Diag(PointOfInstantiation, diag::note_inst_declaration_hint) +- << Function; ++ << Function; + } + } + +diff --git a/clang/test/CodeGenCXX/constexpr-late-instantiation.cpp b/clang/test/CodeGenCXX/constexpr-late-instantiation.cpp +new file mode 100644 +index 0000000000000..1c8eef73f2dda +--- /dev/null ++++ b/clang/test/CodeGenCXX/constexpr-late-instantiation.cpp +@@ -0,0 +1,17 @@ ++// Make sure foo is instantiated and we don't get a link error ++// RUN: %clang_cc1 -S -emit-llvm -triple %itanium_abi_triple %s -o- | FileCheck %s ++ ++template ++constexpr T foo(T a); ++ ++// CHECK-LABEL: define {{.*}} @main ++int main() { ++ // CHECK: call {{.*}} @_Z3fooIiET_S0_ ++ int k = foo(5); ++} ++// CHECK: } ++ ++template ++constexpr T foo(T a) { ++ return a; ++} +diff --git a/clang/test/SemaCXX/constexpr-late-instantiation.cpp b/clang/test/SemaCXX/constexpr-late-instantiation.cpp +new file mode 100644 +index 0000000000000..ec8e071217c1d +--- /dev/null ++++ b/clang/test/SemaCXX/constexpr-late-instantiation.cpp +@@ -0,0 +1,15 @@ ++// RUN: %clang_cc1 %s -fsyntax-only -verify ++ ++template ++constexpr T foo(T a); // expected-note {{declared here}} ++ ++int main() { ++ int k = foo(5); // Ok ++ constexpr int j = // expected-error {{constexpr variable 'j' must be initialized by a constant expression}} ++ foo(5); // expected-note {{undefined function 'foo' cannot be used in a constant expression}} ++} ++ ++template ++constexpr T foo(T a) { ++ return a; ++} diff --git a/debian/patches/series b/debian/patches/series index b3563d78..69b91812 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -160,3 +160,4 @@ fix-typo-1018770.diff lldb/lldb-swig.diff lldb/lldb-swig-2.diff protobuf_3.21.patch +basic_string.patch diff --git a/debian/patches/wasm/wasm-sysroot-usr.diff b/debian/patches/wasm/wasm-sysroot-usr.diff index 0d884214..f24ec1fc 100644 --- a/debian/patches/wasm/wasm-sysroot-usr.diff +++ b/debian/patches/wasm/wasm-sysroot-usr.diff @@ -27,54 +27,21 @@ Index: llvm-toolchain-14-14.0.6/clang/lib/Driver/ToolChains/WebAssembly.cpp if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { SmallString<128> P(D.ResourceDir); -@@ -419,27 +421,39 @@ void WebAssembly::AddClangSystemIncludeA - return; - } +@@ -421,10 +423,10 @@ void WebAssembly::AddClangSystemIncludeA -+ // add the multiarch path on e.g. wasm32-wasi 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 + "/local/include/" + MultiarchTriple); -+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "/local/include"); + addSystemInclude(DriverArgs, CC1Args, SysRoot + "/include/" + MultiarchTriple); } - addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/include"); -+ -+ // also add the non-multiarch path, only on a known OS (as above), or when -+ // a sysroot is given, for backwards compatibility with the original driver -+ if (getTriple().getOS() != llvm::Triple::UnknownOS || -+ !getDriver().SysRoot.empty()) -+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "/include"); ++ addSystemInclude(DriverArgs, CC1Args, SysRoot + "/include"); } void WebAssembly::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, - ArgStringList &CC1Args) const { -+ std::string SysRoot = computeSysRoot(); -+ - if (!DriverArgs.hasArg(options::OPT_nostdlibinc) && - !DriverArgs.hasArg(options::OPT_nostdincxx)) { - if (getTriple().getOS() != llvm::Triple::UnknownOS) { - const std::string MultiarchTriple = -- getMultiarchTriple(getDriver(), getTriple(), getDriver().SysRoot); -+ getMultiarchTriple(getDriver(), getTriple(), SysRoot); - addSystemInclude(DriverArgs, CC1Args, -- getDriver().SysRoot + "/include/" + MultiarchTriple + -+ SysRoot + "/include/" + MultiarchTriple + - "/c++/v1"); - } -- addSystemInclude(DriverArgs, CC1Args, -- getDriver().SysRoot + "/include/c++/v1"); -+ -+ // don't include the host architecture's headers in the search path -+ if (!getDriver().SysRoot.empty()) -+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "/include/c++/v1"); - } - } - -@@ -467,3 +481,15 @@ SanitizerMask WebAssembly::getSupportedS +@@ -467,3 +469,15 @@ SanitizerMask WebAssembly::getSupportedS Tool *WebAssembly::buildLinker() const { return new tools::wasm::Linker(*this); } diff --git a/debian/qualify-clang.sh b/debian/qualify-clang.sh index 385cf5a7..dfda6e44 100755 --- a/debian/qualify-clang.sh +++ b/debian/qualify-clang.sh @@ -1361,34 +1361,22 @@ fi if dpkg -l|grep -q wasi-libc; then cat < printf.c #include - int main(int argc, char *argv[]) { - printf("%s\n", "Hello World!"); + int main(int argc, char *argv[]) + { + printf("%s\n", "Hello world!"); } EOF - # wasi-libc supports only wasm32 right now - clang-$VERSION -target wasm32-wasi -o printf printf.c + 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 - - cat < cout.cpp - #include - int main() { - std::cout << "Hello World!" << std::endl; - } -EOF - # libcxx requires wasi-libc, which only exists for wasm32 right now - clang++-$VERSION --target=wasm32-wasi -o cout cout.cpp - file cout &> foo.log - if ! grep -q "WebAssembly" foo.log; then - echo "the generated file isn't a WebAssembly file?" - exit 1 - fi - rm -f cout.cpp cout fi +echo '#include ' > foo.cpp +# Fails for now +clang++-$VERSION --target=wasm32-wasi -o foo.o -c foo.cpp||true echo ' #include diff --git a/debian/rules b/debian/rules index 184de30a..41309bc2 100755 --- a/debian/rules +++ b/debian/rules @@ -302,6 +302,12 @@ ifeq ($(LIBUNWIND_ENABLE),yes) endif endif +COMPILER_RT_WASM_ENABLE=yes + +ifneq (,$(filter $(DEB_HOST_ARCH), arm64 armel mips64el mipsel ppc64el armhf riscv64)) + COMPILER_RT_WASM_ENABLE=no +endif + # Do not install objects STAGE_ALL_CMAKE_EXTRA += -DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF @@ -709,17 +715,17 @@ debian-libclc-build: ninja $(NJOBS) $(VERBOSE) touch $@ -build-wasm/compiler-rt-%: cpu = $(@:build-wasm/compiler-rt-%=%) -build-wasm/compiler-rt-%: - @echo "Building compiler-rt for $(cpu)" - @echo "Using cmake: $(CMAKE_BIN)" - mkdir -p "$@" - $(CMAKE_BIN) -B "$@" -S compiler-rt/lib/builtins/ \ +debian-rtlib-wasm-build: +ifeq (${COMPILER_RT_WASM_ENABLE},yes) + 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 \ $(SCCACHE_CMAKE) \ - -DCMAKE_C_COMPILER_TARGET=$(cpu)-unknown-unknown \ - -DCMAKE_CXX_COMPILER_TARGET=$(cpu)-unknown-unknown \ - -DCMAKE_ASM_COMPILER_TARGET=$(cpu)-unknown-unknown \ + -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)" \ @@ -736,112 +742,25 @@ build-wasm/compiler-rt-%: -DCOMPILER_RT_INCLUDE_TESTS=OFF \ -DCOMPILER_RT_USE_LIBCXX=OFF \ -DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \ - -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=$(cpu)-unknown-unknown \ - -DCOMPILER_RT_OS_DIR=wasi - ninja -C "$@" $(NJOBS) $(VERBOSE) - -build-wasm/libcxx-%-wasi: cpu = $(@:build-wasm/libcxx-%-wasi=%) -build-wasm/libcxx-%-wasi: build-wasm/compiler-rt-% - @echo "Building libcxx for $(cpu)" - @echo "Using cmake: $(CMAKE_BIN)" - - # We need a functioning clang, which in turn requires a linker. We - # patch clang to use a versioned wasm-ld (cf. wasm-ld-path.diff), so - # create wasm-ld-$(LLVM_VERSION) in the stage2 bin dir manually. - cp $(STAGE_2_BIN_DIR)/wasm-ld $(STAGE_2_BIN_DIR)/wasm-ld-$(LLVM_VERSION) - - # We need a wasm compiler-rt. Depend on the make target that builds it, - # and manually copy it to the stage2 lib dir from there - mkdir -p \ - $(STAGE_2_LIB_DIR)/clang/$(LLVM_VERSION_FULL)/lib/wasi/ - cp build-wasm/compiler-rt-$(cpu)/lib/wasi/libclang_rt.builtins-$(cpu).a \ - $(STAGE_2_LIB_DIR)/clang/$(LLVM_VERSION_FULL)/lib/wasi/ - - # Notes: - # - Uses $(LDFLAGS) instead of $(STAGE_2_LDFLAGS), because wasm-ld does not - # support --build-id yet. Upstream is working on it, cf. D107662. - # - Pass -fno-stack-protector to disable -fstack-protector-strong that is - # passed by default, as this is not supported yet in WebAssembly, cf. - # https://github.com/WebAssembly/wasi-libc/issues/157 - # - Use llvm-ar and llvm-ranlib, as binutils does not currently support - # WebAssembly and creates invalid indexes. - # - Use LLVM_LIBDIR_SUFFIX to install to /usr/lib/wasm32-wasi. To be - # replaced by CMAKE_INSTALL_LIBDIR=lib/$(cpu)-wasi when D130586 - # ships. - mkdir -p "$@" - $(CMAKE_BIN) -B "$@" -S runtimes \ - -G $(GENERATOR) \ - $(SCCACHE_CMAKE) \ - -DCMAKE_C_COMPILER_WORKS=ON \ - -DCMAKE_CXX_COMPILER_WORKS=ON \ - -DLLVM_COMPILER_CHECKED=ON \ - -DCMAKE_C_COMPILER_TARGET=$(cpu)-unknown-wasi \ - -DCMAKE_CXX_COMPILER_TARGET=$(cpu)-unknown-wasi \ - -DCMAKE_ASM_COMPILER_TARGET=$(cpu)-unknown-wasi \ - -DCMAKE_C_COMPILER=$(STAGE_2_BIN_DIR)/clang \ - -DCMAKE_CXX_COMPILER=$(STAGE_2_BIN_DIR)/clang++ \ - -DCMAKE_AR=$(STAGE_2_BIN_DIR)/llvm-ar \ - -DCMAKE_RANLIB=$(STAGE_2_BIN_DIR)/llvm-ranlib \ - -DCMAKE_C_FLAGS="$(opt_flags) $(STAGE_2_CFLAGS) -fno-stack-protector" \ - -DCMAKE_CXX_FLAGS="$(opt_flags) $(STAGE_2_CXXFLAGS) -fno-stack-protector" \ - -DCMAKE_SHARED_LINKER_FLAGS="$(LDFLAGS) -L$(STAGE_2_LIB_DIR)" \ - -DCMAKE_MODULE_LINKER_FLAGS="$(LDFLAGS) -L$(STAGE_2_LIB_DIR)" \ - -DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS) -L$(STAGE_2_LIB_DIR)" \ - -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-$(LLVM_VERSION) \ - -DCMAKE_INSTALL_INCLUDEDIR=include/$(cpu)-wasi \ - -DLLVM_LIBDIR_SUFFIX=/$(cpu)-wasi \ - -DLLVM_CONFIG=$(STAGE_2_BIN_DIR)/llvm-config \ - -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \ - -DLIBCXX_USE_COMPILER_RT=ON \ - -DLIBCXXABI_USE_COMPILER_RT=ON \ - -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \ - -DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON \ - -DLIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF \ - -DCMAKE_BUILD_TYPE=RelWithDebugInfo \ - -DLIBCXX_CXX_ABI=libcxxabi \ - -DLIBCXX_ABI_VERSION=2 \ - -DLIBCXX_HAS_MUSL_LIBC:BOOL=ON \ - -DLIBCXX_ENABLE_SHARED:BOOL=OFF \ - -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY:BOOL=OFF \ - -DLIBCXX_ENABLE_EXCEPTIONS:BOOL=OFF \ - -DLIBCXX_ENABLE_FILESYSTEM:BOOL=OFF \ - -DLIBCXX_ENABLE_THREADS:BOOL=OFF \ - -DLIBCXX_HAS_PTHREAD_API:BOOL=OFF \ - -DLIBCXX_HAS_EXTERNAL_THREAD_API:BOOL=OFF \ - -DLIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY:BOOL=OFF \ - -DLIBCXXABI_ENABLE_SHARED:BOOL=OFF \ - -DLIBCXXABI_ENABLE_EXCEPTIONS:BOOL=OFF \ - -DLIBCXXABI_SILENT_TERMINATE:BOOL=ON \ - -DLIBCXXABI_ENABLE_THREADS:BOOL=OFF \ - -DLIBCXXABI_HAS_PTHREAD_API:BOOL=OFF \ - -DLIBCXXABI_HAS_EXTERNAL_THREAD_API:BOOL=OFF \ - -DLIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY:BOOL=OFF - ninja -C "$@" $(NJOBS) $(VERBOSE) - -# Build compiler-rt for wasm32 and wasm64. Build libcxx only for wasm32, as -# libcxx requires wasi-libc, which only exists for wasm32 right now. -debian-wasm-build: \ - build-wasm/compiler-rt-wasm32 \ - build-wasm/libcxx-wasm32-wasi \ - build-wasm/compiler-rt-wasm64 + -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=$$build-unknown-unknown \ + -DCOMPILER_RT_OS_DIR=wasi; \ + ninja -C build-compiler-rt-$$build $(NJOBS) $(VERBOSE); \ + done +else + echo "Skip on this arch" +endif touch $@ + sccache-stats: # If we used sccache, shows stats if test -f /opt/sccache/sccache; then \ ls -al /opt/sccache/; \ - mkdir -p /tmp/buildd/source/; \ - /opt/sccache/sccache --stats-format json --show-stats > /tmp/buildd/source/sccache-stats.json; \ - cat /tmp/buildd/source/sccache-stats.json; \ + /opt/sccache/sccache --show-stats; \ fi touch $@ -override_dh_auto_build: \ - debian-full-build \ - debian-libfuzzer-build \ - debian-libclc-build \ - debian-wasm-build \ - sccache-stats +override_dh_auto_build: debian-full-build debian-libfuzzer-build debian-libclc-build debian-rtlib-wasm-build sccache-stats override_dh_prep: build_doc dh_prep @@ -980,10 +899,10 @@ endif $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/build/utils/lit/lit/*/__pycache__/ DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C libclc/build install - - DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-wasm/compiler-rt-wasm32 install - DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-wasm/compiler-rt-wasm64 install - DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-wasm/libcxx-wasm32-wasi install +ifeq (${COMPILER_RT_WASM_ENABLE},yes) + DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-compiler-rt-wasm32 install + DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-compiler-rt-wasm64 install +endif # Rename binaries mkdir -p $(DEB_INST)/usr/bin/ @@ -1137,7 +1056,7 @@ ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' bin else # 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 -Xusr/lib/wasm32-wasi + dh_strip -a -v -Xlibclang_rt.builtins-wasm32.a -Xlibclang_rt.builtins-wasm64.a endif override_dh_install: @@ -1167,13 +1086,6 @@ override_dh_installdeb: # Remove some libc++ abi files in the libc++ file. See bug #969274 rm -f $(CURDIR)/debian/libc++-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/include/c++/__cxxabi_config.h $(CURDIR)/debian/libc++-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/include/c++/cxxabi.h - - mkdir -p $(CURDIR)/debian/libc++abi-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1 - mv $(CURDIR)/debian/libc++-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1/__cxxabi_config.h \ - $(CURDIR)/debian/libc++abi-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1/__cxxabi_config.h - mv $(CURDIR)/debian/libc++-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1/cxxabi.h \ - $(CURDIR)/debian/libc++abi-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1/cxxabi.h - # Remove auto generated python pyc find $(CURDIR)/debian/llvm-$(LLVM_VERSION)-tools/usr/lib/llvm-$(LLVM_VERSION)/ -name '*.pyc' | xargs -r rm -f @@ -1262,7 +1174,7 @@ override_dh_auto_test: endif -override_dh_gencontrol: sccache-stats +override_dh_gencontrol: dh_gencontrol -- $(control_vars) @@ -1282,7 +1194,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-wasm + 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 @@ -1298,4 +1210,4 @@ override_dh_auto_clean: : # remove extra stamps rm -f debian-*-build -.PHONY: override_dh_strip preconfigure +.PHONY: override_dh_strip preconfigure debian-full-build debian-libfuzzer-build debian-libclc-build debian-rtlib-wasm-build