Add bison to BuildRequires for RISC-V

Disable LTO for RISC-V

Disable testsuite for RISC-V
This commit is contained in:
Andrew Lukoshko 2025-11-11 21:53:21 +00:00 committed by root
commit 99c3d2c86a
6 changed files with 604 additions and 618 deletions

View File

@ -1,22 +0,0 @@
--- binutils.orig/ld/ldlang.c 2024-07-30 16:10:24.931862075 +0100
+++ binutils-2.41/ld/ldlang.c 2024-07-30 19:11:58.741929934 +0100
@@ -7940,6 +7940,19 @@ lang_list_remove_tail (lang_statement_li
{
union lang_statement_union **savetail;
/* Check that ORIGLIST really is an earlier state of DESTLIST. */
+
+ if (getenv ("LD_DEBUG_NEVER") != NULL)
+ {
+ /* FIXME: RHEL-49348: For some reason building this function for the
+ PowerPC architecture on RHEL-10 is resulting in a linker that
+ triggers the ASSERT below - because the origlist pointer is
+ corrupt. These fprintf statements, even if they will never be
+ used, are enough to cause the compiler to build the function
+ correctly, thus avoiding the problem. */
+ fprintf (stderr, "origlist %p destlist %p\n", origlist, destlist);
+ fprintf (stderr, "heads: %p %p\n", origlist->head, destlist->head);
+ }
+
ASSERT (origlist->head == destlist->head);
savetail = origlist->tail;
origlist->head = *(savetail);

View File

@ -0,0 +1,22 @@
# commit d1458933830456e54223d9fc61f0d9b3a19256f5
# tree 98864afbaa67a592824cc9f0c846bce8efde33c9 tree
# parent 6fe4e5bd10b996428a557e036c07c5839a8e0a49 commit | diff
# PR32858 ld segfault on fuzzed object
#
# We missed one place where it is necessary to check for empty groups.
#
# PR 32858
# * elflink.c (elf_gc_sweep): Protect against empty group.
--- binutils.orig/bfd/elflink.c 2025-06-30 15:59:11.706908490 +0100
+++ binutils-2.41/bfd/elflink.c 2025-06-30 16:00:32.282299523 +0100
@@ -14115,7 +14115,8 @@ elf_gc_sweep (bfd *abfd, struct bfd_link
if (o->flags & SEC_GROUP)
{
asection *first = elf_next_in_group (o);
- o->gc_mark = first->gc_mark;
+ if (first != NULL)
+ o->gc_mark = first->gc_mark;
}
if (o->gc_mark)

View File

@ -20,7 +20,7 @@ diff -rup binutils.orig/ld/testsuite/ld-riscv-elf/pcgp-relax-01.d binutils-2.40/
0+[0-9a-f]+ <_start>:
-.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a0,a0,[0-9]+
+.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a0,a0,\-[0-9]+
+.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a0,a0,.*
.*:[ ]+[0-9a-f]+[ ]+jal[ ]+ra,[0-9a-f]+ <_start>
.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a1,gp,\-[0-9]+ # [0-9a-f]+ <data_g>
.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a2,gp,\-[0-9]+ # [0-9a-f]+ <data_g>
@ -32,7 +32,7 @@ diff -rup binutils.orig/ld/testsuite/ld-riscv-elf/pcgp-relax-02.d binutils-2.40/
.*:[ ]+[0-9a-f]+[ ]+auipc[ ]+a1.*
.*:[ ]+[0-9a-f]+[ ]+addi?[ ]+a0,gp.*<data_a>
-.*:[ ]+[0-9a-f]+[ ]+addi?[ ]+a1,a1.*<data_b>
+.*:[ ]+[0-9a-f]+[ ]+mv[ ]+a1,a1
+.*:[ ]+[0-9a-f]+[ ]+.*
#pass
diff -rup binutils.orig/ld/testsuite/ld-riscv-elf/pcrel-lo-addend-2a.d binutils-2.40/ld/testsuite/ld-riscv-elf/pcrel-lo-addend-2a.d
--- binutils.orig/ld/testsuite/ld-riscv-elf/pcrel-lo-addend-2a.d 2023-02-16 10:11:38.659875285 +0000
@ -115,11 +115,11 @@ diff -rup binutils.orig/ld/testsuite/ld-elf/tls.exp binutils-2.40/ld/testsuite/l
0+[0-9a-f]+ <_start>:
-.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a0,a0,[0-9]+
+.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a0,a0,\-[0-9]+
+.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a0,a0,.*
.*:[ ]+[0-9a-f]+[ ]+jal[ ]+ra,[0-9a-f]+ <_start>
.*:[ ]+[0-9a-f]+[ ]+auipc[ ]+a1,0x[0-9a-f]+
-.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a1,a1,[0-9]+ # [0-9a-f]+ <data_g>
+.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a1,a1,\-[0-9]+ # [0-9a-f]+ <data_g>
+.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a1,a1,.*
.*:[ ]+[0-9a-f]+[ ]+lui[ ]+a2,0x[0-9a-f]+
.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a2,a2,[0-9]+ # [0-9a-f]+ <data_g>
.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a3,tp,0 # 0 <data_t>

View File

@ -0,0 +1,63 @@
diff -rup binutils.orig/gas/config/tc-s390.c binutils-2.41/gas/config/tc-s390.c
--- binutils.orig/gas/config/tc-s390.c 2025-04-15 15:07:06.478139437 +0100
+++ binutils-2.41/gas/config/tc-s390.c 2025-04-15 15:07:25.647687210 +0100
@@ -295,7 +295,7 @@ s390_parse_cpu (const char *arg,
S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX },
{ STRING_COMMA_LEN ("z16"), STRING_COMMA_LEN ("arch14"),
S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX },
- { STRING_COMMA_LEN (""), STRING_COMMA_LEN ("arch15"),
+ { STRING_COMMA_LEN ("z17"), STRING_COMMA_LEN ("arch15"),
S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX }
};
static struct
Only in binutils-2.41/gas/config: tc-s390.c.orig
diff -rup binutils.orig/gas/doc/as.texi binutils-2.41/gas/doc/as.texi
--- binutils.orig/gas/doc/as.texi 2025-04-15 15:07:06.488139463 +0100
+++ binutils-2.41/gas/doc/as.texi 2025-04-15 15:07:25.648222663 +0100
@@ -1938,7 +1938,8 @@ Specify which s390 processor variant is
@samp{arch6}), @samp{z9-109}, @samp{z9-ec} (or @samp{arch7}), @samp{z10} (or
@samp{arch8}), @samp{z196} (or @samp{arch9}), @samp{zEC12} (or @samp{arch10}),
@samp{z13} (or @samp{arch11}), @samp{z14} (or @samp{arch12}), @samp{z15}
-(or @samp{arch13}), @samp{z16} (or @samp{arch14}), or @samp{arch15}.
+(or @samp{arch13}), @samp{z16} (or @samp{arch14}), or @samp{z17} (or
+@samp{arch15}).
@item -mregnames
@itemx -mno-regnames
Allow or disallow symbolic names for registers.
Only in binutils-2.41/gas/doc: as.texi.orig
diff -rup binutils.orig/gas/doc/c-s390.texi binutils-2.41/gas/doc/c-s390.texi
--- binutils.orig/gas/doc/c-s390.texi 2025-04-15 15:07:06.488139463 +0100
+++ binutils-2.41/gas/doc/c-s390.texi 2025-04-15 15:07:25.648670969 +0100
@@ -18,7 +18,8 @@ and eleven chip levels. The architecture
Architecture (ESA) and the newer z/Architecture mode. The chip levels
are g5 (or arch3), g6, z900 (or arch5), z990 (or arch6), z9-109, z9-ec
(or arch7), z10 (or arch8), z196 (or arch9), zEC12 (or arch10), z13
-(or arch11), z14 (or arch12), z15 (or arch13), z16 (or arch14), or arch15.
+(or arch11), z14 (or arch12), z15 (or arch13), z16 (or arch14), or
+z17 (arch15).
@menu
* s390 Options:: Command-line Options.
@@ -73,7 +74,7 @@ are recognized:
@code{z14} (or @code{arch12}),
@code{z15} (or @code{arch13}),
@code{z16} (or @code{arch14}), and
-@code{arch15}.
+@code{z17} (or @code{arch15}).
Assembling an instruction that is not supported on the target
processor results in an error message.
diff -rup binutils.orig/opcodes/s390-mkopc.c binutils-2.41/opcodes/s390-mkopc.c
--- binutils.orig/opcodes/s390-mkopc.c 2025-04-15 15:07:07.711142709 +0100
+++ binutils-2.41/opcodes/s390-mkopc.c 2025-04-15 15:07:25.648816426 +0100
@@ -384,7 +384,8 @@ main (void)
else if (strcmp (cpu_string, "z16") == 0
|| strcmp (cpu_string, "arch14") == 0)
min_cpu = S390_OPCODE_ARCH14;
- else if (strcmp (cpu_string, "arch15") == 0)
+ else if (strcmp (cpu_string, "z17") == 0
+ || strcmp (cpu_string, "arch15") == 0)
min_cpu = S390_OPCODE_ARCH15;
else {
fprintf (stderr, "Couldn't parse cpu string %s\n", cpu_string);
Only in binutils-2.41/opcodes: s390-mkopc.c.orig

View File

@ -2,7 +2,7 @@
Summary: A GNU collection of binary utilities
Name: binutils%{?_with_debug:-debug}
Version: 2.41
Release: 53%{?dist}.alma.1
Release: 58%{?dist}.alma.1
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
@ -77,8 +77,8 @@ URL: https://sourceware.org/binutils
# configurable in case there is ever a need to disable thread support.
%define enable_threading 1
# Enable the use of separate code and data segments for all architectures,
# not just x86/x86_64.
# Separate code is disabled on all architectures by default. Individual
# packages can decide to enable it if they want to.
%define enable_separate_code 0
#----End of Configure Options------------------------------------------------
@ -378,20 +378,24 @@ Patch58: binutils-Intel-APX-part-1-extra-relocs.patch
# Lifetime: Fixed in 2.45
Patch59: binutils-aarch64-small-plt0.patch
#----------------------------------------------------------------------------
# Purpose: Adds z17 as a cpu name for the s390x architecture.
# Lifetime: Fixed in 2.45
Patch60: binutils-s390-z17-cpu-name.patch
# Purpose: Workaround for an unresolved bug in ppc gcc
# which generates bad code in the linker. cf RHEL-49348
# Lifetime: TEMPORARY
Patch98: bin.ppc64.gcc.patch
# Purpose: Add basic support for RISC-V 64-bit EFI objects.
# Lifetime: Fixed in 2.42
Patch61: binutils-riscv-efi.patch
# Purpose: Fix a potential NULL pointer dereference when parsing a corrupt ELF file.
# Lifetime: Fixed in 2.45
Patch62: binutils-CVE-2025-5244.patch
#----------------------------------------------------------------------------
# Purpose: Suppress the x86 linker's p_align-1 tests due to kernel bug on CentOS-10
# Lifetime: TEMPORARY
Patch99: binutils-suppress-ld-align-tests.patch
# AlmaLinux Patch
Patch100: 0001-Add-basic-support-for-RISC-V-64-bit-EFI-objects.patch
#----------------------------------------------------------------------------
Provides: bundled(libiberty)
@ -406,6 +410,10 @@ Provides: bundled(libiberty)
# Perl, sed and touch are all used in the %%prep section of this spec file.
BuildRequires: autoconf, automake, perl, sed, coreutils, make
# bison is used to generate either gold/yyscript.c or ld/ldgram.c depending
# on the build architecture.
BuildRequires: bison
%if %{with clang}
BuildRequires: clang compiler-rt
%else
@ -413,8 +421,8 @@ BuildRequires: gcc
%endif
%if %{with gold}
# Gold needs bison in order to build gold/yyscript.c. The GOLD testsuite needs a static libc++
BuildRequires: bison, m4, gcc-c++, libstdc++-static
# The GOLD testsuite needs a static libc++
BuildRequires: libstdc++-static
%if ! %{with clang}
BuildRequires: gcc-c++
@ -556,7 +564,6 @@ linker, and it may become deprecated in the future.
Summary: Next Generating code profiling tool
Provides: gprofng = %{version}-%{release}
Requires: binutils = %{version}-%{release}
BuildRequires: bison
%description gprofng
GprofNG is the GNU Next Generation Profiler for analyzing the performance
@ -1429,11 +1436,27 @@ exit 0
#----------------------------------------------------------------------------
%changelog
* Wed May 14 2025 Andrew Lukoshko <alukoshko@almalinux.org> - 2.41-53.alma.1
* Tue Nov 11 2025 Andrew Lukoshko <alukoshko@almalinux.org> - 2.41-58.alma.1
- Add bison to BuildRequires for RISC-V
- Disable LTO for RISC-V
- Disable testsuite for RISC-V
- Add basic support for RISC-V 64-bit EFI objects (backported from 2.44)
* Wed Aug 06 2025 Nick Clifton <nickc@redhat.com> - 2.41-58
- Remove workaround for CVE-2025-5702. (RHEL-100159)
* Mon Jun 30 2025 Nick Clifton <nickc@redhat.com> - 2.41-57
- Add fix for CVE-2025-5244. (RHEL-100417)
- USe correct fix for CVE-2025-5702. (RHEL-100159)
* Mon Apr 28 2025 Andrea Bolognani <abologna@redhat.com> - 2.41-56
- Add basic support for RISC-V 64-bit EFI objects. (RHEL-88815)
* Tue Apr 15 2025 Nick Clifton <nickc@redhat.com> - 2.41-55
- Adds z17 as a cpu name for the s390x architecture. (RHEL-87215)
* Wed Apr 02 2025 Andrea Bolognani <abologna@redhat.com> - 2.41-54
- Fix BuildRequires for non-gold architectures. (RHEL-85855)
- Fix RISC-V ld testsuite failures (thanks Nick Clifton). (RHEL-85855)
* Fri Feb 07 2025 Nick Clifton <nickc@redhat.com> - 2.41-53
- Fix seg-fault in AArch64 linker when building u-boot. (RHEL-78233)