diff --git a/0071-Fix-segfault-segment-fault-with-static-in-LoongArch.patch b/0071-Fix-segfault-segment-fault-with-static-in-LoongArch.patch new file mode 100644 index 0000000000000000000000000000000000000000..ecf437c2c6814fa60dc895dff9a22e4ac1e8642b --- /dev/null +++ b/0071-Fix-segfault-segment-fault-with-static-in-LoongArch.patch @@ -0,0 +1,56 @@ +From 3d779f5de7cd918f331d5916af2705958e46bced Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Wed, 10 Jan 2024 10:20:06 +0800 +Subject: [PATCH] Fix segfault: segment fault with -static in LoongArch + +It is needed add crtstuff-cflags to build tmake_file. + +-fasynchronous-unwind-tables is on by default for LoongArch. +We turn it off for crt*.o because it would make __EH_FRAME_BEGIN__ point +to .eh_frame data from crtbeginT.o instead of the user-defined object +during static linking. + +Signed-off-by: Peng Fan +--- + libgcc/config.host | 25 +++++++++++++++---------- + 1 file changed, 15 insertions(+), 10 deletions(-) + +diff --git a/libgcc/config.host b/libgcc/config.host +index 28a4aa52b..5412dfa38 100644 +--- a/libgcc/config.host ++++ b/libgcc/config.host +@@ -944,16 +944,21 @@ lm32-*-uclinux*) + extra_parts="$extra_parts crtbegin.o crtendS.o crtbeginT.o" + tmake_file="lm32/t-lm32 lm32/t-uclinux t-libgcc-pic t-softfp-sfdf t-softfp" + ;; +-loongarch*-*-linux*) +- extra_parts="$extra_parts crtfastmath.o" +- tmake_file="${tmake_file} t-crtfm" +- case ${host} in +- *) +- tmake_file="${tmake_file} t-slibgcc-libgcc" +- ;; +- esac +- md_unwind_header=loongarch/linux-unwind.h +- ;; ++loongarch*-linux*) ++ extra_parts="$extra_parts crtfastmath.o" ++ tmake_file="${tmake_file} t-crtfm loongarch/t-crtstuff" ++ case ${host} in ++ *) ++ tmake_file="${tmake_file} t-slibgcc-libgcc" ++ ;; ++ esac ++ md_unwind_header=loongarch/linux-unwind.h ++ ;; ++loongarch*-elf*) ++ extra_parts="$extra_parts crtfastmath.o" ++ tmake_file="${tmake_file} t-crtfm loongarch/t-crtstuff" ++ tmake_file="${tmake_file} t-slibgcc-libgcc" ++ ;; + m32r-*-elf*) + tmake_file="$tmake_file m32r/t-m32r t-fdpbit" + extra_parts="$extra_parts crtinit.o crtfini.o" +-- +2.33.0 + diff --git a/gcc.spec b/gcc.spec index e0c638747a5e4b531c638b3ea013a8bbce9d97d3..901cf024f8fd79a4d82b7b63c7474a3e4399898e 100644 --- a/gcc.spec +++ b/gcc.spec @@ -61,7 +61,7 @@ Summary: Various compilers (C, C++, Objective-C, ...) Name: gcc Version: %{gcc_version} -Release: 20 +Release: 21 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD URL: https://gcc.gnu.org @@ -181,6 +181,7 @@ Patch67: 0067-aarch64-Remove-below_hard_fp_saved_regs_size.patch Patch68: 0068-aarch64-Make-stack-smash-canary-protect-saved-registers.patch Patch69: 0069-LoongArch-add-SX-ASX-builtin-functions-and-backports.patch Patch70: 0070-LoongArch-add-mrelax-and-mno-relax-options-to-gcc-dr.patch +Patch71: 0071-Fix-segfault-segment-fault-with-static-in-LoongArch.patch %global gcc_target_platform %{_arch}-linux-gnu @@ -692,6 +693,7 @@ not stable, so plugins must be rebuilt any time GCC is updated. %patch68 -p1 %patch69 -p1 %patch70 -p1 +%patch71 -p1 %build @@ -2671,6 +2673,12 @@ end %doc rpm.doc/changelogs/libcc1/ChangeLog* %changelog +* Wed Jan 10 2024 Peng Fan - 10.3.1-21 +- Type:Sync bugfix +- ID:NA +- SUG:NA +- DESC: Fix segment fault with -static. + * Fri Nov 10 2023 Peng Fan - 10.3.1-20 - Type:Sync bugfix - ID:NA