From e021f71c67a73ee1baebd1d44ba5ac3655141a59 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 3 Apr 2023 11:19:28 +0200 Subject: [PATCH 01/19] prepare upload --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 30fbbbfb..77414451 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -llvm-toolchain-15 (1:15.0.7-4) UNRELEASED; urgency=medium +llvm-toolchain-15 (1:15.0.7-4) unstable; urgency=medium * Fix debian/libclang1-15.symbols soname * Remove build artifacts if any From 9a3b107b0f0fa96eabd0f5d0ead496dafcd4415d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 6 Apr 2023 11:52:34 +0200 Subject: [PATCH 02/19] Remove old code to manage Debian stretch --- debian/changelog | 6 ++++++ debian/rules | 11 ----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index 77414451..ca9f9a2a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +llvm-toolchain-15 (1:15.0.7-5) unstable; urgency=medium + + * Remove old code to manage Debian stretch + + -- + llvm-toolchain-15 (1:15.0.7-4) unstable; urgency=medium * Fix debian/libclang1-15.symbols soname diff --git a/debian/rules b/debian/rules index e42d29c0..22b8c896 100755 --- a/debian/rules +++ b/debian/rules @@ -142,15 +142,8 @@ endif endif endif -ifeq ($(USE_CLANG_PACKAGE_TO_BUILD_ITSELF),yes) -# For Debian stretch, gcc isn't available, let's use clang -# itself to build itself. -export CC=clang-14 -export CXX=clang++-14 -else export CC=gcc-$(GCC_VERSION) export CXX=g++-$(GCC_VERSION) -endif opt_flags = -O2 -DNDEBUG -g1 @@ -554,10 +547,6 @@ endif echo "" > debian/libc++abi-$(LLVM_VERSION)-dev-wasm32.install; \ fi - if test "$(DISTRO)" = "stretch"; then \ - echo "" > debian/python3-lldb-$(LLVM_VERSION).install; \ - fi - # Conditionally enable install clangd grpc files if test "$(CLANGD_GRPC_INSTALLED)" = "yes"; then \ sed -i -e "s|#grpc\ ||g" debian/libclang-$(LLVM_VERSION)-dev.install; \ From 17a5b23e97288408e73b698c81f6ca60c7f12f03 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 12 Apr 2023 13:35:59 +0200 Subject: [PATCH 03/19] Force the replacement of new Ubuntu packages introduced in https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-15/+bug/2008755 --- debian/changelog | 2 ++ debian/rules | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/debian/changelog b/debian/changelog index ca9f9a2a..575a09ef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ llvm-toolchain-15 (1:15.0.7-5) unstable; urgency=medium * Remove old code to manage Debian stretch + * Force the replacement of new Ubuntu packages introduced in + https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-15/+bug/2008755 -- diff --git a/debian/rules b/debian/rules index 22b8c896..df3acdd8 100755 --- a/debian/rules +++ b/debian/rules @@ -535,6 +535,15 @@ preconfigure: fi; \ fi + # workaround the breaks/replaces/conflicts + # https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-15/+bug/2008755 + # Yeah, this is ugly but I don't know how to do better + if test "$(DISTRO)" = "jammy" -o "$(DISTRO)" = "kinetic"; then + if test "$(LLVM_VERSION)" = "15"; then \ + sed -i -e "s|(<< 1:15.0.6-5)|(<< 1:15.0.7-0ubuntu0.22.04.1)|g" debian/control; \ + fi; \ + fi + ifdef LLVM_SPIRV # llvm-spirv was found, so we can enable *.spv files. Debian # buster and Ubuntu 18.04 don't have llvm-spirv to create the From 298eb1c53f5f2390c234c3779aad0ab2157a3314 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 12 Apr 2023 13:40:49 +0200 Subject: [PATCH 04/19] missing char --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index df3acdd8..2191b8a2 100755 --- a/debian/rules +++ b/debian/rules @@ -538,7 +538,7 @@ preconfigure: # workaround the breaks/replaces/conflicts # https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-15/+bug/2008755 # Yeah, this is ugly but I don't know how to do better - if test "$(DISTRO)" = "jammy" -o "$(DISTRO)" = "kinetic"; then + if test "$(DISTRO)" = "jammy" -o "$(DISTRO)" = "kinetic"; then \ if test "$(LLVM_VERSION)" = "15"; then \ sed -i -e "s|(<< 1:15.0.6-5)|(<< 1:15.0.7-0ubuntu0.22.04.1)|g" debian/control; \ fi; \ From e3fe31b11413659b793c1562ae3ea70179d824a8 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 12 Apr 2023 17:07:15 +0200 Subject: [PATCH 05/19] fix the declaration --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 2191b8a2..0bd13aa3 100755 --- a/debian/rules +++ b/debian/rules @@ -540,7 +540,7 @@ preconfigure: # Yeah, this is ugly but I don't know how to do better if test "$(DISTRO)" = "jammy" -o "$(DISTRO)" = "kinetic"; then \ if test "$(LLVM_VERSION)" = "15"; then \ - sed -i -e "s|(<< 1:15.0.6-5)|(<< 1:15.0.7-0ubuntu0.22.04.1)|g" debian/control; \ + sed -i -e "s|(<< 1:15.0.6-5)|(<< 1:15.0.7-1)|g" debian/control; \ fi; \ fi From 2e232e6ac20c75034e65981a40e17e5a70f20177 Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Tue, 11 Apr 2023 14:07:16 +0200 Subject: [PATCH 06/19] Adapt test when llvm is built without Z3 support (error message changed) --- debian/qualify-clang.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/qualify-clang.sh b/debian/qualify-clang.sh index 9aa443da..d6cafb77 100755 --- a/debian/qualify-clang.sh +++ b/debian/qualify-clang.sh @@ -406,7 +406,7 @@ void testBitwiseRules(unsigned int a, int b) { ' > foo.c clang-$VERSION -cc1 -analyze -analyzer-constraints=range -analyzer-checker=core,debug.ExprInspection -analyzer-constraints=z3 foo.c &> foo.log || true -if ! grep -q "LLVM was not compiled with Z3 support" foo.log; then +if ! grep -q "error: analyzer constraint manager 'z3' is only available if LLVM was built with -DLLVM_ENABLE_Z3_SOLVER=ON" foo.log; then # Should work clang-$VERSION -cc1 -analyze -analyzer-constraints=range -analyzer-checker=core,debug.ExprInspection -verify -analyzer-config eagerly-assume=false -analyzer-constraints=z3 foo.c clang-$VERSION -cc1 -analyze -analyzer-constraints=range -analyzer-checker=core,debug.ExprInspection -analyzer-constraints=z3 foo.c &> foo.log From 0c3ef31e242d9b83aa29fd64b98601d5fa1ee716 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 13 Apr 2023 20:45:52 +0200 Subject: [PATCH 07/19] ubuntu issue, try a different approach --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 0bd13aa3..02560149 100755 --- a/debian/rules +++ b/debian/rules @@ -540,7 +540,7 @@ preconfigure: # Yeah, this is ugly but I don't know how to do better if test "$(DISTRO)" = "jammy" -o "$(DISTRO)" = "kinetic"; then \ if test "$(LLVM_VERSION)" = "15"; then \ - sed -i -e "s|(<< 1:15.0.6-5)|(<< 1:15.0.7-1)|g" debian/control; \ + sed -i -e "s|libclang-common-15-dev (<< 1:15.0.6-5)|libclang-common-15-dev (<< 1:15.0.6-5), libclang-common-15-dev (= 1:15.0.7-0ubuntu0.22.04.1)|g" debian/control; \ fi; \ fi From 20ff92c9829b28c34e434da22738a8420164c132 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 4 Jun 2023 11:37:18 +0200 Subject: [PATCH 08/19] Adjust LIBCXXABI_ARM_EHABI => _LIBCXXABI_ARM_EHABI Issue: https://github.com/llvm/llvm-project/issues/59240 --- debian/changelog | 4 +++- debian/patches/libcxx/libcxxabi-arm-ehabi-fix.patch | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index 575a09ef..f91f69ac 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,10 @@ llvm-toolchain-15 (1:15.0.7-5) unstable; urgency=medium * Remove old code to manage Debian stretch * Force the replacement of new Ubuntu packages introduced in https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-15/+bug/2008755 + * Adjust LIBCXXABI_ARM_EHABI => _LIBCXXABI_ARM_EHABI + Issue: https://github.com/llvm/llvm-project/issues/59240 - -- + -- Sylvestre Ledru Sun, 04 Jun 2023 11:35:54 +0200 llvm-toolchain-15 (1:15.0.7-4) unstable; urgency=medium diff --git a/debian/patches/libcxx/libcxxabi-arm-ehabi-fix.patch b/debian/patches/libcxx/libcxxabi-arm-ehabi-fix.patch index 8e26cf32..041d41cd 100644 --- a/debian/patches/libcxx/libcxxabi-arm-ehabi-fix.patch +++ b/debian/patches/libcxx/libcxxabi-arm-ehabi-fix.patch @@ -16,7 +16,7 @@ Index: llvm-toolchain-snapshot_14~++20211114120952+5b4bfd8c2415/libcxxabi/src/cx #ifdef __USING_SJLJ_EXCEPTIONS__ _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); -#else -+#elif !LIBCXXABI_ARM_EHABI ++#elif !_LIBCXXABI_ARM_EHABI _Unwind_RaiseException(&exception_header->unwindHeader); +#else + _Unwind_RaiseException(exception_header->unwindHeader); @@ -34,7 +34,7 @@ Index: llvm-toolchain-snapshot_14~++20211114120952+5b4bfd8c2415/libcxxabi/src/cx // to touch a foreign exception in any way, that is undefined // behavior. They likely can't since the only way to catch // a foreign exception is with catch (...)! -+#if !LIBCXXABI_ARM_EHABI ++#if !_LIBCXXABI_ARM_EHABI _Unwind_DeleteException(&globals->caughtExceptions->unwindHeader); +#else + _Unwind_DeleteException(globals->caughtExceptions->unwindHeader); @@ -47,7 +47,7 @@ Index: llvm-toolchain-snapshot_14~++20211114120952+5b4bfd8c2415/libcxxabi/src/cx #ifdef __USING_SJLJ_EXCEPTIONS__ _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); -#else -+#elif !LIBCXXABI_ARM_EHABI ++#elif !_LIBCXXABI_ARM_EHABI _Unwind_RaiseException(&exception_header->unwindHeader); +#else + _Unwind_RaiseException(exception_header->unwindHeader); @@ -58,7 +58,7 @@ Index: llvm-toolchain-snapshot_14~++20211114120952+5b4bfd8c2415/libcxxabi/src/cx dep_exception_header->unwindHeader.exception_cleanup = dependent_exception_cleanup; #ifdef __USING_SJLJ_EXCEPTIONS__ _Unwind_SjLj_RaiseException(&dep_exception_header->unwindHeader); -+#elif !LIBCXXABI_ARM_EHABI ++#elif !_LIBCXXABI_ARM_EHABI + _Unwind_RaiseException(&dep_exception_header->unwindHeader); #else - _Unwind_RaiseException(&dep_exception_header->unwindHeader); @@ -74,7 +74,7 @@ Index: llvm-toolchain-snapshot_14~++20211114120952+5b4bfd8c2415/libcxxabi/src/cx _LIBCXXABI_HIDDEN void __setExceptionClass ( _Unwind_Exception*, uint64_t); _LIBCXXABI_HIDDEN bool __isOurExceptionClass(const _Unwind_Exception*); -+#if LIBCXXABI_ARM_EHABI ++#if _LIBCXXABI_ARM_EHABI +// GCC has _Unwind_Control_Block in unwind.h (unwind_arm_common.h) +#if defined(__clang__) +struct _Unwind_Control_Block From a9c2a8756ddef4a8c82efe95bb902b518280e439 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 4 Jun 2023 11:37:50 +0200 Subject: [PATCH 09/19] exp --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index f91f69ac..44966838 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -llvm-toolchain-15 (1:15.0.7-5) unstable; urgency=medium +llvm-toolchain-15 (1:15.0.7-5~exp1) experimental; urgency=medium * Remove old code to manage Debian stretch * Force the replacement of new Ubuntu packages introduced in From 26c67567926154aae2e2fe3646ce50f7c6b65162 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 10 Jun 2023 11:52:18 +0200 Subject: [PATCH 10/19] Also apply the workround of issue #62621 for focal --- debian/changelog | 6 ++++++ debian/rules | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 44966838..6daa3123 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +llvm-toolchain-15 (1:15.0.7-5~exp2) experimental; urgency=medium + + * Also apply the workround of issue #62621 for focal + + -- Sylvestre Ledru Sat, 10 Jun 2023 11:52:14 +0200 + llvm-toolchain-15 (1:15.0.7-5~exp1) experimental; urgency=medium * Remove old code to manage Debian stretch diff --git a/debian/rules b/debian/rules index 02560149..51440073 100755 --- a/debian/rules +++ b/debian/rules @@ -538,7 +538,7 @@ preconfigure: # workaround the breaks/replaces/conflicts # https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-15/+bug/2008755 # Yeah, this is ugly but I don't know how to do better - if test "$(DISTRO)" = "jammy" -o "$(DISTRO)" = "kinetic"; then \ + if test "$(DISTRO)" = "jammy" -o "$(DISTRO)" = "kinetic" -o "$(DISTRO)" = "focal"; then \ if test "$(LLVM_VERSION)" = "15"; then \ sed -i -e "s|libclang-common-15-dev (<< 1:15.0.6-5)|libclang-common-15-dev (<< 1:15.0.6-5), libclang-common-15-dev (= 1:15.0.7-0ubuntu0.22.04.1)|g" debian/control; \ fi; \ From 11244f6040447d03f69cc1ff81f0e7608af5eefc Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Sun, 11 Jun 2023 09:26:56 +0200 Subject: [PATCH 11/19] From Graham Inggs, update ubuntu releases codenames to include Ubuntu mantic --- debian/changelog | 8 +++++++ debian/patches/series | 1 + debian/patches/ubuntu-releases.patch | 36 ++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 debian/patches/ubuntu-releases.patch diff --git a/debian/changelog b/debian/changelog index 6daa3123..311834b9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +llvm-toolchain-15 (1:15.0.7-5~exp3) UNRELEASED; urgency=medium + + [ Graham Inggs ] + * debian/patches/ubuntu-releases.patch: Update the list of + Ubuntu release names + + -- Gianfranco Costamagna Sun, 11 Jun 2023 09:26:23 +0200 + llvm-toolchain-15 (1:15.0.7-5~exp2) experimental; urgency=medium * Also apply the workround of issue #62621 for focal diff --git a/debian/patches/series b/debian/patches/series index af7b175a..fd726288 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -162,3 +162,4 @@ link-grpc.diff amdgpu/nonlinux.patch amdgpu/usr-search-paths.patch amdgpu/bitcode-multiarch.patch +ubuntu-releases.patch diff --git a/debian/patches/ubuntu-releases.patch b/debian/patches/ubuntu-releases.patch new file mode 100644 index 00000000..cdb7c31f --- /dev/null +++ b/debian/patches/ubuntu-releases.patch @@ -0,0 +1,36 @@ +Description: Update the list of Ubuntu release names +Forwarded: no +Author: Graham Inggs +Last-Update: 2023-04-29 + +--- a/clang/include/clang/Driver/Distro.h ++++ b/clang/include/clang/Driver/Distro.h +@@ -76,6 +76,8 @@ + UbuntuImpish, + UbuntuJammy, + UbuntuKinetic, ++ UbuntuLunar, ++ UbuntuMantic, + UnknownDistro + }; + +@@ -127,7 +129,7 @@ + } + + bool IsUbuntu() const { +- return DistroVal >= UbuntuHardy && DistroVal <= UbuntuKinetic; ++ return DistroVal >= UbuntuHardy && DistroVal <= UbuntuMantic; + } + + bool IsAlpineLinux() const { return DistroVal == AlpineLinux; } +--- a/clang/lib/Driver/Distro.cpp ++++ b/clang/lib/Driver/Distro.cpp +@@ -92,6 +92,8 @@ + .Case("impish", Distro::UbuntuImpish) + .Case("jammy", Distro::UbuntuJammy) + .Case("kinetic", Distro::UbuntuKinetic) ++ .Case("lunar", Distro::UbuntuLunar) ++ .Case("mantic", Distro::UbuntuMantic) + .Default(Distro::UnknownDistro); + return Version; + } From 0b408150ba2bb01d5f5486cc75dc086917b7ce2b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 11 Jun 2023 11:47:25 +0200 Subject: [PATCH 12/19] and to include libpolly-15-dev --- debian/changelog | 1 + debian/rules | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 311834b9..ae2f408b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,7 @@ llvm-toolchain-15 (1:15.0.7-5~exp3) UNRELEASED; urgency=medium llvm-toolchain-15 (1:15.0.7-5~exp2) experimental; urgency=medium * Also apply the workround of issue #62621 for focal + and to include libpolly-15-dev -- Sylvestre Ledru Sat, 10 Jun 2023 11:52:14 +0200 diff --git a/debian/rules b/debian/rules index 51440073..0a6c9f67 100755 --- a/debian/rules +++ b/debian/rules @@ -540,7 +540,7 @@ preconfigure: # Yeah, this is ugly but I don't know how to do better if test "$(DISTRO)" = "jammy" -o "$(DISTRO)" = "kinetic" -o "$(DISTRO)" = "focal"; then \ if test "$(LLVM_VERSION)" = "15"; then \ - sed -i -e "s|libclang-common-15-dev (<< 1:15.0.6-5)|libclang-common-15-dev (<< 1:15.0.6-5), libclang-common-15-dev (= 1:15.0.7-0ubuntu0.22.04.1)|g" debian/control; \ + sed -i -e "s|libclang-common-15-dev (<< 1:15.0.6-5)|libclang-common-15-dev (<< 1:15.0.6-5), libclang-common-15-dev (= 1:15.0.7-0ubuntu0.22.04.1), libpolly-15-dev (= 1:15.0.7-0ubuntu0.22.04.1)|g" debian/control; \ fi; \ fi From 1220dc75a6980b80d237ee645813399efaeb873d Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Sat, 24 Jun 2023 20:01:35 +0200 Subject: [PATCH 13/19] Add powerpc to GOLD architectures --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 0a6c9f67..62e9374c 100755 --- a/debian/rules +++ b/debian/rules @@ -264,7 +264,7 @@ ifeq ($(LLVM_SPIRV_INSTALLED),yes) LIBCLC_LLVM_SPIRV = "-DLLVM_SPIRV=$(LLVM_SPIRV)" endif -BINUTILS_GOLD_ARCHS := amd64 arm64 armhf i386 ppc64 ppc64el x32 s390x hurd-i386 kfreebsd-amd64 kfreebsd-i386 +BINUTILS_GOLD_ARCHS := amd64 arm64 armhf i386 ppc64 ppc64el x32 s390x powerpc hurd-i386 kfreebsd-amd64 kfreebsd-i386 ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' binutils) ge 2.23.1-1~exp3 ; echo $$?),0) ifneq (,$(filter $(DEB_HOST_ARCH),$(BINUTILS_GOLD_ARCHS))) STAGE_ALL_CMAKE_EXTRA += -DLLVM_USE_LINKER=gold From ad8528dcf61a9bab7c2f5ddff7da962dcb82092b Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Sat, 24 Jun 2023 20:01:46 +0200 Subject: [PATCH 14/19] Cherry-pick upstream fix for newer cmake-related build failure --- debian/patches/new-cmake-build-fix.patch | 148 +++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 149 insertions(+) create mode 100644 debian/patches/new-cmake-build-fix.patch diff --git a/debian/patches/new-cmake-build-fix.patch b/debian/patches/new-cmake-build-fix.patch new file mode 100644 index 00000000..f0d84224 --- /dev/null +++ b/debian/patches/new-cmake-build-fix.patch @@ -0,0 +1,148 @@ +From 61967bbc7d4e9f72fb1fa082fa2235b99e36b698 Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Thu, 20 Apr 2023 14:59:27 +0200 +Subject: [PATCH] [OpenMP] Replace libomp_check_linker_flag with + llvm_check_compiler_linker_flag + +Replace the custom libomp_check_linker_flag() implementation with +llvm_check_compiler_linker_flag() from the common cmake utils. Due +to the way the custom implementation is implemented (capturing +output from an entire nested cmake invocation) it can easily end +up incorrectly detecting flags as unavailable, e.g. because "error", +"unknown" or similar occurs inside compiler flags, the directory +name, etc. + +Fixes https://github.com/llvm/llvm-project/issues/62240. + +Differential Revision: https://reviews.llvm.org/D148798 +--- + .../runtime/cmake/LibompCheckLinkerFlag.cmake | 72 ------------------- + openmp/runtime/cmake/config-ix.cmake | 18 ++--- + 2 files changed, 9 insertions(+), 81 deletions(-) + delete mode 100644 openmp/runtime/cmake/LibompCheckLinkerFlag.cmake + +diff --git a/openmp/runtime/cmake/LibompCheckLinkerFlag.cmake b/openmp/runtime/cmake/LibompCheckLinkerFlag.cmake +deleted file mode 100644 +index bcc0ca80c866e..0000000000000 +--- a/openmp/runtime/cmake/LibompCheckLinkerFlag.cmake ++++ /dev/null +@@ -1,72 +0,0 @@ +-# +-#//===----------------------------------------------------------------------===// +-#// +-#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +-#// See https://llvm.org/LICENSE.txt for license information. +-#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +-#// +-#//===----------------------------------------------------------------------===// +-# +- +-include(GNUInstallDirs) +- +-# Checking a linker flag to build a shared library +-# There is no real trivial way to do this in CMake, so we implement it here +-# this will have ${boolean} = TRUE if the flag succeeds, otherwise FALSE. +-function(libomp_check_linker_flag flag boolean) +- if(NOT DEFINED "${boolean}") +- set(retval TRUE) +- set(library_source +- "int foo(int a) { return a*a; }") +- set(cmake_source +- "cmake_minimum_required(VERSION 3.13.4) +- project(foo C) +- set(CMAKE_SHARED_LINKER_FLAGS \"${flag}\") +- add_library(foo SHARED src_to_link.c)") +- # Compiling as a part of runtimes introduces ARCH-unknown-linux-gnu as a part +- # of a working directory. So adding a guard for unknown. +- set(failed_regexes "[Ee]rror;[Uu]nknown[^-];[Ss]kipping;LINK : warning;Unsupported command line") +- set(base_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/link_flag_check_${boolean}) +- file(MAKE_DIRECTORY ${base_dir}) +- file(MAKE_DIRECTORY ${base_dir}/build) +- file(WRITE ${base_dir}/src_to_link.c "${library_source}") +- file(WRITE ${base_dir}/CMakeLists.txt "${cmake_source}") +- +- message(STATUS "Performing Test ${boolean}") +- try_compile( +- try_compile_result +- ${base_dir}/build +- ${base_dir} +- foo +- OUTPUT_VARIABLE OUTPUT) +- +- if(try_compile_result) +- foreach(regex IN LISTS failed_regexes) +- # Ignore the warning about the newer or unknown CUDA version. +- if(("${OUTPUT}" MATCHES ${regex}) AND NOT ("${OUTPUT}" MATCHES "Unknown CUDA version")) +- set(retval FALSE) +- endif() +- endforeach() +- else() +- set(retval FALSE) +- endif() +- +- if(${retval}) +- set(${boolean} 1 CACHE INTERNAL "Test ${boolean}") +- message(STATUS "Performing Test ${boolean} - Success") +- file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log +- "Performing C Linker Flag test ${boolean} succeeded with the following output:\n" +- "${OUTPUT}\n" +- "Source file was:\n${library_source}\n") +- else() +- set(${boolean} "" CACHE INTERNAL "Test ${boolean}") +- message(STATUS "Performing Test ${boolean} - Failed") +- file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log +- "Performing C Linker Flag test ${boolean} failed with the following output:\n" +- "${OUTPUT}\n" +- "Source file was:\n${library_source}\n") +- endif() +- +- set(${boolean} ${retval} PARENT_SCOPE) +- endif() +-endfunction() +diff --git a/openmp/runtime/cmake/config-ix.cmake b/openmp/runtime/cmake/config-ix.cmake +index d0eda6d8ca39a..ca3cb43c285db 100644 +--- a/openmp/runtime/cmake/config-ix.cmake ++++ b/openmp/runtime/cmake/config-ix.cmake +@@ -16,8 +16,8 @@ include(CheckIncludeFile) + include(CheckLibraryExists) + include(CheckIncludeFiles) + include(CheckSymbolExists) +-include(LibompCheckLinkerFlag) + include(LibompCheckFortranFlag) ++include(LLVMCheckCompilerLinkerFlag) + + # Check for versioned symbols + function(libomp_check_version_symbols retval) +@@ -128,14 +128,14 @@ check_symbol_exists(_aligned_malloc "mal + + # Check linker flags + if(WIN32) +- libomp_check_linker_flag(/SAFESEH LIBOMP_HAVE_SAFESEH_FLAG) ++ llvm_check_compiler_linker_flag(/SAFESEH LIBOMP_HAVE_SAFESEH_FLAG) + elseif(NOT APPLE) +- libomp_check_linker_flag(-Wl,-x LIBOMP_HAVE_X_FLAG) +- libomp_check_linker_flag(-Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG) +- libomp_check_linker_flag(-Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG) +- libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG) +- libomp_check_linker_flag(-static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG) +- libomp_check_linker_flag(-Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG) ++ llvm_check_compiler_linker_flag(C -Wl,-x LIBOMP_HAVE_X_FLAG) ++ llvm_check_compiler_linker_flag(C -Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG) ++ llvm_check_compiler_linker_flag(C -Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG) ++ llvm_check_compiler_linker_flag(C "-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG) ++ llvm_check_compiler_linker_flag(C -static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG) ++ llvm_check_compiler_linker_flag(C -Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG) + endif() + + # Check Intel(R) C Compiler specific flags +@@ -146,8 +146,8 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Intel" OR CMAKE_C_COMPILER_ID STREQUAL "IntelLL + check_cxx_compiler_flag(-Qoption,cpp,--extended_float_types LIBOMP_HAVE_EXTENDED_FLOAT_TYPES_FLAG) + check_cxx_compiler_flag(-falign-stack=maintain-16-byte LIBOMP_HAVE_FALIGN_STACK_FLAG) + check_cxx_compiler_flag("-opt-streaming-stores never" LIBOMP_HAVE_OPT_STREAMING_STORES_FLAG) +- libomp_check_linker_flag(-static-intel LIBOMP_HAVE_STATIC_INTEL_FLAG) +- libomp_check_linker_flag(-no-intel-extensions LIBOMP_HAVE_NO_INTEL_EXTENSIONS_FLAG) ++ llvm_check_compiler_linker_flag(C -static-intel LIBOMP_HAVE_STATIC_INTEL_FLAG) ++ llvm_check_compiler_linker_flag(C -no-intel-extensions LIBOMP_HAVE_NO_INTEL_EXTENSIONS_FLAG) + check_library_exists(irc_pic _intel_fast_memcpy "" LIBOMP_HAVE_IRC_PIC_LIBRARY) + endif() + diff --git a/debian/patches/series b/debian/patches/series index fd726288..12010771 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -163,3 +163,4 @@ amdgpu/nonlinux.patch amdgpu/usr-search-paths.patch amdgpu/bitcode-multiarch.patch ubuntu-releases.patch +new-cmake-build-fix.patch From 0f5236ae5ba278a06dc9d69b7eafc3704a80ac04 Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Sat, 24 Jun 2023 20:02:01 +0200 Subject: [PATCH 15/19] [ Steve Langasek ] * debian/rules: disable -Wl,-Bsymbolic-functions for libomp. LP: #2016471. --- debian/rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/rules b/debian/rules index 62e9374c..bc0a9d65 100755 --- a/debian/rules +++ b/debian/rules @@ -177,6 +177,9 @@ ifneq (,$(filter $(DEB_HOST_ARCH),i386)) STAGE_ALL_CMAKE_EXTRA += -DLLVM_HOST_TRIPLE=i386-linux-gnu endif +# https://bugs.launchpad.net/bugs/2016471 +STAGE_2_CMAKE_EXTRA += -DLIBOMP_LDFLAGS=-Wl,-Bno-symbolic + ifneq (,$(filter $(DEB_HOST_ARCH),i386)) # Sometimes, i386 needs help with the triple CMAKE_EXTRA += -DLLVM_HOST_TRIPLE=i386-linux-gnu From 15bbe8ee24610c12e59223f7f505172bbf3b2994 Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Sat, 24 Jun 2023 20:02:47 +0200 Subject: [PATCH 16/19] Update changelog --- debian/changelog | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index ae2f408b..e3cfca3c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,7 +4,14 @@ llvm-toolchain-15 (1:15.0.7-5~exp3) UNRELEASED; urgency=medium * debian/patches/ubuntu-releases.patch: Update the list of Ubuntu release names - -- Gianfranco Costamagna Sun, 11 Jun 2023 09:26:23 +0200 + [ Gianfranco Costamagna ] + * Add powerpc to GOLD architectures + * Cherry-pick upstream fix for newer cmake-related build failure + + [ Steve Langasek ] + * debian/rules: disable -Wl,-Bsymbolic-functions for libomp. LP: #2016471. + + -- Gianfranco Costamagna Sat, 24 Jun 2023 20:02:22 +0200 llvm-toolchain-15 (1:15.0.7-5~exp2) experimental; urgency=medium From b6bb452b1c5e768129bd6febc85c65a994d80d27 Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Sat, 24 Jun 2023 20:04:10 +0200 Subject: [PATCH 17/19] Cherry-pick upstream fix for HIP search path depending on os-release (Closes: #1037452) --- debian/patches/HIP-search-path-fix.patch | 45 ++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 46 insertions(+) create mode 100644 debian/patches/HIP-search-path-fix.patch diff --git a/debian/patches/HIP-search-path-fix.patch b/debian/patches/HIP-search-path-fix.patch new file mode 100644 index 00000000..79e82bed --- /dev/null +++ b/debian/patches/HIP-search-path-fix.patch @@ -0,0 +1,45 @@ +From f8598357662dc8dd0f4400bcaeb48e8befe43ecc Mon Sep 17 00:00:00 2001 +From: Cordell Bloor +Date: Tue, 9 May 2023 09:46:48 -0400 +Subject: [PATCH] [HIP] Detect HIP for Ubuntu, Mint, Gentoo, etc. + +HIP may be installed into /usr or /usr/local on a variety of Linux +operating systems. It may become unwieldy to list them all. + +Reviewed by: Siu Chi Chan, Yaxun Liu + +Differential Revision: https://reviews.llvm.org/D149110 +--- + clang/lib/Driver/ToolChains/AMDGPU.cpp | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp +index acedcfabefe1c..1eb22ed8704c9 100644 +--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp ++++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp +@@ -11,7 +11,6 @@ + #include "clang/Basic/TargetID.h" + #include "clang/Config/config.h" + #include "clang/Driver/Compilation.h" +-#include "clang/Driver/Distro.h" + #include "clang/Driver/DriverDiagnostic.h" + #include "clang/Driver/InputInfo.h" + #include "clang/Driver/Options.h" +@@ -309,13 +308,10 @@ RocmInstallationDetector::getInstallationPathCandidates() { + ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/" + LatestROCm, + /*StrictChecking=*/true); + +- Distro Dist(D.getVFS(), llvm::Triple(llvm::sys::getProcessTriple())); +- if (Dist.IsDebian() || Dist.IsRedhat()) { +- ROCmSearchDirs.emplace_back(D.SysRoot + "/usr/local", +- /*StrictChecking=*/true); +- ROCmSearchDirs.emplace_back(D.SysRoot + "/usr", +- /*StrictChecking=*/true); +- } ++ ROCmSearchDirs.emplace_back(D.SysRoot + "/usr/local", ++ /*StrictChecking=*/true); ++ ROCmSearchDirs.emplace_back(D.SysRoot + "/usr", ++ /*StrictChecking=*/true); + + DoPrintROCmSearchDirs(); + return ROCmSearchDirs; diff --git a/debian/patches/series b/debian/patches/series index 12010771..dc562ae9 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -164,3 +164,4 @@ amdgpu/usr-search-paths.patch amdgpu/bitcode-multiarch.patch ubuntu-releases.patch new-cmake-build-fix.patch +HIP-search-path-fix.patch From 5cc62d049126214cca34c60d8329903e25b8a7b7 Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Sat, 24 Jun 2023 20:05:23 +0200 Subject: [PATCH 18/19] Upload to sid --- debian/changelog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index e3cfca3c..f2369481 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -llvm-toolchain-15 (1:15.0.7-5~exp3) UNRELEASED; urgency=medium +llvm-toolchain-15 (1:15.0.7-5) unstable; urgency=medium [ Graham Inggs ] * debian/patches/ubuntu-releases.patch: Update the list of @@ -7,11 +7,12 @@ llvm-toolchain-15 (1:15.0.7-5~exp3) UNRELEASED; urgency=medium [ Gianfranco Costamagna ] * Add powerpc to GOLD architectures * Cherry-pick upstream fix for newer cmake-related build failure + * Cherry-pick upstream fix for HIP search path depending on os-release (Closes: #1037452) [ Steve Langasek ] * debian/rules: disable -Wl,-Bsymbolic-functions for libomp. LP: #2016471. - -- Gianfranco Costamagna Sat, 24 Jun 2023 20:02:22 +0200 + -- Gianfranco Costamagna Sat, 24 Jun 2023 20:04:59 +0200 llvm-toolchain-15 (1:15.0.7-5~exp2) experimental; urgency=medium From 9beedde6d6c563b8c6c4d9358e75eee5e1a8ca03 Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Sat, 24 Jun 2023 20:09:21 +0200 Subject: [PATCH 19/19] Refresh patch --- debian/patches/HIP-search-path-fix.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/patches/HIP-search-path-fix.patch b/debian/patches/HIP-search-path-fix.patch index 79e82bed..fc02be4c 100644 --- a/debian/patches/HIP-search-path-fix.patch +++ b/debian/patches/HIP-search-path-fix.patch @@ -17,9 +17,9 @@ diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChain index acedcfabefe1c..1eb22ed8704c9 100644 --- a/clang/lib/Driver/ToolChains/AMDGPU.cpp +++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp -@@ -11,7 +11,6 @@ +@@ -10,7 +10,6 @@ + #include "CommonArgs.h" #include "clang/Basic/TargetID.h" - #include "clang/Config/config.h" #include "clang/Driver/Compilation.h" -#include "clang/Driver/Distro.h" #include "clang/Driver/DriverDiagnostic.h"