From a072d50769ad339a1908c5ade01c8b5fd5af5546 Mon Sep 17 00:00:00 2001 From: dpd Date: Mon, 16 Mar 2026 16:56:27 +0800 Subject: [PATCH] Enable -fasynchronous-unwind-tables by default on Linux --- ...us-unwind-tables-by-default-on-Linux.patch | 66 +++++++++++++++++++ llvm.spec | 8 ++- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 0001-Enable-fasynchronous-unwind-tables-by-default-on-Linux.patch diff --git a/0001-Enable-fasynchronous-unwind-tables-by-default-on-Linux.patch b/0001-Enable-fasynchronous-unwind-tables-by-default-on-Linux.patch new file mode 100644 index 0000000..ba4a4d8 --- /dev/null +++ b/0001-Enable-fasynchronous-unwind-tables-by-default-on-Linux.patch @@ -0,0 +1,66 @@ +From 0d41e462fcaecc3b82eea611bccfdde9a42156b5 Mon Sep 17 00:00:00 2001 +From: doupengda +Date: Mon, 16 Mar 2026 15:20:27 +0800 +Subject: [PATCH] Enable -fasynchronous-unwind-tables by default on Linux + +--- + clang/lib/Driver/ToolChains/Gnu.cpp | 2 ++ + clang/test/Driver/loongarch-default-features.c | 9 --------- + clang/test/Driver/loongarch-features.c | 16 ++++++++++++++++ + 3 files changed, 18 insertions(+), 9 deletions(-) + delete mode 100644 clang/test/Driver/loongarch-default-features.c + create mode 100644 clang/test/Driver/loongarch-features.c + +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index c5a240236..dc44e8673 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2927,6 +2927,8 @@ Generic_GCC::getDefaultUnwindTableLevel(const ArgList &Args) const { + case llvm::Triple::ppc64le: + case llvm::Triple::riscv32: + case llvm::Triple::riscv64: ++ case llvm::Triple::loongarch32: ++ case llvm::Triple::loongarch64: + case llvm::Triple::x86: + case llvm::Triple::x86_64: + // Enable -funwind-tables on all architectures supported by Fedora: +diff --git a/clang/test/Driver/loongarch-default-features.c b/clang/test/Driver/loongarch-default-features.c +deleted file mode 100644 +index 90634bbcf..000000000 +--- a/clang/test/Driver/loongarch-default-features.c ++++ /dev/null +@@ -1,9 +0,0 @@ +-// RUN: %clang --target=loongarch32 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=LA32 +-// RUN: %clang --target=loongarch64 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=LA64 +- +-// LA32: "target-features"="+32bit" +-// LA64: "target-features"="+64bit,+d,+f,+lsx,+ual" +- +-int foo(void) { +- return 3; +-} +diff --git a/clang/test/Driver/loongarch-features.c b/clang/test/Driver/loongarch-features.c +new file mode 100644 +index 000000000..464eda982 +--- /dev/null ++++ b/clang/test/Driver/loongarch-features.c +@@ -0,0 +1,16 @@ ++// RUN: %clang --target=loongarch32 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=LA32 ++// RUN: %clang --target=loongarch64 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=LA64 ++ ++// LA32: "target-features"="+32bit" ++// LA64: "target-features"="+64bit,+d,+f,+ual" ++ ++// RUN: %clang --target=loongarch32-linux -### %s -fsyntax-only 2>&1 \ ++// RUN: | FileCheck %s --check-prefix=DEFAULT-LINUX ++// RUN: %clang --target=loongarch64-linux -### %s -fsyntax-only 2>&1 \ ++// RUN: | FileCheck %s --check-prefix=DEFAULT-LINUX ++ ++// DEFAULT-LINUX: "-funwind-tables=2" ++ ++int foo(void) { ++ return 3; ++} +-- +2.43.7 + diff --git a/llvm.spec b/llvm.spec index b0a2a44..12af939 100644 --- a/llvm.spec +++ b/llvm.spec @@ -85,7 +85,7 @@ ##region main package Name: llvm Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 17%{?dist} +Release: 18%{?dist} Summary: The Low Level Virtual Machine License: Apache-2.0 WITH LLVM-exception OR NCSA @@ -276,6 +276,7 @@ Patch0421: 0017-LoongArch-Fix-test-cases-after-2dd8460d8a36.patch # distro self made patches Patch5000: 0001-Fix-mlir-pdll-lsp-server-coredump.patch +Patch5001: 0001-Enable-fasynchronous-unwind-tables-by-default-on-Linux.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -2108,6 +2109,11 @@ fi %changelog +* Mon Mar 16 2026 doupengda - 17.0.6-18 +- [Type] other +- [DESC] Enable -fasynchronous-unwind-tables by default on Linux +- from https://github.com/llvm/llvm-project/pull/94711 + * Fri Dec 05 2025 Zhao Zhen - 17.0.6-17 - fixed unsafe-buffer-use in clang -- Gitee