Compare commits

..

8 commits

Author SHA1 Message Date
Nick Clifton
4c95d31d7d Add support for zstd compression. (#2454341) 2026-04-08 11:33:24 +01:00
Nick Clifton
1ff5036d07 Remove experimental Risc-V patch added with -2 revision. 2026-01-15 13:06:38 +00:00
Nick Clifton
dc4df4e96a Fix Risc-V related test failures caused by -2 revision. 2026-01-09 16:56:20 +00:00
Nick Clifton
90c9453706 Change Risc-V assembler to default to disabling relaxation. 2026-01-05 13:40:20 +00:00
Nick Clifton
bb5d7aeac8 Fix sources 2025-11-12 12:16:09 +00:00
Nick Clifton
9dac73ea8c Rebase to the binutils 2.45.1 release. 2025-11-12 12:15:23 +00:00
Nick Clifton
0c47e9d593 Stop a potential illegal memory access when linking a corrupt input file. (CVE-2025-11082)
Stop a potential illegal memory access when linking a corrupt input file.  (CVE-2025-11083)
2025-10-03 13:27:10 +01:00
Nick Clifton
2752f0f412 Enhance the riscv-64 zicfilp-unlabeled-plt test to cope with larger offsets. 2025-09-12 10:46:20 +01:00
15 changed files with 1393 additions and 569 deletions

3
.gitignore vendored
View file

@ -65,6 +65,3 @@ stamp-*
/isl*
/binutils-2.19.50.0.1-output-format.sed
/binutils-2.44.50-13.fc43.src.rpm
/binutils-with-gold-2.45.50-be970c68891.tar.gz
/binutils-with-gold-2.45.50-ba5838a98fb.tar.gz
/binutils-2.47.50-1.fc46.src.rpm

View file

@ -0,0 +1,45 @@
From ea1a0737c7692737a644af0486b71e4a392cbca8 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 22 Sep 2025 15:20:34 +0800
Subject: [PATCH] elf: Don't read beyond .eh_frame section size
PR ld/33464
* elf-eh-frame.c (_bfd_elf_parse_eh_frame): Don't read beyond
.eh_frame section size.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
bfd/elf-eh-frame.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index dc0d2e097f5..30bb313489c 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -737,6 +737,7 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
if (hdr_id == 0)
{
unsigned int initial_insn_length;
+ char *null_byte;
/* CIE */
this_inf->cie = 1;
@@ -753,10 +754,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
REQUIRE (cie->version == 1
|| cie->version == 3
|| cie->version == 4);
- REQUIRE (strlen ((char *) buf) < sizeof (cie->augmentation));
+ null_byte = memchr ((char *) buf, 0, end - buf);
+ REQUIRE (null_byte != NULL);
+ REQUIRE ((size_t) (null_byte - (char *) buf)
+ < sizeof (cie->augmentation));
strcpy (cie->augmentation, (char *) buf);
- buf = (bfd_byte *) strchr ((char *) buf, '\0') + 1;
+ buf = (bfd_byte *) null_byte + 1;
this_inf->u.cie.aug_str_len = buf - start - 1;
ENSURE_NO_RELOCS (buf);
if (buf[0] == 'e' && buf[1] == 'h')
--
2.51.0

View file

@ -0,0 +1,76 @@
From 9ca499644a21ceb3f946d1c179c38a83be084490 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 18 Sep 2025 16:59:25 -0700
Subject: [PATCH] elf: Don't match corrupt section header in linker input
Don't swap in nor match corrupt section header in linker input to avoid
linker crash later.
PR ld/33457
* elfcode.h (elf_swap_shdr_in): Changed to return bool. Return
false for corrupt section header in linker input.
(elf_object_p): Reject if elf_swap_shdr_in returns false.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
bfd/elfcode.h | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 9c65852e103..5224a1abee6 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -311,7 +311,7 @@ elf_swap_ehdr_out (bfd *abfd,
/* Translate an ELF section header table entry in external format into an
ELF section header table entry in internal format. */
-static void
+static bool
elf_swap_shdr_in (bfd *abfd,
const Elf_External_Shdr *src,
Elf_Internal_Shdr *dst)
@@ -341,6 +341,9 @@ elf_swap_shdr_in (bfd *abfd,
{
_bfd_error_handler (_("warning: %pB has a section "
"extending past end of file"), abfd);
+ /* PR ld/33457: Don't match corrupt section header. */
+ if (abfd->is_linker_input)
+ return false;
abfd->read_only = 1;
}
}
@@ -350,6 +353,7 @@ elf_swap_shdr_in (bfd *abfd,
dst->sh_entsize = H_GET_WORD (abfd, src->sh_entsize);
dst->bfd_section = NULL;
dst->contents = NULL;
+ return true;
}
/* Translate an ELF section header table entry in internal format into an
@@ -642,9 +646,9 @@ elf_object_p (bfd *abfd)
/* Read the first section header at index 0, and convert to internal
form. */
- if (bfd_read (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
+ if (bfd_read (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)
+ || !elf_swap_shdr_in (abfd, &x_shdr, &i_shdr))
goto got_no_match;
- elf_swap_shdr_in (abfd, &x_shdr, &i_shdr);
/* If the section count is zero, the actual count is in the first
section header. */
@@ -730,9 +734,9 @@ elf_object_p (bfd *abfd)
to internal form. */
for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++)
{
- if (bfd_read (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
+ if (bfd_read (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)
+ || !elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex))
goto got_no_match;
- elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex);
/* Sanity check sh_link and sh_info. */
if (i_shdrp[shindex].sh_link >= num_sec)
--
2.51.0

View file

@ -0,0 +1,413 @@
From 9e7085f2700d698dfbb37aef24c0489c2d09a978 Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@gotplt.org>
Date: Thu, 6 Feb 2025 12:06:27 -0500
Subject: [PATCH] Revert "aarch64: GCS tests for linking issues with dynamic
objects"
This reverts commit 1c136b8ee9b9fb402b66957bd51e89e47b94a0f6.
---
.../protections/aarch64-protections.exp | 15 ----------
.../ld-aarch64/protections/gcs-dynamic-1-a.d | 12 --------
.../ld-aarch64/protections/gcs-dynamic-1-b.d | 12 --------
.../protections/gcs-dynamic-2-a-i.d | 15 ----------
.../protections/gcs-dynamic-2-a-ii.d | 8 ------
.../protections/gcs-dynamic-2-a-iii.d | 15 ----------
.../protections/gcs-dynamic-2-a-iv.d | 12 --------
.../ld-aarch64/protections/gcs-dynamic-2-b.d | 14 ----------
.../ld-aarch64/protections/gcs-dynamic-2-c.d | 12 --------
.../ld-aarch64/protections/gcs-dynamic-2-d.d | 14 ----------
.../ld-aarch64/protections/gcs-dynamic-3-a.d | 15 ----------
.../ld-aarch64/protections/gcs-dynamic-3-b.d | 14 ----------
.../ld-aarch64/protections/gcs-dynamic-3-c.d | 12 --------
.../ld-aarch64/protections/gcs-dynamic-4-a.d | 7 -----
.../ld-aarch64/protections/gcs-dynamic-4-b.d | 7 -----
.../ld-aarch64/protections/gcs-dynamic-4-c.d | 7 -----
ld/testsuite/ld-aarch64/protections/gcs-so.s | 28 -------------------
ld/testsuite/ld-aarch64/protections/gcs-so2.s | 28 -------------------
18 files changed, 247 deletions(-)
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-1-a.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-1-b.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-i.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-ii.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-iii.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-iv.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-b.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-c.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-d.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-a.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-b.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-c.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-a.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-b.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-c.d
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-so.s
delete mode 100644 ld/testsuite/ld-aarch64/protections/gcs-so2.s
diff --git a/ld/testsuite/ld-aarch64/protections/aarch64-protections.exp b/ld/testsuite/ld-aarch64/protections/aarch64-protections.exp
index cf0f03daee6..b49428d1039 100644
--- a/ld/testsuite/ld-aarch64/protections/aarch64-protections.exp
+++ b/ld/testsuite/ld-aarch64/protections/aarch64-protections.exp
@@ -42,21 +42,6 @@ set aarch64elflinktests {
"-shared" ""
"-I$srcdir/$subdir -defsym __property_bti__=1"
{bti-plt-so.s} {} "libbti-plt-so.so"}
-
- {"Build gcs-so for GCS tests"
- "-shared" ""
- "-I$srcdir/$subdir -defsym __property_gcs__=1"
- {gcs-so.s} {} "libgcs-so.so"}
-
- {"Build nogcs-so for GCS tests"
- "-shared" ""
- "-I$srcdir/$subdir"
- {gcs-so.s} {} "libnogcs-so.so"}
-
- {"Build gcs-so2 for GCS tests"
- "-shared" ""
- "-I$srcdir/$subdir -defsym __property_gcs__=1"
- {gcs-so2.s} {} "libgcs-so2.so"}
}
if [check_shared_lib_support] {
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-1-a.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-1-a.d
deleted file mode 100644
index be8a301f6c0..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-1-a.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#name: '-z gcs=always -z gcs-report=error' and shared library with GCS feature reports no error.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=error -L./tmpdir -lgcs-so
-#readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[ ]+Owner[ ]+Data size[ ]+Description
- GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-1-b.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-1-b.d
deleted file mode 100644
index d53d45ae598..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-1-b.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#name: '-z gcs=always -z gcs-report=error -z gcs-report-dynamic=error' and shared library with GCS feature reports no error.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=error -z gcs-report-dynamic=error -L./tmpdir -lgcs-so
-#readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[ ]+Owner[ ]+Data size[ ]+Description
- GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-i.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-i.d
deleted file mode 100644
index 903d14099be..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-i.d
+++ /dev/null
@@ -1,15 +0,0 @@
-#name: '-z gcs=always -z gcs-report=error' and shared libraries without GCS feature reports warnings.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=error -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#warning: \A[^\n]*libnogcs-so\.so: warning: GCS is required by -z gcs[^\n]*\n
-#warning: [^\n]*libbti-plt-so\.so: warning: GCS is required by -z gcs[^\n]*
-
-#readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[ ]+Owner[ ]+Data size[ ]+Description
- GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-ii.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-ii.d
deleted file mode 100644
index 7adb481bc30..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-ii.d
+++ /dev/null
@@ -1,8 +0,0 @@
-#name: '-z gcs=always -z gcs-report=error -z gcs-report-dynamic=error' and shared libraries without GCS feature reports errors.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=error -z gcs-report-dynamic=error -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#error: \A[^\n]*libnogcs-so\.so: error: GCS is required by -z gcs[^\n]*\n
-#error: [^\n]*libbti-plt-so\.so: error: GCS is required by -z gcs[^\n]*
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-iii.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-iii.d
deleted file mode 100644
index 76a7c461347..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-iii.d
+++ /dev/null
@@ -1,15 +0,0 @@
-#name: '-z gcs=always -z gcs-report=error -z gcs-report-dynamic=warning' and shared libraries without GCS feature reports warnings.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=error -z gcs-report-dynamic=warning -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#warning: \A[^\n]*libnogcs-so\.so: warning: GCS is required by -z gcs[^\n]*\n
-#warning: [^\n]*libbti-plt-so\.so: warning: GCS is required by -z gcs[^\n]*
-
-#readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[ ]+Owner[ ]+Data size[ ]+Description
- GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: GCS
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-iv.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-iv.d
deleted file mode 100644
index 554ca1186ef..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-a-iv.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#name: '-z gcs=always -z gcs-report=error -z gcs-report-dynamic=none' and shared libraries without GCS feature reports nothing.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=error -z gcs-report-dynamic=none -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[ ]+Owner[ ]+Data size[ ]+Description
- GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: GCS
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-b.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-b.d
deleted file mode 100644
index 36262bbc087..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-b.d
+++ /dev/null
@@ -1,14 +0,0 @@
-#name: '-z gcs=always -z gcs-report=warning' and shared libraries without GCS feature reports warnings.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=warning -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#warning: \A[^\n]*libnogcs-so\.so: warning: GCS is required by -z gcs[^\n]*\n
-#warning: [^\n]*libbti-plt-so\.so: warning: GCS is required by -z gcs[^\n]*
-#readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[ ]+Owner[ ]+Data size[ ]+Description
- GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-c.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-c.d
deleted file mode 100644
index 6c7f5da8be7..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-c.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#name: '-z gcs=always -z gcs-report=none' and shared libraries without GCS feature reports nothing.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report=none -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[ ]+Owner[ ]+Data size[ ]+Description
- GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-d.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-d.d
deleted file mode 100644
index 58498e6c00b..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-2-d.d
+++ /dev/null
@@ -1,14 +0,0 @@
-#name: '-z gcs=always -z gcs-report' and shared libraries without GCS feature reports warnings.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=always -z gcs-report -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#warning: \A[^\n]*libnogcs-so\.so: warning: GCS is required by -z gcs[^\n]*\n
-#warning: [^\n]*libbti-plt-so\.so: warning: GCS is required by -z gcs[^\n]*
-#readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[ ]+Owner[ ]+Data size[ ]+Description
- GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-a.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-a.d
deleted file mode 100644
index ecdaf526779..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-a.d
+++ /dev/null
@@ -1,15 +0,0 @@
-#name: '-z gcs=implicit -z gcs-report=error' and shared libraries without GCS feature reports warnings.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=implicit -z gcs-report=error -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#warning: \A[^\n]*libnogcs-so\.so: warning: GCS is required by -z gcs[^\n]*\n
-#warning: [^\n]*libbti-plt-so\.so: warning: GCS is required by -z gcs[^\n]*
-
-#readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[ ]+Owner[ ]+Data size[ ]+Description
- GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: GCS
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-b.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-b.d
deleted file mode 100644
index 4d32fb6aa54..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-b.d
+++ /dev/null
@@ -1,14 +0,0 @@
-#name: '-z gcs=implicit -z gcs-report=warning' and shared libraries without GCS feature reports warnings.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=implicit -z gcs-report=warning -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#warning: \A[^\n]*libnogcs-so\.so: warning: GCS is required by -z gcs[^\n]*\n
-#warning: [^\n]*libbti-plt-so\.so: warning: GCS is required by -z gcs[^\n]*
-#readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[ ]+Owner[ ]+Data size[ ]+Description
- GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: GCS
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-c.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-c.d
deleted file mode 100644
index c0da6c1d9c6..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-3-c.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#name: '-z gcs=implicit -z gcs-report=none' and shared libraries without GCS feature reports no warning.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=implicit -z gcs-report=none -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#readelf: -n
-
-Displaying notes found in: .note.gnu.property
-[ ]+Owner[ ]+Data size[ ]+Description
- GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
- Properties: AArch64 feature: GCS
\ No newline at end of file
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-a.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-a.d
deleted file mode 100644
index ae324bbba1e..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-a.d
+++ /dev/null
@@ -1,7 +0,0 @@
-#name: '-z gcs=never -z gcs-report=error' and shared libraries without GCS feature reports no warning/error.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=never -z gcs-report=error -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#readelf: -n
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-b.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-b.d
deleted file mode 100644
index 6b65898b924..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-b.d
+++ /dev/null
@@ -1,7 +0,0 @@
-#name: '-z gcs=never -z gcs-report=warning' and shared libraries without GCS feature reports no warning/error.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=never -z gcs-report=warning -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#readelf: -n
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-c.d b/ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-c.d
deleted file mode 100644
index 35b011f6a8e..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-dynamic-4-c.d
+++ /dev/null
@@ -1,7 +0,0 @@
-#name: '-z gcs=never -z gcs-report=none' and shared libraries without GCS feature reports no warning/error.
-#source: gcs.s
-#source: gcs2.s
-#alltargets: [check_shared_lib_support] *linux*
-#as: -march=armv9.4-a+gcs -defsym __property_gcs__=1
-#ld: -z gcs=never -z gcs-report=none -L./tmpdir -lnogcs-so -lbti-plt-so -lgcs-so2
-#readelf: -n
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-so.s b/ld/testsuite/ld-aarch64/protections/gcs-so.s
deleted file mode 100644
index aa6485b9dde..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-so.s
+++ /dev/null
@@ -1,28 +0,0 @@
- .global foo2
- .type foo2, %function
-foo2:
- sub sp, sp, #16
- mov w0, 9
- str w0, [sp, 12]
- ldr w0, [sp, 12]
- add w0, w0, 4
- str w0, [sp, 12]
- nop
- add sp, sp, 16
- ret
- .size foo2, .-foo2
- .global bar2
- .type bar2, %function
-bar2:
- sub sp, sp, #16
- mov w0, 9
- str w0, [sp, 12]
- ldr w0, [sp, 12]
- add w0, w0, 4
- str w0, [sp, 12]
- nop
- add sp, sp, 16
- ret
- .size bar2, .-bar2
-
-.include "gnu-note-properties-selectable-merged.inc"
diff --git a/ld/testsuite/ld-aarch64/protections/gcs-so2.s b/ld/testsuite/ld-aarch64/protections/gcs-so2.s
deleted file mode 100644
index 938ba43c69c..00000000000
--- a/ld/testsuite/ld-aarch64/protections/gcs-so2.s
+++ /dev/null
@@ -1,28 +0,0 @@
- .global foo3
- .type foo3, %function
-foo3:
- sub sp, sp, #16
- mov w0, 9
- str w0, [sp, 12]
- ldr w0, [sp, 12]
- add w0, w0, 4
- str w0, [sp, 12]
- nop
- add sp, sp, 16
- ret
- .size foo3, .-foo3
- .global bar3
- .type bar3, %function
-bar3:
- sub sp, sp, #16
- mov w0, 9
- str w0, [sp, 12]
- ldr w0, [sp, 12]
- add w0, w0, 4
- str w0, [sp, 12]
- nop
- add sp, sp, 16
- ret
- .size bar3, .-bar3
-
-.include "gnu-note-properties-selectable-merged.inc"
--
2.48.1

View file

@ -0,0 +1,17 @@
diff -pruN a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
--- a/bfd/elfnn-aarch64.c 2025-02-06 10:39:49.722259921 -0500
+++ b/bfd/elfnn-aarch64.c 2025-02-06 10:47:28.604658973 -0500
@@ -5051,11 +5051,10 @@ bfd_elfNN_aarch64_set_options (struct bf
libraries. If a user also wants to error GCS issues in the shared
libraries, '-z gcs-report-dynamic=error' will have to be specified
explicitly. */
+ /* XXX Fedora override: default to NONE. */
if (sw_protections->gcs_report_dynamic == MARKING_UNSET)
elf_aarch64_tdata (output_bfd)->sw_protections.gcs_report_dynamic
- = (sw_protections->gcs_report == MARKING_ERROR)
- ? MARKING_WARN
- : sw_protections->gcs_report;
+ = MARKING_NONE;
elf_aarch64_tdata (output_bfd)->n_bti_issues = 0;
elf_aarch64_tdata (output_bfd)->n_gcs_issues = 0;

View file

@ -1,40 +0,0 @@
# The gold linker does not build if the target list includes s390x-linux
# but does not include s390-linux. ie it needs the 32-bit target to be
# enabled in order for the 64-bit target to work. On the other hand the
# BFD library does not support the 32-bit s390 target. So this patch
# "enhances" the gold configure script so that if s390x is listed, the
# s390 target will automatically be added to the list as well.
diff -upr orig/gold/configure binutils-2.47/gold/configure
--- orig/gold/configure 2026-07-27 09:38:54.907192013 +0100
+++ binutils-2.47/gold/configure 2026-07-27 10:12:02.759629540 +0100
@@ -5223,7 +5223,12 @@ if test -n "$enable_targets"; then
for targ in `echo $enable_targets | sed -e 's/,/ /g'`; do
result=`$ac_config_sub $targ 2>/dev/null`
if test -n "$result"; then
- canon_targets="$canon_targets $result"
+ canon_targets="$canon_targets $result" ;
+ case "$result" in
+ s390x-*)
+ canon_targets="$canon_targets s390-gnu-linux"
+ ;;
+ esac
else
# Permit unrecognized target names, like "all".
canon_targets="$canon_targets $targ"
diff -upr orig/gold/configure.ac binutils-2.47/gold/configure.ac
--- orig/gold/configure.ac 2026-07-27 09:38:54.907192013 +0100
+++ binutils-2.47/gold/configure.ac 2026-07-27 10:18:18.480766140 +0100
@@ -133,6 +133,12 @@ if test -n "$enable_targets"; then
result=`$ac_config_sub $targ 2>/dev/null`
if test -n "$result"; then
canon_targets="$canon_targets $result"
+ # Hack: Enable the s390-linux target if s390x-linux is enabled.
+ case "$result" in
+ s390x-*)
+ canon_targets="$canon_targets s390-gnu-linux"
+ ;;
+ esac
else
# Permit unrecognized target names, like "all".
canon_targets="$canon_targets $targ"

View file

@ -24,6 +24,26 @@ diff -rup binutils.orig/gold/configure.ac binutils-2.34/gold/configure.ac
else
targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)"
if test "$targ_extra_obj" != ""; then
--- binutils.orig/ld/configure.tgt 2020-04-20 12:35:12.465301359 +0100
+++ binutils-2.34/ld/configure.tgt 2020-04-20 14:17:52.123066333 +0100
@@ -220,7 +220,7 @@ bfin-*-linux-uclibc*) targ_emul=elf32bfi
targ_extra_emuls="elf32bfin"
targ_extra_libpath=$targ_extra_emuls
;;
-bpf-*-*) targ_emul=elf64bpf
+bpf-* | bpf-*-*) targ_emul=elf64bpf
;;
cr16-*-elf*) targ_emul=elf32cr16
;;
@@ -1026,7 +1026,7 @@ z8k-*-coff) targ_emul=z8002
targ_extra_ofiles=
;;
*)
- echo 2>&1 "*** ld does not support target ${targ}"
+ echo 2>&1 "*** ld does not support target '${targ}' NO REALLY"
echo 2>&1 "*** see ld/configure.tgt for supported targets"
exit 1
--- binutils.orig/bfd/config.bfd 2020-04-20 12:35:13.038297375 +0100
+++ binutils-2.34/bfd/config.bfd 2020-04-20 14:25:26.452869193 +0100
@@ -473,7 +473,7 @@ case "${targ}" in
@ -35,14 +55,12 @@ diff -rup binutils.orig/gold/configure.ac binutils-2.34/gold/configure.ac
targ_defvec=bpf_elf64_le_vec
targ_selvecs=bpf_elf64_be_vec
targ_underscore=yes
--- binutils.orig/ld/configure.tgt 2026-01-05 08:51:02.908224792 +0000
+++ binutils-with-gold-2.45.50-be970c68891/ld/configure.tgt 2026-01-05 08:51:55.852677409 +0000
@@ -255,7 +255,7 @@ bfin-*-uclinux*) targ_emul=elf32bfin;
bfin-*-linux-uclibc*) targ_emul=elf32bfinfd;
targ_extra_libpath=elf32bfin
;;
-bpf-*-*) targ_emul=elf64bpf
+bpf-* | bpf-*-*) targ_emul=elf64bpf
;;
cr16-*-elf*) targ_emul=elf32cr16
;;
@@ -1427,7 +1427,7 @@ case "${targ}" in
;;
*)
- echo 1>&2 "*** BFD does not support target ${targ}."
+ echo 1>&2 "*** BFD does not support target '${targ}'. Honest."
echo 1>&2 "*** Look in bfd/config.bfd for supported targets."
exit 1
;;

View file

@ -1,52 +0,0 @@
diff -rup binutils.orig/bfd/elflink.c binutils-with-gold-2.45.50-be970c68891/bfd/elflink.c
--- binutils.orig/bfd/elflink.c 2026-01-14 09:21:14.835847967 +0000
+++ binutils-with-gold-2.45.50-be970c68891/bfd/elflink.c 2026-01-14 09:23:48.780495205 +0000
@@ -13786,7 +13786,7 @@ _bfd_elf_final_link (bfd *abfd, struct b
{
if (info->textrel_check == textrel_check_error)
info->callbacks->einfo
- (_("%P%X: read-only segment has dynamic relocations\n"));
+ (_("%P%X: error: read-only segment has dynamic relocations\n"));
else if (bfd_link_dll (info))
info->callbacks->einfo
(_("%P: warning: creating DT_TEXTREL in a shared object\n"));
diff -rup binutils.orig/ld/testsuite/ld-aarch64/dt-memtag-mode.d binutils-with-gold-2.45.50-be970c68891/ld/testsuite/ld-aarch64/dt-memtag-mode.d
--- binutils.orig/ld/testsuite/ld-aarch64/dt-memtag-mode.d 2026-01-14 09:21:15.248851537 +0000
+++ binutils-with-gold-2.45.50-be970c68891/ld/testsuite/ld-aarch64/dt-memtag-mode.d 2026-01-14 09:22:24.603416270 +0000
@@ -1,5 +1,5 @@
#source: dt-memtag.s
-#ld: -shared -z memtag-mode=async
+#ld: -shared -z memtag-mode=async -z notext
#readelf: -d
#...
diff -rup binutils.orig/ld/testsuite/ld-aarch64/dt-memtag-stack.d binutils-with-gold-2.45.50-be970c68891/ld/testsuite/ld-aarch64/dt-memtag-stack.d
--- binutils.orig/ld/testsuite/ld-aarch64/dt-memtag-stack.d 2026-01-14 09:21:15.248851537 +0000
+++ binutils-with-gold-2.45.50-be970c68891/ld/testsuite/ld-aarch64/dt-memtag-stack.d 2026-01-14 09:24:19.594780414 +0000
@@ -1,5 +1,5 @@
#source: dt-memtag.s
-#ld: -shared -z memtag-stack
+#ld: -shared -z memtag-stack -z notext
#readelf: -d
#...
diff -rup binutils.orig/ld/testsuite/ld-aarch64/relr-text-pie.d binutils-with-gold-2.45.50-be970c68891/ld/testsuite/ld-aarch64/relr-text-pie.d
--- binutils.orig/ld/testsuite/ld-aarch64/relr-text-pie.d 2026-01-14 09:21:15.246851520 +0000
+++ binutils-with-gold-2.45.50-be970c68891/ld/testsuite/ld-aarch64/relr-text-pie.d 2026-01-14 09:24:45.363485698 +0000
@@ -1,5 +1,5 @@
#source: relr-text.s
-#ld: -pie -z pack-relative-relocs -T relocs.ld
+#ld: -pie -z pack-relative-relocs -T relocs.ld -z notext
#readelf: -drW
#...
diff -rup binutils.orig/ld/testsuite/ld-aarch64/relr-text-shared.d binutils-with-gold-2.45.50-be970c68891/ld/testsuite/ld-aarch64/relr-text-shared.d
--- binutils.orig/ld/testsuite/ld-aarch64/relr-text-shared.d 2026-01-14 09:21:15.246851520 +0000
+++ binutils-with-gold-2.45.50-be970c68891/ld/testsuite/ld-aarch64/relr-text-shared.d 2026-01-14 09:25:06.651664713 +0000
@@ -1,5 +1,5 @@
#source: relr-text.s
-#ld: -shared -z pack-relative-relocs -T relocs.ld
+#ld: -shared -z pack-relative-relocs -T relocs.ld -z notext
#readelf: -drW
#...

View file

@ -1,33 +0,0 @@
diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-with-gold-2.45.50-96b8a8a633a/ld/testsuite/ld-x86-64/x86-64.exp
--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2025-11-20 12:02:23.738336155 +0000
+++ binutils-with-gold-2.45.50-96b8a8a633a/ld/testsuite/ld-x86-64/x86-64.exp 2025-11-20 12:03:17.894485264 +0000
@@ -1413,14 +1413,6 @@ if { [isnative] && [check_compiler_avail
"libprotected-func-2b.so" \
] \
[list \
- "Build protected-func-2 without PIE" \
- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libprotected-func-2b.so" \
- "$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
- { protected-func-1b.c } \
- {} \
- "protected-func-2" \
- ] \
- [list \
"Build libprotected-func-2c.so" \
"-shared" \
"-fPIC -Wa,-mx86-used-note=yes" \
@@ -1429,14 +1421,6 @@ if { [isnative] && [check_compiler_avail
"libprotected-func-2c.so" \
] \
[list \
- "Build protected-func-2a without PIE" \
- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libprotected-func-2c.so" \
- "$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
- { protected-func-1b.c } \
- {} \
- "protected-func-2a" \
- ] \
- [list \
"Build libprotected-data-1a.so" \
"-shared -z noindirect-extern-access" \
"-fPIC -Wa,-mx86-used-note=yes" \

View file

@ -0,0 +1,124 @@
--- binutils.orig/ld/scripttempl/elf.sc 2024-11-01 10:17:24.308959289 +0000
+++ binutils-2.43.50-22c62092858/ld/scripttempl/elf.sc 2024-11-01 10:17:39.730019895 +0000
@@ -397,19 +397,6 @@ fi
# ===========================================================================
# Functions for generating parts of the linker script
-# Helper function for putting comments into scripts.
-# Useful when trying to track down script composition problems.
-# Use by adding:
-# emit_comment "a message"
-# wherever necessary.
-
-emit_comment()
-{
-cat <<EOF
- /* $1 */
-EOF
-}
-
emit_header()
{
cat <<EOF
@@ -438,6 +425,7 @@ emit_early_ro()
{
cat <<EOF
${INITIAL_READONLY_SECTIONS}
+ .note.gnu.build-id ${RELOCATING-0}: { *(.note.gnu.build-id) }
EOF
}
@@ -448,11 +436,6 @@ cat <<EOF
${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}
${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}}
${CREATE_PIE+${RELOCATING+PROVIDE (__executable_start = ${SHLIB_TEXT_START_ADDR}); . = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}}
-
- /* Place build-id as close to the ELF headers as possible. This
- maximises the chance the build-id will be present in core files,
- which GDB can then use to locate the associated debuginfo file. */
- .note.gnu.build-id ${RELOCATING-0}: { *(.note.gnu.build-id) }
EOF
}
@@ -574,7 +557,6 @@ EOF
align_text()
{
cat <<EOF
- ${RELOCATING+/* Align the text segment. */}
${RELOCATING+${TEXT_SEGMENT_ALIGN}}
EOF
}
@@ -816,28 +798,11 @@ EOF
emit_executable_start
if test -z "${ALL_TEXT_BEFORE_RO}"; then
- # We are allowed to put R/O sections before code sections.
-
test -n "${SEPARATE_CODE}" || emit_early_ro
test -n "${NON_ALLOC_DYN}${SEPARATE_CODE}" || emit_dyn
-
- # We only need the alignment if we have emitted some sections.
- if test -z "${SEPARATE_CODE}"; then
- align_text
- elif test -z "${NON_ALLOC_DYN}${SEPARATE_CODE}"; then
- align_text
- fi
fi
- # We do not align the code segment here as doing so will increase the file size.
- # Normally having the text segment at the start of the file will automatically
- # mean that it is aligned(*), and if we have emitted any r/o sections due to the
- # tests of SEPARATE_CODE above, then extra alignment will have already been
- # generated.
- #
- # *: Including the ELF headers and .note.gnu.build-id section in the code segment
- # is a very small theoretical risk.
-
+ align_text
emit_text
align_rodata
diff -rup binutils.orig/ld/testsuite/ld-i386/pr32191.d binutils-2.43.50-22c62092858/ld/testsuite/ld-i386/pr32191.d
--- binutils.orig/ld/testsuite/ld-i386/pr32191.d 2024-11-01 13:56:39.584115148 +0000
+++ binutils-2.43.50-22c62092858/ld/testsuite/ld-i386/pr32191.d 2024-11-01 13:58:30.962432716 +0000
@@ -2,6 +2,7 @@
#as: --32 -mx86-used-note=yes
#ld: -shared -m elf_i386 -z separate-code --build-id --rosegment
#readelf: -lW
+#xfail: *-*-*
#...
+[0-9]+ +\.note\.gnu\.build-id \.text
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr32191-x32.d binutils-2.43.50-22c62092858/ld/testsuite/ld-x86-64/pr32191-x32.d
--- binutils.orig/ld/testsuite/ld-x86-64/pr32191-x32.d 2024-11-01 13:56:39.652115341 +0000
+++ binutils-2.43.50-22c62092858/ld/testsuite/ld-x86-64/pr32191-x32.d 2024-11-01 13:59:27.626595088 +0000
@@ -2,6 +2,7 @@
#as: --x32 -mx86-used-note=yes
#ld: -shared -m elf32_x86_64 -z separate-code --build-id --rosegment
#readelf: -lW
+#xfail: *-*-*
#...
+[0-9]+ +\.note\.gnu\.build-id \.text
diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr32191.d binutils-2.43.50-22c62092858/ld/testsuite/ld-x86-64/pr32191.d
--- binutils.orig/ld/testsuite/ld-x86-64/pr32191.d 2024-11-01 13:56:39.652115341 +0000
+++ binutils-2.43.50-22c62092858/ld/testsuite/ld-x86-64/pr32191.d 2024-11-01 13:59:12.906552493 +0000
@@ -2,6 +2,7 @@
#as: --64 -mx86-used-note=yes
#ld: -shared -m elf_x86_64 -z separate-code --build-id --rosegment
#readelf: -lW
+#xfail: *-*-*
#...
+[0-9]+ +\.note\.gnu\.build-id \.text
diff -rup bin.orig/ld/testsuite/ld-elf/pr23658-1e.d binutils-2.43.50-55e32b3c682/ld/testsuite/ld-elf/pr23658-1e.d
--- bin.orig/ld/testsuite/ld-elf/pr23658-1e.d 2024-11-04 12:18:57.021055380 +0000
+++ binutils-2.43.50-55e32b3c682/ld/testsuite/ld-elf/pr23658-1e.d 2024-11-04 12:19:06.522083958 +0000
@@ -16,6 +16,7 @@
#xfail: *-*-hpux*
#xfail: arc*-* avr-* m68hc1*-* microblaze*-* nds32*-* spu-*-* xstormy16-*-*
#noxfail: microblaze*-linux*
+#xfail: *-*-*
#...
+[0-9]+ +\.note.gnu.build-id +

View file

@ -182,88 +182,3 @@ diff -rup binutils.orig/ld/testsuite/ld-riscv-elf/pcgp-relax-02.d binutils-2.43.
+.*:[ ]+[0-9a-f]+[ ]+auipc[ ]+t3,0x[0-9a-f]+
.*:[ ]+[0-9a-f]+[ ]+ld[ ]+t3,[0-9]+\(t3\) # [0-9a-f]+ <bar>
.*:[ ]+[0-9a-f]+[ ]+jalr[ ]+t1,t3
diff -rup binutils-with-gold-2.45.50-beab972c07d,orig/binutils/testsuite/binutils-all/objcopy.exp binutils-with-gold-2.45.50-beab972c07d/binutils/testsuite/binutils-all/objcopy.exp
--- binutils-with-gold-2.45.50-beab972c07d,orig/binutils/testsuite/binutils-all/objcopy.exp 2025-12-02 12:47:19.063123207 +0000
+++ binutils-with-gold-2.45.50-beab972c07d/binutils/testsuite/binutils-all/objcopy.exp 2025-12-04 12:39:26.079989597 +0000
@@ -602,14 +602,19 @@ proc strip_test { } {
set exec_output [binutils_run $STRIP "$STRIPFLAGS $objfile"]
set exec_output [prune_warnings $exec_output]
if ![string equal "" $exec_output] {
- fail $test
+ fail "$test (warnings in linker output)"
+ verbose $exec_output
return
}
set exec_output [binutils_run $NM "-a $NMFLAGS $objfile"]
set exec_output [prune_warnings $exec_output]
if ![string match "*: no symbols*" $exec_output] {
- fail $test
+
+ # The RISC-V target compiles with annotation enabled and these symbols remain after stripping.
+ setup_xfail riscv*-*-*
+
+ fail "$test (symbols in nm output)"
return
}
@@ -659,6 +664,9 @@ proc strip_test_with_saving_a_symbol { }
pass $test
}
+# The RISC-V target compiles with annotation enabled and these symbols remain after stripping.
+setup_xfail riscv*-*-*
+
strip_test_with_saving_a_symbol
# Test stripping an archive.
@@ -1503,7 +1519,7 @@ proc objcopy_test_without_global_symbol
# 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*-*-*
+setup_xfail riscv*-*-*
objcopy_test_without_global_symbol
diff -rup binutils-with-gold-2.45.50-beab972c07d,orig/ld/testsuite/lib/ld-lib.exp binutils-with-gold-2.45.50-beab972c07d/ld/testsuite/lib/ld-lib.exp
--- binutils-with-gold-2.45.50-beab972c07d,orig/ld/testsuite/lib/ld-lib.exp 2025-12-02 12:47:19.201090894 +0000
+++ binutils-with-gold-2.45.50-beab972c07d/ld/testsuite/lib/ld-lib.exp 2025-12-03 09:30:07.184360005 +0000
@@ -1633,6 +1633,12 @@ proc compile_one_cc { src output additio
proc check_ctf_available { } {
global ctf_available_saved
+ # Skip CTF tests for the Risc-V target for now, as the
+ # tests have not been tweaked to support the riscv format.
+ if { [istarget "riscv*-*-linux*"] } {
+ return 0
+ }
+
if {![info exists ctf_available_saved]} {
set ctf_available_saved 0
--- fred/binutils/testsuite/lib/binutils-common.exp 2026-03-16 09:18:37.205413649 +0000
+++ binutils-with-gold-2.46.50-d712202846b/binutils/testsuite/lib/binutils-common.exp 2026-03-16 09:18:49.559358668 +0000
@@ -803,6 +803,9 @@ proc prune_warnings_extra { text } {
# Ignore warnings about linking objects with an old sframe format
regsub -all {(^|\n)([^\n]* unexpected SFrame format version [^\n]*\n[^\n]* SFrame section ignored\n?)+} $text {\1} text
+ # Skip warnings about the LTO plugin being needed.
+ regsub -all "(^|\n)(\[^\n\]*:\[^\n\]*plugin needed to handle lto object\[^\n\]*\n?)+" $text "\\1" text
+
return $text
}
--- binutils.orig/ld/testsuite/ld-elf/shared.exp 2026-06-10 15:32:21.012274073 +0100
+++ binutils-with-gold-2.46.50-48997323b0f/ld/testsuite/ld-elf/shared.exp 2026-06-10 15:34:41.397899263 +0100
@@ -1859,6 +1859,10 @@ run_cc_link_tests [list \
"pr29655.so" \
] \
]
+
+# FIXME: Find out why the Risc-V fails this test.
+setup_xfail "riscv64-*-*"
+
# PR 29655 (cont.): Check that in PIC code linked as PDE taking the address
# of a function defined in a DSO results in the function address (from GOT)
# and not the "canonical PLT" address from the PDE.

View file

@ -0,0 +1,537 @@
From a0d3507d10755c2ccaed3204db22c21308bfc4d6 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 22 Jul 2025 14:09:48 -0700
Subject: [PATCH] strip: Properly handle LLVM IR bitcode
commit 717a38e9a02109fcbcb18bb2ec3aa251e2ad0a0d
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sun May 4 05:12:46 2025 +0800
strip: Add GCC LTO IR support
added "-R .gnu.lto_.*" to strip to remove all GCC LTO sections. When
"-R .gnu.lto_.*" is used, the plugin target is ignored so that all LTO
sections are stripped as the regular sections. It works for the slim
GCC LTO IR since the GCC LTO IR is stored in the regular sections. When
the plugin target is ignored, the GCC LTO IR can be recognized as the
normal object files. But it doesn't work for the slim LLVM IR which
is stored in a standalone file.
1. Add bfd_check_format_matches_lto and bfd_check_format_lto to take an
argument, lto_sections_removed, to indicate if all LTO sections should
be removed.
2. Update strip to always enable the plugin target so that the plugin
target is enabled when checking for bfd_archive.
3. Update strip to ignore the plugin target for bfd_object when all LTO
sections should be removed. If the object is unknown, copy it as an
unknown file without any messages.
4. Treat the "-R .llvm.lto" strip option as removing all LTO sections.
bfd/
PR binutils/33198
* format.c (bfd_check_format_lto): New function.
(bfd_check_format): Call bfd_check_format_matches_lto.
(bfd_check_format_matches): Renamed to ...
(bfd_check_format_matches_lto): This. Add an argument,
lto_sections_removed, to indicate if all LTO sections should be
removed and don't match the plugin target if lto_sections_removed
is true.
(bfd_check_format_matches): Call bfd_check_format_matches_lto.
* bfd-in2.h: Regenerated.
binutils/
PR binutils/33198
* objcopy.c (copy_archive): Call bfd_check_format_lto, instead
of bfd_check_format, and pass lto_sections_removed. Remove the
non-fatal message on unknown element since it will be copied as
an unknown file.
(copy_file): Don't check lto_sections_removed when enabling LTO
plugin in strip.
(copy_file): Ignore the plugin target first if all LTO sections
should be removed. Try with the plugin target next if ignoring
the plugin target failed to match the format.
(strip_main): Also set lto_sections_removed for -R .llvm.lto.
* testsuite/binutils-all/x86-64/pr33198.c: New file.
* testsuite/binutils-all/x86-64/x86-64.exp (run_pr33198_test):
New.
Run binutils/33198 tests.
* testsuite/lib/binutils-common.exp (llvm_plug_opt): New.
(CLANG_FOR_TARGET): New. Set to "clang" for native build if
"clang -v" reports "clang version".
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit f752be8f916efa70aea9c2e4f664c75690fd136c)
---
bfd/bfd-in2.h | 7 +
bfd/format.c | 84 ++++++++--
binutils/objcopy.c | 40 +++--
.../testsuite/binutils-all/x86-64/pr33198.c | 4 +
.../testsuite/binutils-all/x86-64/x86-64.exp | 158 ++++++++++++++++++
binutils/testsuite/lib/binutils-common.exp | 27 +++
6 files changed, 299 insertions(+), 21 deletions(-)
create mode 100644 binutils/testsuite/binutils-all/x86-64/pr33198.c
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index b013ef954da..2ff3e930bfa 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2903,8 +2903,15 @@ bool generic_core_file_matches_executable_p
(bfd *core_bfd, bfd *exec_bfd);
/* Extracted from format.c. */
+bool bfd_check_format_lto (bfd *abfd, bfd_format format,
+ bool lto_sections_removed);
+
bool bfd_check_format (bfd *abfd, bfd_format format);
+bool bfd_check_format_matches_lto
+ (bfd *abfd, bfd_format format, char ***matching,
+ bool lto_sections_removed);
+
bool bfd_check_format_matches
(bfd *abfd, bfd_format format, char ***matching);
diff --git a/bfd/format.c b/bfd/format.c
index a909b70fe81..f3a0774af08 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -56,16 +56,19 @@ extern const size_t _bfd_target_vector_entries;
/*
FUNCTION
- bfd_check_format
+ bfd_check_format_lto
SYNOPSIS
- bool bfd_check_format (bfd *abfd, bfd_format format);
+ bool bfd_check_format_lto (bfd *abfd, bfd_format format,
+ bool lto_sections_removed);
DESCRIPTION
Verify if the file attached to the BFD @var{abfd} is compatible
with the format @var{format} (i.e., one of <<bfd_object>>,
<<bfd_archive>> or <<bfd_core>>).
+ If LTO_SECTION_REMOVED is true, ignore plugin target.
+
If the BFD has been set to a specific target before the
call, only the named target and format combination is
checked. If the target has not been set, or has been set to
@@ -99,10 +102,31 @@ DESCRIPTION
itself.
*/
+bool
+bfd_check_format_lto (bfd *abfd, bfd_format format,
+ bool lto_sections_removed)
+{
+ return bfd_check_format_matches_lto (abfd, format, NULL,
+ lto_sections_removed);
+}
+
+
+/*
+FUNCTION
+ bfd_check_format
+
+SYNOPSIS
+ bool bfd_check_format (bfd *abfd, bfd_format format);
+
+DESCRIPTION
+ Similar to bfd_check_format_plugin, except plugin target isn't
+ ignored.
+*/
+
bool
bfd_check_format (bfd *abfd, bfd_format format)
{
- return bfd_check_format_matches (abfd, format, NULL);
+ return bfd_check_format_matches_lto (abfd, format, NULL, false);
}
struct bfd_preserve
@@ -407,11 +431,12 @@ bfd_set_lto_type (bfd *abfd ATTRIBUTE_UNUSED)
/*
FUNCTION
- bfd_check_format_matches
+ bfd_check_format_matches_lto
SYNOPSIS
- bool bfd_check_format_matches
- (bfd *abfd, bfd_format format, char ***matching);
+ bool bfd_check_format_matches_lto
+ (bfd *abfd, bfd_format format, char ***matching,
+ bool lto_sections_removed);
DESCRIPTION
Like <<bfd_check_format>>, except when it returns FALSE with
@@ -423,10 +448,14 @@ DESCRIPTION
When done with the list that @var{matching} points to, the caller
should free it.
+
+ If LTO_SECTION_REMOVED is true, ignore plugin target.
*/
bool
-bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
+bfd_check_format_matches_lto (bfd *abfd, bfd_format format,
+ char ***matching,
+ bool lto_sections_removed ATTRIBUTE_UNUSED)
{
extern const bfd_target binary_vec;
const bfd_target * const *target;
@@ -495,8 +524,13 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
if (!bfd_preserve_save (abfd, &preserve, NULL))
goto err_ret;
- /* If the target type was explicitly specified, just check that target. */
- if (!abfd->target_defaulted)
+ /* If the target type was explicitly specified, just check that target.
+ If LTO_SECTION_REMOVED is true, don't match the plugin target. */
+ if (!abfd->target_defaulted
+#if BFD_SUPPORTS_PLUGINS
+ && (!lto_sections_removed || !bfd_plugin_target_p (abfd->xvec))
+#endif
+ )
{
if (bfd_seek (abfd, 0, SEEK_SET) != 0) /* rewind! */
goto err_ret;
@@ -540,10 +574,12 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
searching. Don't match the plugin target if we have another
alternative since we want to properly set the input format
before allowing a plugin to claim the file. Also, don't
- check the default target twice. */
+ check the default target twice. If LTO_SECTION_REMOVED is
+ true, don't match the plugin target. */
if (*target == &binary_vec
#if BFD_SUPPORTS_PLUGINS
- || (match_count != 0 && bfd_plugin_target_p (*target))
+ || ((lto_sections_removed || match_count != 0)
+ && bfd_plugin_target_p (*target))
#endif
|| (!abfd->target_defaulted && *target == save_targ))
continue;
@@ -795,6 +831,32 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
return false;
}
+/*
+FUNCTION
+ bfd_check_format_matches
+
+SYNOPSIS
+ bool bfd_check_format_matches
+ (bfd *abfd, bfd_format format, char ***matching);
+
+DESCRIPTION
+ Like <<bfd_check_format>>, except when it returns FALSE with
+ <<bfd_errno>> set to <<bfd_error_file_ambiguously_recognized>>. In that
+ case, if @var{matching} is not NULL, it will be filled in with
+ a NULL-terminated list of the names of the formats that matched,
+ allocated with <<malloc>>.
+ Then the user may choose a format and try again.
+
+ When done with the list that @var{matching} points to, the caller
+ should free it.
+*/
+
+bool
+bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
+{
+ return bfd_check_format_matches_lto (abfd, format, matching, false);
+}
+
/*
FUNCTION
bfd_set_format
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 8c9077356f1..038f6555c0b 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3748,10 +3748,13 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
l->obfd = NULL;
list = l;
+#if BFD_SUPPORTS_PLUGINS
+ /* Ignore plugin target if all LTO sections should be removed. */
+ ok_object = bfd_check_format_lto (this_element, bfd_object,
+ lto_sections_removed);
+#else
ok_object = bfd_check_format (this_element, bfd_object);
- if (!ok_object)
- bfd_nonfatal_message (NULL, this_element, NULL,
- _("Unable to recognise the format of file"));
+#endif
/* PR binutils/3110: Cope with archives
containing multiple target types. */
@@ -3887,9 +3890,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
}
#if BFD_SUPPORTS_PLUGINS
- /* Enable LTO plugin in strip unless all LTO sections should be
- removed. */
- if (is_strip && !target && !lto_sections_removed)
+ /* Enable LTO plugin in strip. */
+ if (is_strip && !target)
target = "plugin";
#endif
@@ -3987,7 +3989,21 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
input_arch))
status = 1;
}
- else if (bfd_check_format_matches (ibfd, bfd_object, &obj_matching))
+ else if (
+#if BFD_SUPPORTS_PLUGINS
+ /* Ignore plugin target first if all LTO sections should be
+ removed. Try with plugin target next if ignoring plugin
+ target fails to match the format. */
+ bfd_check_format_matches_lto (ibfd, bfd_object, &obj_matching,
+ lto_sections_removed)
+ || (lto_sections_removed
+ && bfd_check_format_matches_lto (ibfd, bfd_object,
+ &obj_matching, false))
+#else
+ bfd_check_format_matches_lto (ibfd, bfd_object, &obj_matching,
+ false)
+#endif
+ )
{
bfd *obfd;
do_copy:
@@ -5043,9 +5059,13 @@ strip_main (int argc, char *argv[])
#if BFD_SUPPORTS_PLUGINS
/* Check if all GCC LTO sections should be removed, assuming all LTO
sections will be removed with -R .gnu.lto_.*. * Remove .gnu.lto_.*
- sections will also remove .gnu.debuglto_. sections. */
- lto_sections_removed = !!find_section_list (".gnu.lto_.*", false,
- SECTION_CONTEXT_REMOVE);
+ sections will also remove .gnu.debuglto_. sections. LLVM IR
+ bitcode is stored in .llvm.lto section which will be removed with
+ -R .llvm.lto. */
+ lto_sections_removed = (!!find_section_list (".gnu.lto_.*", false,
+ SECTION_CONTEXT_REMOVE)
+ || !!find_section_list (".llvm.lto", false,
+ SECTION_CONTEXT_REMOVE));
#endif
i = optind;
diff --git a/binutils/testsuite/binutils-all/x86-64/pr33198.c b/binutils/testsuite/binutils-all/x86-64/pr33198.c
new file mode 100644
index 00000000000..cd0130cacdf
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/pr33198.c
@@ -0,0 +1,4 @@
+void
+foo (void)
+{
+}
diff --git a/binutils/testsuite/binutils-all/x86-64/x86-64.exp b/binutils/testsuite/binutils-all/x86-64/x86-64.exp
index 05c73047b60..ab1aa50a9a1 100644
--- a/binutils/testsuite/binutils-all/x86-64/x86-64.exp
+++ b/binutils/testsuite/binutils-all/x86-64/x86-64.exp
@@ -96,3 +96,161 @@ if {[catch "system \"bzip2 -dc $t > $tempfile\""] != 0} {
}
}
}
+
+proc run_pr33198_test { fat strip_flags } {
+ global srcdir
+ global subdir
+ global llvm_plug_opt
+ global AR
+ global CLANG_FOR_TARGET
+ global NM
+ global READELF
+ global STRIP
+
+ set test pr33198
+ set testname "${test}${fat} with $strip_flags"
+
+ if { [istarget "x86_64-*-linux*-gnux32"] \
+ || ![info exists CLANG_FOR_TARGET]
+ || [string match "" $llvm_plug_opt] } then {
+ untested $testname
+ return
+ }
+
+ set src $srcdir/$subdir/${test}.c
+ set obj tmpdir/${test}${fat}.o
+ set archive tmpdir/${test}${fat}.a
+ set CLANG_CFLAGS "-c -O2 -flto"
+ if { "$fat" == "-fat" } {
+ append CLANG_CFLAGS " -ffat-lto-objects"
+ }
+
+ append strip_flags " --strip-unneeded $llvm_plug_opt"
+
+ set cmd "$CLANG_FOR_TARGET $CLANG_CFLAGS -o $obj $src"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname ($obj)"
+ return
+ }
+
+ set cmd "$NM $llvm_plug_opt $obj\n"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![regexp "0+ T foo" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname ($obj)"
+ return
+ }
+
+ pass "$testname ($obj)"
+
+ set cmd "$STRIP $strip_flags $obj -o ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $obj)"
+ return
+ }
+
+ set cmd "$NM $llvm_plug_opt ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![regexp "0+ T foo" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $obj)"
+ return
+ }
+
+ if { "$fat" == "-fat" } {
+ set cmd "$READELF -SW ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if [regexp "\.llvm\.lto *LLVM_LTO *" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $obj)"
+ return
+ }
+ }
+
+ pass "$testname (strip $obj)"
+
+ set cmd "$AR $llvm_plug_opt -s -r -c $archive $obj"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname ($archive)"
+ return
+ }
+
+ set cmd "$NM $llvm_plug_opt $archive\n"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![regexp "0+ T foo" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname ($archive)"
+ return
+ }
+
+ pass "$testname ($archive)"
+
+ set cmd "$STRIP $strip_flags $archive -o ${archive}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $archive)"
+ return
+ }
+
+ set cmd "$NM $llvm_plug_opt ${archive}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![regexp "0+ T foo" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $archive)"
+ return
+ }
+
+ if { "$fat" == "-fat" } {
+ set cmd "$READELF -SW ${archive}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if [regexp "\.llvm\.lto *LLVM_LTO *" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $archive)"
+ return
+ }
+ }
+
+ pass "$testname (strip $archive)"
+}
+
+run_pr33198_test "" "-R .gnu.lto_* -R .gnu.debuglto_* -R .llvm.lto -N __gnu_lto_v1"
+run_pr33198_test "-fat" "-R .gnu.lto_* -R .gnu.debuglto_* -R .llvm.lto -N __gnu_lto_v1"
+run_pr33198_test "" "-R .llvm.lto"
+run_pr33198_test "-fat" "-R .llvm.lto"
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 2da7138e211..ec246f45257 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -1813,3 +1813,30 @@ proc get_standard_section_names {} {
}
return
}
+
+set llvm_plug_opt ""
+if { [isnative] } then {
+ if ![info exists CLANG_FOR_TARGET] then {
+ catch "exec clang -v" got
+ if [regexp "clang version" $got] then {
+ set CLANG_FOR_TARGET clang
+ }
+ }
+ if [info exists CLANG_FOR_TARGET] then {
+ set llvm_plug_so [string trim [exec $CLANG_FOR_TARGET -print-file-name=LLVMgold.so]]
+ if { $llvm_plug_so ne "LLVMgold.so" } then {
+ set llvm_plug_opt "--plugin $llvm_plug_so"
+ }
+
+ if { $llvm_plug_opt eq "" } then {
+ # If it is still blank, try llvm-config --libdir. Clang
+ # searches CLANG_INSTALL_LIBDIR_BASENAME which corresponds
+ # to this.
+ catch "exec llvm-config --libdir" got
+ if {[file isdirectory $got] \
+ && [file isfile $got/LLVMgold.so]} then {
+ set llvm_plug_opt "--plugin $got/LLVMgold.so"
+ }
+ }
+ }
+}
--
2.50.1

View file

@ -27,6 +27,17 @@
if ![regexp $want $got] then {
fail "$testname -s option $got\n"
} else {
--- binutils.orig/binutils/testsuite/binutils-all/objdump.exp 2023-08-03 13:09:07.631503783 +0100
+++ binutils-2.41/binutils/testsuite/binutils-all/objdump.exp 2023-08-03 14:51:54.621295727 +0100
@@ -921,7 +921,7 @@ proc test_objdump_S { } {
}
}
-test_objdump_S
+# test_objdump_S
# Test objdump --private
proc test_objdump_P {} {
--- binutils.orig/ld/testsuite/ld-scripts/ld-version.d 2023-08-03 13:09:07.949504208 +0100
+++ binutils-2.41/ld/testsuite/ld-scripts/ld-version.d 2023-08-03 15:13:01.374590134 +0100
@@ -4,4 +4,4 @@
@ -63,7 +74,7 @@
+++ binutils-2.41/ld/testsuite/ld-x86-64/x86-64.exp 2023-08-03 15:46:29.537416942 +0100
@@ -1386,7 +1386,7 @@ if { [isnative] && [check_compiler_avail
"$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libprotected-func-2b.so" \
"$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
"$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
{ protected-func-1b.c } \
- {{error_output "pr28875-func.err"}} \
+ {} \
@ -72,7 +83,7 @@
[list \
@@ -1402,7 +1402,7 @@ if { [isnative] && [check_compiler_avail
"$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libprotected-func-2c.so" \
"$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
"$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
{ protected-func-1b.c } \
- {{error_output "pr28875-func.err"}} \
+ {} \
@ -1032,7 +1043,7 @@ diff -rup bin.orig/ld/testsuite/ld-x86-64/sframe-pltgot-2.d binutils-2.43.50-55e
}
}
- undefined_weak "$DIRECT_EXTERN_ACCESS_CFLAGS $NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
- undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
undefined_weak "-fPIE" "$NOPIE_LDFLAGS"
undefined_weak "-fPIE" "-pie"
undefined_weak "-fPIE" "$NOPIE_LDFLAGS -Wl,-z,nodynamic-undefined-weak"
@ -1070,80 +1081,3 @@ diff -rup bin.orig/ld/testsuite/ld-x86-64/sframe-pltgot-2.d binutils-2.43.50-55e
]
}
--- fred/binutils/testsuite/binutils-all/objdump.exp 2026-02-16 09:03:27.457277379 +0000
+++ binutils-with-gold-2.46.50-2d306bf8a70/binutils/testsuite/binutils-all/objdump.exp 2026-02-16 09:03:30.592967621 +0000
@@ -957,7 +957,7 @@ proc test_objdump_S { } {
}
}
-test_objdump_S
+# test_objdump_S
# Test objdump --map-global-vars on file containing dwarf-2 encoding information.
diff -rup binutils.orig/ld/testsuite/ld-riscv-elf/data-reloc-rv32-pic.d binutils-with-gold-2.46/ld/testsuite/ld-riscv-elf/data-reloc-rv32-pic.d
--- binutils.orig/ld/testsuite/ld-riscv-elf/data-reloc-rv32-pic.d 2026-03-20 13:02:05.468700958 +0000
+++ binutils-with-gold-2.46/ld/testsuite/ld-riscv-elf/data-reloc-rv32-pic.d 2026-03-20 13:05:31.155200130 +0000
@@ -1,6 +1,6 @@
#source: data-reloc.s
#as: -march=rv32i -mabi=ilp32 -defsym __abs__=1 -defsym __addr__=1 -defsym __undef__=1
-#ld: -m[riscv_choose_ilp32_emul] -Ttext 0x8000 --defsym _start=0x0 --defsym abs=0x100 --defsym abs_local=0x200 -shared
+#ld: -m[riscv_choose_ilp32_emul] -Ttext 0x8000 --defsym _start=0x0 --defsym abs=0x100 --defsym abs_local=0x200 -shared -z notext
#objdump: -dR
.*:[ ]+file format .*
diff -rup binutils.orig/ld/testsuite/ld-riscv-elf/data-reloc-rv32-pie.d binutils-with-gold-2.46/ld/testsuite/ld-riscv-elf/data-reloc-rv32-pie.d
--- binutils.orig/ld/testsuite/ld-riscv-elf/data-reloc-rv32-pie.d 2026-03-20 13:02:05.468700958 +0000
+++ binutils-with-gold-2.46/ld/testsuite/ld-riscv-elf/data-reloc-rv32-pie.d 2026-03-20 13:05:52.846252771 +0000
@@ -1,6 +1,6 @@
#source: data-reloc.s
#as: -march=rv32i -mabi=ilp32 -defsym __abs__=1 -defsym __addr__=1
-#ld: -m[riscv_choose_ilp32_emul] -Ttext 0x8000 --defsym _start=0x0 --defsym abs=0x100 --defsym abs_local=0x200 -pie
+#ld: -m[riscv_choose_ilp32_emul] -Ttext 0x8000 --defsym _start=0x0 --defsym abs=0x100 --defsym abs_local=0x200 -pie -z notext
#objdump: -dR
.*:[ ]+file format .*
diff -rup binutils.orig/ld/testsuite/ld-riscv-elf/data-reloc-rv32-symbolic.d binutils-with-gold-2.46/ld/testsuite/ld-riscv-elf/data-reloc-rv32-symbolic.d
--- binutils.orig/ld/testsuite/ld-riscv-elf/data-reloc-rv32-symbolic.d 2026-03-20 13:02:05.468700958 +0000
+++ binutils-with-gold-2.46/ld/testsuite/ld-riscv-elf/data-reloc-rv32-symbolic.d 2026-03-20 13:06:01.427273593 +0000
@@ -1,6 +1,6 @@
#source: data-reloc.s
#as: -march=rv32i -mabi=ilp32 -defsym __abs__=1 -defsym __addr__=1 -defsym __undef__=1
-#ld: -m[riscv_choose_ilp32_emul] -Ttext 0x8000 --defsym _start=0x0 --defsym abs=0x100 --defsym abs_local=0x200 -shared -Bsymbolic
+#ld: -m[riscv_choose_ilp32_emul] -Ttext 0x8000 --defsym _start=0x0 --defsym abs=0x100 --defsym abs_local=0x200 -shared -Bsymbolic -z notext
#objdump: -dR
.*:[ ]+file format .*
diff -rup binutils.orig/ld/testsuite/ld-riscv-elf/data-reloc-rv64-pic.d binutils-with-gold-2.46/ld/testsuite/ld-riscv-elf/data-reloc-rv64-pic.d
--- binutils.orig/ld/testsuite/ld-riscv-elf/data-reloc-rv64-pic.d 2026-03-20 13:02:05.468700958 +0000
+++ binutils-with-gold-2.46/ld/testsuite/ld-riscv-elf/data-reloc-rv64-pic.d 2026-03-20 13:04:07.601997355 +0000
@@ -1,6 +1,6 @@
#source: data-reloc.s
#as: -march=rv64i -mabi=lp64 -defsym __64_bit__=1 -defsym __abs__=1 -defsym __addr__=1 -defsym __undef__=1
-#ld: -m[riscv_choose_lp64_emul] -Ttext 0x8000 --defsym _start=0x0 --defsym abs=0x100 --defsym abs_local=0x200 -shared
+#ld: -m[riscv_choose_lp64_emul] -Ttext 0x8000 --defsym _start=0x0 --defsym abs=0x100 --defsym abs_local=0x200 -shared -z notext
#objdump: -dR
.*:[ ]+file format .*
diff -rup binutils.orig/ld/testsuite/ld-riscv-elf/data-reloc-rv64-pie.d binutils-with-gold-2.46/ld/testsuite/ld-riscv-elf/data-reloc-rv64-pie.d
--- binutils.orig/ld/testsuite/ld-riscv-elf/data-reloc-rv64-pie.d 2026-03-20 13:02:05.468700958 +0000
+++ binutils-with-gold-2.46/ld/testsuite/ld-riscv-elf/data-reloc-rv64-pie.d 2026-03-20 13:04:57.106117494 +0000
@@ -1,6 +1,6 @@
#source: data-reloc.s
#as: -march=rv64i -mabi=lp64 -defsym __64_bit__=1 -defsym __abs__=1 -defsym __addr__=1
-#ld: -m[riscv_choose_lp64_emul] -Ttext 0x8000 --defsym _start=0x0 --defsym abs=0x100 --defsym abs_local=0x200 -pie
+#ld: -m[riscv_choose_lp64_emul] -Ttext 0x8000 --defsym _start=0x0 --defsym abs=0x100 --defsym abs_local=0x200 -pie -z notext
#objdump: -dR
.*:[ ]+file format .*
diff -rup binutils.orig/ld/testsuite/ld-riscv-elf/data-reloc-rv64-symbolic.d binutils-with-gold-2.46/ld/testsuite/ld-riscv-elf/data-reloc-rv64-symbolic.d
--- binutils.orig/ld/testsuite/ld-riscv-elf/data-reloc-rv64-symbolic.d 2026-03-20 13:02:05.468700958 +0000
+++ binutils-with-gold-2.46/ld/testsuite/ld-riscv-elf/data-reloc-rv64-symbolic.d 2026-03-20 13:05:14.650160073 +0000
@@ -1,6 +1,6 @@
#source: data-reloc.s
#as: -march=rv64i -mabi=lp64 -defsym __64_bit__=1 -defsym __abs__=1 -defsym __addr__=1 -defsym __undef__=1
-#ld: -m[riscv_choose_lp64_emul] -Ttext 0x8000 --defsym _start=0x0 --defsym abs=0x100 --defsym abs_local=0x200 -shared -Bsymbolic
+#ld: -m[riscv_choose_lp64_emul] -Ttext 0x8000 --defsym _start=0x0 --defsym abs=0x100 --defsym abs_local=0x200 -shared -Bsymbolic -z notext
#objdump: -dR
.*:[ ]+file format .*

View file

@ -6,8 +6,8 @@ Name: binutils%{?_with_debug:-debug}
# A version number of X.XX.90 is a pre-release snapshot.
# The variable %%{source} (see below) should be set to indicate which of these
# origins is being used.
Version: 2.47.50
Release: 6%{?dist}
Version: 2.45.1
Release: 5%{?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
@ -96,23 +96,13 @@ URL: https://sourceware.org/binutils
%define enable_separate_code 0
%endif
# Enable the creation of relocations against the contents of read-only
# sections (such as .text). This is a security vulnerability, so it is
# disabled here by default.
# Note - the upstream GNU Binutils sources enable the generation of this
# kind of relocation by default, so this is a difference between Ferdora
# and upstream.
%define enable_textrel 0
# Indicate where the sources come from.
#
# Official releases come from: https://ftp.gnu.org/gnu/binutils
# Pre releases come from: https://sourceware.org/pub/binutils/snapshots/
# (Even numbered pre releases include gold)
# Snapshots come from: https://snapshots.sourceware.org/binutils/trunk/
# and are turned into commits by following this process:
# Tarballs are made by hand following a process outlined in this document:
# https://fedoraproject.org/wiki/BinutilsRawhideSync
# Tarballs are made by hand as and when necessary.
#
# Note - the Linux Kernel binutils releases are too unstable and contain
# too many controversial patches so we stick with the official GNU version
@ -122,10 +112,9 @@ URL: https://sourceware.org/binutils
# They are a "snapshot" of the about to be released branch sources, rather than
# a snapshot of the mainline development sources.
# %%define source official-release
# %%define source even-pre-release
# %%define source odd-pre-release
%define source snapshot
%define source official-release
# %%define source pre-release
# %%define source snapshot
# %%define source tarball
# For snapshots and tarballs an extension is used to indicate the commit ID.
@ -133,50 +122,43 @@ URL: https://sourceware.org/binutils
# correctly. Note %%(echo) is used because you cannot directly set a
# spec variable to a hexadecimal string value.
%define commit_id %(echo "48c933a69a8")
%define commit_id %(echo "21e608528c3")
#----End of Configure Options------------------------------------------------
# Default: Not bootstrapping.
%bcond bootstrap 0
%bcond_with bootstrap
# Default: Not debug
%bcond debug 0
%bcond_with debug
# Default: support debuginfod.
%bcond debuginfod 1
%bcond_without debuginfod
# Default: Always build documentation.
%bcond docs 1
%bcond_without docs
# Default: build binutils-gprofng package.
%bcond gprofng 1
%bcond_without gprofng
# Default: Use the system supplied version of the zlib compression library.
%bcond systemzlib 1
%bcond_without systemzlib
# Default: Always run the testsuite.
%bcond testsuite 1
%bcond_without testsuite
# Default: Use the xxhash-devel library.
%bcond xxhash 1
%bcond_without xxhash
# Default: Use the libztsd-devel library.
%bcond zstd 1
# Default: Do not create cross targeted versions of the binutils.
%bcond crossbuilds 0
%bcond_without zstd
# Note - in the future the gold linker will become deprecated in Fedora.
# And it will be deprecated in RHEL-11.
%if 0%{?rhel} >= 11
%bcond gold 0
# Note - in the future the gold linker may become deprecated.
%ifnarch riscv64
%bcond_without gold
%else
# RISC-V does not have ld.gold thus disable by default.
%ifarch riscv64
%bcond gold 0
%else
%bcond gold 1
%endif
%bcond_with gold
%endif
# Allow the user to override the compiler used to build the binutils.
# The default build compiler is gcc if %%toolchain is not clang.
%if "%toolchain" == "clang"
%bcond clang 1
%bcond_without clang
%else
%bcond clang 0
%bcond_with clang
%endif
%if %{with clang}
@ -185,6 +167,10 @@ URL: https://sourceware.org/binutils
%global toolchain gcc
%endif
# (Do not) create cross targeted versions of the binutils.
%bcond_with crossbuilds
# %%bcond_without crossbuilds
%if %{with bootstrap}
%undefine with_docs
%undefine with_testsuite
@ -215,29 +201,29 @@ URL: https://sourceware.org/binutils
# ODD numbered upstream GNU Binutils releases do not include the sources
# for the GOLD linker, so we use a snapshot from the mainline development
# sources instead - but only for GOLD, not for the rest of the binutils.
#
# FIXME: Delete this once the gold linker is fully deprecated.
# %%define gold_tarball %%(echo "binutils-with-gold-2.46.50-f85ff0c4bce")
%define gold_tarball none
# %%define use_separate_gold_tarball 0
%define gold_tarball %(echo "binutils-with-gold-2.44.50-21e608528c3")
#----------------------------------------------------------------------------
%if "%{source}" == "official-release"
# Source0: https://ftp.gnu.org/gnu/binutils/binutils-with-gold-%%{version}.tar.xz
Source0: https://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz
%elif "%{source}" == "even-pre-release"
Source0: binutils-with-gold-%{version}.tar.xz
%elif "%{source}" == "odd-pre-release"
%endif
%if "%{source}" == "pre-release"
Source0: binutils-%{version}.tar.xz
%elif "%{source}" == "snapshot"
Source0: binutils-with-gold-%{version}-%{commit_id}.tar.xz
%elif "%{source}" == "tarball"
%endif
%if "%{source}" == "snapshot"
Source0: binutils-with-gold-%{version}-%{commit_id}.tar.xz
%endif
%if "%{source}" == "tarball"
Source0: binutils-%{version}-%{commit_id}.tar.xz
%endif
Source1: binutils-2.19.50.0.1-output-format.sed
%if "%{gold_tarball}" != "none"
%if "%{gold_tarball}" != ""
Source2: %{gold_tarball}.tar.xz
%endif
@ -291,82 +277,81 @@ Patch06: binutils-2.27-aarch64-ifunc.patch
# Lifetime: Permanent.
Patch07: binutils-do-not-link-with-static-libstdc++.patch
# Purpose: Allow the binutils to be configured with any (recent) version of
# autoconf.
# Lifetime: Fixed in 2.46 (maybe ?)
Patch08: binutils-autoconf-version.patch
# Purpose: Stop libtool from inserting useless runpaths into binaries.
# Lifetime: Who knows.
Patch09: binutils-libtool-no-rpath.patch
# Purpose: Fix binutils testsuite failures.
# Lifetime: Permanent, but varies with each rebase.
Patch10: binutils-testsuite-fixes.patch
# Purpose: Fix binutils testsuite failures for the RISCV-64 target.
# Lifetime: Permanent, but varies with each rebase.
Patch11: binutils-riscv-testsuite-fixes.patch
# Purpose: Fix the ar test of non-deterministic archives.
# Lifetime: Fixed in 2.46
Patch12: binutils-fix-ar-test.patch
# Purpose: Fix a seg fault in the AArch64 linker when building u-boot.
# Lifetime: Fixed in 2.46
Patch13: binutils-aarch64-small-plt0.patch
%if %{with gold}
# Purpose: Make the GOLD linker ignore the "-z pack-relative-relocs" command line option.
# Lifetime: Fixed in 2.46 (maybe)
Patch14: binutils-gold-pack-relative-relocs.patch
# Purpose: Let the gold linker ignore --error-execstack and --error-rwx-segments.
# Lifetime: Fixed in 2.46 (maybe)
Patch15: binutils-gold-ignore-execstack-error.patch
# Purpose: Stop gold from aborting when input sections with the same name
# have different flags.
# Lifetime: Fixed in 2.43 (maybe)
Patch16: binutils-gold-mismatched-section-flags.patch
Patch08: binutils-gold-mismatched-section-flags.patch
# Purpose: Change the gold configuration script to only warn about
# unsupported targets. This allows the binutils to be built with
# BPF support enabled.
# Lifetime: Permanent.
Patch17: binutils-gold-warn-unsupported.patch
Patch09: binutils-gold-warn-unsupported.patch
# Purpose: Enable the creation of .note.gnu.property sections by the GOLD
# linker for x86 binaries.
# Lifetime: Permanent.
Patch18: binutils-gold-i386-gnu-property-notes.patch
Patch10: binutils-gold-i386-gnu-property-notes.patch
# Purpose: Allow the binutils to be configured with any (recent) version of
# autoconf.
# Lifetime: Fixed in 2.44 (maybe ?)
Patch11: binutils-autoconf-version.patch
# Purpose: Stop libtool from inserting useless runpaths into binaries.
# Lifetime: Who knows.
Patch12: binutils-libtool-no-rpath.patch
# Purpose: Stop an abort when using dwp to process a file with no dwo links.
# Lifetime: Fixed in 2.46 (maybe)
Patch19: binutils-gold-empty-dwp.patch
# Lifetime: Fixed in 2.44 (maybe)
Patch13: binutils-gold-empty-dwp.patch
# Purpose: Enable building the gold linker with the target is s390x-linux.
# Lifetime: Fixed in 2.48 (maybe)
Patch20: binutils-gold-s390-configure.patch
# Purpose: Fix binutils testsuite failures.
# Lifetime: Permanent, but varies with each rebase.
Patch14: binutils-testsuite-fixes.patch
%endif
# Purpose: Fix binutils testsuite failures for the RISCV-64 target.
# Lifetime: Permanent, but varies with each rebase.
Patch15: binutils-riscv-testsuite-fixes.patch
# Purpose: Fix ld testsuite failures when enable_textrel is set.
# Lifetime: Permanent.
Patch21: binutils-ld-default-z-text.patch
# Purpose: Make the GOLD linker ignore the "-z pack-relative-relocs" command line option.
# Lifetime: Fixed in 2.44 (maybe)
Patch16: binutils-gold-pack-relative-relocs.patch
# Purpose: Let the gold linker ignore --error-execstack and --error-rwx-segments.
# Lifetime: Fixed in 2.44 (maybe)
Patch17: binutils-gold-ignore-execstack-error.patch
# Purpose: Fix the ar test of non-deterministic archives.
# Lifetime: Fixed in 2.44
Patch18: binutils-fix-ar-test.patch
# Purpose: Fix a seg fault in the AArch64 linker when building u-boot.
# Lifetime: Fixed in 2.45
Patch19: binutils-aarch64-small-plt0.patch
# Purpose: Stops a potential illegal memory access when linking a corrupt
# input file. PR 33457
# Lifetime: Fixed in 2.46
Patch20: binutils-CVE-2025-11083.patch
# Purpose: Stops a potential illegal memory access when linking a corrupt
# input file. PR 33464
# Lifetime: Fixed in 2.46
Patch21: binutils-CVE-2025-11082.patch
#----------------------------------------------------------------------------
# Purpose: Remove the Build protected-func-2 without PIE linker tests
# as these are currently failing.
# Lifetime: TEMPORARY - should be fixed by the 2.46 release.
Patch98: binutils-remove-ld-protected-func-2-test.patch
# Purpose: Suppress the x86 linker's p_align-1 tests due to kernel bug on CentOS-10.
# 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
# Purpose: Disable GCS warnings when shared dependencies are not built with GCS
# support
# Lifetime: TEMPORARY
Patch100: binutils-disable-gcs-report-dynamic.patch
Patch101: binutils-disable-gcs-report-dynamic-tests.patch
#----------------------------------------------------------------------------
Provides: bundled(libiberty)
@ -381,7 +366,8 @@ 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 gold/yyscript.c and ld/ldgram.c.
# bison is used to generate either gold/yyscript.c or ld/ldgram.c depending
# on the build architecture.
BuildRequires: bison
%if %{with clang}
@ -443,6 +429,15 @@ Requires(preun): %{_sbindir}/alternatives
# We also need rm.
Requires(post): coreutils
# %%if %%{with gold}
# # For now we make the binutils package require the gold sub-package.
# # That way other packages that have a requirement on "binutils" but
# # actually want gold will not have to be changed. In the future, if
# # we decide to deprecate gold, we can remove this requirement, and
# # then update other packages as necessary.
# Requires: binutils-gold >= %%{version}
# %%endif
# On ARM EABI systems, we do want -gnueabi to be part of the
# target triple.
%ifnarch %{arm}
@ -615,37 +610,33 @@ use by developers. It is NOT INTENDED FOR PRODUCTION use.
%prep
%if "%{gold_tarball}" != "none"
%if "%{gold_tarball}" != ""
%setup -q -n binutils-%{version} -a 0
%if %{with gold}
%setup -q -n binutils-%{version} -D -b 2
mv ../%{gold_tarball}/gold .
mv ../%{gold_tarball}/elfcpp .
%endif
%autopatch -p1
%elif "%{source}" == "snapshot"
%else
%if "%{source}" == "snapshot"
%autosetup -p1 -n binutils-with-gold-%{version}-%{commit_id}
%elif "%{source}" == "official-release"
%autosetup -p1 -n binutils-with-gold-%{version}
%elif "%{source}" == "even-pre-release"
%autosetup -p1 -n binutils-with-gold-%{version}
%elif "%{source}" == "odd-pre-release"
%autosetup -p1 -n binutils-%{version}
%else
%autosetup -p1 -n binutils-with-gold-%{version}
%autosetup -p1 -n binutils-%{version}
%endif
%endif
# On ppc64 and aarch64, we might use 64KiB pages
sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*ppc.c
sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*aarch64.c
%if %{with gold}
sed -i -e '/common_pagesize/s/4 /64 /' gold/powerpc.cc
sed -i -e '/pagesize/s/0x1000,/0x10000,/' gold/aarch64.cc
%endif
# LTP sucks
perl -pi -e 's/i\[3-7\]86/i[34567]86/g' */conf*
@ -799,18 +790,16 @@ compute_global_configuration()
CARGS="$CARGS --enable-threads=no"
%endif
%if %{enable_textrel}
CARGS="$CARGS --enable-textrel-check=no"
%else
CARGS="$CARGS --enable-textrel-check=error"
%endif
# The binutils build system enables -Werror by default, which is a problem
# because there is a known issue with the libiberty library sources:
%if "%{source}" != "official-release"
# Since non official release tarballs are created directly from development
# sources they will have "development=true" set in the bfd/development.sh file.
# This enables -Werror by default, which is a problem because there is a
# known issue with the libiberty library:
# libiberty/cp-demangle.c: In function 'd_demangle_callback.constprop':
# libiberty/cp-demangle.c:6794:1: error: stack usage might be unbounded [-Werror=stack-usage=]
# So we explicitly disable werror for builds.
# So we explicitly disable werror for builds from these tarballs.
CARGS="$CARGS --enable-werror=no"
%endif
}
# run_target_configuration()
@ -835,13 +824,7 @@ run_target_configuration()
%set_build_flags
%if %{enable_lto}
# RHEL-121799: Builders may want to restrict the number of CPUs used by
# the LTO compiler. The normal way to do this is to set RPM_BUILD_NCPUS.
# But this only affects the -j option passed to make. By adding -flto=N
# we can also restrict the number of threads used by the LTO compiler.
export CFLAGS="$RPM_OPT_FLAGS -flto=$RPM_BUILD_NCPUS"
%endif
export CFLAGS="$RPM_OPT_FLAGS"
%ifarch %{power64}
export CFLAGS="$CFLAGS -Wno-error"
@ -875,8 +858,12 @@ run_target_configuration()
#
# Also enable the BPF target so that strip will work on BPF files.
case $target in
s390x*)
TARGS="--enable-targets=s390x-linux,x86_64-pep,bpf-unknown-none"
s390*)
# Note - The s390-linux target is there so that the GOLD linker will
# build. By default, if configured for just s390x-linux, the GOLD
# configure system will only include support for 64-bit targets, but
# the s390x gold backend uses both 32-bit and 64-bit templates.
TARGS="--enable-targets=s390-linux,s390x-linux,x86_64-pep,bpf-unknown-none"
;;
ia64*)
TARGS="--enable-targets=ia64-linux,x86_64-pep,bpf-unknown-none"
@ -1373,8 +1360,8 @@ exit 0
%{_bindir}/[!l]*
# %%verify(symlink) does not work for some reason, so using "owner" instead.
%verify(owner) %{_bindir}/ld
# %%verify(mtime) does not work, probably because of the alternatives command in the %%post stage, so using "not mtime" instead. (#2277349)(RHEL-238406)
%verify(not mtime) %{_bindir}/ld.bfd
# %%verify(mtime) does not work, probably because of the alternatives command in the %%post stage, so using "owner" instead. (#2277349)
%verify(owner) %{_bindir}/ld.bfd
%if %{with gprofng}
%exclude %{_bindir}/gp-*
@ -1500,145 +1487,30 @@ exit 0
#----------------------------------------------------------------------------
%changelog
* Tue Sep 01 2026 Nick Clifton <nickc@redhat.com> - 2.47.50-6
- Rebase to commit 48c933a69a8
* Tue Sep 01 2026 Jesus Checa Hidalgo <jchecahi@redhat.com> - 2.47.50-5
- Fix logic to enable and disable gold linker.
* Wed Aug 19 2026 Nick Clifton <nickc@redhat.com> - 2.47.50-4
- Rebase to bring in commits d9ab6e42e739fe826b02a5f868586132ea2d893a and
- 0f9faaebc91bc1886a563bde6c178601b4be743b, thus fixing CVE-2026-19548. (#2514618)
* Thu Aug 13 2026 Nick Clifton <nickc@redhat.com> - 2.47.50-3
- Switch from using %%bcond_with and %%bcond_without to just %%bcond <0|1>
* Thu Aug 13 2026 Nick Clifton <nickc@redhat.com> - 2.47.50-2
- Re-enable the gold linker - for now - for Rawhide.
* Wed Aug 12 2026 Nick Clifton <nickc@redhat.com> - 2.47.50-1
- Rebase to commit 4e8ba93fdb2.
- Disable the gold linker for Rawhide as well.
* Wed Aug 12 2026 Yaakov Selkowitz <yselkowi@redhat.com>
- Disable the gold linker by default for RHEL-11+.
* Mon Jul 27 2026 Nick Clifton <nickc@redhat.com> - 2.47-1
- Rebase to 2.47 release.
* Wed Jul 15 2026 Fedora Release Engineering <releng@fedoraproject.org> - 2.46.90-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
* Mon Jul 13 2026 Nick Clifton <nickc@redhat.com> - 2.46.90-1
- Rebase to 2.47 pre-release tarball.
* Thu Jun 25 2026 Nick Clifton <nickc@redhat.com> - 2.46.50-12
- Rebase to commit f85ff0c4bce
* Thu Jun 11 2026 Nick Clifton <nickc@redhat.com> - 2.46.50-11
- Fix linker testsuite problem for Risc-V.
* Thu Jun 04 2026 Nick Clifton <nickc@redhat.com> - 2.46.50-10
- Rebase to commit 48997323b0f
* Thu May 14 2026 Nick Clifton <nickc@redhat.com> - 2.46.50-9
- Rebase to commit 2ea3f3a7ac2
* Fri Apr 24 2026 Nick Clifton <nickc@redhat.com> - 2.46.50-8
- Rebase to commit 991cf245839.
* Wed Apr 08 2026 Nick Clifton <nickc@redhat.com> - 2.45.50-7
* Wed Apr 08 2026 Nick Clifton <nickc@redhat.com> - 2.45.1-5
- Add support for zstd compression. (#2454341)
* Tue Apr 07 2026 Nick Clifton <nickc@redhat.com> - 2.46.50-6
- Rebase to commit c220f3ab8c0
* Thu Jan 15 2026 Nick Clifton <nickc@redhat.com> - 2.45.1-4
- Remove experimental Risc-V patch added with -2 revision.
* Mon Mar 30 2026 Nick Clifton <nickc@redhat.com> - 2.46.50-5
- Rebase to commit c220f3ab8c0
* Fri Jan 09 2026 Nick Clifton <nickc@redhat.com> - 2.45.1-3
- Fix Risc-V related test failures caused by previous patch.
* Fri Mar 20 2026 Nick Clifton <nickc@redhat.com> - 2.46.50-4
- Fix Risc-V linker testsuite failures caused by #2428281.
* Mon Mar 16 2026 Nick Clifton <nickc@redhat.com> - 2.46.50-3
- Rebase to commit d712202846b.
* Mon Mar 02 2026 Nick Clifton <nickc@redhat.com> - 2.46.50-2
- Rebase to commit dd9a411627a.
* Mon Feb 16 2026 Nick Clifton <nickc@redhat.com> - 2.46.50-1
- Rebase to commit 2d306bf8a70
* Mon Feb 09 2026 Nick Clifton <nickc@redhat.com> - 2.46-1
- Rebase to GNU Binutils 2.46.
* Tue Jan 27 2026 Nick Clifton <nickc@redhat.com> - 2.45.90-1
- Rebase to pre-release snapshot.
* Mon Jan 19 2026 Nick Clifton <nickc@redhat.com> - 2.45.50-19
- Rebase to commit ba5838a98fb
* Fri Jan 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 2.45.50-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
* Fri Jan 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 2.45.50-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
* Thu Jan 15 2026 Nick Clifton <nickc@redhat.com> - 2.45.50-16
- Remove experimental Risc-V patch added with -12 revision.
* Tue Jan 13 2026 Nick Clifton <nickc@redhat.com> - 2.45.50-15
- Disallow the creation of shared object that use text relocations. (#2428281)
* Fri Jan 09 2026 Nick Clifton <nickc@redhat.com> - 2.45.50-14
- Fix Risc-V related test failures caused by -12 revision.
* Mon Jan 05 2026 Nick Clifton <nickc@redhat.com> - 2.45.50-13
- Rebase to commit be970c68891
* Thu Dec 18 2025 Nick Clifton <nickc@redhat.com> - 2.45.50-12
- Fix compile time warning messages about discarded qualifiers.
* Mon Jan 05 2026 Nick Clifton <nickc@redhat.com> - 2.45.1-2
- Change Risc-V assembler to default to disabling relaxation.
* Mon Dec 08 2025 Nick Clifton <nickc@redhat.com> - 2.45.50-11
- Rebase to commit 8e992ccb1e4
* Wed Nov 12 2025 Nick Clifton <nickc@redhat.com> - 2.45.1-1
- Rebase to the 2.45.1 release.
* Thu Dec 04 2025 Nick Clifton <nickc@redhat.com> - 2.45.50-10
- Fix testsuite failures for Risc-V target.
* Fri Oct 03 2025 Nick Clifton <nickc@redhat.com> - 2.45-4
- Stop a potential illegal memory access when linking a corrupt input file. (CVE-2025-11082)
* Mon Nov 24 2025 Nick Clifton <nickc@redhat.com> - 2.45.50-9
- Rebase to commit beab972c07d
- Revert patches for PR 33577
* Thu Oct 02 2025 Nick Clifton <nickc@redhat.com> - 2.45-3
- Stop a potential illegal memory access when linking a corrupt input file. (CVE-2025-11083)
* Tue Nov 11 2025 Nick Clifton <nickc@redhat.com> - 2.45.50-8
- Rebase to commit 96b8a8a633a
* Tue Nov 04 2025 Nick Clifton <nickc@redhat.com> - 2.45.50-7
- Pass -flto=$RPM_BUILD_NCPUS in CFLAGS. (RHEL-121799)
* Tue Oct 28 2025 Nick Clifton <nickc@redhat.com> - 2.45.50-6
- Rebase to commit 2006dea18d5
* Mon Oct 06 2025 Nick Clifton <nickc@redhat.com> - 2.45.50-5
- Rebase to commit b05d1d89605
* Tue Sep 09 2025 Nick Clifton <nickc@redhat.com> - 2.45.50-4
* Fri Sep 12 2025 Nick Clifton <nickc@redhat.com> - 2.45-2
- Enhance the riscv-64 zicfilp-unlabeled-plt test to cope with larger offsets.
* Mon Sep 08 2025 Nick Clifton <nickc@redhat.com> - 2.45.50-3
- Rebase to commit 79b2b564fec
* Tue Aug 19 2025 Nick Clifton <nickc@redhat.com> - 2.45.50-2
- Rebase to commit 7e432e93f8a (previous rebase appears to be broken)
* Mon Aug 18 2025 Nick Clifton <nickc@redhat.com> - 2.45.50-1
- Rebase to commit 570f4c0c119.
* Fri Aug 15 2025 Nick Clifton <nickc@redhat.com> - 2.45-3
- Oops - the gold linker was disabled too soon, re-enabling.
* Wed Aug 13 2025 Nick Clifton <nickc@redhat.com> - 2.45-2
- Disable building of gold by default. Ref: https://fedoraproject.org/wiki/Changes/DeprecateGoldLinker
* Mon Jul 28 2025 Nick Clifton <nickc@redhat.com> - 2.45-1
- Rebase to official GNU Binutils 2.45 release.

View file

@ -1,2 +1,3 @@
SHA512 (binutils-with-gold-2.47.50-48c933a69a8.tar.xz) = c4300e4881227c431c0bbbb949a5ee5bc113701f993766418b152df7d46d9df378ebace9efffcb6e1f0b7e72ad716bbcccf5b6aa55851dc28216555b242d18a0
SHA512 (binutils-2.45.1.tar.xz) = ea030419eba387579ab717be7e3223fc99e93b586860b06003c12489f93441640d4082736f76aa5e98233db4f46e232f536a45e471486de1f5b64e1b827c167e
SHA512 (binutils-2.19.50.0.1-output-format.sed) = 2f8686b0c8af13c98cda056824c2820416f6e2d003f70b78ccf5314525b9ee3684d421dfa83e638a2d42d06ea4d4bdaf5226b64d6ec26f7ff59c44ffb2a23dd2
SHA512 (binutils-with-gold-2.44.50-21e608528c3.tar.xz) = 5d8d4123ca290893ce20b73ad94263102e602bfc0d3f3b9412f5dd769c5bd44a1330b954b012442f8f2dcee6392992b44218d6d200b986a10359bb11e8ac5c3b