Compare commits

1 Commits
main ... 1.1

8 changed files with 137 additions and 165 deletions

View File

@@ -16,7 +16,6 @@
<flavor>spu</flavor>
<flavor>avr</flavor>
<flavor>pru</flavor>
<flavor>loongarch64</flavor>
<flavor>mips</flavor>
<flavor>m68k</flavor>
<flavor>epiphany</flavor>

View File

@@ -0,0 +1,56 @@
Change default common-page-size to 64K on aarch64. This enables the use
of RELRO since we are using 64K pages.
Index: binutils-2.41/bfd/elfnn-aarch64.c
===================================================================
--- binutils-2.41.orig/bfd/elfnn-aarch64.c 2023-07-03 01:00:00.000000000 +0200
+++ binutils-2.41/bfd/elfnn-aarch64.c 2023-08-16 16:31:51.238779641 +0200
@@ -10251,7 +10251,7 @@ const struct elf_size_info elfNN_aarch64
#define ELF_ARCH bfd_arch_aarch64
#define ELF_MACHINE_CODE EM_AARCH64
#define ELF_MAXPAGESIZE 0x10000
-#define ELF_COMMONPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x10000
#define bfd_elfNN_bfd_free_cached_info \
elfNN_aarch64_bfd_free_cached_info
Index: binutils-2.41/gold/aarch64.cc
===================================================================
--- binutils-2.41.orig/gold/aarch64.cc 2023-07-03 01:00:00.000000000 +0200
+++ binutils-2.41/gold/aarch64.cc 2023-08-16 16:28:35.959450565 +0200
@@ -3555,7 +3555,7 @@ const Target::Target_info Target_aarch64
"/lib/ld.so.1", // program interpreter
0x400000, // default_text_segment_address
0x10000, // abi_pagesize (overridable by -z max-page-size)
- 0x1000, // common_pagesize (overridable by -z common-page-size)
+ 0x10000, // common_pagesize (overridable by -z common-page-size)
false, // isolate_execinstr
0, // rosegment_gap
elfcpp::SHN_UNDEF, // small_common_shndx
@@ -3584,7 +3584,7 @@ const Target::Target_info Target_aarch64
"/lib/ld.so.1", // program interpreter
0x400000, // default_text_segment_address
0x10000, // abi_pagesize (overridable by -z max-page-size)
- 0x1000, // common_pagesize (overridable by -z common-page-size)
+ 0x10000, // common_pagesize (overridable by -z common-page-size)
false, // isolate_execinstr
0, // rosegment_gap
elfcpp::SHN_UNDEF, // small_common_shndx
@@ -3613,7 +3613,7 @@ const Target::Target_info Target_aarch64
"/lib/ld.so.1", // program interpreter
0x400000, // default_text_segment_address
0x10000, // abi_pagesize (overridable by -z max-page-size)
- 0x1000, // common_pagesize (overridable by -z common-page-size)
+ 0x10000, // common_pagesize (overridable by -z common-page-size)
false, // isolate_execinstr
0, // rosegment_gap
elfcpp::SHN_UNDEF, // small_common_shndx
@@ -3642,7 +3642,7 @@ const Target::Target_info Target_aarch64
"/lib/ld.so.1", // program interpreter
0x400000, // default_text_segment_address
0x10000, // abi_pagesize (overridable by -z max-page-size)
- 0x1000, // common_pagesize (overridable by -z common-page-size)
+ 0x10000, // common_pagesize (overridable by -z common-page-size)
false, // isolate_execinstr
0, // rosegment_gap
elfcpp::SHN_UNDEF, // small_common_shndx

BIN
binutils-2.43-branch.diff.gz (Stored with Git LFS)

Binary file not shown.

View File

@@ -1,22 +0,0 @@
This is used to manually patch the bison generated files when
the binutils-X.YZ-branch.diff touches them. That diff is generated
directly from git and doesn't contain the generated .c/h files.
The base tarball does contain them, but generated from the unpatched state.
In SLE12 and older we can't regenerate them due to too old versions
of flex and bison.
So, when the branch diff _does_ touch them we need to do the regeneration
via such a manual patch.
Index: binutils-2.43/ld/ldgram.c
===================================================================
--- binutils-2.43.orig/ld/ldgram.c 2024-08-04 01:00:00.000000000 +0200
+++ binutils-2.43/ld/ldgram.c 2024-12-09 16:41:08.089715376 +0100
@@ -2839,7 +2839,7 @@ yyreduce:
case 73: /* ifile_p1: SEARCH_DIR '(' filename ')' */
#line 324 "ldgram.y"
- { ldfile_add_library_path ((yyvsp[-1].name), search_dir_linker_script); }
+ { ldfile_add_library_path ((yyvsp[-1].name), false); }
#line 2844 "ldgram.c"
break;

View File

@@ -1,70 +1,3 @@
-------------------------------------------------------------------
Thu Jul 10 05:26:01 UTC 2025 - Bernhard Wiedemann <bwiedemann@suse.com>
- Skip PGO with %want_reproducible_builds (boo#1040589)
-------------------------------------------------------------------
Wed Jun 18 09:30:37 UTC 2025 - Andreas Schwab <schwab@suse.de>
- pr33029.patch: Fix crash in assembler with -gdwarf-5
-------------------------------------------------------------------
Tue Jun 3 09:07:07 UTC 2025 - Andreas Schwab <schwab@suse.de>
- Drop aarch64-common-pagesize.patch, aarch64 no longer uses 64K page size
-------------------------------------------------------------------
Tue May 6 14:33:48 UTC 2025 - Michael Matz <matz@suse.com>
- Add -std=gnu17 to move gcc15 forward, as temporary measure until
the binutils version can be updated [bsc#1241916].
-------------------------------------------------------------------
Thu Feb 13 09:39:06 UTC 2025 - Richard Biener <rguenther@suse.com>
- Do not build binutils-gold for SLFO.
-------------------------------------------------------------------
Fri Jan 10 08:54:55 UTC 2025 - JS <obs.coke518@passinbox.com>
- Enable multitarget build on loongarch64
-------------------------------------------------------------------
Tue Dec 17 14:09:54 UTC 2024 - Andreas Schwab <schwab@suse.de>
- Unset SUSE_ZNOW while running testsuite, many tests cannot cope
-------------------------------------------------------------------
Mon Dec 9 14:49:46 UTC 2024 - Michael Matz <matz@suse.com>
- Update to current 2.43.1 branch [PED-10254, PED-10306]:
* s390 - Add arch15 instructions
* various fixes from upstream: PR32153, PR32171, PR32189,
PR32196, PR32191, PR32109, PR32372, PR32387
- Adjusted binutils-2.43-branch.diff.gz.
- Disable zstd-by-default again (needs adjustments in at least
golang,llvm15,llvm17 first)
- Add binutils-fix-branch.diff.
- Check non-changing of flex/bison inputs only after applying
branch and fix-branch diffs.
-------------------------------------------------------------------
Wed Nov 20 14:59:28 UTC 2024 - Jiri Slaby <jslaby@suse.cz>
- drop ld-relro.diff (relro is the default for some time)
and it warns on avr spuriously (bsc#1233520)
-------------------------------------------------------------------
Mon Nov 18 18:12:05 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Add loongarch64 as new target
-------------------------------------------------------------------
Tue Sep 10 05:25:27 UTC 2024 - Martin Liška <martin.liska@hey.com>
- Enable zstd compression algorithm (instead of zlib)
for debug info sections by default.
-------------------------------------------------------------------
Wed Aug 28 13:18:28 UTC 2024 - Michael Matz <matz@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package binutils
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -99,12 +99,12 @@ Release: 0
%define make_check_handling false
%endif
# handle all binary object formats supported by SUSE (and a few more)
%ifarch %ix86 %arm aarch64 ia64 ppc ppc64 ppc64le riscv64 s390 s390x x86_64 %x86_64 loongarch64
%ifarch %ix86 %arm aarch64 ia64 ppc ppc64 ppc64le riscv64 s390 s390x x86_64 %x86_64
%define build_multitarget 1
%else
%define build_multitarget 0
%endif
%define target_list aarch64 alpha armv5l armv6l armv7l armv8l avr pru epiphany hppa hppa64 i686 ia64 loongarch64 m68k mips powerpc powerpc64 powerpc64le riscv64 rx s390 s390x sh4 sparc sparc64 x86_64 xtensa
%define target_list aarch64 alpha armv5l armv6l armv7l armv8l avr pru epiphany hppa hppa64 i686 ia64 m68k mips powerpc powerpc64 powerpc64le riscv64 rx s390 s390x sh4 sparc sparc64 x86_64 xtensa
%define build_gprofng 0
@@ -132,17 +132,18 @@ Source2: binutils-%{version}.tar.bz2.sig
Source3: binutils.keyring
Source4: baselibs.conf
Patch1: binutils-2.43-branch.diff.gz
Patch2: binutils-fix-branch.diff
Patch3: binutils-skip-rpaths.patch
Patch4: s390-biarch.diff
Patch5: x86-64-biarch.patch
Patch6: unit-at-a-time.patch
Patch8: ld-relro.diff
Patch9: testsuite.diff
Patch10: enable-targets-gold.diff
Patch12: s390-pic-dso.diff
Patch14: binutils-build-as-needed.diff
Patch15: binutils-znow.patch
Patch22: binutils-bfd_h.patch
Patch34: aarch64-common-pagesize.patch
Patch37: binutils-revert-plt32-in-branches.diff
Patch38: binutils-fix-invalid-op-errata.diff
Patch39: binutils-revert-nm-symversion.diff
@@ -152,7 +153,6 @@ Patch42: binutils-compat-old-behaviour.diff
Patch43: binutils-revert-hlasm-insns.diff
Patch44: binutils-revert-rela.diff
Patch60: binutils-disable-code-arch-error.diff
Patch61: pr33029.patch
Patch90: cross-avr-nesc-as.patch
Patch92: cross-avr-omit_section_dynsym.patch
Patch93: cross-avr-size.patch
@@ -178,8 +178,7 @@ Requires: alts
%else
PreReq: update-alternatives
%endif
# We want gold for SLE15 and (newer) openSUSE, but not SLE16
%if 0%{!?cross:1} && 0%{?suse_version} >= 1310 && ( 0%{?suse_version} < 1600 || 0%{?is_opensuse} )
%if 0%{!?cross:1} && 0%{?suse_version} >= 1310
%define gold_archs %ix86 aarch64 %arm x86_64 %x86_64 ppc ppc64 ppc64le s390x %sparc
%endif
@@ -246,29 +245,26 @@ The next generation profiling tool for Linux
echo "make check will return with %{make_check_handling} in case of testsuite failures."
%setup -q -n binutils-%{version}
# Patch is outside test_vanilla because it's supposed to be the
# patch bringing the tarball to the newest upstream version
%patch -P 1 -p1
%patch -P 2 -p1
# Backup flex and biscon files for later verification. Do this
# after branch and fix-branch patches are applied (which are assumed
# to manual fixup generated files, in case the branch diff touches
# the flex/bison source files)
# Backup flex and biscon files for later verification.
cp ld/ldlex.l ld/ldlex.l.orig
cp ld/ldgram.y ld/ldgram.y.orig
# Patch is outside test_vanilla because it's supposed to be the
# patch bringing the tarball to the newest upstream version
%patch -P 1 -p1
%if !%{test_vanilla}
%patch -P 3 -p1
%patch -P 4
%patch -P 5
%patch -P 6
%patch -P 8
%patch -P 9
%patch -P 10
%patch -P 12
%patch -P 14
%patch -P 15
%patch -P 22
%patch -P 34 -p1
%if %{suse_version} < 1550
%patch -P 37 -p1
%endif
@@ -282,7 +278,6 @@ cp ld/ldgram.y ld/ldgram.y.orig
%patch -P 44 -p1
%endif
%patch -P 60 -p1
%patch -P 61 -p1
%if "%{TARGET}" == "avr"
cp gas/config/tc-avr.h gas/config/tc-avr-nesc.h
%patch -P 90
@@ -303,14 +298,6 @@ diff -u ld/ldgram.y ld/ldgram.y.orig
sed -i -e '/BFD_VERSION_DATE/s/$/-%(echo %release | sed 's/\.[0-9]*$//')/' bfd/version.h
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error"
# gcc15 and up default to c23, these older binutils would need patches
# for that. As an impeding version update fixes that as well, simply
# override the compiler instead of bothering with backports
%if %{suse_version} > 1600
CC="gcc -std=gnu17"
export CC
%endif
%if 0%{!?cross:1}
# Building native binutils
echo "Building native binutils."
@@ -389,7 +376,7 @@ cd build-dir
%endif
--enable-shared \
%if %{suse_version} > 1500
%if %{with bootstrap} && 0%{?do_profiling} && !0%{?want_reproducible_builds}
%if %{with bootstrap} && 0%{?do_profiling}
--enable-pgo-build=lto \
%endif
--enable-colored-disassembly \
@@ -401,9 +388,8 @@ cd build-dir
--enable-warn-execstack=yes \
--enable-warn-rwx-segments=yes
# FIXME: enable in future, when at least llvm15,llvm17,golang are
# fixed to accept zstd
#%if %{suse_version} > 1600
#FIXME: enable in the future
#%if %{suse_version} > 1550
# --enable-default-compressed-debug-sections-algorithm=zstd \
#%endif
@@ -503,7 +489,7 @@ make -C gas-nesc %{?make_output_sync} %{?_smp_mflags}
%endif
%check
unset SUSE_ASNEEDED SUSE_ZNOW
unset SUSE_ASNEEDED
# newer distros set this envvar (e.g. to get deterministic archives by default)
# but of course that breaks tests that precisely are
# designed for checking file replacement in archives based on mtime.

63
ld-relro.diff Normal file
View File

@@ -0,0 +1,63 @@
Index: ld/lexsup.c
===================================================================
--- ld/lexsup.c.orig 2024-08-04 01:00:00.000000000 +0200
+++ ld/lexsup.c 2024-08-06 16:02:35.554864901 +0200
@@ -772,6 +772,9 @@ parse_args (unsigned argc, char **argv)
}
}
+ optarg = "relro";
+ ldemul_handle_option ('z');
+
last_optind = -1;
while (1)
{
Index: ld/testsuite/config/default.exp
===================================================================
--- ld/testsuite/config/default.exp.orig 2024-08-04 01:00:00.000000000 +0200
+++ ld/testsuite/config/default.exp 2024-08-06 16:05:13.860859897 +0200
@@ -39,7 +39,7 @@ if [info exists env(LD_UNDER_TEST)] {
}
if ![info exists ld] then {
- set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
+ set ld "[findfile $base_dir/ld-new $base_dir/ld-new [transform ld]] -znorelro"
}
if ![info exists as] then {
@@ -92,7 +92,7 @@ if {[info exists ld_testsuite_bindir]} {
}
catch "exec ln -s ld tmpdir/ld/collect-ld" status
catch "exec ln -s ../../../gas/as-new tmpdir/ld/as" status
- set gcc_B_opt "-B[pwd]/tmpdir/ld/"
+ set gcc_B_opt "-B[pwd]/tmpdir/ld/ -Wl,-z,norelro"
}
# load the linker path
@@ -343,7 +343,7 @@ if ![info exists ELFEDIT] then {
}
if ![info exists LD] then {
- set LD [findfile $base_dir/ld-new ./ld-new [transform ld]]
+ set LD "[findfile $base_dir/ld-new ./ld-new [transform ld]] -znorelro"
}
if ![info exists LDFLAGS] then {
Index: ld/testsuite/ld-bootstrap/bootstrap.exp
===================================================================
--- ld/testsuite/ld-bootstrap/bootstrap.exp.orig 2024-08-04 01:00:00.000000000 +0200
+++ ld/testsuite/ld-bootstrap/bootstrap.exp 2024-08-06 16:02:35.554864901 +0200
@@ -112,7 +112,12 @@ foreach flags $test_flags {
# This test can only be run if we have the ld build directory,
# since we need the object files.
- if {[file normalize $ld] != [file normalize $objdir/ld-new]} {
+ set ldexe $ld
+ set ldparm [string first " " $ld]
+ if { $ldparm > 0 } then {
+ set ldexe [string range $ld 0 $ldparm]
+ }
+ if {[file normalize $ldexe] != [file normalize $objdir/ld-new]} {
untested $testname
continue
}

View File

@@ -1,43 +0,0 @@
From f601ffb52199a883f16df385b73a14e756b3e19a Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 28 May 2025 18:20:17 +0930
Subject: [PATCH] PR 33029 segv in dwarf2_finish with --gdwarf-5
Specifying --gdwarf-5 with a source lacking a ".file 0" directive
results in this segfault.
* dwarf2dbg.c (out_debug_str): Use files[1] if files[0] is
empty regardless of dwarf level.
---
gas/dwarf2dbg.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index fd1f96d80c5..a40fe6967d5 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -3019,6 +3019,11 @@ out_debug_str (segT str_seg, symbolS **name_sym, symbolS **comp_dir_sym,
int len;
int first_file = DWARF2_LINE_VERSION > 4 ? 0 : 1;
+ if (files_in_use == 0)
+ abort ();
+ if (first_file == 0 && files[first_file].filename == NULL)
+ first_file = 1;
+
subseg_set (str_seg, 0);
/* DW_AT_name. We don't have the actual file name that was present
@@ -3026,8 +3031,7 @@ out_debug_str (segT str_seg, symbolS **name_sym, symbolS **comp_dir_sym,
We're not supposed to get called unless at least one line number
entry was emitted, so this should always be defined. */
*name_sym = symbol_temp_new_now_octets ();
- if (files_in_use == 0)
- abort ();
+
if (files[first_file].dir)
{
char *dirname = remap_debug_filename (dirs[files[first_file].dir]);
--
2.50.0