From 860949d9262da6ed4ce031b7b2e1bf26636b06c8 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 16 Aug 2024 16:18:00 +0100 Subject: [PATCH] NVR Bump to allow rebuilding with GTS-14 gcc. Resolves: RHEL-53519 --- binutils-s390-testsuite-fixes.patch | 39 +++++++ binutils.spec | 162 ++++++++++++++++++---------- 2 files changed, 144 insertions(+), 57 deletions(-) diff --git a/binutils-s390-testsuite-fixes.patch b/binutils-s390-testsuite-fixes.patch index 8b94ed1..44675b6 100644 --- a/binutils-s390-testsuite-fixes.patch +++ b/binutils-s390-testsuite-fixes.patch @@ -50,3 +50,42 @@ diff -rup binutils.orig/ld/testsuite/ld-vsb/vsb.exp binutils-2.41/ld/testsuite/l if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainnp.o] } { setup_xfail "sparc*-*-linux*" } +diff -rup binutils.orig/ld/testsuite/ld-ctf/slice.d binutils-2.41/ld/testsuite/ld-ctf/slice.d +--- binutils.orig/ld/testsuite/ld-ctf/slice.d 2024-08-16 15:01:57.439706788 +0100 ++++ binutils-2.41/ld/testsuite/ld-ctf/slice.d 2024-08-16 15:03:25.824963879 +0100 +@@ -25,9 +25,9 @@ Contents of CTF section .ctf: + #... + 0x[0-9a-f]*: \(kind 6\) struct slices \(size 0x[0-9a-f]*\) \(aligned at 0x[0-9a-f]*\) + *\[0x0\] one: ID 0x[0-9a-f]*: \(kind 1\) int:1 \[slice 0x0:0x1\] \(format 0x1\) \(size 0x1\) \(aligned at 0x1\) +- *\[0x1\] two: ID 0x[0-9a-f]*: \(kind 1\) int:2 \[slice 0x0:0x2\] \(format 0x1\) \(size 0x1\) \(aligned at 0x1\) +- *\[0x3\] six: ID 0x[0-9a-f]*: \(kind 1\) int:6 \[slice 0x0:0x6\] \(format 0x1\) \(size 0x1\) \(aligned at 0x1\) +- *\[0x9\] ten: ID 0x[0-9a-f]*: \(kind 1\) int:10 \[slice 0x0:0xa\] \(format 0x1\) \(size 0x2\) \(aligned at 0x2\) +- *\[0x13\] bar: ID 0x[0-9a-f]*: \(kind 8\) enum foo:1 \[slice 0x0:0x1\] \(format 0x1\) \(size 0x1\) \(aligned at 0x1\) ++ *\[0x.\] two: ID 0x[0-9a-f]*: \(kind 1\) int:2 \[slice 0x.:0x2\] \(format 0x1\) \(size 0x1\) \(aligned at 0x1\) ++ *\[0x.\] six: ID 0x[0-9a-f]*: \(kind 1\) int:6 \[slice 0x.:0x6\] \(format 0x1\) \(size 0x1\) \(aligned at 0x1\) ++ *\[0x.\] ten: ID 0x[0-9a-f]*: \(kind 1\) int:10 \[slice 0x.:0xa\] \(format 0x1\) \(size 0x2\) \(aligned at 0x2\) ++ *\[0x.*\] bar: ID 0x[0-9a-f]*: \(kind 8\) enum foo:1 \[slice 0x.*:0x1\] \(format 0x1\) \(size 0x1\) \(aligned at 0x1\) + + #... +diff -rup binutils.orig/ld/testsuite/ld-shared/shared.exp binutils-2.41/ld/testsuite/ld-shared/shared.exp +--- binutils.orig/ld/testsuite/ld-shared/shared.exp 2024-08-16 15:01:57.612707292 +0100 ++++ binutils-2.41/ld/testsuite/ld-shared/shared.exp 2024-08-16 15:05:33.353334828 +0100 +@@ -274,6 +274,7 @@ if ![ld_compile "$CC_FOR_TARGET $SHCFLAG + setup_xfail "aarch64*-*-linux*" + # Solaris defaults to -z text. + setup_xfail "*-*-solaris2*" ++ setup_xfail "s390x-*-*" + shared_test shnp "shared (non PIC, load offset)" \ + mainnp.o sh1np.o sh2np.o shared \ + "-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv" +--- binutils.orig/ld/testsuite/ld-vsb/vsb.exp 2024-08-16 15:01:57.631707347 +0100 ++++ binutils-2.41/ld/testsuite/ld-vsb/vsb.exp 2024-08-16 15:46:04.098564801 +0100 +@@ -396,7 +396,7 @@ proc visibility_run {visibility} { + setup_xfail "*-*-beos*" + } + +- if { ![is_xcoff_format] } { ++ if { ![is_xcoff_format] && ![istarget s390x-*-*] } { + visibility_test $visibility vnp "visibility ($visibility) (non PIC, load offset)" \ + mainnp.o sh1np.o sh2np.o $datfile \ + "-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv" diff --git a/binutils.spec b/binutils.spec index 9340067..77e19d9 100644 --- a/binutils.spec +++ b/binutils.spec @@ -9,7 +9,7 @@ BuildRequires: scl-utils-build Summary: A GNU collection of binary utilities Name: %{?scl_prefix}binutils Version: 2.41 -Release: 2%{?dist} +Release: 3%{?dist} License: GPL-3.0-or-later AND (GPL-3.0-or-later WITH Bison-exception-2.2) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND BSD-3-Clause AND GFDL-1.3-or-later AND GPL-2.0-or-later AND LGPL-2.1-or-later AND LGPL-2.0-or-later URL: https://sourceware.org/binutils @@ -154,6 +154,13 @@ URL: https://sourceware.org/binutils #---------------------------------------------------------------------------- +# Bootstrapping: Set this to 1 to build annobin with the system gcc. +# Then once GTS-gcc is built and in the buildroot, reset this variable +# to 0, bump the NVR and rebuild GTS-binutils. +%define bootstrapping 0 + +#---------------------------------------------------------------------------- + # Note - the Linux Kernel binutils releases are too unstable and contain # too many controversial patches so we stick with the official FSF version # instead. @@ -362,77 +369,116 @@ BuildRequires: autoconf, automake, perl, sed, coreutils, make BuildRequires: clang compiler-rt %else -# XXX Bootstrapping - build with the system gcc first. - -# Use the GTS version of gcc to build the binutils so that the built static libraries -# (libfd.a, libopcodes.a libiberty.a libsframe.a) use the same LTO version as the one -# that will be used by consumers of GTS binutils. -# Note - during GTS bootstrap these have to be changed to the systemOS versions. -# XXX BuildRequires: %%{?scl_prefix}gcc -# XXX BuildRequires: %%{?scl_prefix}annobin-plugin-gcc -# XXX BuildRequires: %%{?scl_prefix}gcc-c++ - -BuildRequires: gcc -BuildRequires: gcc-c++ - -# XXX %%define gcc_for_libraries %%{?_scl_root}/usr/bin/gcc -# XXX %%define gxx_for_libraries %%{?_scl_root}/usr/bin/g++ - -%define gcc_for_libraries /usr/bin/gcc -%define gxx_for_libraries /usr/bin/g++ +%if %{bootstrapping} +# Note - during GTS bootstrap these have to use the system compiler. # Note - during GTS bootstrap it may be necessary to build the binutils without # annobin annotations. # %%undefine _annotated_build +%define gcc_package gcc +%define gxx_package gcc-c++ + +%define gcc_for_binutils /usr/bin/gcc +%define gxx_for_binutils /usr/bin/g++ + +%else + +# Use the GTS version of gcc to build the binutils so that the built static libraries +# (libfd.a, libopcodes.a libiberty.a libsframe.a) use the same LTO version as the one +# that will be used by consumers of GTS binutils. + +%define gcc_package %{?scl_prefix}gcc +%define gxx_package %{?scl_prefix}gcc-c++ + +BuildRequires: %{?scl_prefix}annobin-plugin-gcc + +%define gcc_for_binutils %{_scl_root}/usr/bin/gcc +%define gxx_for_binutils %{_scl_root}/usr/bin/g++ + %endif +BuildRequires: %{gcc_package} +BuildRequires: %{gxx_package} + +%endif + +#---------------------------------------------------------------------------- + %if %{with gold} # Gold needs bison in order to build gold/yyscript.c. The GOLD testsuite needs a static libc++ BuildRequires: bison, m4, libstdc++-static %if ! %{with clang} -# XXX BuildRequires: %%{?scl_prefix}gcc-c++ + +%if %{bootstrapping} BuildRequires: gcc-c++ +%else +BuildRequires: %{?scl_prefix}gcc-c++ +%endif + %endif %endif +#---------------------------------------------------------------------------- + %if %{without bootstrap} + BuildRequires: gettext, flex, jansson-devel + %if %{with systemzlib} BuildRequires: zlib-devel %endif + %endif +#---------------------------------------------------------------------------- + %if %{with docs} + BuildRequires: texinfo >= 4.0 # BZ 920545: We need pod2man in order to build the manual pages. BuildRequires: /usr/bin/pod2man + %else + BuildRequires: findutils + %endif +#---------------------------------------------------------------------------- + +%if %{with testsuite} + # Required for: ld-bootstrap/bootstrap.exp bootstrap with --static # It should not be required for: ld-elf/elf.exp static {preinit,init,fini} array -%if %{with testsuite} # relro_test.sh uses dc which is part of the bc rpm, hence its inclusion here. # sharutils is needed so that we can uuencode the testsuite results. BuildRequires: dejagnu, glibc-static, sharutils, bc, libstdc++ + %if %{with systemzlib} BuildRequires: zlib-devel %endif + %endif +#---------------------------------------------------------------------------- + %if %{with debuginfod} BuildRequires: elfutils-debuginfod-client-devel %endif +#---------------------------------------------------------------------------- + %{?scl:Requires:%scl_runtime} -# XXX %%define alternatives_cmd %%{_sbindir}/alternatives -# XXX %%define alternatives_cmdline %%{alternatives_cmd} +%if %{bootstrapping} +%define alternatives_cmd %{_sbindir}/alternatives +%define alternatives_cmdline %{alternatives_cmd} +%else %define alternatives_cmd %{!?scl:%{_sbindir}}%{?scl:%{_root_sbindir}}/alternatives %define alternatives_cmdline %{alternatives_cmd}%{?scl: --altdir %{_sysconfdir}/alternatives --admindir %{_scl_root}/var/lib/alternatives} +%endif Requires(post): %{alternatives_cmd} Requires(preun): %{alternatives_cmd} @@ -556,8 +602,8 @@ Requires: zlib-devel %endif BuildRequires: autoconf automake perl sed coreutils make findutils -BuildRequires: %{?scl_prefix}gcc -BuildRequires: %{?scl_prefix}gcc-c++ +BuildRequires: %{gcc_package} +BuildRequires: %{gxx_package} ExcludeArch: aarch64-linux-gnu aarch64-redhat-linux @@ -575,8 +621,8 @@ Requires: zlib-devel %endif BuildRequires: autoconf automake perl sed coreutils make findutils -BuildRequires: %{?scl_prefix}gcc -BuildRequires: %{?scl_prefix}gcc-c++ +BuildRequires: %{gcc_package} +BuildRequires: %{gxx_package} ExcludeArch: ppc64le-linux-gnu ppc64le-redhat-linux @@ -594,8 +640,8 @@ Requires: zlib-devel %endif BuildRequires: autoconf automake perl sed coreutils make findutils -BuildRequires: %{?scl_prefix}gcc -BuildRequires: %{?scl_prefix}gcc-c++ +BuildRequires: %{gcc_package} +BuildRequires: %{gxx_package} ExcludeArch: s390x-linux-gnu s390x-redhat-linux @@ -613,8 +659,8 @@ Requires: zlib-devel %endif BuildRequires: autoconf automake perl sed coreutils make findutils -BuildRequires: %{?scl_prefix}gcc -BuildRequires: %{?scl_prefix}gcc-c++ +BuildRequires: %{gcc_package} +BuildRequires: %{gxx_package} ExcludeArch: x86_64-linux-gnu x86_64-redhat-linux i686-linux-gnu i686-redhat-linux @@ -879,8 +925,8 @@ run_target_configuration() else RARGS="--disable-shared" fi - - ../configure --target=$target $CARGS $SARGS $RARGS $TARGS || cat config.log + + CC=%gcc_for_binutils CXX=%gxx_for_binutils ../configure --target=$target $CARGS $SARGS $RARGS $TARGS || cat config.log popd } @@ -897,10 +943,10 @@ build_target() %if %{with docs} # Because of parallel building, info has to be made after all. - %make_build %{_smp_mflags} tooldir=%{_prefix} all - %make_build %{_smp_mflags} tooldir=%{_prefix} info +%make_build %{_smp_mflags} tooldir=%{_prefix} CC=%gcc_for_binutils CXX=%gxx_for_binutils all + %make_build %{_smp_mflags} tooldir=%{_prefix} CC=%gcc_for_binutils CXX=%gxx_for_binutils info %else - %make_build %{_smp_mflags} tooldir=%{_prefix} MAKEINFO=true all + %make_build %{_smp_mflags} tooldir=%{_prefix} CC=%gcc_for_binutils CXX=%gxx_for_binutils MAKEINFO=true all %endif popd @@ -938,14 +984,14 @@ run_tests() # Run the tests and accumulate the logs - but ignore failures... if test x$native == x1 ; then - make -k check-gas check-binutils check-ld < /dev/null || : + make -k CC=%gcc_for_binutils CXX=%gxx_for_binutils check-gas check-binutils check-ld < /dev/null || : %if %{with gold} # The GOLD testsuite always returns an error code, even if no tests fail. - make -k check-gold < /dev/null || : + make -k CC=%gcc_for_binutils CXX=%gxx_for_binutils check-gold < /dev/null || : %endif else # Do not try running linking tests for the cross-binutils. - make -k check-gas check-binutils < /dev/null || : + make -k CC=%gcc_for_binutils CXX=%gxx_for_binutils check-gas check-binutils < /dev/null || : fi for f in {gas/testsuite/gas,ld/ld,binutils/binutils}.sum @@ -988,11 +1034,11 @@ run_tests() # Run the tests and this time fail if there are any errors. if test x$native == x1 ; then - make -k check-gas check-binutils check-ld < /dev/null + make -k CC=%gcc_for_binutils CXX=%gxx_for_binutils check-gas check-binutils check-ld < /dev/null # Ignore the gold tests - they always fail else # Do not try running linking tests for the cross-binutils. - make -k check-gas check-binutils < /dev/null + make -k CC=%gcc_for_binutils CXX=%gxx_for_binutils check-gas check-binutils < /dev/null fi popd @@ -1011,7 +1057,7 @@ run_tests() %define _with_cc_clang 1 %endif -# Disable LTO on arm due to: +# Disable LTO on Arm due to: # https://bugzilla.redhat.com/show_bug.cgi?id=1918924 %ifarch %{arm} %define enable_lto 0 @@ -1081,12 +1127,11 @@ install_binutils() if test x$native == x1 ; then %if %{with docs} - %make_install DESTDIR=%{buildroot} - make prefix=%{buildroot}%{_prefix} infodir=$local_infodir install-info + %make_install CC=%gcc_for_binutils CXX=%gxx_for_binutils DESTDIR=%{buildroot} + make CC=%gcc_for_binutils CXX=%gxx_for_binutils prefix=%{buildroot}%{_prefix} infodir=$local_infodir install-info %else - %make_install DESTDIR=%{buildroot} MAKEINFO=true + %make_install CC=%gcc_for_binutils CXX=%gxx_for_binutils DESTDIR=%{buildroot} MAKEINFO=true %endif - # Rebuild the static libiaries with -fPIC. # It would be nice to build the static libraries with -fno-lto so that # they can be used by programs that are built with a different version @@ -1094,23 +1139,23 @@ install_binutils() # warnings from annocheck. # Future: Remove libiberty together with its header file, projects should bundle it. - %make_build -s -C libiberty clean + %make_build -s -C libiberty CC=%gcc_for_binutils CXX=%gxx_for_binutils clean %set_build_flags - %make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libiberty + %make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libiberty CC=%gcc_for_binutils CXX=%gxx_for_binutils # Without the hidden visibility the 3rd party shared libraries would export # the bfd non-stable ABI. - %make_build -s -C bfd clean + %make_build -s -C bfd CC=%gcc_for_binutils CXX=%gxx_for_binutils clean %set_build_flags - %make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS -fvisibility=hidden" -C bfd + %make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS -fvisibility=hidden" -C bfd CC=%gcc_for_binutils CXX=%gxx_for_binutils - %make_build -s -C opcodes clean + %make_build -s -C opcodes clean CC=%gcc_for_binutils CXX=%gxx_for_binutils %set_build_flags - %make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C opcodes + %make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C opcodes CC=%gcc_for_binutils CXX=%gxx_for_binutils - %make_build -s -C libsframe clean + %make_build -s -C libsframe clean CC=%gcc_for_binutils CXX=%gxx_for_binutils %set_build_flags - %make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libsframe + %make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libsframe CC=%gcc_for_binutils CXX=%gxx_for_binutils install -m 644 bfd/.libs/libbfd.a $local_libdir install -m 644 libiberty/libiberty.a $local_libdir @@ -1187,7 +1232,7 @@ EOH local target_root=$local_root/$target - %make_install DESTDIR=%{buildroot} MAKEINFO=true + %make_install DESTDIR=%{buildroot} MAKEINFO=true CC=%gcc_for_binutils CXX=%gxx_for_binutils fi # This one comes from gcc @@ -1271,7 +1316,7 @@ exit 0 # RHEL-22818: Restire the SELinux context of the gprofng libraries. restorecon -R %{_libdir} # And the rc file. -restorecon /opt/rh/gcc-toolset-14/root/usr/etc/gprofng.rc +restorecon %{_scl_root}/etc/gprofng.rc exit 0 %endif @@ -1416,7 +1461,7 @@ exit 0 %dir %{_libdir}/gprofng %{_libdir}/gprofng/* # FIXME: Work out the correct way to specify this file: -/opt/rh/gcc-toolset-14/root/etc/gprofng.rc +%{_scl_root}/etc/gprofng.rc %endif %if %{with crossbuilds} @@ -1449,6 +1494,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Fri Aug 16 2024 Nick Clifton - 2.41-3 +- NVR Bump to allow rebuilding with GTS-14 gcc. (RHEL-53519) + * Tue Apr 30 2024 Nick Clifton - 2.41-2 - Fix s390x testsuite errors to allow building for RHEL-8. (RHEL-30410)