diff --git a/0001-Produce-DWARF4-by-default.patch b/0001-Produce-DWARF4-by-default.patch new file mode 100644 index 0000000..9b5b46b --- /dev/null +++ b/0001-Produce-DWARF4-by-default.patch @@ -0,0 +1,125 @@ +From adbe188f3b1e3a0dd5ec80d9409601ba7f5b0423 Mon Sep 17 00:00:00 2001 +From: Konrad Kleine +Date: Thu, 24 Mar 2022 09:44:21 +0100 +Subject: [PATCH] Produce DWARF4 by default + +Have a look at the following commit to see when the move from DWARF 4 to 5 first happened upstream: + +https://github.com/llvm/llvm-project/commit/d3b26dea16108c427b19b5480c9edc76edf8f5b4?diff=unified +--- + clang/lib/Driver/ToolChain.cpp | 4 +--- + clang/test/CodeGen/dwarf-version.c | 4 ++-- + clang/test/Driver/as-options.s | 4 ++-- + clang/test/Driver/cl-options.c | 2 +- + clang/test/Driver/clang-g-opts.c | 2 +- + clang/test/Driver/ve-toolchain.c | 2 +- + clang/test/Driver/ve-toolchain.cpp | 2 +- + 7 files changed, 9 insertions(+), 11 deletions(-) + +diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp +index 8dafc3d481c2..92bf26dc8ec6 100644 +--- a/clang/lib/Driver/ToolChain.cpp ++++ b/clang/lib/Driver/ToolChain.cpp +@@ -428,9 +428,7 @@ ToolChain::getDefaultUnwindTableLevel(const ArgList &Args) const { + } + + unsigned ToolChain::GetDefaultDwarfVersion() const { +- // TODO: Remove the RISC-V special case when R_RISCV_SET_ULEB128 linker +- // support becomes more widely available. +- return getTriple().isRISCV() ? 4 : 5; ++ return 4; + } + + Tool *ToolChain::getClang() const { +diff --git a/clang/test/CodeGen/dwarf-version.c b/clang/test/CodeGen/dwarf-version.c +index d307eb3f101f..e7e93bf6688c 100644 +--- a/clang/test/CodeGen/dwarf-version.c ++++ b/clang/test/CodeGen/dwarf-version.c +@@ -2,8 +2,8 @@ + // RUN: %clang -target x86_64-linux-gnu -gdwarf-3 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER3 + // RUN: %clang -target x86_64-linux-gnu -gdwarf-4 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4 + // RUN: %clang -target x86_64-linux-gnu -gdwarf-5 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5 +-// RUN: %clang -target x86_64-linux-gnu -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5 +-// RUN: %clang -target x86_64-linux-gnu -gdwarf -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5 ++// RUN: %clang -target x86_64-linux-gnu -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4 ++// RUN: %clang -target x86_64-linux-gnu -gdwarf -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4 + + // The -isysroot is used as a hack to avoid LIT messing with the SDKROOT + // environment variable which indirecty overrides the version in the target +diff --git a/clang/test/Driver/as-options.s b/clang/test/Driver/as-options.s +index 73d002c7ef7e..71d55f7fd537 100644 +--- a/clang/test/Driver/as-options.s ++++ b/clang/test/Driver/as-options.s +@@ -122,7 +122,7 @@ + // RUN: FileCheck --check-prefix=DEBUG %s + // RUN: %clang --target=aarch64-linux-gnu -fno-integrated-as -g0 -g %s -### 2>&1 | \ + // RUN: FileCheck --check-prefix=DEBUG %s +-// DEBUG: "-g" "-gdwarf-5" ++// DEBUG: "-g" "-gdwarf-4" + // RUN: %clang --target=aarch64-linux-gnu -fno-integrated-as -g -g0 %s -### 2>&1 | \ + // RUN: FileCheck --check-prefix=NODEBUG %s + // RUN: %clang --target=aarch64-linux-gnu -fno-integrated-as -gdwarf-5 -g0 %s -### 2>&1 | \ +@@ -141,7 +141,7 @@ + // RUN: %clang --target=aarch64-linux-gnu -fno-integrated-as -gdwarf-2 %s -### 2>&1 | \ + // RUN: FileCheck --check-prefix=GDWARF2 %s + // RUN: %clang --target=aarch64-linux-gnu -fno-integrated-as -gdwarf %s -### 2>&1 | \ +-// RUN: FileCheck --check-prefix=GDWARF5 %s ++// RUN: FileCheck --check-prefix=GDWARF4 %s + + // RUN: %clang --target=aarch64-linux-gnu -fno-integrated-as -gdwarf-5 %s -### 2>&1 | \ + // RUN: FileCheck --check-prefix=GDWARF5 %s +diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c +index 6d929b19e7e2..373905c2e0fc 100644 +--- a/clang/test/Driver/cl-options.c ++++ b/clang/test/Driver/cl-options.c +@@ -569,7 +569,7 @@ + // RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s + // Z7_gdwarf: "-gcodeview" + // Z7_gdwarf: "-debug-info-kind=constructor" +-// Z7_gdwarf: "-dwarf-version= ++// Z7_gdwarf: "-dwarf-version=4 + + // RUN: %clang_cl /ZH:MD5 /c -### -- %s 2>&1 | FileCheck -check-prefix=ZH_MD5 %s + // ZH_MD5: "-gsrc-hash=md5" +diff --git a/clang/test/Driver/clang-g-opts.c b/clang/test/Driver/clang-g-opts.c +index 5ee0fe64fe48..985158746137 100644 +--- a/clang/test/Driver/clang-g-opts.c ++++ b/clang/test/Driver/clang-g-opts.c +@@ -32,7 +32,7 @@ + + // CHECK-WITHOUT-G-NOT: -debug-info-kind + // CHECK-WITH-G: "-debug-info-kind=constructor" +-// CHECK-WITH-G: "-dwarf-version=5" ++// CHECK-WITH-G: "-dwarf-version=4" + // CHECK-WITH-G-DWARF2: "-dwarf-version=2" + + // CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone" +diff --git a/clang/test/Driver/ve-toolchain.c b/clang/test/Driver/ve-toolchain.c +index 32e25769b6da..b8a2852daba8 100644 +--- a/clang/test/Driver/ve-toolchain.c ++++ b/clang/test/Driver/ve-toolchain.c +@@ -6,7 +6,7 @@ + /// Checking dwarf-version + + // RUN: %clang -### -g --target=ve %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s +-// DWARF_VER: "-dwarf-version=5" ++// DWARF_VER: "-dwarf-version=4" + + ///----------------------------------------------------------------------------- + /// Checking include-path +diff --git a/clang/test/Driver/ve-toolchain.cpp b/clang/test/Driver/ve-toolchain.cpp +index 5a33d5eceb61..cedf895b36dc 100644 +--- a/clang/test/Driver/ve-toolchain.cpp ++++ b/clang/test/Driver/ve-toolchain.cpp +@@ -7,7 +7,7 @@ + + // RUN: %clangxx -### -g --target=ve-unknown-linux-gnu \ + // RUN: %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s +-// DWARF_VER: "-dwarf-version=5" ++// DWARF_VER: "-dwarf-version=4" + + ///----------------------------------------------------------------------------- + /// Checking include-path +-- +2.41.0 + diff --git a/clang.cfg b/clang.cfg deleted file mode 100644 index bee5a7a..0000000 --- a/clang.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Drop the following option after debugedit adds support to DWARF-5: -# https://sourceware.org/bugzilla/show_bug.cgi?id=28728 --gdwarf-4 diff --git a/clang.spec b/clang.spec index 4b38d62..f338783 100644 --- a/clang.spec +++ b/clang.spec @@ -55,7 +55,7 @@ Name: %pkg_name Version: %{clang_version}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}} -Release: 3%{?dist} +Release: 4%{?dist} Summary: A C language family front-end for LLVM License: Apache-2.0 WITH LLVM-exception OR NCSA @@ -77,18 +77,20 @@ Source4: release-keys.asc %if %{without compat_build} Source5: macros.%{name} %endif -Source6: clang.cfg # Patches for clang Patch1: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch Patch2: 0003-PATCH-clang-Don-t-install-static-libraries.patch Patch3: 0001-Driver-Add-a-gcc-equivalent-triple-to-the-list-of-tr.patch +# Drop the following patch after debugedit adds support to DWARF-5: +# https://sourceware.org/bugzilla/show_bug.cgi?id=28728 +Patch4: 0001-Produce-DWARF4-by-default.patch # Backport from LLVM 18: # https://github.com/llvm/llvm-project-release-prs/pull/689 -Patch4: 689.patch +Patch5: 689.patch # Workaround a bug in ORC on ppc64le. # More info is available here: https://reviews.llvm.org/D159115#4641826 -Patch5: 0001-Workaround-a-bug-in-ORC-on-ppc64le.patch +Patch6: 0001-Workaround-a-bug-in-ORC-on-ppc64le.patch # RHEL specific patches # Avoid unwanted dependency on python-recommonmark @@ -414,7 +416,6 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py -DBUILD_SHARED_LIBS=OFF \ -DCLANG_REPOSITORY_STRING="%{?dist_vendor} %{version}-%{release}" \ -DCLANG_RESOURCE_DIR=../lib/clang/%{maj_ver} \ - -DCLANG_CONFIG_FILE_SYSTEM_DIR=%{_sysconfdir}/%{name}/ \ %ifarch %{arm} -DCLANG_DEFAULT_LINKER=lld \ %endif @@ -503,10 +504,6 @@ mkdir -p %{buildroot}%{install_prefix}/lib/clang/%{maj_ver}/{bin,include,lib,sha ln -s %{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format-diff %endif -# Install config file -mkdir -p %{buildroot}%{_sysconfdir}/%{name}/ -mv %{SOURCE6} %{buildroot}%{_sysconfdir}/%{name}/%{_target_platform}.cfg - %check %if %{without compat_build} %if %{with check} @@ -544,7 +541,6 @@ false %files libs %{install_prefix}/lib/clang/%{maj_ver}/include/* %{install_libdir}/*.so.* -%{_sysconfdir}/%{name}/%{_target_platform}.cfg %files devel %if %{without compat_build} @@ -646,6 +642,11 @@ false %endif %changelog +%{?llvm_snapshot_changelog_entry} + +* Tue Sep 19 2023 Tulio Magno Quites Machado Filho - 17.0.0~rc4-4 +- Re-add dwarf4 patch. Fix rhbz#2239619. + * Tue Sep 19 2023 Tulio Magno Quites Machado Filho - 17.0.0~rc4-3 - Move macros.clang to resource-filesystem @@ -655,8 +656,6 @@ false * Wed Sep 06 2023 Tom Stellard - 17.0.0~rc3-2 - Drop dwarf4 patch in favor of config files -%{?llvm_snapshot_changelog_entry} - * Tue Sep 05 2023 Tulio Magno Quites Machado Filho - 17.0.0~rc4-1 - Update to LLVM 17.0.0 RC4