diff -Nru llvm-toolchain-13-13.0.1/debian/changelog llvm-toolchain-13-13.0.1/debian/changelog --- llvm-toolchain-13-13.0.1/debian/changelog 2023-01-27 15:20:13.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/changelog 2023-07-31 20:16:10.000000000 +0000 @@ -1,14 +1,31 @@ -llvm-toolchain-13 (1:13.0.1-11ubuntu14) lunar; urgency=medium +llvm-toolchain-13 (1:13.0.1-13) unstable; urgency=medium - * Rebuild against new OCAML ABI. + * Fixup typo in SPIRV detection - -- Gianfranco Costamagna Fri, 27 Jan 2023 16:20:13 +0100 + -- Gianfranco Costamagna Mon, 31 Jul 2023 22:16:10 +0200 -llvm-toolchain-13 (1:13.0.1-11ubuntu13) lunar; urgency=medium +llvm-toolchain-13 (1:13.0.1-12) unstable; urgency=medium - * Back in sync with Debian + [ Gianfranco Costamagna ] + * Apply new cmake build fix from llvm-toolchain-16 branch + * Add gcc-13-build-fix.patch (Closes: #1037757) + + [ Nishit Majithia ] + * SECURITY UPDATE: canonicalize pass crashed with segmentation fault + - debian/patches/CVE-2023-29932.patch: Use default attributes for + intrinsics + - CVE-2023-29932 + * SECURITY UPDATE: convert-scf-to-spirv Pass crashed with segmentation + fault + - debian/patches/CVE-2023-29934.patch: Account for type conversion + failures in scf-to-spirv + - CVE-2023-29934 + * SECURITY UPDATE: spirv-lower-abi-attrs crashes with segmentation faults + - debian/patches/CVE-2023-29939.patch: Fix crash in + spirv-lower-abi-attributes when the are no SPIR-V env attributes + - CVE-2023-29939 - -- Gianfranco Costamagna Wed, 04 Jan 2023 12:00:44 +0100 + -- Nishit Majithia Fri, 28 Jul 2023 08:42:29 +0530 llvm-toolchain-13 (1:13.0.1-11) unstable; urgency=medium diff -Nru llvm-toolchain-13-13.0.1/debian/patches/CVE-2023-29932.patch llvm-toolchain-13-13.0.1/debian/patches/CVE-2023-29932.patch --- llvm-toolchain-13-13.0.1/debian/patches/CVE-2023-29932.patch 1970-01-01 00:00:00.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/patches/CVE-2023-29932.patch 2023-07-28 03:12:29.000000000 +0000 @@ -0,0 +1,187 @@ +[Ubuntu note: backport this patch according to this llvm release] +From d35fcf0e97e7bb02381506a71e61ec282b292c50 Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Mon, 7 Nov 2022 15:50:05 +0100 +Subject: [PATCH] [WebAssembly] Use default attributes for intrinsics + +This switches wasm intrinsics to use default attributes, +i.e. nofree, nosync, nocallback and willreturn. Especially +willreturn will be required to avoid optimization regressions +in the future. + +The attributes are omitted from the trapping fptoi intrinsics +(where I assume trapping is considered well-defined, and as such +these aren't willreturn), the throw/rethrow intrinsics (which +will unwind) and the atomic intrinsics (which aren't nosync). + +Differential Revision: https://reviews.llvm.org/D137551 +--- + llvm/include/llvm/IR/IntrinsicsWebAssembly.td | 335 +++++++++--------- + .../CodeGen/WebAssembly/lower-wasm-ehsjlj.ll | 2 +- + 2 files changed, 173 insertions(+), 164 deletions(-) + +--- llvm-toolchain-13-13.0.1.orig/llvm/include/llvm/IR/IntrinsicsWebAssembly.td ++++ llvm-toolchain-13-13.0.1/llvm/include/llvm/IR/IntrinsicsWebAssembly.td +@@ -16,10 +16,10 @@ let TargetPrefix = "wasm" in { // All i + // Query the current memory size, and increase the current memory size. + // Note that memory.size is not IntrNoMem because it must be sequenced with + // respect to memory.grow calls. +-def int_wasm_memory_size : Intrinsic<[llvm_anyint_ty], ++def int_wasm_memory_size : DefaultAttrsIntrinsic<[llvm_anyint_ty], + [llvm_i32_ty], + [IntrReadMem]>; +-def int_wasm_memory_grow : Intrinsic<[llvm_anyint_ty], ++def int_wasm_memory_grow : DefaultAttrsIntrinsic<[llvm_anyint_ty], + [llvm_i32_ty, LLVMMatchType<0>], + []>; + +@@ -38,10 +38,10 @@ def int_wasm_trunc_unsigned : Intrinsic< + // Saturating float-to-int conversions + //===----------------------------------------------------------------------===// + +-def int_wasm_trunc_saturate_signed : Intrinsic<[llvm_anyint_ty], ++def int_wasm_trunc_saturate_signed : DefaultAttrsIntrinsic<[llvm_anyint_ty], + [llvm_anyfloat_ty], + [IntrNoMem, IntrSpeculatable]>; +-def int_wasm_trunc_saturate_unsigned : Intrinsic<[llvm_anyint_ty], ++def int_wasm_trunc_saturate_unsigned : DefaultAttrsIntrinsic<[llvm_anyint_ty], + [llvm_anyfloat_ty], + [IntrNoMem, IntrSpeculatable]>; + +@@ -57,25 +57,25 @@ def int_wasm_rethrow : Intrinsic<[], [], + + // Since wasm does not use landingpad instructions, these instructions return + // exception pointer and selector values until we lower them in WasmEHPrepare. +-def int_wasm_get_exception : Intrinsic<[llvm_ptr_ty], [llvm_token_ty], ++def int_wasm_get_exception : DefaultAttrsIntrinsic<[llvm_ptr_ty], [llvm_token_ty], + [IntrHasSideEffects]>; +-def int_wasm_get_ehselector : Intrinsic<[llvm_i32_ty], [llvm_token_ty], ++def int_wasm_get_ehselector : DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_token_ty], + [IntrHasSideEffects]>; + + // wasm.catch returns the pointer to the exception object caught by wasm 'catch' + // instruction. This returns a single pointer, which is sufficient for C++ + // support. The immediate argument is an index to for a tag, which is 0 for C++. +-def int_wasm_catch : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty], ++def int_wasm_catch : DefaultAttrsIntrinsic<[llvm_ptr_ty], [llvm_i32_ty], + [IntrHasSideEffects, ImmArg>]>; + + // WebAssembly EH must maintain the landingpads in the order assigned to them + // by WasmEHPrepare pass to generate landingpad table in EHStreamer. This is + // used in order to give them the indices in WasmEHPrepare. +-def int_wasm_landingpad_index: Intrinsic<[], [llvm_token_ty, llvm_i32_ty], ++def int_wasm_landingpad_index: DefaultAttrsIntrinsic<[], [llvm_token_ty, llvm_i32_ty], + [IntrNoMem, ImmArg>]>; + + // Returns LSDA address of the current function. +-def int_wasm_lsda : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>; ++def int_wasm_lsda : DefaultAttrsIntrinsic<[llvm_ptr_ty], [], [IntrNoMem]>; + + //===----------------------------------------------------------------------===// + // Atomic intrinsics +@@ -105,69 +105,69 @@ def int_wasm_memory_atomic_notify: + //===----------------------------------------------------------------------===// + + def int_wasm_swizzle : +- Intrinsic<[llvm_v16i8_ty], ++ DefaultAttrsIntrinsic<[llvm_v16i8_ty], + [llvm_v16i8_ty, llvm_v16i8_ty], + [IntrNoMem, IntrSpeculatable]>; + def int_wasm_shuffle : +- Intrinsic<[llvm_v16i8_ty], ++ DefaultAttrsIntrinsic<[llvm_v16i8_ty], + [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty, llvm_i32_ty, + llvm_i32_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty, + llvm_i32_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty, + llvm_i32_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], + [IntrNoMem, IntrSpeculatable]>; + def int_wasm_sub_sat_signed : +- Intrinsic<[llvm_anyvector_ty], ++ DefaultAttrsIntrinsic<[llvm_anyvector_ty], + [LLVMMatchType<0>, LLVMMatchType<0>], + [IntrNoMem, IntrSpeculatable]>; + def int_wasm_sub_sat_unsigned : +- Intrinsic<[llvm_anyvector_ty], ++ DefaultAttrsIntrinsic<[llvm_anyvector_ty], + [LLVMMatchType<0>, LLVMMatchType<0>], + [IntrNoMem, IntrSpeculatable]>; + def int_wasm_avgr_unsigned : +- Intrinsic<[llvm_anyvector_ty], ++ DefaultAttrsIntrinsic<[llvm_anyvector_ty], + [LLVMMatchType<0>, LLVMMatchType<0>], + [IntrNoMem, IntrSpeculatable]>; + def int_wasm_bitselect : +- Intrinsic<[llvm_anyvector_ty], ++ DefaultAttrsIntrinsic<[llvm_anyvector_ty], + [LLVMMatchType<0>, LLVMMatchType<0>, LLVMMatchType<0>], + [IntrNoMem, IntrSpeculatable]>; + def int_wasm_anytrue : +- Intrinsic<[llvm_i32_ty], ++ DefaultAttrsIntrinsic<[llvm_i32_ty], + [llvm_anyvector_ty], + [IntrNoMem, IntrSpeculatable]>; + def int_wasm_alltrue : +- Intrinsic<[llvm_i32_ty], ++ DefaultAttrsIntrinsic<[llvm_i32_ty], + [llvm_anyvector_ty], + [IntrNoMem, IntrSpeculatable]>; + def int_wasm_bitmask : +- Intrinsic<[llvm_i32_ty], ++ DefaultAttrsIntrinsic<[llvm_i32_ty], + [llvm_anyvector_ty], + [IntrNoMem, IntrSpeculatable]>; + def int_wasm_dot : +- Intrinsic<[llvm_v4i32_ty], ++ DefaultAttrsIntrinsic<[llvm_v4i32_ty], + [llvm_v8i16_ty, llvm_v8i16_ty], + [IntrNoMem, IntrSpeculatable]>; + + def int_wasm_narrow_signed : +- Intrinsic<[llvm_anyvector_ty], ++ DefaultAttrsIntrinsic<[llvm_anyvector_ty], + [llvm_anyvector_ty, LLVMMatchType<1>], + [IntrNoMem, IntrSpeculatable]>; + def int_wasm_narrow_unsigned : +- Intrinsic<[llvm_anyvector_ty], ++ DefaultAttrsIntrinsic<[llvm_anyvector_ty], + [llvm_anyvector_ty, LLVMMatchType<1>], + [IntrNoMem, IntrSpeculatable]>; + + def int_wasm_q15mulr_sat_signed : +- Intrinsic<[llvm_v8i16_ty], ++ DefaultAttrsIntrinsic<[llvm_v8i16_ty], + [llvm_v8i16_ty, llvm_v8i16_ty], + [IntrNoMem, IntrSpeculatable]>; + + def int_wasm_extadd_pairwise_signed : +- Intrinsic<[llvm_anyvector_ty], ++ DefaultAttrsIntrinsic<[llvm_anyvector_ty], + [LLVMSubdivide2VectorType<0>], + [IntrNoMem, IntrSpeculatable]>; + def int_wasm_extadd_pairwise_unsigned : +- Intrinsic<[llvm_anyvector_ty], ++ DefaultAttrsIntrinsic<[llvm_anyvector_ty], + [LLVMSubdivide2VectorType<0>], + [IntrNoMem, IntrSpeculatable]>; + +@@ -176,17 +176,17 @@ def int_wasm_extadd_pairwise_unsigned : + //===----------------------------------------------------------------------===// + + def int_wasm_tls_size : +- Intrinsic<[llvm_anyint_ty], ++ DefaultAttrsIntrinsic<[llvm_anyint_ty], + [], + [IntrNoMem, IntrSpeculatable]>; + + def int_wasm_tls_align : +- Intrinsic<[llvm_anyint_ty], ++ DefaultAttrsIntrinsic<[llvm_anyint_ty], + [], + [IntrNoMem, IntrSpeculatable]>; + + def int_wasm_tls_base : +- Intrinsic<[llvm_ptr_ty], ++ DefaultAttrsIntrinsic<[llvm_ptr_ty], + [], + [IntrReadMem]>; + diff -Nru llvm-toolchain-13-13.0.1/debian/patches/CVE-2023-29934.patch llvm-toolchain-13-13.0.1/debian/patches/CVE-2023-29934.patch --- llvm-toolchain-13-13.0.1/debian/patches/CVE-2023-29934.patch 1970-01-01 00:00:00.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/patches/CVE-2023-29934.patch 2023-07-28 03:12:29.000000000 +0000 @@ -0,0 +1,58 @@ +From 80d5400d924e543c5420f4e924f5818313605e99 Mon Sep 17 00:00:00 2001 +From: Jakub Kuderski +Date: Mon, 9 Jan 2023 11:35:46 -0500 +Subject: [PATCH] [mlir][spirv] Account for type conversion failures in + scf-to-spirv + +Fixes: https://github.com/llvm/llvm-project/issues/59136 + +Reviewed By: antiagainst + +Differential Revision: https://reviews.llvm.org/D141292 +--- + mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp | 5 +++++ + mlir/test/Conversion/SCFToSPIRV/if.mlir | 14 ++++++++++++++ + 2 files changed, 19 insertions(+) + +--- llvm-toolchain-13-13.0.1.orig/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp ++++ llvm-toolchain-13-13.0.1/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp +@@ -17,6 +17,7 @@ + #include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h" + #include "mlir/IR/BuiltinOps.h" + #include "mlir/Transforms/DialectConversion.h" ++#include "llvm/Support/FormatVariadic.h" + + using namespace mlir; + +@@ -274,6 +275,10 @@ IfOpConversion::matchAndRewrite(scf::IfO + SmallVector returnTypes; + for (auto result : ifOp.results()) { + auto convertedType = typeConverter.convertType(result.getType()); ++ if (!convertedType) ++ return failure(); ++ ++ + returnTypes.push_back(convertedType); + } + replaceSCFOutputValue(ifOp, selectionOp, rewriter, scfToSPIRVContext, +--- llvm-toolchain-13-13.0.1.orig/mlir/test/Conversion/SCFToSPIRV/if.mlir ++++ llvm-toolchain-13-13.0.1/mlir/test/Conversion/SCFToSPIRV/if.mlir +@@ -153,4 +153,18 @@ func @simple_if_yield_type_change(%arg2 + return + } + ++// Memrefs without a spirv storage class are not supported. The conversion ++// should preserve the `scf.if` and not crash. ++func.func @unsupported_yield_type(%arg0 : memref<8xi32>, %arg1 : memref<8xi32>, %c : i1) { ++// CHECK-LABEL: @unsupported_yield_type ++// CHECK-NEXT: scf.if ++// CHECK: spirv.Return ++ %r = scf.if %c -> (memref<8xi32>) { ++ scf.yield %arg0 : memref<8xi32> ++ } else { ++ scf.yield %arg1 : memref<8xi32> ++ } ++ return ++} ++ + } // end module diff -Nru llvm-toolchain-13-13.0.1/debian/patches/CVE-2023-29939.patch llvm-toolchain-13-13.0.1/debian/patches/CVE-2023-29939.patch --- llvm-toolchain-13-13.0.1/debian/patches/CVE-2023-29939.patch 1970-01-01 00:00:00.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/patches/CVE-2023-29939.patch 2023-07-28 03:12:29.000000000 +0000 @@ -0,0 +1,46 @@ +From 466aa585c6dfb096bf9a7ad9bcbc6ce8cc7abff1 Mon Sep 17 00:00:00 2001 +From: Jakub Kuderski +Date: Fri, 13 Jan 2023 10:55:04 -0500 +Subject: [PATCH] [mlir][spirv] Fix crash in spirv-lower-abi-attributes + +... when the are no SPIR-V env attributes. + +Fixes: https://github.com/llvm/llvm-project/issues/59983 + +Reviewed By: antiagainst + +Differential Revision: https://reviews.llvm.org/D141695 +--- + .../SPIRV/Transforms/LowerABIAttributesPass.cpp | 7 ++++++- + mlir/test/Dialect/SPIRV/Transforms/abi-interface.mlir | 10 +++++++++- + 2 files changed, 15 insertions(+), 2 deletions(-) + +--- llvm-toolchain-13-13.0.1.orig/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp ++++ llvm-toolchain-13-13.0.1/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp +@@ -233,7 +233,12 @@ void LowerABIAttributesPass::runOnOperat + spirv::ModuleOp module = getOperation(); + MLIRContext *context = &getContext(); + +- spirv::TargetEnv targetEnv(spirv::lookupTargetEnv(module)); ++ spirv::TargetEnvAttr targetEnvAttr = spirv::lookupTargetEnv(module); ++ if (!targetEnvAttr) { ++ module->emitOpError("missing SPIR-V target env attribute"); ++ return signalPassFailure(); ++ } ++ spirv::TargetEnv targetEnv(targetEnvAttr); + + SPIRVTypeConverter typeConverter(targetEnv); + +--- llvm-toolchain-13-13.0.1.orig/mlir/test/Dialect/SPIRV/Transforms/abi-interface.mlir ++++ llvm-toolchain-13-13.0.1/mlir/test/Dialect/SPIRV/Transforms/abi-interface.mlir +@@ -29,3 +29,10 @@ spv.module Logical GLSL450 { + } // end spv.module + + } // end module ++ ++// ----- ++ ++module { ++// expected-error@+1 {{'spirv.module' op missing SPIR-V target env attribute}} ++spirv.module Logical GLSL450 {} ++} // end module diff -Nru llvm-toolchain-13-13.0.1/debian/patches/gcc-13-build-fix.patch llvm-toolchain-13-13.0.1/debian/patches/gcc-13-build-fix.patch --- llvm-toolchain-13-13.0.1/debian/patches/gcc-13-build-fix.patch 1970-01-01 00:00:00.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/patches/gcc-13-build-fix.patch 2023-07-31 11:58:17.000000000 +0000 @@ -0,0 +1,54 @@ +From ff1681ddb303223973653f7f5f3f3435b48a1983 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Mon, 23 May 2022 08:03:23 +0100 +Subject: [PATCH] [Support] Add missing header to Signals.h + +Without the change llvm build fails on this week's gcc-13 snapshot as: + + [ 0%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/Signals.cpp.o + In file included from llvm/lib/Support/Signals.cpp:14: + llvm/include/llvm/Support/Signals.h:119:8: error: variable or field 'CleanupOnSignal' declared void + 119 | void CleanupOnSignal(uintptr_t Context); + | ^~~~~~~~~~~~~~~ +--- + llvm/include/llvm/Support/Signals.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/llvm/include/llvm/Support/Signals.h b/llvm/include/llvm/Support/Signals.h +index 44f5a750ff5cb0..937e0572d4a725 100644 +--- a/llvm/include/llvm/Support/Signals.h ++++ b/llvm/include/llvm/Support/Signals.h +@@ -14,6 +14,7 @@ + #ifndef LLVM_SUPPORT_SIGNALS_H + #define LLVM_SUPPORT_SIGNALS_H + ++#include + #include + + namespace llvm { + +From 1b4fdf18bc2aaa2d46bf072475dd9cbcd44a9fee Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Fri, 20 Jan 2023 10:11:01 +0100 +Subject: [PATCH] [libomp] Explicitly include header (NFC) + +This is required to build against libstdc++ 13. Debug.h uses +std::stoi() from without explicitly including it. +--- + openmp/libomptarget/include/Debug.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/openmp/libomptarget/include/Debug.h b/openmp/libomptarget/include/Debug.h +index 4e7da8b7d53f24..387dfe50659e43 100644 +--- a/openmp/libomptarget/include/Debug.h ++++ b/openmp/libomptarget/include/Debug.h +@@ -39,6 +39,7 @@ + + #include + #include ++#include + + /// 32-Bit field data attributes controlling information presented to the user. + enum OpenMPInfoType : uint32_t { + +27° diff -Nru llvm-toolchain-13-13.0.1/debian/patches/link-grpc.diff llvm-toolchain-13-13.0.1/debian/patches/link-grpc.diff --- llvm-toolchain-13-13.0.1/debian/patches/link-grpc.diff 2022-12-26 16:49:08.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/patches/link-grpc.diff 2023-07-24 17:12:07.000000000 +0000 @@ -2,7 +2,7 @@ =================================================================== --- llvm-toolchain-14-14.0.6.orig/llvm/cmake/modules/FindGRPC.cmake +++ llvm-toolchain-14-14.0.6/llvm/cmake/modules/FindGRPC.cmake -@@ -73,10 +73,27 @@ else() +@@ -73,10 +73,29 @@ else() endif() endif() endif() @@ -23,19 +23,29 @@ + set_target_properties(grpc PROPERTIES IMPORTED_LOCATION ${GRPC2_LIBRARY}) + + find_library(ABSL_SYNCHRONIZATION_LIBRARY absl_synchronization $GRPC_OPTS REQUIRED) -+ add_library(absl_synchronization UNKNOWN IMPORTED GLOBAL) -+ message(STATUS "Using absl_synchronization: " ${ABSL_SYNCHRONIZATION_LIBRARY}) -+ set_target_properties(absl_synchronization PROPERTIES IMPORTED_LOCATION ${ABSL_SYNCHRONIZATION_LIBRARY}) ++ if (ABSL_SYNCHRONIZATION_LIBRARY) ++ add_library(absl_synchronization UNKNOWN IMPORTED GLOBAL) ++ message(STATUS "Using absl_synchronization: " ${ABSL_SYNCHRONIZATION_LIBRARY}) ++ set_target_properties(absl_synchronization PROPERTIES IMPORTED_LOCATION ${ABSL_SYNCHRONIZATION_LIBRARY}) ++ endif() + if (ENABLE_GRPC_REFLECTION) find_library(GRPC_REFLECTION_LIBRARY grpc++_reflection $GRPC_OPTS REQUIRED) add_library(grpc++_reflection UNKNOWN IMPORTED GLOBAL) -@@ -123,7 +140,7 @@ function(generate_protos LibraryName Pro +@@ -121,9 +140,15 @@ function(generate_protos LibraryName Pro + ARGS ${Flags} "${ProtoSourceAbsolutePath}" + DEPENDS "${ProtoSourceAbsolutePath}") ++ set(LINKED_GRPC_LIBRARIES protobuf gpr grpc grpc++) ++ ++ if (ABSL_SYNCHRONIZATION_LIBRARY) ++ list(APPEND LINKED_GRPC_LIBRARIES absl_synchronization) ++ endif() ++ add_clang_library(${LibraryName} ${GeneratedProtoSource} PARTIAL_SOURCES_INTENDED - LINK_LIBS PUBLIC grpc++ protobuf) -+ LINK_LIBS PUBLIC protobuf gpr grpc absl_synchronization grpc++) ++ LINK_LIBS PUBLIC ${LINKED_GRPC_LIBRARIES}) # Ensure dependency headers are generated before dependent protos are built. # DEPENDS arg is a list of "Foo.proto". While they're logically relative to diff -Nru llvm-toolchain-13-13.0.1/debian/patches/new-cmake-build-fix.patch llvm-toolchain-13-13.0.1/debian/patches/new-cmake-build-fix.patch --- llvm-toolchain-13-13.0.1/debian/patches/new-cmake-build-fix.patch 1970-01-01 00:00:00.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/patches/new-cmake-build-fix.patch 2023-07-31 11:03:49.000000000 +0000 @@ -0,0 +1,185 @@ +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 + +Add also part of 24d144571dbffc6993d13fb7ca781248eed024de +diff --git a/openmp/runtime/cmake/LLVMCheckCompilerLinkerFlag.cmake b/openmp/runtime/cmake/LLVMCheckCompilerLinkerFlag.cmake +new file mode 100644 +index 00000000000000..f61ec0585f9a45 +--- /dev/null ++++ b/openmp/runtime/cmake/LLVMCheckCompilerLinkerFlag.cmake +@@ -0,0 +1,35 @@ ++include(CMakePushCheckState) ++ ++include(CheckCompilerFlag OPTIONAL) ++ ++if(NOT COMMAND check_compiler_flag) ++ include(CheckCCompilerFlag) ++ include(CheckCXXCompilerFlag) ++endif() ++ ++function(llvm_check_compiler_linker_flag lang flag out_var) ++ # If testing a flag with check_c_compiler_flag, it gets added to the compile ++ # command only, but not to the linker command in that test. If the flag ++ # is vital for linking to succeed, the test would fail even if it would ++ # have succeeded if it was included on both commands. ++ # ++ # Therefore, try adding the flag to CMAKE_REQUIRED_FLAGS, which gets ++ # added to both compiling and linking commands in the tests. ++ ++ cmake_push_check_state() ++ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}") ++ if(COMMAND check_compiler_flag) ++ check_compiler_flag("${lang}" "" ${out_var}) ++ else() ++ # Until the minimum CMAKE version is 3.19 ++ # cmake builtin compatible, except we assume lang is C or CXX ++ if("${lang}" STREQUAL "C") ++ check_c_compiler_flag("" ${out_var}) ++ elseif("${lang}" STREQUAL "CXX") ++ check_cxx_compiler_flag("" ${out_var}) ++ else() ++ message(FATAL_ERROR "\"${lang}\" is not C or CXX") ++ endif() ++ endif() ++ cmake_pop_check_state() ++endfunction() +Index: llvm-toolchain-13-13.0.1/openmp/runtime/cmake/LibompCheckLinkerFlag.cmake +=================================================================== +--- llvm-toolchain-13-13.0.1.orig/openmp/runtime/cmake/LibompCheckLinkerFlag.cmake ++++ /dev/null +@@ -1,68 +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 +-#// +-#//===----------------------------------------------------------------------===// +-# +- +-# 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)") +- set(failed_regexes "[Ee]rror;[Uu]nknown;[Ss]kipping;LINK : warning") +- 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() +Index: llvm-toolchain-13-13.0.1/openmp/runtime/cmake/config-ix.cmake +=================================================================== +--- llvm-toolchain-13-13.0.1.orig/openmp/runtime/cmake/config-ix.cmake ++++ llvm-toolchain-13-13.0.1/openmp/runtime/cmake/config-ix.cmake +@@ -16,8 +16,8 @@ + include(CheckLibraryExists) + include(CheckIncludeFiles) + include(CheckSymbolExists) +-include(LibompCheckLinkerFlag) + include(LibompCheckFortranFlag) ++include(LLVMCheckCompilerLinkerFlag) + + # Check for versioned symbols + function(libomp_check_version_symbols retval) +@@ -111,14 +111,14 @@ + + # 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 +@@ -129,8 +129,8 @@ + 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 -Nru llvm-toolchain-13-13.0.1/debian/patches/series llvm-toolchain-13-13.0.1/debian/patches/series --- llvm-toolchain-13-13.0.1/debian/patches/series 2022-12-26 16:49:15.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/patches/series 2023-07-31 11:04:54.000000000 +0000 @@ -163,3 +163,8 @@ lldb/lldb-swig.diff protobuf_llvm_13.0.1-8.patch link-grpc.diff +new-cmake-build-fix.patch +gcc-13-build-fix.patch +CVE-2023-29932.patch +CVE-2023-29934.patch +CVE-2023-29939.patch diff -Nru llvm-toolchain-13-13.0.1/debian/rules llvm-toolchain-13-13.0.1/debian/rules --- llvm-toolchain-13-13.0.1/debian/rules 2022-12-19 12:09:11.000000000 +0000 +++ llvm-toolchain-13-13.0.1/debian/rules 2023-07-31 20:16:10.000000000 +0000 @@ -225,7 +225,7 @@ LLVM_SPIRV_INSTALLED = no else # if executable is llvm-spirv without a -$(LLVM_VERSION) suffix - ifeq ($(LLVM_SPIRV:-$(LLVM_SPIR_VERSION)=),$(LLVM_SPIRV)) + ifeq ($(LLVM_SPIRV:-$(LLVM_SPIRV_VERSION)=),$(LLVM_SPIRV)) # Too old llvm-spirv version are failing. See #52200 ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' $(notdir $(LLVM_SPIRV))) gt 10.0.0 ; echo $$?),0) LLVM_SPIRV_INSTALLED = yes @@ -719,7 +719,7 @@ # Clean up temporary files to make sure the install works rm -rf $(find $(TARGET_BUILD) -wholename '*CMakeFiles*' -not -name CMakeLists.txt -a -name "*.dir" -type d) # install/fast enables a make install without recompiling temporary files - LD_LIBRARY_PATH=$(STAGE_2_LIB_DIR) DESTDIR=$(DEB_INST)/ ninja -C $(TARGET_BUILD) $(VERBOSE) stage2-install + LD_LIBRARY_PATH=$(STAGE_2_LIB_DIR):$$LD_LIBRARY_PATH DESTDIR=$(DEB_INST)/ ninja -C $(TARGET_BUILD) $(VERBOSE) stage2-install # Not used on Linux. rm -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/bin/argdumper