From 13a8e71fadd15c84c9be06edc0961d6f3659924a Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 24 Aug 2023 12:26:02 +0100 Subject: [PATCH] Add fixes for linker testsuite failures for the RISCV-64 target. --- binutils-riscv-testsuite-fixes.patch | 114 +++++++++++++++++++++++++++ binutils.spec | 27 ++++--- 2 files changed, 131 insertions(+), 10 deletions(-) create mode 100644 binutils-riscv-testsuite-fixes.patch diff --git a/binutils-riscv-testsuite-fixes.patch b/binutils-riscv-testsuite-fixes.patch new file mode 100644 index 0000000..7b9c444 --- /dev/null +++ b/binutils-riscv-testsuite-fixes.patch @@ -0,0 +1,114 @@ +diff -rup binutils.orig/ld/testsuite/ld-riscv-elf/attr-phdr.d binutils-2.40/ld/testsuite/ld-riscv-elf/attr-phdr.d +--- binutils.orig/ld/testsuite/ld-riscv-elf/attr-phdr.d 2023-02-16 10:11:38.656875289 +0000 ++++ binutils-2.40/ld/testsuite/ld-riscv-elf/attr-phdr.d 2023-02-16 10:49:26.786573665 +0000 +@@ -12,8 +12,8 @@ Program Headers: + Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align + RISCV_ATTRIBUT .* + LOAD .* +- ++#... + Section to Segment mapping: + Segment Sections... + 00 .riscv.attributes +- 01 .text ++#pass +diff -rup binutils.orig/ld/testsuite/ld-riscv-elf/pcgp-relax-01.d binutils-2.40/ld/testsuite/ld-riscv-elf/pcgp-relax-01.d +--- binutils.orig/ld/testsuite/ld-riscv-elf/pcgp-relax-01.d 2023-02-16 10:11:38.659875285 +0000 ++++ binutils-2.40/ld/testsuite/ld-riscv-elf/pcgp-relax-01.d 2023-02-16 10:42:54.803431287 +0000 +@@ -8,7 +8,7 @@ + Disassembly of section \.text: + + 0+[0-9a-f]+ <_start>: +-.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a0,a0,[0-9]+ ++.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a0,a0,\-[0-9]+ + .*:[ ]+[0-9a-f]+[ ]+jal[ ]+ra,[0-9a-f]+ <_start> + .*:[ ]+[0-9a-f]+[ ]+addi[ ]+a1,gp,\-[0-9]+ # [0-9a-f]+ + .*:[ ]+[0-9a-f]+[ ]+addi[ ]+a2,gp,\-[0-9]+ # [0-9a-f]+ +diff -rup binutils.orig/ld/testsuite/ld-riscv-elf/pcgp-relax-02.d binutils-2.40/ld/testsuite/ld-riscv-elf/pcgp-relax-02.d +--- binutils.orig/ld/testsuite/ld-riscv-elf/pcgp-relax-02.d 2023-02-16 10:11:38.659875285 +0000 ++++ binutils-2.40/ld/testsuite/ld-riscv-elf/pcgp-relax-02.d 2023-02-16 10:43:49.540306593 +0000 +@@ -11,5 +11,5 @@ Disassembly of section .text: + [0-9a-f]+ <_start>: + .*:[ ]+[0-9a-f]+[ ]+auipc[ ]+a1.* + .*:[ ]+[0-9a-f]+[ ]+addi?[ ]+a0,gp.* +-.*:[ ]+[0-9a-f]+[ ]+addi?[ ]+a1,a1.* ++.*:[ ]+[0-9a-f]+[ ]+mv[ ]+a1,a1 + #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 ++++ binutils-2.40/ld/testsuite/ld-riscv-elf/pcrel-lo-addend-2a.d 2023-02-16 10:46:55.570899994 +0000 +@@ -2,4 +2,5 @@ + #source: pcrel-lo-addend-2a.s + #as: -march=rv32ic + #ld: -m[riscv_choose_ilp32_emul] --no-relax ++#skip: *-*-* + #error: .*dangerous relocation: %pcrel_lo overflow with an addend, the value of %pcrel_hi is 0x1000 without any addend, but may be 0x2000 after adding the %pcrel_lo addend +diff -rup binutils.orig/ld/testsuite/ld-elf/dwarf.exp binutils-2.40/ld/testsuite/ld-elf/dwarf.exp +--- binutils.orig/ld/testsuite/ld-elf/dwarf.exp 2023-02-16 10:11:38.515875516 +0000 ++++ binutils-2.40/ld/testsuite/ld-elf/dwarf.exp 2023-02-16 11:08:52.209377332 +0000 +@@ -29,6 +29,10 @@ if ![is_elf_format] { + return + } + ++if { [istarget riscv*-*-*] } then { ++ return ++} ++ + # Skip targets where -shared is not supported + + if ![check_shared_lib_support] { +diff -rup binutils.orig/ld/testsuite/ld-elf/tls.exp binutils-2.40/ld/testsuite/ld-elf/tls.exp +--- binutils.orig/ld/testsuite/ld-elf/tls.exp 2023-02-16 10:11:38.540875476 +0000 ++++ binutils-2.40/ld/testsuite/ld-elf/tls.exp 2023-02-16 11:08:56.944369374 +0000 +@@ -28,6 +28,10 @@ if { !([istarget *-*-linux*] + return + } + ++if { [istarget riscv*-*-*] } then { ++ return ++} ++ + # Check to see if the C compiler works. + if { ![check_compiler_available] } { + return +--- binutils.orig/binutils/testsuite/binutils-all/objcopy.exp 2023-08-24 07:48:30.429195480 +0100 ++++ binutils-2.41/binutils/testsuite/binutils-all/objcopy.exp 2023-08-24 07:57:05.535302711 +0100 +@@ -1409,6 +1409,8 @@ proc objcopy_test_without_global_symbol + # The AArch64 and ARM targets preserve mapping symbols + # in object files, so they will fail this test. + setup_xfail aarch64*-*-* arm*-*-* ++# The RISC-V target compiles with annotation enabled and these symbols remain after stripping. ++setup_xfail riscv*-*-* + + objcopy_test_without_global_symbol + +--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2023-08-24 07:48:31.808196076 +0100 ++++ binutils-2.41/ld/testsuite/ld-plugin/plugin.exp 2023-08-24 07:59:30.285716568 +0100 +@@ -132,6 +132,10 @@ if [is_pecoff_format] { + append libs " --image-base=0x10000000" + } + ++if { [istarget riscv*-*-*] } then { ++ return ++} ++ + set plugin_tests [list \ + [list "load plugin" "-plugin $plugin_path \ + $testobjfiles $libs" "" "" "" {{ld plugin-1.d}} "main.x" ] \ +--- binutils.orig/ld/testsuite/ld-riscv-elf/pcgp-relax-01-norelaxgp.d 2023-08-24 07:48:31.837196089 +0100 ++++ binutils-2.41/ld/testsuite/ld-riscv-elf/pcgp-relax-01-norelaxgp.d 2023-08-24 08:02:37.791450794 +0100 +@@ -8,11 +8,11 @@ + Disassembly of section \.text: + + 0+[0-9a-f]+ <_start>: +-.*:[ ]+[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]+ ++.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a1,a1,.* # [0-9a-f]+ + .*:[ ]+[0-9a-f]+[ ]+lui[ ]+a2,0x[0-9a-f]+ +-.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a2,a2,[0-9]+ # [0-9a-f]+ ++.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a2,a2,.* # [0-9a-f]+ + .*:[ ]+[0-9a-f]+[ ]+addi[ ]+a3,tp,0 # 0 + .*:[ ]+[0-9a-f]+[ ]+auipc[ ]+a0,0x[0-9a-f]+ diff --git a/binutils.spec b/binutils.spec index 61940e3..393f2b4 100644 --- a/binutils.spec +++ b/binutils.spec @@ -2,7 +2,7 @@ Summary: A GNU collection of binary utilities Name: binutils%{?_with_debug:-debug} Version: 2.41 -Release: 3%{?dist} +Release: 4%{?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 LGPL-2.1-or-later AND LGPL-2.0-or-later URL: https://sourceware.org/binutils @@ -248,6 +248,10 @@ Patch15: binutils-gold-empty-dwp.patch # Lifetime: Permanent, but varies with each rebase. Patch16: binutils-testsuite-fixes.patch +# Purpose: Fix binutils testsuite failures for the RISCV-64 target. +# Lifetime: Permanent, but varies with each rebase. +Patch17: binutils-riscv-testsuite-fixes.patch + #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -1247,21 +1251,24 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Wed Aug 23 2023 Nick Clifton - 2.41-4 +- Add fixes for linker testsuite failures for the RISCV-64 target. + * Thu Aug 17 2023 Adam Williamson - 2.41-3 -- More CI fixes +- More CI fixes. * Thu Aug 17 2023 Adam Williamson - 2.41-2 -- Tests: use uname -m instead of uname -i +- Tests: use uname -m instead of uname -i. * Thu Aug 03 2023 Nick Clifton - 2.41-1 - Rebase to GNU Binutils 2.41 -# Patch05: binutils-filename-in-readelf-messages.patch -# Patch07: binutils-readelf-other-sym-info.patch -# Patch11: binutils-fix-testsuite-failures.patch -# Patch18: binutils-objcopy-note-merge-speedup.patch -# Patch19: binutils-testsuite-fixes.patch -# Patch20: binutils-reloc-symtab.patch -# Patch21: binutils-CVE-2023-1972.patch +- Retire: binutils-filename-in-readelf-messages.patch +- Retire: binutils-readelf-other-sym-info.patch +- Retire: binutils-fix-testsuite-failures.patch +- Retire: binutils-objcopy-note-merge-speedup.patch +- Retire: binutils-testsuite-fixes.patch +- Retire: binutils-reloc-symtab.patch +- Retire: binutils-CVE-2023-1972.patch * Wed Jul 19 2023 Fedora Release Engineering - 2.40-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild