From 47360a941faae826e2f62a373bfac04246c6bce3 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Thu, 5 Nov 2020 17:32:50 +0100 Subject: [PATCH 1/4] regular build for 10.2.0 --- .gitignore | 1 + arm-none-eabi-gcc-cs.spec | 44 +++++++++++++++++++++++++++++++++++---- gcc-config.patch | 44 +++++++++++++++++++++++++++++++++++++++ sources | 2 +- 4 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 gcc-config.patch diff --git a/.gitignore b/.gitignore index f6d84bc..f1cdc38 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /gcc-7.3.0.tar.xz /gcc-7.4.0.tar.xz /gcc-9.2.0.tar.xz +/gcc-10.2.0.tar.xz diff --git a/arm-none-eabi-gcc-cs.spec b/arm-none-eabi-gcc-cs.spec index 88fb1e9..73a7100 100644 --- a/arm-none-eabi-gcc-cs.spec +++ b/arm-none-eabi-gcc-cs.spec @@ -1,7 +1,7 @@ %global processor_arch arm %global target %{processor_arch}-none-eabi -%global gcc_ver 9.2.0 -%global gcc_short_ver 9.2 +%global gcc_ver 10.2.0 +%global gcc_short_ver 10.2 # we need newlib to compile complete gcc, but we need gcc to compile newlib, # so compile minimal gcc first @@ -10,7 +10,7 @@ Name: %{target}-gcc-cs Epoch: 1 Version: %{gcc_ver} -Release: 4%{?dist} +Release: 2%{?dist} Summary: GNU GCC for cross-compilation for %{target} target # Most of the sources are licensed under GPLv3+ with these exceptions: @@ -31,7 +31,9 @@ Source0: gcc-%{gcc_ver}.tar.xz Source1: README.fedora Source2: bootstrapexplain Patch0: gcc10.patch +Patch1: gcc-config.patch +BuildRequires: autoconf BuildRequires: gcc-c++ BuildRequires: %{target}-binutils >= 2.21, zlib-devel gmp-devel mpfr-devel libmpc-devel flex autogen %if ! %{bootstrap} @@ -57,7 +59,16 @@ compile c++ code for the %{target} platform, instead of for the native %prep %setup -q -c -%patch0 -p1 +pushd gcc-%{gcc_ver} +#%patch0 -p2 -b .gcc10fix +%patch1 -p2 -b .gccconfig +popd +pushd gcc-%{gcc_ver}/libiberty +autoconf -f +popd +pushd gcc-%{gcc_ver}/intl +autoconf -f +popd pushd gcc-%{gcc_ver} contrib/gcc_update --touch @@ -86,6 +97,11 @@ sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \ %build +# This package's testsuite fails on s390 when LTO is enabled. Disable +# LTO for now on s390x until the root cause is identified +%ifarch s390x +%define _lto_cflags %{nil} +%endif mkdir -p gcc-%{target} gcc-nano-%{target} #### normal version @@ -282,6 +298,26 @@ popd %endif %changelog +* Wed Nov 04 2020 Michal Hlavinka - 1:10.2.0-2 +- regular build for 10.2.0 + +* Wed Nov 04 2020 Michal Hlavinka - 1:10.2.0-1 +- bootstrap build for gcc 10.2.0 + +* Mon Aug 10 2020 Jeff Law - 1:9.2.0-8 +- Disable LTO on s390x for now + +* Sat Aug 01 2020 Fedora Release Engineering - 1:9.2.0-7 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jul 27 2020 Fedora Release Engineering - 1:9.2.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jul 20 2020 Jeff Law - 1:9.2.0-5 +- Fix broken configured tests compromised by LTO +- Add autoconf to BuildRequires + * Tue Jan 28 2020 Fedora Release Engineering - 1:9.2.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/gcc-config.patch b/gcc-config.patch new file mode 100644 index 0000000..b7ec9ed --- /dev/null +++ b/gcc-config.patch @@ -0,0 +1,44 @@ +diff -Nrup a/gcc-9.2.0/libiberty/aclocal.m4 b/libiberty/aclocal.m4 +--- a/gcc-9.2.0/libiberty/aclocal.m4 2019-01-19 09:01:34.000000000 -0700 ++++ b/gcc-9.2.0/libiberty/aclocal.m4 2020-01-09 22:00:27.183312982 -0700 +@@ -147,7 +147,7 @@ if test $ac_cv_os_cray = yes; then + fi + + AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, +-[AC_TRY_RUN([find_stack_direction () ++[AC_TRY_RUN([__attribute__ ((noclone,noinline)) find_stack_direction () + { + static char *addr = 0; + auto char dummy; +diff --git a/config/intdiv0.m4 b/gcc-9.2.0/config/intdiv0.m4 +index 55dddcf1..ba906efc 100644 +--- a/gcc-9.2.0/config/intdiv0.m4 ++++ b/gcc-9.2.0/config/intdiv0.m4 +@@ -31,10 +31,10 @@ sigfpe_handler (sig) int sig; + exit (sig != SIGFPE); + } + +-int x = 1; +-int y = 0; +-int z; +-int nan; ++volatile int x = 1; ++volatile int y = 0; ++volatile int z; ++volatile int nan; + + int main () + { +diff --git a/gcc-9.2.0/libiberty/configure.ac b/gcc-9.2.0/libiberty/configure.ac +index f1ce7601..fc20d228 100644 +--- a/gcc-9.2.0/libiberty/configure.ac ++++ b/gcc-9.2.0/libiberty/configure.ac +@@ -661,7 +661,7 @@ if test -z "${setobjs}"; then + for v in $vars; do + AC_MSG_CHECKING([for $v]) + AC_CACHE_VAL(libiberty_cv_var_$v, +- [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p = $v;]])], ++ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[__attribute__ ((used)) int *p;]],[[extern int $v []; p = $v;]])], + [eval "libiberty_cv_var_$v=yes"], + [eval "libiberty_cv_var_$v=no"])]) + if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then diff --git a/sources b/sources index 9ccf65e..8265983 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gcc-9.2.0.tar.xz) = a12dff52af876aee0fd89a8d09cdc455f35ec46845e154023202392adc164848faf8ee881b59b681b696e27c69fd143a214014db4214db62f9891a1c8365c040 +SHA512 (gcc-10.2.0.tar.xz) = 42ae38928bd2e8183af445da34220964eb690b675b1892bbeb7cd5bb62be499011ec9a93397dba5e2fb681afadfc6f2767d03b9035b44ba9be807187ae6dc65e From e4a8d55cc9003e188429bb4e7d69940686210ab3 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Thu, 5 Nov 2020 17:43:02 +0100 Subject: [PATCH 2/4] bootstrap build first --- arm-none-eabi-gcc-cs.spec | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arm-none-eabi-gcc-cs.spec b/arm-none-eabi-gcc-cs.spec index 73a7100..ffbf3de 100644 --- a/arm-none-eabi-gcc-cs.spec +++ b/arm-none-eabi-gcc-cs.spec @@ -5,12 +5,12 @@ # we need newlib to compile complete gcc, but we need gcc to compile newlib, # so compile minimal gcc first -%global bootstrap 0 +%global bootstrap 1 Name: %{target}-gcc-cs Epoch: 1 Version: %{gcc_ver} -Release: 2%{?dist} +Release: 1%{?dist} Summary: GNU GCC for cross-compilation for %{target} target # Most of the sources are licensed under GPLv3+ with these exceptions: @@ -298,9 +298,6 @@ popd %endif %changelog -* Wed Nov 04 2020 Michal Hlavinka - 1:10.2.0-2 -- regular build for 10.2.0 - * Wed Nov 04 2020 Michal Hlavinka - 1:10.2.0-1 - bootstrap build for gcc 10.2.0 From 41d964c32583950780b47b6019a07b804f23a96d Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Thu, 5 Nov 2020 20:10:32 +0100 Subject: [PATCH 3/4] regular build for 10.2.0 --- arm-none-eabi-gcc-cs.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arm-none-eabi-gcc-cs.spec b/arm-none-eabi-gcc-cs.spec index ffbf3de..c287afa 100644 --- a/arm-none-eabi-gcc-cs.spec +++ b/arm-none-eabi-gcc-cs.spec @@ -5,12 +5,12 @@ # we need newlib to compile complete gcc, but we need gcc to compile newlib, # so compile minimal gcc first -%global bootstrap 1 +%global bootstrap 0 Name: %{target}-gcc-cs Epoch: 1 Version: %{gcc_ver} -Release: 1%{?dist} +Release: 2%{?dist} Summary: GNU GCC for cross-compilation for %{target} target # Most of the sources are licensed under GPLv3+ with these exceptions: @@ -298,6 +298,9 @@ popd %endif %changelog +* Thu Nov 05 2020 Michal Hlavinka - 1:10.2.0-2 +- regular build for 10.2.0 + * Wed Nov 04 2020 Michal Hlavinka - 1:10.2.0-1 - bootstrap build for gcc 10.2.0 From 4183dfd499388878d672a683044cebf5057c4b48 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Wed, 5 May 2021 13:31:51 +0200 Subject: [PATCH 4/4] updated to 10.3.0 --- .gitignore | 1 + arm-none-eabi-gcc-cs.spec | 20 ++++- gcc11.patch | 172 ++++++++++++++++++++++++++++++++++++++ sources | 2 +- 4 files changed, 190 insertions(+), 5 deletions(-) create mode 100644 gcc11.patch diff --git a/.gitignore b/.gitignore index f1cdc38..6b0e3d9 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ /gcc-7.4.0.tar.xz /gcc-9.2.0.tar.xz /gcc-10.2.0.tar.xz +/gcc-10.3.0.tar.xz diff --git a/arm-none-eabi-gcc-cs.spec b/arm-none-eabi-gcc-cs.spec index c287afa..b19e202 100644 --- a/arm-none-eabi-gcc-cs.spec +++ b/arm-none-eabi-gcc-cs.spec @@ -1,7 +1,7 @@ %global processor_arch arm %global target %{processor_arch}-none-eabi -%global gcc_ver 10.2.0 -%global gcc_short_ver 10.2 +%global gcc_ver 10.3.0 +%global gcc_short_ver 10.3 # we need newlib to compile complete gcc, but we need gcc to compile newlib, # so compile minimal gcc first @@ -10,7 +10,7 @@ Name: %{target}-gcc-cs Epoch: 1 Version: %{gcc_ver} -Release: 2%{?dist} +Release: 1%{?dist} Summary: GNU GCC for cross-compilation for %{target} target # Most of the sources are licensed under GPLv3+ with these exceptions: @@ -32,12 +32,14 @@ Source1: README.fedora Source2: bootstrapexplain Patch0: gcc10.patch Patch1: gcc-config.patch +Patch2: gcc11.patch BuildRequires: autoconf BuildRequires: gcc-c++ BuildRequires: %{target}-binutils >= 2.21, zlib-devel gmp-devel mpfr-devel libmpc-devel flex autogen %if ! %{bootstrap} BuildRequires: %{target}-newlib +BuildRequires: make %endif Requires: %{target}-binutils >= 2.21 Provides: %{target}-gcc = %{gcc_ver} @@ -62,6 +64,7 @@ compile c++ code for the %{target} platform, instead of for the native pushd gcc-%{gcc_ver} #%patch0 -p2 -b .gcc10fix %patch1 -p2 -b .gccconfig +%patch2 -p1 -b .gcc11fix popd pushd gcc-%{gcc_ver}/libiberty autoconf -f @@ -298,7 +301,16 @@ popd %endif %changelog -* Thu Nov 05 2020 Michal Hlavinka - 1:10.2.0-2 +* Tue May 04 2021 Michal Hlavinka - 1:10.3.0-1 +- updated to 10.3.0 + +* Wed Feb 24 2021 Jeff Law - 1:10.2.0-4 +- Packport fix for libbacktrace's handling of dwarf-5 + +* Tue Jan 26 2021 Fedora Release Engineering - 1:10.2.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Nov 04 2020 Michal Hlavinka - 1:10.2.0-2 - regular build for 10.2.0 * Wed Nov 04 2020 Michal Hlavinka - 1:10.2.0-1 diff --git a/gcc11.patch b/gcc11.patch new file mode 100644 index 0000000..aaf7f0a --- /dev/null +++ b/gcc11.patch @@ -0,0 +1,172 @@ +commit 325e70b47c6c321710c7b9c792b8fbee95cecd63 +Author: Ian Lance Taylor +Date: Mon Jan 18 14:38:10 2021 -0800 + + libbacktrace: use correct directory/filename for DWARF 5 + + PR debug/98716 + * dwarf.c (read_v2_paths): Allocate zero entry for dirs and + filenames. + (read_line_program): Remove parameter u, change caller. Don't + subtract one from dirs and filenames index. + (read_function_entry): Don't subtract one from filenames index. + +diff --git a/libbacktrace/dwarf.c b/libbacktrace/dwarf.c +index 3d0cbedf770..9097df6cc76 100644 +--- a/libbacktrace/dwarf.c ++++ b/libbacktrace/dwarf.c +@@ -2344,19 +2344,20 @@ read_v2_paths (struct backtrace_state *state, struct unit *u, + ++hdr->dirs_count; + } + +- hdr->dirs = NULL; +- if (hdr->dirs_count != 0) +- { +- hdr->dirs = ((const char **) +- backtrace_alloc (state, +- hdr->dirs_count * sizeof (const char *), +- hdr_buf->error_callback, +- hdr_buf->data)); +- if (hdr->dirs == NULL) +- return 0; +- } ++ /* The index of the first entry in the list of directories is 1. Index 0 is ++ used for the current directory of the compilation. To simplify index ++ handling, we set entry 0 to the compilation unit directory. */ ++ ++hdr->dirs_count; ++ hdr->dirs = ((const char **) ++ backtrace_alloc (state, ++ hdr->dirs_count * sizeof (const char *), ++ hdr_buf->error_callback, ++ hdr_buf->data)); ++ if (hdr->dirs == NULL) ++ return 0; + +- i = 0; ++ hdr->dirs[0] = u->comp_dir; ++ i = 1; + while (*hdr_buf->buf != '\0') + { + if (hdr_buf->reported_underflow) +@@ -2383,6 +2384,10 @@ read_v2_paths (struct backtrace_state *state, struct unit *u, + ++hdr->filenames_count; + } + ++ /* The index of the first entry in the list of file names is 1. Index 0 is ++ used for the DW_AT_name of the compilation unit. To simplify index ++ handling, we set entry 0 to the compilation unit file name. */ ++ ++hdr->filenames_count; + hdr->filenames = ((const char **) + backtrace_alloc (state, + hdr->filenames_count * sizeof (char *), +@@ -2390,7 +2395,8 @@ read_v2_paths (struct backtrace_state *state, struct unit *u, + hdr_buf->data)); + if (hdr->filenames == NULL) + return 0; +- i = 0; ++ hdr->filenames[0] = u->filename; ++ i = 1; + while (*hdr_buf->buf != '\0') + { + const char *filename; +@@ -2404,7 +2410,7 @@ read_v2_paths (struct backtrace_state *state, struct unit *u, + return 0; + dir_index = read_uleb128 (hdr_buf); + if (IS_ABSOLUTE_PATH (filename) +- || (dir_index == 0 && u->comp_dir == NULL)) ++ || (dir_index < hdr->dirs_count && hdr->dirs[dir_index] == NULL)) + hdr->filenames[i] = filename; + else + { +@@ -2413,10 +2419,8 @@ read_v2_paths (struct backtrace_state *state, struct unit *u, + size_t filename_len; + char *s; + +- if (dir_index == 0) +- dir = u->comp_dir; +- else if (dir_index - 1 < hdr->dirs_count) +- dir = hdr->dirs[dir_index - 1]; ++ if (dir_index < hdr->dirs_count) ++ dir = hdr->dirs[dir_index]; + else + { + dwarf_buf_error (hdr_buf, +@@ -2704,8 +2708,8 @@ read_line_header (struct backtrace_state *state, struct dwarf_data *ddata, + + static int + read_line_program (struct backtrace_state *state, struct dwarf_data *ddata, +- struct unit *u, const struct line_header *hdr, +- struct dwarf_buf *line_buf, struct line_vector *vec) ++ const struct line_header *hdr, struct dwarf_buf *line_buf, ++ struct line_vector *vec) + { + uint64_t address; + unsigned int op_index; +@@ -2715,8 +2719,8 @@ read_line_program (struct backtrace_state *state, struct dwarf_data *ddata, + + address = 0; + op_index = 0; +- if (hdr->filenames_count > 0) +- reset_filename = hdr->filenames[0]; ++ if (hdr->filenames_count > 1) ++ reset_filename = hdr->filenames[1]; + else + reset_filename = ""; + filename = reset_filename; +@@ -2781,10 +2785,8 @@ read_line_program (struct backtrace_state *state, struct dwarf_data *ddata, + size_t f_len; + char *p; + +- if (dir_index == 0 && hdr->version < 5) +- dir = u->comp_dir; +- else if (dir_index - 1 < hdr->dirs_count) +- dir = hdr->dirs[dir_index - 1]; ++ if (dir_index < hdr->dirs_count) ++ dir = hdr->dirs[dir_index]; + else + { + dwarf_buf_error (line_buf, +@@ -2851,14 +2853,14 @@ read_line_program (struct backtrace_state *state, struct dwarf_data *ddata, + filename = ""; + else + { +- if (fileno - 1 >= hdr->filenames_count) ++ if (fileno >= hdr->filenames_count) + { + dwarf_buf_error (line_buf, + ("invalid file number in " + "line number program")); + return 0; + } +- filename = hdr->filenames[fileno - 1]; ++ filename = hdr->filenames[fileno]; + } + } + break; +@@ -2948,7 +2950,7 @@ read_line_info (struct backtrace_state *state, struct dwarf_data *ddata, + if (!read_line_header (state, ddata, u, is_dwarf64, &line_buf, hdr)) + goto fail; + +- if (!read_line_program (state, ddata, u, hdr, &line_buf, &vec)) ++ if (!read_line_program (state, ddata, hdr, &line_buf, &vec)) + goto fail; + + if (line_buf.reported_underflow) +@@ -3289,7 +3291,7 @@ read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata, + function->caller_filename = ""; + else + { +- if (val.u.uint - 1 >= lhdr->filenames_count) ++ if (val.u.uint >= lhdr->filenames_count) + { + dwarf_buf_error (unit_buf, + ("invalid file number in " +@@ -3297,7 +3299,7 @@ read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata, + return 0; + } + function->caller_filename = +- lhdr->filenames[val.u.uint - 1]; ++ lhdr->filenames[val.u.uint]; + } + } + break; diff --git a/sources b/sources index 8265983..b173009 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (gcc-10.2.0.tar.xz) = 42ae38928bd2e8183af445da34220964eb690b675b1892bbeb7cd5bb62be499011ec9a93397dba5e2fb681afadfc6f2767d03b9035b44ba9be807187ae6dc65e +SHA512 (gcc-10.3.0.tar.xz) = 2b2dd7453d48a398c29eaebd1422b70341001b8c90a62aee51e83344e7fdd8a8e45f82a4a9165bd7edc76dada912c932f4b6632c5636760fec4c5d7e402b3f86