binutils rebuild

This commit is contained in:
Rmys
2025-11-07 17:48:43 +03:00
parent cba7e8e1a7
commit 7a85f15ae2
21 changed files with 2945 additions and 133 deletions
@@ -1,66 +0,0 @@
Only in binutils-2.34/gold: autom4te.cache
diff -rup binutils.orig/gold/configure binutils-2.34/gold/configure
--- binutils.orig/gold/configure 2020-04-20 12:35:13.048297305 +0100
+++ binutils-2.34/gold/configure 2020-04-20 14:02:06.743725696 +0100
@@ -5180,7 +5180,8 @@ for targ in $target $canon_targets; do
. ${srcdir}/configure.tgt
if test "$targ_obj" = "UNKNOWN"; then
- as_fn_error $? "\"unsupported target $targ\"" "$LINENO" 5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"unsupported target $targ\"" >&5
+$as_echo "$as_me: WARNING: \"unsupported target $targ\"" >&2;}
else
targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)"
if test "$targ_extra_obj" != ""; then
diff -rup binutils.orig/gold/configure.ac binutils-2.34/gold/configure.ac
--- binutils.orig/gold/configure.ac 2020-04-20 12:35:13.050297291 +0100
+++ binutils-2.34/gold/configure.ac 2020-04-20 14:01:46.435868770 +0100
@@ -181,7 +181,7 @@ for targ in $target $canon_targets; do
. ${srcdir}/configure.tgt
if test "$targ_obj" = "UNKNOWN"; then
- AC_MSG_ERROR("unsupported target $targ")
+ AC_MSG_WARN("unsupported target $targ")
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
;;
#ifdef BFD64
- bpf-*-none)
+ bpf-*-none | bpf-*)
targ_defvec=bpf_elf64_le_vec
targ_selvecs=bpf_elf64_be_vec
targ_underscore=yes
@@ -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
;;
@@ -1,66 +0,0 @@
Only in binutils-2.34/gold: autom4te.cache
diff -rup binutils.orig/gold/configure binutils-2.34/gold/configure
--- binutils.orig/gold/configure 2020-04-20 12:35:13.048297305 +0100
+++ binutils-2.34/gold/configure 2020-04-20 14:02:06.743725696 +0100
@@ -5180,7 +5180,8 @@ for targ in $target $canon_targets; do
. ${srcdir}/configure.tgt
if test "$targ_obj" = "UNKNOWN"; then
- as_fn_error $? "\"unsupported target $targ\"" "$LINENO" 5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"unsupported target $targ\"" >&5
+$as_echo "$as_me: WARNING: \"unsupported target $targ\"" >&2;}
else
targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)"
if test "$targ_extra_obj" != ""; then
diff -rup binutils.orig/gold/configure.ac binutils-2.34/gold/configure.ac
--- binutils.orig/gold/configure.ac 2020-04-20 12:35:13.050297291 +0100
+++ binutils-2.34/gold/configure.ac 2020-04-20 14:01:46.435868770 +0100
@@ -181,7 +181,7 @@ for targ in $target $canon_targets; do
. ${srcdir}/configure.tgt
if test "$targ_obj" = "UNKNOWN"; then
- AC_MSG_ERROR("unsupported target $targ")
+ AC_MSG_WARN("unsupported target $targ")
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
;;
#ifdef BFD64
- bpf-*-none)
+ bpf-*-none | bpf-*)
targ_defvec=bpf_elf64_le_vec
targ_selvecs=bpf_elf64_be_vec
targ_underscore=yes
@@ -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
;;
@@ -0,0 +1,33 @@
From ad8cf343ab5c442e62e0b2606732760787ae735a Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Sun, 27 Jul 2025 10:53:38 +0100
Subject: [PATCH 01/23] Re-enable development on the 2.45 branch
---
bfd/development.sh | 2 +-
bfd/version.m4 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bfd/development.sh b/bfd/development.sh
index 8b004da7d52..b8014261bfb 100644
--- a/bfd/development.sh
+++ b/bfd/development.sh
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Controls whether to enable development-mode features by default.
-development=false
+development=true
# Indicate whether this is a release branch.
experimental=false
diff --git a/bfd/version.m4 b/bfd/version.m4
index 00d03934d68..848470098f5 100644
--- a/bfd/version.m4
+++ b/bfd/version.m4
@@ -1 +1 @@
-m4_define([BFD_VERSION], [2.45])
+m4_define([BFD_VERSION], [2.45.0])
--
2.49.1
@@ -0,0 +1,534 @@
From 2a07e06e26918c83071cb7c5789439315f505430 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Mon, 28 Jul 2025 08:21:51 +0930
Subject: [PATCH 02/23] Re: Re-enable development on the 2.45 branch
regen configure for the version bump 2.45 -> 2.45.0
---
bfd/configure | 20 ++++++++++----------
binutils/configure | 20 ++++++++++----------
gas/configure | 20 ++++++++++----------
gprof/configure | 20 ++++++++++----------
ld/configure | 20 ++++++++++----------
opcodes/configure | 20 ++++++++++----------
6 files changed, 60 insertions(+), 60 deletions(-)
diff --git a/bfd/configure b/bfd/configure
index ec09f5bc834..86561b30ac4 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for bfd 2.45.
+# Generated by GNU Autoconf 2.69 for bfd 2.45.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bfd'
PACKAGE_TARNAME='bfd'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='bfd 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='bfd 2.45.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1409,7 +1409,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures bfd 2.45 to adapt to many kinds of systems.
+\`configure' configures bfd 2.45.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1480,7 +1480,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of bfd 2.45:";;
+ short | recursive ) echo "Configuration of bfd 2.45.0:";;
esac
cat <<\_ACEOF
@@ -1625,7 +1625,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-bfd configure 2.45
+bfd configure 2.45.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2219,7 +2219,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by bfd $as_me 2.45, which was
+It was created by bfd $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3202,7 +3202,7 @@ fi
# Define the identity of the package.
PACKAGE='bfd'
- VERSION='2.45'
+ VERSION='2.45.0'
cat >>confdefs.h <<_ACEOF
@@ -17754,7 +17754,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by bfd $as_me 2.45, which was
+This file was extended by bfd $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -17820,7 +17820,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-bfd config.status 2.45
+bfd config.status 2.45.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/binutils/configure b/binutils/configure
index 94be22505d4..0ff4539f458 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for binutils 2.45.
+# Generated by GNU Autoconf 2.69 for binutils 2.45.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='binutils'
PACKAGE_TARNAME='binutils'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='binutils 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='binutils 2.45.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1407,7 +1407,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures binutils 2.45 to adapt to many kinds of systems.
+\`configure' configures binutils 2.45.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1478,7 +1478,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of binutils 2.45:";;
+ short | recursive ) echo "Configuration of binutils 2.45.0:";;
esac
cat <<\_ACEOF
@@ -1640,7 +1640,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-binutils configure 2.45
+binutils configure 2.45.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2108,7 +2108,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by binutils $as_me 2.45, which was
+It was created by binutils $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3091,7 +3091,7 @@ fi
# Define the identity of the package.
PACKAGE='binutils'
- VERSION='2.45'
+ VERSION='2.45.0'
cat >>confdefs.h <<_ACEOF
@@ -16879,7 +16879,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by binutils $as_me 2.45, which was
+This file was extended by binutils $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16945,7 +16945,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-binutils config.status 2.45
+binutils config.status 2.45.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/gas/configure b/gas/configure
index 9c640c870cd..ca149e79195 100755
--- a/gas/configure
+++ b/gas/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gas 2.45.
+# Generated by GNU Autoconf 2.69 for gas 2.45.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='gas'
PACKAGE_TARNAME='gas'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='gas 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='gas 2.45.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1393,7 +1393,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures gas 2.45 to adapt to many kinds of systems.
+\`configure' configures gas 2.45.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1464,7 +1464,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gas 2.45:";;
+ short | recursive ) echo "Configuration of gas 2.45.0:";;
esac
cat <<\_ACEOF
@@ -1621,7 +1621,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-gas configure 2.45
+gas configure 2.45.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2032,7 +2032,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by gas $as_me 2.45, which was
+It was created by gas $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3012,7 +3012,7 @@ fi
# Define the identity of the package.
PACKAGE='gas'
- VERSION='2.45'
+ VERSION='2.45.0'
cat >>confdefs.h <<_ACEOF
@@ -16548,7 +16548,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by gas $as_me 2.45, which was
+This file was extended by gas $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16614,7 +16614,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-gas config.status 2.45
+gas config.status 2.45.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/gprof/configure b/gprof/configure
index 36ac75e49b3..e40de173a1e 100755
--- a/gprof/configure
+++ b/gprof/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gprof 2.45.
+# Generated by GNU Autoconf 2.69 for gprof 2.45.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='gprof'
PACKAGE_TARNAME='gprof'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='gprof 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='gprof 2.45.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1351,7 +1351,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures gprof 2.45 to adapt to many kinds of systems.
+\`configure' configures gprof 2.45.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1422,7 +1422,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gprof 2.45:";;
+ short | recursive ) echo "Configuration of gprof 2.45.0:";;
esac
cat <<\_ACEOF
@@ -1541,7 +1541,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-gprof configure 2.45
+gprof configure 2.45.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1906,7 +1906,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by gprof $as_me 2.45, which was
+It was created by gprof $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2886,7 +2886,7 @@ fi
# Define the identity of the package.
PACKAGE='gprof'
- VERSION='2.45'
+ VERSION='2.45.0'
cat >>confdefs.h <<_ACEOF
@@ -14255,7 +14255,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by gprof $as_me 2.45, which was
+This file was extended by gprof $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14321,7 +14321,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-gprof config.status 2.45
+gprof config.status 2.45.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/ld/configure b/ld/configure
index 78b54b39eb2..4afc58566fc 100755
--- a/ld/configure
+++ b/ld/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for ld 2.45.
+# Generated by GNU Autoconf 2.69 for ld 2.45.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ld'
PACKAGE_TARNAME='ld'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='ld 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='ld 2.45.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1436,7 +1436,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures ld 2.45 to adapt to many kinds of systems.
+\`configure' configures ld 2.45.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1507,7 +1507,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of ld 2.45:";;
+ short | recursive ) echo "Configuration of ld 2.45.0:";;
esac
cat <<\_ACEOF
@@ -1690,7 +1690,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-ld configure 2.45
+ld configure 2.45.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2222,7 +2222,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by ld $as_me 2.45, which was
+It was created by ld $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3206,7 +3206,7 @@ fi
# Define the identity of the package.
PACKAGE='ld'
- VERSION='2.45'
+ VERSION='2.45.0'
cat >>confdefs.h <<_ACEOF
@@ -19661,7 +19661,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by ld $as_me 2.45, which was
+This file was extended by ld $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -19727,7 +19727,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-ld config.status 2.45
+ld config.status 2.45.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/opcodes/configure b/opcodes/configure
index d878234c88f..3dd6b692f89 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for opcodes 2.45.
+# Generated by GNU Autoconf 2.69 for opcodes 2.45.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='opcodes'
PACKAGE_TARNAME='opcodes'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='opcodes 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='opcodes 2.45.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1368,7 +1368,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures opcodes 2.45 to adapt to many kinds of systems.
+\`configure' configures opcodes 2.45.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1439,7 +1439,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of opcodes 2.45:";;
+ short | recursive ) echo "Configuration of opcodes 2.45.0:";;
esac
cat <<\_ACEOF
@@ -1560,7 +1560,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-opcodes configure 2.45
+opcodes configure 2.45.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1971,7 +1971,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by opcodes $as_me 2.45, which was
+It was created by opcodes $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2951,7 +2951,7 @@ fi
# Define the identity of the package.
PACKAGE='opcodes'
- VERSION='2.45'
+ VERSION='2.45.0'
cat >>confdefs.h <<_ACEOF
@@ -14623,7 +14623,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by opcodes $as_me 2.45, which was
+This file was extended by opcodes $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14689,7 +14689,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-opcodes config.status 2.45
+opcodes config.status 2.45.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
--
2.49.1
@@ -0,0 +1,39 @@
From f4290b2509788d1a284d8287cf078041d427c96e Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Thu, 17 Jul 2025 13:16:31 +0100
Subject: [PATCH 03/23] bfd: drop unused elt_no
GCC trunk recently had improvements to its -Wunused-but-set-variable which
picked up that elt_no isn't used at all in the end.
* archive.c (_bfd_compute_and_write_armap): Drop unused elt_no.
(cherry picked from commit 11153b13a56dae4ddd068ccf812ebc295783edf9)
---
bfd/archive.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/bfd/archive.c b/bfd/archive.c
index 8e20554d781..c61d4b12658 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -2299,7 +2299,6 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
{
char *first_name = NULL;
bfd *current;
- file_ptr elt_no = 0;
struct orl *map = NULL;
unsigned int orl_max = 1024; /* Fine initial default. */
unsigned int orl_count = 0;
@@ -2334,7 +2333,7 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
/* Map over each element. */
for (current = arch->archive_head;
current != NULL;
- current = current->archive_next, elt_no++)
+ current = current->archive_next)
{
if (bfd_check_format (current, bfd_object)
&& (bfd_get_file_flags (current) & HAS_SYMS) != 0)
--
2.49.1
@@ -0,0 +1,56 @@
From 5541a7e7712ddc5f2eaf4321675201f281610c85 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Thu, 17 Jul 2025 13:18:05 +0100
Subject: [PATCH 04/23] binutils: drop unused note_size, contents, old
variables
GCC trunk recently had improvements to its -Wunused-but-set-variable which
picked up that contents and hence note_size & old aren't used at all in the
end.
* objcopy.c (merge_gnu_build_notes): Drop unused 'note_size', 'contents',
and 'old' variables.
(cherry picked from commit d3d1718602b179d8ec833851f5cb67ab9d314a92)
---
binutils/objcopy.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 038f6555c0b..905ce917708 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2529,7 +2529,6 @@ merge_gnu_build_notes (bfd * abfd,
/* Reconstruct the ELF notes. */
bfd_byte * new_contents;
- bfd_byte * old;
bfd_byte * new;
bfd_vma prev_start = 0;
bfd_vma prev_end = 0;
@@ -2537,12 +2536,8 @@ merge_gnu_build_notes (bfd * abfd,
/* Not sure how, but the notes might grow in size.
(eg see PR 1774507). Allow for this here. */
new = new_contents = xmalloc (size * 2);
- for (pnote = pnotes, old = contents;
- pnote < pnotes_end;
- pnote ++)
+ for (pnote = pnotes; pnote < pnotes_end; pnote ++)
{
- bfd_size_type note_size = 12 + pnote->padded_namesz + pnote->note.descsz;
-
if (! is_deleted_note (pnote))
{
/* Create the note, potentially using the
@@ -2585,8 +2580,6 @@ merge_gnu_build_notes (bfd * abfd,
prev_end = pnote->end;
}
}
-
- old += note_size;
}
#if DEBUG_MERGE
--
2.49.1
@@ -0,0 +1,200 @@
From 29996106c19da84c522dbfa9d986f0e18540a9fc Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Fri, 18 Jul 2025 14:40:17 +0930
Subject: [PATCH 05/23] Fix unused variable warnings
(cherry picked from commit 1cfce7750aefc84768e143076bac239134ceb40d)
---
bfd/coff-mips.c | 3 +--
bfd/elf32-arm.c | 5 ++---
bfd/elf32-bfin.c | 3 +--
bfd/elf32-csky.c | 5 ++---
bfd/elf32-microblaze.c | 7 ++-----
bfd/elf32-nds32.c | 5 ++---
bfd/elf64-ppc.c | 5 ++---
bfd/elfnn-aarch64.c | 3 +--
8 files changed, 13 insertions(+), 23 deletions(-)
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index 8c4d4f7bf73..1213a159358 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -801,7 +801,6 @@ mips_relocate_section (bfd *output_bfd,
bool gp_undefined;
struct external_reloc *ext_rel;
struct external_reloc *ext_rel_end;
- unsigned int i;
bool got_lo;
struct internal_reloc lo_int_rel;
bfd_size_type amt;
@@ -861,7 +860,7 @@ mips_relocate_section (bfd *output_bfd,
ext_rel = (struct external_reloc *) external_relocs;
ext_rel_end = ext_rel + input_section->reloc_count;
- for (i = 0; ext_rel < ext_rel_end; ext_rel++, i++)
+ for (; ext_rel < ext_rel_end; ext_rel++)
{
struct internal_reloc int_rel;
bool use_lo = false;
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index c913f2b4c7d..a8fca76eb09 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -6527,16 +6527,15 @@ elf32_arm_size_stubs (bfd *output_bfd,
while (1)
{
bfd *input_bfd;
- unsigned int bfd_indx;
asection *stub_sec;
enum elf32_arm_stub_type stub_type;
bool stub_changed = false;
unsigned prev_num_a8_fixes = num_a8_fixes;
num_a8_fixes = 0;
- for (input_bfd = info->input_bfds, bfd_indx = 0;
+ for (input_bfd = info->input_bfds;
input_bfd != NULL;
- input_bfd = input_bfd->link.next, bfd_indx++)
+ input_bfd = input_bfd->link.next)
{
Elf_Internal_Shdr *symtab_hdr;
asection *section;
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index 7ac95a0634e..3cb554a717d 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -1376,7 +1376,6 @@ bfin_relocate_section (bfd * output_bfd,
asection *sgot;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- int i = 0;
dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
@@ -1387,7 +1386,7 @@ bfin_relocate_section (bfd * output_bfd,
rel = relocs;
relend = relocs + input_section->reloc_count;
- for (; rel < relend; rel++, i++)
+ for (; rel < relend; rel++)
{
int r_type;
reloc_howto_type *howto;
diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c
index 47a63895b55..3f55e7cbbac 100644
--- a/bfd/elf32-csky.c
+++ b/bfd/elf32-csky.c
@@ -3446,13 +3446,12 @@ elf32_csky_size_stubs (bfd *output_bfd,
while (1)
{
bfd *input_bfd;
- unsigned int bfd_indx;
asection *stub_sec;
bool stub_changed = false;
- for (input_bfd = info->input_bfds, bfd_indx = 0;
+ for (input_bfd = info->input_bfds;
input_bfd != NULL;
- input_bfd = input_bfd->link.next, bfd_indx++)
+ input_bfd = input_bfd->link.next)
{
Elf_Internal_Shdr *symtab_hdr;
asection *section;
diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index 57c37c53074..db7ed465779 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -1765,7 +1765,6 @@ microblaze_elf_relax_section (bfd *abfd,
Elf_Internal_Rela *irel, *irelend;
bfd_byte *contents = NULL;
bfd_byte *free_contents = NULL;
- int rel_count;
unsigned int shndx;
size_t i, sym_index;
asection *o;
@@ -1818,8 +1817,7 @@ microblaze_elf_relax_section (bfd *abfd,
goto error_return;
irelend = internal_relocs + sec->reloc_count;
- rel_count = 0;
- for (irel = internal_relocs; irel < irelend; irel++, rel_count++)
+ for (irel = internal_relocs; irel < irelend; irel++)
{
bfd_vma symval;
if ((ELF32_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64_PCREL)
@@ -1935,10 +1933,9 @@ microblaze_elf_relax_section (bfd *abfd,
if (sdata->relax_count > 0)
{
shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
- rel_count = 0;
sdata->relax[sdata->relax_count].addr = sec->size;
- for (irel = internal_relocs; irel < irelend; irel++, rel_count++)
+ for (irel = internal_relocs; irel < irelend; irel++)
{
bfd_vma nraddr;
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 3627b30af9c..bcd7c42e300 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -4344,7 +4344,6 @@ nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
Elf_Internal_Shdr *symtab_hdr;
asection *sgot;
char *local_tls_type;
- unsigned long symndx;
bfd_vma *local_tlsdesc_gotent;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
@@ -4386,8 +4385,8 @@ nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
sgot = elf_hash_table (info)->sgot;
local_tls_type = elf32_nds32_local_got_tls_type (ibfd);
local_tlsdesc_gotent = elf32_nds32_local_tlsdesc_gotent (ibfd);
- for (symndx = 0; local_got < end_local_got;
- ++local_got, ++local_tls_type, ++local_tlsdesc_gotent, ++symndx)
+ for (; local_got < end_local_got;
+ ++local_got, ++local_tls_type, ++local_tlsdesc_gotent)
{
if (*local_got > 0)
{
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 3e768dca8d6..00c1c32ffd2 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -13819,15 +13819,14 @@ ppc64_elf_size_stubs (struct bfd_link_info *info)
while (1)
{
bfd *input_bfd;
- unsigned int bfd_indx;
struct map_stub *group;
htab->stub_iteration += 1;
htab->relr_count = 0;
- for (input_bfd = info->input_bfds, bfd_indx = 0;
+ for (input_bfd = info->input_bfds;
input_bfd != NULL;
- input_bfd = input_bfd->link.next, bfd_indx++)
+ input_bfd = input_bfd->link.next)
{
Elf_Internal_Shdr *symtab_hdr;
asection *section;
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 9e98215d638..e86f0280c2a 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -8464,10 +8464,9 @@ elfNN_aarch64_modify_headers (bfd *abfd,
struct bfd_link_info *info)
{
struct elf_segment_map *m;
- unsigned int segment_count = 0;
Elf_Internal_Phdr *p;
- for (m = elf_seg_map (abfd); m != NULL; m = m->next, segment_count++)
+ for (m = elf_seg_map (abfd); m != NULL; m = m->next)
{
/* We are only interested in the memory tag segment that will be dumped
to a core file. If we have no memory tags or this isn't a core file we
--
2.49.1
@@ -0,0 +1,185 @@
From 879eabba0fcfd56738ecb91743236eda0fb08dde Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Fri, 18 Jul 2025 16:53:38 +0930
Subject: [PATCH 06/23] Fix more unused variable warnings
(cherry picked from commit 9472a0558d67610b07776d34b1dbdcc8e40f393c)
---
gas/config/tc-cr16.c | 3 ---
gas/config/tc-mn10200.c | 5 ++---
gas/config/tc-v850.c | 5 -----
gas/config/tc-xgate.c | 2 --
gas/config/tc-z8k.c | 3 +--
gas/ecoff.c | 3 ---
gas/write.c | 6 +++---
7 files changed, 6 insertions(+), 21 deletions(-)
diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c
index 99bc1bdd506..f2d110868f8 100644
--- a/gas/config/tc-cr16.c
+++ b/gas/config/tc-cr16.c
@@ -119,7 +119,6 @@ const size_t md_longopts_size = sizeof (md_longopts);
static void
l_cons (int nbytes)
{
- int c;
expressionS exp;
#ifdef md_flush_pending_output
@@ -141,7 +140,6 @@ l_cons (int nbytes)
md_cons_align (nbytes);
#endif
- c = 0;
do
{
unsigned int bits_available = BITS_PER_CHAR * nbytes;
@@ -236,7 +234,6 @@ l_cons (int nbytes)
if ((*(input_line_pointer) == '@') && (*(input_line_pointer +1) == 'c'))
code_label = 1;
emit_expr (&exp, nbytes);
- ++c;
if ((*(input_line_pointer) == '@') && (*(input_line_pointer +1) == 'c'))
{
input_line_pointer +=3;
diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c
index 1eb470295a4..fe54d2161eb 100644
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -896,7 +896,6 @@ md_assemble (char *str)
for (;;)
{
const char *errmsg = NULL;
- int op_idx;
char *hold;
int extra_shift = 0;
@@ -906,9 +905,9 @@ md_assemble (char *str)
next_opindex = 0;
insn = opcode->opcode;
extension = 0;
- for (op_idx = 1, opindex_ptr = opcode->operands;
+ for (opindex_ptr = opcode->operands;
*opindex_ptr != 0;
- opindex_ptr++, op_idx++)
+ opindex_ptr++)
{
const struct mn10200_operand *operand;
expressionS ex;
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index f73c3bfbab3..176910dfaff 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -344,15 +344,10 @@ v850_comm (int area)
int old_subsec;
char *pfrag;
int align;
- flagword applicable;
old_sec = now_seg;
old_subsec = now_subseg;
- applicable = bfd_applicable_section_flags (stdoutput);
-
- applicable &= SEC_ALLOC;
-
switch (area)
{
case SCOMMON_SECTION:
diff --git a/gas/config/tc-xgate.c b/gas/config/tc-xgate.c
index 0823ecd93a4..4a7829f4e60 100644
--- a/gas/config/tc-xgate.c
+++ b/gas/config/tc-xgate.c
@@ -1123,7 +1123,6 @@ xgate_scan_operands (struct xgate_opcode *opcode, s_operand oprs[])
unsigned short oper_mask = 0;
int operand_bit_length = 0;
unsigned int operand = 0;
- char n_operand_bits = 0;
char first_operand_equals_second = 0;
int i = 0;
char c = 0;
@@ -1139,7 +1138,6 @@ xgate_scan_operands (struct xgate_opcode *opcode, s_operand oprs[])
{
oper_mask <<= 1;
oper_mask += 1;
- n_operand_bits++;
}
}
diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index 2980cffd59a..83a732f1335 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -1032,7 +1032,6 @@ build_bytes (opcode_entry_type *this_try, struct z8k_op *operand ATTRIBUTE_UNUSE
{
unsigned char *output_ptr = buffer;
int c;
- int nibble;
unsigned int *class_ptr;
frag_wane (frag_now);
@@ -1044,7 +1043,7 @@ build_bytes (opcode_entry_type *this_try, struct z8k_op *operand ATTRIBUTE_UNUSE
memset (buffer, 0, sizeof (buffer));
class_ptr = this_try->byte_info;
- for (nibble = 0; (c = *class_ptr++); nibble++)
+ while ((c = *class_ptr++) != 0)
{
switch (c & CLASS_MASK)
diff --git a/gas/ecoff.c b/gas/ecoff.c
index 74115959f94..97b909364a9 100644
--- a/gas/ecoff.c
+++ b/gas/ecoff.c
@@ -3606,7 +3606,6 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend,
efdr_t *file;
proc_t *proc;
unsigned long c;
- long iline;
long totcount;
lineno_list_t first;
lineno_list_t *local_first_lineno = first_lineno;
@@ -3620,7 +3619,6 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend,
proc = NULL;
last = NULL;
c = offset;
- iline = 0;
totcount = 0;
/* FIXME? Now that MIPS embedded-PIC is gone, it may be safe to
@@ -3800,7 +3798,6 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend,
++c;
}
- ++iline;
last = l;
}
diff --git a/gas/write.c b/gas/write.c
index 455dc446a01..c56ad28ea51 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -2242,7 +2242,7 @@ write_object_file (void)
char *table_ptr;
addressT table_addr;
addressT from_addr, to_addr;
- int n, m;
+ int n;
subseg_change (lie->seg, lie->subseg);
fragP = lie->dispfrag;
@@ -2267,9 +2267,9 @@ write_object_file (void)
table_ptr += md_short_jump_size;
table_addr += md_short_jump_size;
- for (m = 0;
+ for (;
lie && lie->dispfrag == fragP;
- m++, lie = lie->next_broken_word)
+ lie = lie->next_broken_word)
{
if (lie->added == 2)
continue;
--
2.49.1
@@ -0,0 +1,210 @@
From 3d6a0b4a3f6b0582781979062cc6730e858997ae Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 10 Mar 2025 17:07:16 -0700
Subject: [PATCH 12/23] Adjust testsuites for -flto and without -g
Adjust testsuites for binutils built with -flto and without -g:
1. Pass -fno-lto to objcopy tests which don't work with LTO.
2. Update gprof testsuite to avoid LTO and compile with -g for line
number info checked by tst-gmon-gprof-l.sh.
3. Append $NOLTO_CFLAGS in ctf.exp.
4. For libctf, filter out -flto in CFLAGS for "make check" and also
prune lto-wrapper warnings.
binutils/
PR binutils/32773
* testsuite/binutils-all/objcopy.exp (no_lto_flags): New.
(strip_test): Pass $no_lto_flags to target_compile.
(strip_test_with_saving_a_symbol): Likewise.
(objcopy_test_without_global_symbol): Likewise.
gprof/
PR binutils/32773
PR gprof/32779
* testsuite/Makefile.am (GPROF_FLAGS): Add -g.
(COMPILE): Set to "$(CC) $(AM_CFLAGS) $(GPROF_FLAGS)".
(LINK) Set to "$(CC) $(AM_CFLAGS) $(GPROF_FLAGS) $(AM_LDFLAGS)
$(LDFLAGS) -o $@".
* testsuite/Makefile.in: Regenerated.
ld/
PR binutils/32773
* testsuite/ld-ctf/ctf.exp (old_CFLAGS): New.
(CFLAGS_FOR_TARGET): Append $NOLTO_CFLAGS.
libctf/
PR binutils/32773
* Makefile.am (check-DEJAGNU): Filter out -flto in CFLAGS.
* Makefile.in: Regenerated.
* testsuite/lib/ctf-lib.exp (prune_warnings_lto): New.
(run_lookup_test): Replace prune_warnings with
prune_warnings_lto.
(run_lookup_test): Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
binutils/testsuite/binutils-all/objcopy.exp | 14 +++++++++++---
ld/testsuite/ld-ctf/ctf.exp | 5 +++++
libctf/Makefile.am | 3 ++-
libctf/Makefile.in | 3 ++-
libctf/testsuite/lib/ctf-lib.exp | 14 ++++++++++++--
5 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 6aa6d2d9fe7..9371d928d60 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -36,6 +36,11 @@ if ![is_remote host] {
set copyfile copy
}
+set no_lto_flags "additional_flags=-fno-lto"
+if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object $no_lto_flags] != "" } {
+ set no_lto_flags ""
+}
+
# Test that objcopy does not modify a file when copying it.
# "object" or "executable" values for type are supported.
@@ -516,10 +521,11 @@ proc strip_test { } {
global srcdir
global subdir
global READELF
+ global no_lto_flags
set test "strip"
- if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
+ if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object "debug $no_lto_flags"] != "" } {
untested $test
return
}
@@ -628,10 +634,11 @@ proc strip_test_with_saving_a_symbol { } {
global NMFLAGS
global srcdir
global subdir
+ global no_lto_flags
set test "strip with saving a symbol"
- if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
+ if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object "debug $no_lto_flags"] != "" } {
untested $test
return
}
@@ -1462,10 +1469,11 @@ proc objcopy_test_without_global_symbol { } {
global OBJDUMPFLAGS
global srcdir
global subdir
+ global no_lto_flags
set test "strip without global symbol "
- if { [target_compile $srcdir/$subdir/pr19547.c tmpdir/pr19547.o object debug] != "" } {
+ if { [target_compile $srcdir/$subdir/pr19547.c tmpdir/pr19547.o object "debug $no_lto_flags"] != "" } {
untested $test
return
}
diff --git a/ld/testsuite/ld-ctf/ctf.exp b/ld/testsuite/ld-ctf/ctf.exp
index c314f2995af..08b47d2db18 100644
--- a/ld/testsuite/ld-ctf/ctf.exp
+++ b/ld/testsuite/ld-ctf/ctf.exp
@@ -33,6 +33,9 @@ if ![check_shared_lib_support] {
return 0
}
+set old_CFLAGS "$CFLAGS_FOR_TARGET"
+append CFLAGS_FOR_TARGET " $NOLTO_CFLAGS"
+
if {[info exists env(LC_ALL)]} {
set old_lc_all $env(LC_ALL)
}
@@ -55,3 +58,5 @@ if {[info exists old_lc_all]} {
} else {
unset env(LC_ALL)
}
+
+set CFLAGS_FOR_TARGET "$old_CFLAGS"
diff --git a/libctf/Makefile.am b/libctf/Makefile.am
index 12301277275..26980667cc3 100644
--- a/libctf/Makefile.am
+++ b/libctf/Makefile.am
@@ -114,11 +114,12 @@ check-DEJAGNU: site.exp development.exp
else \
TEST_CROSS=yes; \
fi; \
+ TEST_CFLAGS=`echo "$(CFLAGS)" | sed -e "s/-flto[^ \t]*//"`; \
runtest=$(RUNTEST); \
if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
$$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
CC="$(CC)" CC_FOR_TARGET="$(CC_FOR_TARGET)" TEST_CROSS="$${TEST_CROSS}" \
- CFLAGS="$(CFLAGS) -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \
+ CFLAGS="$$TEST_CFLAGS -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \
LIBS="$(libctf_nobfd_la_LIBADD) $(LIBS)" $(RUNTESTFLAGS); \
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi
diff --git a/libctf/Makefile.in b/libctf/Makefile.in
index 639d7147b02..812134c70c9 100644
--- a/libctf/Makefile.in
+++ b/libctf/Makefile.in
@@ -1826,11 +1826,12 @@ check-DEJAGNU: site.exp development.exp
else \
TEST_CROSS=yes; \
fi; \
+ TEST_CFLAGS=`echo "$(CFLAGS)" | sed -e "s/-flto[^ \t]*//"`; \
runtest=$(RUNTEST); \
if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
$$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
CC="$(CC)" CC_FOR_TARGET="$(CC_FOR_TARGET)" TEST_CROSS="$${TEST_CROSS}" \
- CFLAGS="$(CFLAGS) -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \
+ CFLAGS="$$TEST_CFLAGS -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \
LIBS="$(libctf_nobfd_la_LIBADD) $(LIBS)" $(RUNTESTFLAGS); \
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi
diff --git a/libctf/testsuite/lib/ctf-lib.exp b/libctf/testsuite/lib/ctf-lib.exp
index 64d2a40ad9f..6d3b75e22a2 100644
--- a/libctf/testsuite/lib/ctf-lib.exp
+++ b/libctf/testsuite/lib/ctf-lib.exp
@@ -54,6 +54,16 @@ proc compile_link_one_host_cc { src output additional_args } {
return [run_native_host_cmd "./libtool --quiet --tag=CC --mode=link $CC $CFLAGS $src -o $output $additional_args" ]
}
+# Also prune lto-wrapper warnings, like
+# lto-wrapper: warning: using serial compilation of 16 LTRANS jobs
+# lto-wrapper: note: see the '-flto' option documentation for more information
+#
+proc prune_warnings_lto { msg } {
+ set msgx "lto-wrapper: (?:warning\:\[^\n\r\]+|note\:\[^\n\r\]+)"
+ regsub -all "$msgx\[\n\r\]*" $msg {} msg
+ return [prune_warnings $msg]
+}
+
# run_lookup_test FILE
#
# Compile with the host compiler and link a .c file into a "lookup" binary, then
@@ -208,7 +218,7 @@ proc run_lookup_test { name } {
set testname $file4log
# Compile and link the lookup program.
- set comp_output [prune_warnings [compile_link_one_host_cc $opts(lookup) "tmpdir/lookup" "libctf.la $opts(lookup_link)"]]
+ set comp_output [prune_warnings_lto [compile_link_one_host_cc $opts(lookup) "tmpdir/lookup" "libctf.la $opts(lookup_link)"]]
if { $comp_output != ""} {
send_log "compilation of lookup program $opts(lookup) failed with <$comp_output>"
@@ -244,7 +254,7 @@ proc run_lookup_test { name } {
}
}
- set comp_output [prune_warnings [run_host_cmd "$CC_FOR_TARGET" "$CFLAGS_FOR_TARGET $lookup_flags [concat $src] -o $lookup_output"]]
+ set comp_output [prune_warnings_lto [run_host_cmd "$CC_FOR_TARGET" "$CFLAGS_FOR_TARGET $lookup_flags [concat $src] -o $lookup_output"]]
if { $comp_output != ""} {
send_log "compilation of CTF program [concat $src] failed with <$comp_output>"
--
2.49.1
@@ -0,0 +1,135 @@
From b7396b55f673d68766a95f9e60e000d62b398ed0 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 30 Jul 2025 08:53:11 -0700
Subject: [PATCH 13/23] strip: Don't check target_defaulted in input BFD
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The target_defaulted field in BFD is set to true if the target isn't
specified. After
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
the target is set to "plugin" if BFD supports plugin when the target
isn't specified nor default. Update strip to check the input target,
instead of the target_defaulted field in input BFD.
PR binutils/33230
* objcopy.c (copy_object): Add a bool argument, target_defaulted,
to indicate if the input target isn't specified nor default.
Check it instead of ibfd->target_defaulted.
(copy_archive): Add a bool argument, target_defaulted, and pass
it to copy_object.
(copy_file): Set target_defaulted to true if the input target
isn't specified and pass it to copy_archive and copy_object.
* testsuite/binutils-all/x86-64/pr33230.obj.bz2: New file.
* testsuite/binutils-all/x86-64/x86-64.exp: Run PR binutils/33230
tests.
The test case has been removed in Gentoo since it generates a git
binary diff. -Andreas K. Hüttel (dilfridge)
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 8e885fece150ee97e5b0e78363e7fe9888ae9c29)
---
binutils/objcopy.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 905ce917708..5774711abe6 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2661,7 +2661,8 @@ set_long_section_mode (bfd *output_bfd, bfd *input_bfd, enum long_section_name_h
Returns TRUE upon success, FALSE otherwise. */
static bool
-copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
+copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch,
+ bool target_defaulted)
{
bfd_vma start;
long symcount;
@@ -2812,7 +2813,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
imach = 0;
}
if (!bfd_set_arch_mach (obfd, iarch, imach)
- && (ibfd->target_defaulted
+ && (target_defaulted
|| bfd_get_arch (ibfd) != bfd_get_arch (obfd)))
{
if (bfd_get_arch (ibfd) == bfd_arch_unknown)
@@ -3615,7 +3616,8 @@ fail:
static bool
copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
bool force_output_target,
- const bfd_arch_info_type *input_arch)
+ const bfd_arch_info_type *input_arch,
+ bool target_defaulted)
{
struct name_list
{
@@ -3772,7 +3774,8 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
#endif
if (ok_object)
{
- ok = copy_object (this_element, output_element, input_arch);
+ ok = copy_object (this_element, output_element, input_arch,
+ target_defaulted);
if (!ok && bfd_get_arch (this_element) == bfd_arch_unknown)
/* Try again as an unknown object file. */
@@ -3872,6 +3875,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
char **core_matching;
off_t size = get_file_size (input_filename);
const char *target = input_target;
+ bool target_defaulted = (!input_target
+ || strcmp (input_target, "default") == 0);
if (size < 1)
{
@@ -3948,7 +3953,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
/* bfd_get_target does not return the correct value until
bfd_check_format succeeds. */
- if (output_target == NULL)
+ if (output_target == NULL
+ || strcmp (output_target, "default") == 0)
{
output_target = bfd_get_target (ibfd);
force_output_target = false;
@@ -3979,7 +3985,7 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
}
if (!copy_archive (ibfd, obfd, output_target, force_output_target,
- input_arch))
+ input_arch, target_defaulted))
status = 1;
}
else if (
@@ -4003,7 +4009,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
/* bfd_get_target does not return the correct value until
bfd_check_format succeeds. */
- if (output_target == NULL)
+ if (output_target == NULL
+ || strcmp (output_target, "default") == 0)
output_target = bfd_get_target (ibfd);
if (ofd >= 0)
@@ -4034,7 +4041,7 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
else
#endif
{
- if (! copy_object (ibfd, obfd, input_arch))
+ if (! copy_object (ibfd, obfd, input_arch, target_defaulted))
status = 1;
/* PR 17512: file: 0f15796a.
--
2.49.1
@@ -0,0 +1,470 @@
From 390066f36a104e6d3127aa5461c79e202e3e9a9b Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sun, 3 Aug 2025 10:28:40 -0700
Subject: [PATCH 14/23] strip: Don't treat fat IR objects as plugin object
Fat IR objects contains both regular sections and IR sections. After
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
"strip --strip-debug" no longer strips debug sections in fat IR objects
since fat IR objects are recognized as plugin object and copied as unknown
objects. Add a is_strip_input field to bfd to indicate called from strip.
Update bfd_check_format_matches not to treat archive member nor standalone
fat IR object as IR object so that strip can remove debug and IR sections
in fat IR object. For archive member, it is copied as an unknown object
if the plugin target is in use or it is a slim IR object. For standalone
fat IR object, it is copied as non-IR object.
bfd/
PR binutils/33246
* archive.c: Include "plugin-api.h" and "plugin.h" if plugin is
enabled.
(_bfd_compute_and_write_armap): Don't complain plugin is needed
when the plugin target is in use.
* bfd-in2.h: Regenerated.
* bfd.c (bfd): Add is_strip_input.
* format.c (bfd_set_lto_type): If there is .llvm.lto section,
set LTO type to lto_fat_ir_object.
(bfd_check_format_matches): Don't set LTO type when setting
format. When called from strip, don't treat archive member nor
standalone fat IR object as an IR object.
* plugin.c (bfd_plugin_get_symbols_in_object_only): Copy LTO
type derived from input sections.
nm/
PR binutils/33246
* nm.c (filter_symbols): Don't complain plugin is needed when
the plugin target is in use.
(display_rel_file): Likewise.
* objcopy.c (copy_archive): Set the BFD is_strip_input field of
archive member to 1 to indicate called from strip. Also copy
slim IR archive member as unknown object.
(copy_file): Set the BFD is_strip_input field of input bfd to
1 to indicate called from strip.
(strip_main): Keep .gnu.debuglto_* sections unless all GCC LTO
sections will be removed.
ld/
PR binutils/33246
* testsuite/ld-plugin/lto-binutils.exp (run_pr33246_test): New.
Run binutils/33246 tests with GCC and Clang.
* testsuite/ld-plugin/pr33246.c: New file.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit c2729c37f10af09126b2916215cae425ae724f55)
---
bfd/archive.c | 10 ++
bfd/bfd-in2.h | 3 +
bfd/bfd.c | 3 +
bfd/format.c | 25 +++-
bfd/plugin.c | 3 +
binutils/nm.c | 9 +-
binutils/objcopy.c | 13 +-
ld/testsuite/ld-plugin/lto-binutils.exp | 175 ++++++++++++++++++++++++
ld/testsuite/ld-plugin/pr33246.c | 4 +
9 files changed, 238 insertions(+), 7 deletions(-)
create mode 100644 ld/testsuite/ld-plugin/pr33246.c
diff --git a/bfd/archive.c b/bfd/archive.c
index c61d4b12658..697b2ed23f2 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -141,6 +141,10 @@ SUBSECTION
#include "hashtab.h"
#include "filenames.h"
#include "bfdlink.h"
+#if BFD_SUPPORTS_PLUGINS
+#include "plugin-api.h"
+#include "plugin.h"
+#endif
#ifndef errno
extern int errno;
@@ -2343,6 +2347,9 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
long src_count;
if (bfd_get_lto_type (current) == lto_slim_ir_object
+#if BFD_SUPPORTS_PLUGINS
+ && !bfd_plugin_target_p (current->xvec)
+#endif
&& report_plugin_err)
{
report_plugin_err = false;
@@ -2400,6 +2407,9 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
if (bfd_lto_slim_symbol_p (current,
syms[src_count]->name)
+#if BFD_SUPPORTS_PLUGINS
+ && !bfd_plugin_target_p (current->xvec)
+#endif
&& report_plugin_err)
{
report_plugin_err = false;
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 2ff3e930bfa..bcff44a0f44 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2131,6 +2131,9 @@ struct bfd
/* Set if this is the linker input BFD. */
unsigned int is_linker_input : 1;
+ /* Set if this is the strip input BFD. */
+ unsigned int is_strip_input : 1;
+
/* If this is an input for a compiler plug-in library. */
ENUM_BITFIELD (bfd_plugin_format) plugin_format : 2;
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 858ab5ce017..4aded6809bb 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -296,6 +296,9 @@ CODE_FRAGMENT
. {* Set if this is the linker input BFD. *}
. unsigned int is_linker_input : 1;
.
+. {* Set if this is the strip input BFD. *}
+. unsigned int is_strip_input : 1;
+.
. {* If this is an input for a compiler plug-in library. *}
. ENUM_BITFIELD (bfd_plugin_format) plugin_format : 2;
.
diff --git a/bfd/format.c b/bfd/format.c
index f3a0774af08..246838c7ab5 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -413,6 +413,11 @@ bfd_set_lto_type (bfd *abfd ATTRIBUTE_UNUSED)
abfd->object_only_section = sec;
break;
}
+ else if (strcmp (sec->name, ".llvm.lto") == 0)
+ {
+ type = lto_fat_ir_object;
+ break;
+ }
else if (lsection.major_version == 0
&& startswith (sec->name, ".gnu.lto_.lto.")
&& bfd_get_section_contents (abfd, sec, &lsection, 0,
@@ -481,10 +486,7 @@ bfd_check_format_matches_lto (bfd *abfd, bfd_format format,
}
if (abfd->format != bfd_unknown)
- {
- bfd_set_lto_type (abfd);
- return abfd->format == format;
- }
+ return abfd->format == format;
if (matching != NULL || *bfd_associated_vector != NULL)
{
@@ -537,7 +539,20 @@ bfd_check_format_matches_lto (bfd *abfd, bfd_format format,
cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
- if (cleanup)
+ /* When called from strip, don't treat archive member nor
+ standalone fat IR object as an IR object. For archive
+ member, it will be copied as an unknown object if the
+ plugin target is in use or it is a slim IR object. For
+ standalone fat IR object, it will be copied as non-IR
+ object. */
+ if (cleanup
+#if BFD_SUPPORTS_PLUGINS
+ && (!abfd->is_strip_input
+ || !bfd_plugin_target_p (abfd->xvec)
+ || (abfd->lto_type != lto_fat_ir_object
+ && abfd->my_archive == NULL))
+#endif
+ )
goto ok_ret;
/* For a long time the code has dropped through to check all
diff --git a/bfd/plugin.c b/bfd/plugin.c
index 1c72b748a8f..6dd22d75137 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -203,6 +203,9 @@ bfd_plugin_get_symbols_in_object_only (bfd *abfd)
bfd_close (nbfd);
return;
}
+
+ /* Copy LTO type derived from input sections. */
+ abfd->lto_type = nbfd->lto_type;
}
else
{
diff --git a/binutils/nm.c b/binutils/nm.c
index a5d56311dde..d44083dcc94 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -802,6 +802,9 @@ filter_symbols (bfd *abfd, bool is_dynamic, void *minisyms,
continue;
if (bfd_lto_slim_symbol_p (abfd, sym->name)
+#if BFD_SUPPORTS_PLUGINS
+ && !bfd_plugin_target_p (abfd->xvec)
+#endif
&& report_plugin_err)
{
report_plugin_err = false;
@@ -1484,7 +1487,11 @@ display_rel_file (bfd *abfd, bfd *archive_bfd)
/* lto_type is set to lto_non_ir_object when a bfd is loaded with a
compiler LTO plugin. */
- if (bfd_get_lto_type (abfd) == lto_slim_ir_object)
+ if (bfd_get_lto_type (abfd) == lto_slim_ir_object
+#if BFD_SUPPORTS_PLUGINS
+ && !bfd_plugin_target_p (abfd->xvec)
+#endif
+ )
{
report_plugin_err = false;
non_fatal (_("%s: plugin needed to handle lto object"),
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 5774711abe6..a5690257059 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3687,6 +3687,8 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
bool ok_object;
const char *element_name;
+ this_element->is_strip_input = 1;
+
element_name = bfd_get_filename (this_element);
/* PR binutils/17533: Do not allow directory traversal
outside of the current directory tree by archive members. */
@@ -3768,7 +3770,9 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
#if BFD_SUPPORTS_PLUGINS
/* Copy LTO IR file as unknown object. */
- if (bfd_plugin_target_p (this_element->xvec))
+ if ((!lto_sections_removed
+ && this_element->lto_type == lto_slim_ir_object)
+ || bfd_plugin_target_p (this_element->xvec))
ok_object = false;
else
#endif
@@ -3946,6 +3950,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
break;
}
+ ibfd->is_strip_input = 1;
+
if (bfd_check_format (ibfd, bfd_archive))
{
bool force_output_target;
@@ -5066,6 +5072,11 @@ strip_main (int argc, char *argv[])
SECTION_CONTEXT_REMOVE)
|| !!find_section_list (".llvm.lto", false,
SECTION_CONTEXT_REMOVE));
+ /* NB: Must keep .gnu.debuglto_* sections unless all GCC LTO sections
+ will be removed to avoid undefined references to symbols in GCC LTO
+ debug sections. */
+ if (!lto_sections_removed)
+ find_section_list (".gnu.debuglto_*", true, SECTION_CONTEXT_KEEP);
#endif
i = optind;
diff --git a/ld/testsuite/ld-plugin/lto-binutils.exp b/ld/testsuite/ld-plugin/lto-binutils.exp
index 5b4e0a10991..51332696d5b 100644
--- a/ld/testsuite/ld-plugin/lto-binutils.exp
+++ b/ld/testsuite/ld-plugin/lto-binutils.exp
@@ -356,3 +356,178 @@ run_cc_link_tests [list \
"tmpdir/libstrip-1b-fat-s.a" \
] \
]
+
+proc run_pr33246_test { llvm fat } {
+ global srcdir
+ global subdir
+ global plug_opt
+ global llvm_plug_opt
+ global ar
+ global CLANG_FOR_TARGET
+ global CC_FOR_TARGET
+ global NM
+ global READELF
+ global strip
+
+ set strip_flags "--strip-debug --enable-deterministic-archives"
+
+ set test pr33246
+ set testname "${test}${llvm}${fat} with $strip_flags"
+
+ if { "$llvm" == "-llvm" } {
+ # Skip native x32 and i?86 targets since system LLVMgold.so may
+ # not be compatible with native x32 and i?86 targets binutils.
+ if { [istarget "x86_64-*-linux*-gnux32"]
+ || [istarget "i?86-*-*"]
+ || ![info exists CLANG_FOR_TARGET]
+ || [string match "" $llvm_plug_opt] } then {
+ untested $testname
+ return
+ }
+ set CC $CLANG_FOR_TARGET
+ set binutils_plug_opt "$llvm_plug_opt"
+ } else {
+ if { ![info exists CC_FOR_TARGET]
+ || [string match "" $plug_opt] } then {
+ untested $testname
+ return
+ }
+ set CC $CC_FOR_TARGET
+ set binutils_plug_opt "$plug_opt"
+ }
+
+ append strip_flags " $binutils_plug_opt"
+
+ set src $srcdir/$subdir/${test}.c
+ set obj tmpdir/${test}${llvm}${fat}.o
+ set archive tmpdir/${test}${llvm}${fat}.a
+ set CFLAGS "-c -g -O2 -flto"
+ if { "$fat" == "-fat" } {
+ append CFLAGS " -ffat-lto-objects"
+ } else {
+ append CFLAGS " -fno-fat-lto-objects"
+ }
+
+ set cmd "$CC $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 "$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 $binutils_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 " \.debug_" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $obj)"
+ return
+ }
+ } else {
+ set cmd "cmp $obj ${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
+ }
+ }
+
+ pass "$testname (strip $obj)"
+
+ set cmd "$ar $binutils_plug_opt -D -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 "$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 $binutils_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 " \.debug_" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $archive)"
+ return
+ }
+ } else {
+ set cmd "cmp $archive ${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
+ }
+ }
+
+ pass "$testname (strip $archive)"
+}
+
+run_pr33246_test "" ""
+run_pr33246_test "" "-fat"
+run_pr33246_test "-llvm" ""
+run_pr33246_test "-llvm" "-fat"
diff --git a/ld/testsuite/ld-plugin/pr33246.c b/ld/testsuite/ld-plugin/pr33246.c
new file mode 100644
index 00000000000..cd0130cacdf
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr33246.c
@@ -0,0 +1,4 @@
+void
+foo (void)
+{
+}
--
2.49.1
@@ -0,0 +1,147 @@
From 5f3b1671d35130038b2267daddecea4aa084685b Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 30 Jul 2025 08:18:19 +0930
Subject: [PATCH 15/23] PR 33229 nds32 gas segfaults on gcc output
Commit 1ac26e9f7ac2 replaced ISSPACE with is_whitespace, but the
former returns true on EOL while the latter does not. Sprinkle
is_end_of_stmt tests to fix this bug.
The same segfault can be triggered by a ".relax_hint" with no
following instructions. Fix that too.
* config/tc-nds32.c (nds32_lookup_pseudo_opcode): Use
is_end_of_stmt along with is_whitespace.
(nds32_relax_relocs, nds32_relax_hint, nds32_flag),
(ict_model: Likewise.
(nds32_elf_append_relax_relocs): Return on no opcode.
* testsuite/gas/nds32/nds32.exp: Find .d files automatically.
* testsuite/gas/nds32/pr33229.d,
* testsuite/gas/nds32/pr33229.s: New test.
(cherry picked from commit 303045d9539d9032208b8b67f222943ff4c96b05)
(cherry picked from commit 72d7cfff264820841f469e3bf34ff1b76efa5240)
---
gas/config/tc-nds32.c | 17 +++++++++++------
gas/testsuite/gas/nds32/nds32.exp | 22 +++++++++-------------
gas/testsuite/gas/nds32/pr33229.d | 2 ++
gas/testsuite/gas/nds32/pr33229.s | 3 +++
4 files changed, 25 insertions(+), 19 deletions(-)
create mode 100644 gas/testsuite/gas/nds32/pr33229.d
create mode 100644 gas/testsuite/gas/nds32/pr33229.s
diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c
index 647744fd6d1..d107555e373 100644
--- a/gas/config/tc-nds32.c
+++ b/gas/config/tc-nds32.c
@@ -3452,8 +3452,9 @@ nds32_lookup_pseudo_opcode (const char *str)
for (i = 0; i < maxlen; i++)
{
- if (is_whitespace (op[i] = str[i]))
+ if (is_end_of_stmt (str[i]) || is_whitespace (str[i]))
break;
+ op[i] = str[i];
}
op[i] = '\0';
@@ -4093,7 +4094,8 @@ nds32_relax_relocs (int relax)
{"", "",};
name = input_line_pointer;
- while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+ while (!is_end_of_stmt (*input_line_pointer)
+ && !is_whitespace (*input_line_pointer))
input_line_pointer++;
saved_char = *input_line_pointer;
*input_line_pointer = 0;
@@ -4228,7 +4230,8 @@ nds32_relax_hint (int mode ATTRIBUTE_UNUSED)
struct relax_hint_id *record_id;
name = input_line_pointer;
- while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+ while (!is_end_of_stmt (*input_line_pointer)
+ && !is_whitespace (*input_line_pointer))
input_line_pointer++;
saved_char = *input_line_pointer;
*input_line_pointer = 0;
@@ -4361,7 +4364,8 @@ nds32_flag (int ignore ATTRIBUTE_UNUSED)
/* Skip whitespaces. */
name = input_line_pointer;
- while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+ while (!is_end_of_stmt (*input_line_pointer)
+ && !is_whitespace (*input_line_pointer))
input_line_pointer++;
saved_char = *input_line_pointer;
*input_line_pointer = 0;
@@ -4398,7 +4402,8 @@ ict_model (int ignore ATTRIBUTE_UNUSED)
/* Skip whitespaces. */
name = input_line_pointer;
- while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+ while (!is_end_of_stmt (*input_line_pointer)
+ && !is_whitespace (*input_line_pointer))
input_line_pointer++;
saved_char = *input_line_pointer;
*input_line_pointer = 0;
@@ -5944,7 +5949,7 @@ nds32_elf_append_relax_relocs (const char *key, const void *value)
char *where;
int pcrel;
- if (!relocs_pattern)
+ if (!relocs_pattern || !relocs_pattern->opcode)
return;
if (!nds32_find_reloc_table (relocs_pattern, &hint_info))
diff --git a/gas/testsuite/gas/nds32/nds32.exp b/gas/testsuite/gas/nds32/nds32.exp
index 82934cee605..216fcf185bf 100644
--- a/gas/testsuite/gas/nds32/nds32.exp
+++ b/gas/testsuite/gas/nds32/nds32.exp
@@ -16,17 +16,13 @@
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
-if { [istarget nds32*] } {
- run_dump_test "alu-1"
- run_dump_test "alu-2"
- run_dump_test "lsi"
- run_dump_test "ls"
- run_dump_test "br-1"
- run_dump_test "br-2"
- run_dump_test "ji-jr"
- run_dump_test "to-16bit-v1"
- run_dump_test "to-16bit-v2"
- run_dump_test "to-16bit-v3"
- run_dump_test "usr-spe-reg"
- run_dump_test "sys-reg"
+if { ![istarget nds32*] } {
+ return
+}
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach t $test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ verbose [file rootname $t]
+ run_dump_test [file rootname $t]
}
diff --git a/gas/testsuite/gas/nds32/pr33229.d b/gas/testsuite/gas/nds32/pr33229.d
new file mode 100644
index 00000000000..e65ca413d55
--- /dev/null
+++ b/gas/testsuite/gas/nds32/pr33229.d
@@ -0,0 +1,2 @@
+#as: --fatal-warnings
+#error: .*relax hint.*
diff --git a/gas/testsuite/gas/nds32/pr33229.s b/gas/testsuite/gas/nds32/pr33229.s
new file mode 100644
index 00000000000..3127d6da65b
--- /dev/null
+++ b/gas/testsuite/gas/nds32/pr33229.s
@@ -0,0 +1,3 @@
+ .relax_hint 0
+ ret5
+ .relax_hint 1
--
2.49.1
@@ -0,0 +1,62 @@
From 3dbec0d8fd2fe3e9549c8ff15c7e6c42a987222d Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Sat, 2 Aug 2025 10:12:21 +0930
Subject: [PATCH 16/23] Re: resbin: don't pass NULL as printf %s arg
Commit c6c8d0b82175 went completely the wrong way. "key" needs to be
NULL as that reads a different type of data.
PR 33244
* resbin.c (get_version_header): Don't pass a NULL key on to
toosmall.
(bin_to_res_version): Restore NULL key cases.
(cherry picked from commit 891d1654d7314fa520f708dbc5f1bf855d15bd40)
(cherry picked from commit b09f71c1c4680a639ab83bb273aea1f3f4380a6a)
---
binutils/resbin.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/binutils/resbin.c b/binutils/resbin.c
index 889126e9e32..fa77cd43d23 100644
--- a/binutils/resbin.c
+++ b/binutils/resbin.c
@@ -1052,7 +1052,7 @@ get_version_header (windres_bfd *wrbfd, const bfd_byte *data,
{
if (length < 8)
{
- toosmall (key);
+ toosmall (key ? key : _("version header"));
return false;
}
@@ -1250,7 +1250,7 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data,
vst = res_alloc (sizeof (rc_ver_stringtable));
- if (!get_version_header (wrbfd, data, length, "version stringtable",
+ if (!get_version_header (wrbfd, data, length, NULL,
&vst->language, &stverlen, &vallen,
&type, &off))
return NULL;
@@ -1284,7 +1284,7 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data,
vs = res_alloc (sizeof (rc_ver_stringinfo));
- if (!get_version_header (wrbfd, data, length, "version string",
+ if (!get_version_header (wrbfd, data, length, NULL,
&vs->key, &sverlen, &vallen,
&type, &off))
return NULL;
@@ -1348,7 +1348,7 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data,
data += off;
length -= off;
- if (!get_version_header (wrbfd, data, length, "version varfileinfo",
+ if (!get_version_header (wrbfd, data, length, NULL,
&vi->u.var.key, &verlen, &vallen,
&type, &off))
return NULL;
--
2.49.1
@@ -0,0 +1,70 @@
From 3c0c1b0482f52039c146228223c87754ef1012cb Mon Sep 17 00:00:00 2001
From: Matthieu Longo <matthieu.longo@arm.com>
Date: Mon, 4 Aug 2025 11:04:13 +0100
Subject: [PATCH 17/23] libiberty: sync with gcc
Import the following commits from GCC as of r16-3056-gca2169c65bd169:
0d0837df697 libiberty: disable logging of list content for doubly-linked list tests
(cherry picked from commit d45e8bff0b4279009f7962ce6e65795f34133c46)
---
libiberty/ChangeLog | 11 +++++++++++
libiberty/testsuite/test-doubly-linked-list.c | 13 ++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 2ae5626ed2e..b072d0bed52 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,14 @@
+2025-08-06 Matthieu Longo <matthieu.longo@arm.com>
+
+ * testsuite/test-doubly-linked-list.c: disable debug logging on
+ stdout.
+
+2025-07-09 Matthieu Longo <matthieu.longo@arm.com>
+
+ * Makefile.in: Add new header.
+ * testsuite/Makefile.in: Add new test.
+ * testsuite/test-doubly-linked-list.c: New test.
+
2025-05-13 Andreas Schwab <schwab@suse.de>
* regex.c (regex_compile): Don't write beyond array bounds when
diff --git a/libiberty/testsuite/test-doubly-linked-list.c b/libiberty/testsuite/test-doubly-linked-list.c
index 1e1fc637653..93fe19a27ae 100644
--- a/libiberty/testsuite/test-doubly-linked-list.c
+++ b/libiberty/testsuite/test-doubly-linked-list.c
@@ -155,19 +155,26 @@ bool check(const char *op,
bool success = true;
bool res;
- l_print (wrapper->first);
+#define DUMP_LIST 0
+
+ if (DUMP_LIST)
+ l_print (wrapper->first);
+
res = run_test (expect, wrapper, false);
printf ("%s: test-linked-list::%s: check forward conformity\n",
res ? "PASS": "FAIL", op);
success &= res;
- l_reverse_print (wrapper->last);
+ if (DUMP_LIST)
+ l_reverse_print (wrapper->last);
+
res = run_test (expect, wrapper, true);
printf ("%s: test-linked-list::%s: check backward conformity\n",
res ? "PASS": "FAIL", op);
success &= res;
- printf("\n");
+ if (DUMP_LIST)
+ printf("\n");
return success;
}
--
2.49.1
@@ -0,0 +1,242 @@
From 7757ef4a8b03a2f9d12cc5fe0dc0b252a05b1ac5 Mon Sep 17 00:00:00 2001
From: Xi Ruoyao <xry111@xry111.site>
Date: Wed, 6 Aug 2025 12:19:22 +0800
Subject: [PATCH 18/23] LoongArch: Fix symbol size after relaxation
There's a logic error in loongarch_relax_perform_deletes: when there's
not any delete operation of which the start address is strictly smaller
than the symbol address, splay_tree_predecessor() will return nullptr
and the symbol size will be unchanged even if some bytes of it are
removed.
Make the logic more complete to fix this issue. Also factor out the
symbol size adjustment logic into a function to avoid code bloating.
Tested-by: WANG Xuerui <git@xen0n.name>
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
(cherry picked from commit 99f48156dd1d02193e3b550c85cc8925826752b7)
---
bfd/elfnn-loongarch.c | 102 ++++++++++--------
.../ld-loongarch-elf/ld-loongarch-elf.exp | 2 +
.../ld-loongarch-elf/relax-sym-size-1.d | 7 ++
.../ld-loongarch-elf/relax-sym-size-1.s | 8 ++
.../ld-loongarch-elf/relax-sym-size-2.d | 7 ++
.../ld-loongarch-elf/relax-sym-size-2.s | 19 ++++
6 files changed, 102 insertions(+), 43 deletions(-)
create mode 100644 ld/testsuite/ld-loongarch-elf/relax-sym-size-1.d
create mode 100644 ld/testsuite/ld-loongarch-elf/relax-sym-size-1.s
create mode 100644 ld/testsuite/ld-loongarch-elf/relax-sym-size-2.d
create mode 100644 ld/testsuite/ld-loongarch-elf/relax-sym-size-2.s
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 46fafb332de..505f1196987 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -4902,6 +4902,60 @@ loongarch_relax_delete_or_nop (bfd *abfd,
bfd_put (32, abfd, LARCH_NOP, contents + addr);
}
+/* If some bytes in a symbol is deleted, we need to adjust its size. */
+static void
+loongarch_relax_resize_symbol (bfd_size_type *size, bfd_vma orig_value,
+ splay_tree pdops)
+{
+ splay_tree_key key = (splay_tree_key)orig_value;
+ bfd_vma orig_end = orig_value + *size;
+ splay_tree_node node = splay_tree_predecessor (pdops, key);
+
+ if (node)
+ {
+ bfd_vma addr = (bfd_vma)node->key;
+ struct pending_delete_op *op = (struct pending_delete_op *)node->value;
+
+ /* This shouldn't happen unless people write something really insane like
+ .reloc ., R_LARCH_ALIGN, 60
+ .rept 15
+ 1: nop
+ .endr
+ .set x, 1b
+ .size x, . - 1b
+ But let's just try to make it "work" anyway. */
+ if (orig_value < addr + op->size)
+ {
+ bfd_size_type n_deleted = op->size - (orig_value - addr);
+ if (n_deleted >= *size)
+ {
+ *size = 0;
+ return;
+ }
+
+ *size -= n_deleted;
+ }
+ }
+
+ node = splay_tree_lookup (pdops, key);
+ if (!node)
+ node = splay_tree_successor (pdops, key);
+
+ for (; node; node = splay_tree_successor (pdops, node->key))
+ {
+ bfd_vma addr = (bfd_vma)node->key;
+ struct pending_delete_op *op = (struct pending_delete_op *)node->value;
+
+ if (addr >= orig_end)
+ return;
+
+ if (orig_end < addr + op->size)
+ *size -= orig_end - addr;
+ else
+ *size -= op->size;
+ }
+}
+
static void
loongarch_relax_perform_deletes (bfd *abfd, asection *sec,
struct bfd_link_info *link_info)
@@ -5000,30 +5054,8 @@ loongarch_relax_perform_deletes (bfd *abfd, asection *sec,
sym->st_value
= loongarch_calc_relaxed_addr (link_info, orig_value);
- /* If the symbol *spans* some deleted bytes, that is its *end* is in
- the moved bytes but its *start* isn't, then we must adjust its
- size.
-
- This test needs to use the original value of st_value, otherwise
- we might accidentally decrease size when deleting bytes right
- before the symbol. */
- bfd_vma sym_end = orig_value + sym->st_size;
- if (sym_end <= toaddr)
- {
- splay_tree_node node = splay_tree_predecessor (
- pdops, (splay_tree_key)orig_value);
- for (; node; node = splay_tree_successor (pdops, node->key))
- {
- bfd_vma addr = (bfd_vma)node->key;
- struct pending_delete_op *op
- = (struct pending_delete_op *)node->value;
-
- if (addr >= sym_end)
- break;
- if (orig_value <= addr && sym_end > addr)
- sym->st_size -= op->size;
- }
- }
+ if (orig_value + sym->st_size <= toaddr)
+ loongarch_relax_resize_symbol (&sym->st_size, orig_value, pdops);
}
}
@@ -5070,29 +5102,13 @@ loongarch_relax_perform_deletes (bfd *abfd, asection *sec,
{
bfd_vma orig_value = sym_hash->root.u.def.value;
- /* As above, adjust the value. */
+ /* As above, adjust the value and size. */
if (orig_value <= toaddr)
sym_hash->root.u.def.value
= loongarch_calc_relaxed_addr (link_info, orig_value);
- /* As above, adjust the size if needed. */
- bfd_vma sym_end = orig_value + sym_hash->size;
- if (sym_end <= toaddr)
- {
- splay_tree_node node = splay_tree_predecessor (
- pdops, (splay_tree_key)orig_value);
- for (; node; node = splay_tree_successor (pdops, node->key))
- {
- bfd_vma addr = (bfd_vma)node->key;
- struct pending_delete_op *op
- = (struct pending_delete_op *)node->value;
-
- if (addr >= sym_end)
- break;
- if (orig_value <= addr && sym_end > addr)
- sym_hash->size -= op->size;
- }
- }
+ if (orig_value + sym_hash->size <= toaddr)
+ loongarch_relax_resize_symbol (&sym_hash->size, orig_value, pdops);
}
}
}
diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
index e23cdc87161..a33727f2efd 100644
--- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
+++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
@@ -48,6 +48,8 @@ if [istarget "loongarch64-*-*"] {
run_dump_test "relax-after-alignment"
run_dump_test "relax-medium-call"
run_dump_test "relax-medium-call-1"
+ run_dump_test "relax-sym-size-1"
+ run_dump_test "relax-sym-size-2"
run_dump_test "check_got_relax"
}
diff --git a/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.d b/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.d
new file mode 100644
index 00000000000..eec989f68be
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.d
@@ -0,0 +1,7 @@
+#source: relax-sym-size-1.s
+#ld:
+#readelf: -s
+
+#...
+ *[0-9]+: [0-9a-z]+ +8 .* _start
+#...
diff --git a/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.s b/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.s
new file mode 100644
index 00000000000..c70ac7176bd
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.s
@@ -0,0 +1,8 @@
+.p2align 2
+bar:
+ nop
+.globl _start
+_start:
+ la.pcrel $a0, bar
+ ret
+.size _start, . - _start
diff --git a/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.d b/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.d
new file mode 100644
index 00000000000..1388099d37f
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.d
@@ -0,0 +1,7 @@
+#source: relax-sym-size-2.s
+#ld:
+#readelf: -s
+
+#...
+ *[0-9]+: [0-9a-z]+ +64 .* _start
+#...
diff --git a/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.s b/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.s
new file mode 100644
index 00000000000..e02e16b7d26
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.s
@@ -0,0 +1,19 @@
+bar:
+ nop
+.p2align 6
+
+.reloc ., R_LARCH_ALIGN, 60
+.rept 15
+ 1: nop
+.endr
+ la.pcrel $a0, bar
+ ret
+
+.reloc ., R_LARCH_ALIGN, 60
+.rept 15
+ 2: nop
+.endr
+
+.globl _start
+.set _start, 1b
+.size _start, 2b - 1b
--
2.49.1
@@ -0,0 +1,66 @@
From a998d99a7ea659565f69c0b4412c17c69bcc083a Mon Sep 17 00:00:00 2001
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date: Wed, 16 Jul 2025 13:10:05 +0100
Subject: [PATCH 19/23] libctf: do not use mmap on Solaris 11
Writable mmaps and read are inconsistent with each other on Solaris 11.4,
which breaks archive writing. Simply assert that Solaris 2.11 doesn't have
mmap, falling back to read(): the archive format is being bumped shortly, to
one with completely different writeout code, so this workaround need not
stay for long.
[nca: added commit log]
libctf/
PR libctf/29292
* configure.ac: Turn off mmap on Solaris 2.11.
* configure: Regenerated.
(cherry picked from commit 00d853d1fe7885d0a685584f32b7ed70485c6def)
(cherry picked from commit 404cb58a92f5a0e52b9e148e188760397a062dc8)
---
libctf/configure | 8 ++++++++
libctf/configure.ac | 8 ++++++++
2 files changed, 16 insertions(+)
diff --git a/libctf/configure b/libctf/configure
index 54c86592b70..c53c15ec6b8 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -15973,6 +15973,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+case "${host}" in
+ # PR libctf/29292
+ # libctf's use of mmap doesn't work on Solaris 11.4, so disable it.
+ *-*-solaris2.11*)
+ ac_cv_func_mmap_fixed_mapped=no
+ ;;
+esac
+
diff --git a/libctf/configure.ac b/libctf/configure.ac
index 3e83f43ba13..435967132d9 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -65,6 +65,14 @@ AM_MAINTAINER_MODE
AM_INSTALL_LIBBFD
ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_libctf_warn_cflags])
+case "${host}" in
+ # PR libctf/29292
+ # libctf's use of mmap doesn't work on Solaris 11.4, so disable it.
+ *-*-solaris2.11*)
+ ac_cv_func_mmap_fixed_mapped=no
+ ;;
+esac
+
GCC_AC_FUNC_MMAP
# Needed for BFD capability checks.
AC_SEARCH_LIBS(dlsym, dl)
--
2.49.1
@@ -0,0 +1,52 @@
From ad51ff9367bf6111cdb959dec8be10fa336b2fe1 Mon Sep 17 00:00:00 2001
From: Nick Alcock <nick.alcock@oracle.com>
Date: Wed, 16 Jul 2025 14:43:25 +0100
Subject: [PATCH 20/23] libctf: get libctf-nobfd.ver from the right place with
Solaris ld
We generate de-commented version scripts for Solaris ld (whose
-z gnu-version-script linker option does not support comments),
but after we switched to generating libctf-nobfd.ver itself, we
failed to adjust this code to pick it up from the new location.
libctf/
PR libctf/33161
* configure.ac: Fix libctf-nobfd.ver path on Solaris.
* configure: Regenerated.
(cherry picked from commit 3ff8956e4bf46ffd638bf12ea4788a858e905023)
(cherry picked from commit 32830073ea0086ad6f258cd536de680d9c546157)
---
libctf/configure | 2 +-
libctf/configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libctf/configure b/libctf/configure
index c53c15ec6b8..8ba9d47127e 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -17050,7 +17050,7 @@ if test -n "$decommented_version_script"; then
# used by GNU ld. Use cpp to strip the comments out. (cpp exists under this
# name on all platforms that support ld -z gnu-version-script.)
/lib/cpp < $srcdir/libctf.ver > libctf-decommented.ver
- /lib/cpp < $srcdir/libctf-nobfd.ver > libctf-nobfd-decommented.ver
+ /lib/cpp < libctf-nobfd.ver > libctf-nobfd-decommented.ver
VERSION_FLAGS="$ac_cv_libctf_version_script='libctf-decommented.ver'"
VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script='libctf-nobfd-decommented.ver'"
elif test -z "$no_version_script"; then
diff --git a/libctf/configure.ac b/libctf/configure.ac
index 435967132d9..3824812e49a 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -311,7 +311,7 @@ if test -n "$decommented_version_script"; then
# used by GNU ld. Use cpp to strip the comments out. (cpp exists under this
# name on all platforms that support ld -z gnu-version-script.)
/lib/cpp < $srcdir/libctf.ver > libctf-decommented.ver
- /lib/cpp < $srcdir/libctf-nobfd.ver > libctf-nobfd-decommented.ver
+ /lib/cpp < libctf-nobfd.ver > libctf-nobfd-decommented.ver
VERSION_FLAGS="$ac_cv_libctf_version_script='libctf-decommented.ver'"
VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script='libctf-nobfd-decommented.ver'"
elif test -z "$no_version_script"; then
--
2.49.1
@@ -0,0 +1,49 @@
From ef3b54c6da528c97ad3aa1edde084859035539b4 Mon Sep 17 00:00:00 2001
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date: Wed, 16 Jul 2025 16:55:51 +0100
Subject: [PATCH 21/23] libctf: exclude always-emitted Solaris symbols from the
symtypetab
If we're skipping _BEGIN_ and _END_ we should certainly skip all the other
ABI-required always-emitted symbols given in ld/emultempl/solaris2*em as
well. (This fixes a couple of diagnostics tests, but that's just because
the tests are quite sensitive to CTF section sizes, and introducing any
symtypetab entries for those tests perturbs those.)
Some of these are usually STT_NOTYPE, but not always: if programs already
emitted the symbol they might end up with any type, in particular
STT_OBJECT, and appear in the symtypetabs.
[nca: added commit log, added more symbols]
libctf/
PR libctf/33162
* ctf-serialize.c (ctf_symtab_skippable): Skip
more always-emitted Solaris symbols.
(cherry picked from commit 4214ca9036c8f5d01025d0505ff1167700af5f98)
(cherry picked from commit e54a1de95156e7f60908dc2ac0d3b16d2ae5e5fb)
---
libctf/ctf-serialize.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libctf/ctf-serialize.c b/libctf/ctf-serialize.c
index 8c35a2b2489..f04c278344c 100644
--- a/libctf/ctf-serialize.c
+++ b/libctf/ctf-serialize.c
@@ -74,6 +74,12 @@ ctf_symtab_skippable (ctf_link_sym_t *sym)
|| sym->st_shndx == SHN_UNDEF
|| strcmp (sym->st_name, "_START_") == 0
|| strcmp (sym->st_name, "_END_") == 0
+ || strcmp (sym->st_name, "_DYNAMIC") == 0
+ || strcmp (sym->st_name, "_GLOBAL_OFFSET_TABLE_") == 0
+ || strcmp (sym->st_name, "_PROCEDURE_LINKAGE_TABLE_") == 0
+ || strcmp (sym->st_name, "_edata") == 0
+ || strcmp (sym->st_name, "_end") == 0
+ || strcmp (sym->st_name, "_etext") == 0
|| (sym->st_type == STT_OBJECT && sym->st_shndx == SHN_EXTABS
&& sym->st_value == 0));
}
--
2.49.1
@@ -0,0 +1,176 @@
From 2330d43c431ed74cd12fbba51896eabc5760df81 Mon Sep 17 00:00:00 2001
From: Nick Alcock <nick.alcock@oracle.com>
Date: Thu, 17 Jul 2025 17:45:02 +0100
Subject: [PATCH 22/23] libctf: don't run tests requiring deduplicating linker
unless one is in use
Before now, we were relying on gcc -B to repoint GCC at our freshly-built
linker, and assuming we could use this to run tests that do linker dedup.
This is, alas, not reliable (building --with-ld=/an/absolute/path bypasses
-B searches for the linker), and we would like the libctf tests in
particular to not fail if the compiler uses a linker that cannot deduplicate
(simply skipping such tests).
Add a new testsuite function that tries to link one of the lookup tests'
testcases (which is known to produce conflicting types, i.e. a dict with
per-translation-unit children) and then does an objdump and greps it for
signs of the per-translation-unit children. If there are none, the linker
probably just concatenated the sections: i.e., it is not a linker that
can deduplicate CTF.
libctf/
PR libctf/33162
* testsuite/config/default.exp (objdump): Introduce.
(OBJDUMPFLAGS): Likewise.
* testsuite/lib/ctf-lib.exp (check_ctf_linker_dedup): New.
* testsuite/libctf-lookup/lookup.exp: Use it.
* testsuite/libctf-regression/libctf-repeat-cu.exp: Likewise.
* testsuite/libctf-regression/regression.exp: Likewise.
(cherry picked from commit 4983bb052d3a57fe1b43334071ba61a8443bb5aa)
(cherry picked from commit ae8c1b4241ada295a2a914311c03b239327285b9)
---
libctf/testsuite/config/default.exp | 8 +++-
libctf/testsuite/lib/ctf-lib.exp | 45 +++++++++++++++++++
libctf/testsuite/libctf-lookup/lookup.exp | 5 +++
.../libctf-regression/libctf-repeat-cu.exp | 5 +++
.../libctf-regression/regression.exp | 5 +++
5 files changed, 67 insertions(+), 1 deletion(-)
diff --git a/libctf/testsuite/config/default.exp b/libctf/testsuite/config/default.exp
index f24482620b6..d5e51f418ca 100644
--- a/libctf/testsuite/config/default.exp
+++ b/libctf/testsuite/config/default.exp
@@ -34,6 +34,10 @@ if ![info exists as] then {
set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]]
}
+if ![info exists objdump] then {
+ set objdump [findfile $base_dir/../binutils/objdump]
+}
+
remote_exec host "mkdir -p tmpdir"
# Make symlinks from tmpdir/libctf to the linker and assembler in the
@@ -63,10 +67,12 @@ if {![info exists CFLAGS_FOR_TARGET]} {
if ![info exists AR] then {
set AR [findfile $base_dir/../binutils/ar]
}
-
if {![info exists OBJDUMP]} {
set OBJDUMP [findfile $base_dir/../binutils/objdump]
}
+if ![info exists OBJDUMPFLAGS] then {
+ set OBJDUMPFLAGS {}
+}
# load the utility procedures
load_lib ctf-lib.exp
diff --git a/libctf/testsuite/lib/ctf-lib.exp b/libctf/testsuite/lib/ctf-lib.exp
index 6d3b75e22a2..a50235bf8d7 100644
--- a/libctf/testsuite/lib/ctf-lib.exp
+++ b/libctf/testsuite/lib/ctf-lib.exp
@@ -20,6 +20,51 @@
load_file $srcdir/../../ld/testsuite/lib/ld-lib.exp
+# Returns true if the target linker deduplicates CTF.
+proc check_ctf_linker_dedup { } {
+ global ctf_linker_dedup_saved
+
+ if {![info exists ctf_linker_dedup_saved]} {
+ set ctf_linker_dedup_saved 0
+
+ if ([check_ctf_available]) {
+ global objdump srcdir
+
+ set basename "tmpdir/ctf_linker_dedups[pid]"
+ compile_one_cc $srcdir/libctf-lookup/ambiguous-struct-A.c ${basename}-A.o "-gctf -fPIC -c"
+ compile_one_cc $srcdir/libctf-lookup/ambiguous-struct-B.c ${basename}-B.o "-gctf -fPIC -c"
+ compile_one_cc "${basename}-A.o ${basename}-B.o" $basename.so "-gctf -fPIC -shared"
+ if {! [remote_file host exists $basename.so] } {
+ return 0
+ }
+
+ # Don't use run_host_cmd: it dumps the entire output into the log,
+ # even on success.
+ set cmdret [remote_exec host [concat sh -c [list "$objdump --ctf $basename.so >dump.out 2>dump.err"]] "" "/dev/null"]
+ set cmdret [lindex $cmdret 0]
+ remote_upload host "dump.out"
+ remote_upload host "dump.err"
+ set dump_out [prune_warnings [file_contents "dump.out"]]
+ set dump_err [prune_warnings [file_contents "dump.err"]]
+ remote_file host delete "dump.out" "dump.err"
+ remote_file build delete "dump.out" "dump.err"
+
+ if {$cmdret != 0} {
+ verbose -log "failed with $cmdret: stderr: $dump_err"
+ verbose -log "output: $dump_out"
+ return 0;
+ }
+
+ remote_file host delete $basename.so ${basename}-A.o ${basename}-B.o
+ if [regexp {CTF archive member: } $dump_out] {
+ set ctf_linker_dedup_saved 1
+ }
+ }
+ }
+ return $ctf_linker_dedup_saved
+}
+
+
proc run_native_host_cmd { command } {
global link_output
global ld
diff --git a/libctf/testsuite/libctf-lookup/lookup.exp b/libctf/testsuite/libctf-lookup/lookup.exp
index a8b09c2df78..d15c315729d 100644
--- a/libctf/testsuite/libctf-lookup/lookup.exp
+++ b/libctf/testsuite/libctf-lookup/lookup.exp
@@ -28,6 +28,11 @@ if {![check_ctf_available]} {
return 0
}
+if {![check_ctf_linker_dedup]} {
+ unsupported "no CTF deduplication support in the linker"
+ return 0
+}
+
if {[info exists env(LC_ALL)]} {
set old_lc_all $env(LC_ALL)
}
diff --git a/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp b/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp
index e29cf63fce9..7c19fe8f6a7 100644
--- a/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp
+++ b/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp
@@ -37,6 +37,11 @@ if {![check_ctf_available]} {
return 0
}
+if {![check_ctf_linker_dedup]} {
+ unsupported "no CTF deduplication support in the linker"
+ return 0
+}
+
if {[info exists env(LC_ALL)]} {
set old_lc_all $env(LC_ALL)
}
diff --git a/libctf/testsuite/libctf-regression/regression.exp b/libctf/testsuite/libctf-regression/regression.exp
index e4b63473691..0270cca0cba 100644
--- a/libctf/testsuite/libctf-regression/regression.exp
+++ b/libctf/testsuite/libctf-regression/regression.exp
@@ -23,6 +23,11 @@ if {![check_ctf_available]} {
return 0
}
+if {![check_ctf_linker_dedup]} {
+ unsupported "no CTF deduplication support in the linker"
+ return 0
+}
+
if ![is_elf_format] {
unsupported "CTF needs bfd changes to be emitted on non-ELF"
return 0
--
2.49.1
@@ -0,0 +1,194 @@
From e6c0416cd6abd3b7493630fd1ead68a46121ff74 Mon Sep 17 00:00:00 2001
From: Nick Alcock <nick.alcock@oracle.com>
Date: Wed, 23 Jul 2025 14:20:26 +0100
Subject: [PATCH 23/23] libctf: link: rejig lazy opening to not need weak
symbols
The ctf_link_add_ctf API function has a 'lazy opening' feature whereby,
if you pass in the file but not a CTF archive, the archive is opened
as late as possible during links. This is valuable mostly in
cu-mapped links (a feature not accessible via GNU ld), where it
ensures that, rather than eventually needing memory for the original
link inputs, the smushed-together cu-mapped intermediate outputs,
*and* the final output, we only need enough memory for the smushed-
together outputs, the final output, and one input, since the inputs
can be closed immediately after they are smushed together.
(In GNU ld, the feature is useless because it loads all sections into
memory anyway.)
The lazy-opening feature uses libctf's ctf_open function, which uses
BFD: so it is not available in libctf-nobfd -- except that I thought I
had a cunning trick, and used a weak symbol so that if you linked
libctf-nobfd into your program and then also linked in bfd, the feature
stayed enabled.
This is silly -- if your program is licensed such that you can link in
BFD, you can just link in libctf.so and not bother with libctf-nobfd.so
in the first place. Worse, the weak symbol usage broke MacOS builds,
since MacOS's system compiler uses a different means of introducing weak
symbols. We could test for and use it, but this is the only place in
libctf to use weak symbols at all, and the feature of lazy-opening with
libctf-nobfd is so marginal we might as well drop it: it's almost
certain there are zero users, certainly fewer users than users of MacOS
with the system compiler.
While we're at it, simplify things by deleting the never-implemented
feature (not exposed in the API) to allow linking together raw buffers
of CTF data. If we need it we can bring it back, but all it's doing
right now is complicating the code to no end at all.
libctf/
PR libctf/33194
* ctf-link.c (ctf_open): Delete weak pragma.
(ctf_link_add): Fuse with...
(ctf_link_add_ctf): ... this function. Drop BUF, N args
and corresponding unimplemented feature warnings. Only check
NOBFD to see whether lazy loading is available, not PIC as
well.
(ctf_link_lazy_open): Likewise.
(cherry picked from commit d3e582895b2038feb47b68f1e03efaa0d9dae325)
(cherry picked from commit 2b2e51a31ec7c48ef830f7e8415b42d4b95e335a)
---
libctf/ctf-link.c | 88 +++++++++++++++--------------------------------
1 file changed, 27 insertions(+), 61 deletions(-)
diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c
index 2d4401d2210..524ed7e2466 100644
--- a/libctf/ctf-link.c
+++ b/libctf/ctf-link.c
@@ -20,10 +20,6 @@
#include <ctf-impl.h>
#include <string.h>
-#if defined (PIC)
-#pragma weak ctf_open
-#endif
-
/* CTF linking consists of adding CTF archives full of content to be merged into
this one to the current file (which must be writable) by calling
ctf_link_add_ctf. Once this is done, a call to ctf_link will merge the type
@@ -145,56 +141,33 @@ ctf_link_add_ctf_internal (ctf_dict_t *fp, ctf_archive_t *ctf,
return ctf_set_errno (fp, ENOMEM);
}
-/* Add a file, memory buffer, or unopened file (by name) to a link.
-
- You can call this with:
-
- CTF and NAME: link the passed ctf_archive_t, with the given NAME.
- NAME alone: open NAME as a CTF file when needed.
- BUF and NAME: open the BUF (of length N) as CTF, with the given NAME. (Not
- yet implemented.)
+/* Add an opened CTF archive or unopened file (by name) to a link.
+ If CTF is NULL and NAME is non-null, an unopened file is meant:
+ otherwise, the specified archive is assumed to have the given NAME.
- Passed in CTF args are owned by the dictionary and will be freed by it.
- The BUF arg is *not* owned by the dictionary, and the user should not free
- its referent until the link is done.
+ If CTF is NULL, the NAME is only opened when needed, and is closed when no
+ longer needed, so that large cu-mapped links will only use memory for their
+ cu-mapped inputs briefly (compensating for the memory usage of the
+ smushed-together cu-mapped verion).
- The order of calls to this function influences the order of types in the
- final link output, but otherwise is not important.
+ Passed in CTF args are owned by the dictionary and will be freed by it.
- Repeated additions of the same NAME have no effect; repeated additions of
- different dicts with the same NAME add all the dicts with unique NAMEs
- derived from NAME.
+ The order of calls to this function influences the order of types in the
+ final link output, but otherwise is not important.
- Private for now, but may in time become public once support for BUF is
- implemented. */
+ Repeated additions of the same NAME have no effect; repeated additions of
+ different dicts with the same NAME add all the dicts with unique NAMEs
+ derived from NAME. */
-static int
-ctf_link_add (ctf_dict_t *fp, ctf_archive_t *ctf, const char *name,
- void *buf _libctf_unused_, size_t n _libctf_unused_)
+int
+ctf_link_add_ctf (ctf_dict_t *fp, ctf_archive_t *ctf, const char *name)
{
- if (buf)
- return (ctf_set_errno (fp, ECTF_NOTYET));
-
- if (!((ctf && name && !buf)
- || (name && !buf && !ctf)
- || (buf && name && !ctf)))
+ if (!name)
return (ctf_set_errno (fp, EINVAL));
- /* We can only lazily open files if libctf.so is in use rather than
- libctf-nobfd.so. This is a little tricky: in shared libraries, we can use
- a weak symbol so that -lctf -lctf-nobfd works, but in static libraries we
- must distinguish between the two libraries explicitly. */
-
-#if defined (PIC)
- if (!buf && !ctf && name && !ctf_open)
- return (ctf_set_errno (fp, ECTF_NEEDSBFD));
-#elif NOBFD
- if (!buf && !ctf && name)
- return (ctf_set_errno (fp, ECTF_NEEDSBFD));
-#endif
-
if (fp->ctf_link_outputs)
return (ctf_set_errno (fp, ECTF_LINKADDEDLATE));
+
if (fp->ctf_link_inputs == NULL)
fp->ctf_link_inputs = ctf_dynhash_create (ctf_hash_string,
ctf_hash_eq_string, free,
@@ -203,22 +176,15 @@ ctf_link_add (ctf_dict_t *fp, ctf_archive_t *ctf, const char *name,
if (fp->ctf_link_inputs == NULL)
return (ctf_set_errno (fp, ENOMEM));
- return ctf_link_add_ctf_internal (fp, ctf, NULL, name);
-}
-
-/* Add an opened CTF archive or unopened file (by name) to a link.
- If CTF is NULL and NAME is non-null, an unopened file is meant:
- otherwise, the specified archive is assumed to have the given NAME.
-
- Passed in CTF args are owned by the dictionary and will be freed by it.
+ /* We can only lazily open files if libctf.so is in use rather than
+ libctf-nobfd.so. */
- The order of calls to this function influences the order of types in the
- final link output, but otherwise is not important. */
+#if NOBFD
+ if (!ctf)
+ return (ctf_set_errno (fp, ECTF_NEEDSBFD));
+#endif
-int
-ctf_link_add_ctf (ctf_dict_t *fp, ctf_archive_t *ctf, const char *name)
-{
- return ctf_link_add (fp, ctf, name, NULL, 0);
+ return ctf_link_add_ctf_internal (fp, ctf, NULL, name);
}
/* Lazily open a CTF archive for linking, if not already open.
@@ -238,12 +204,12 @@ ctf_link_lazy_open (ctf_dict_t *fp, ctf_link_input_t *input)
return 1;
/* See ctf_link_add_ctf. */
-#if defined (PIC) || !NOBFD
- input->clin_arc = ctf_open (input->clin_filename, NULL, &err);
-#else
+#if NOBFD
ctf_err_warn (fp, 0, ECTF_NEEDSBFD, _("cannot open %s lazily"),
input->clin_filename);
return ctf_set_errno (fp, ECTF_NEEDSBFD);
+#else
+ input->clin_arc = ctf_open (input->clin_filename, NULL, &err);
#endif
/* Having no CTF sections is not an error. We just don't need to do
--
2.49.1
+25 -1
View File
@@ -16,7 +16,24 @@
<Dependency>texinfo</Dependency>
</BuildDependencies>
<Patches>
<!-- <Patch level="1">fedora/binutils-gold-warn-unsupported.patch</Patch> -->
<Patch level="1">gentoo/0001-Re-enable-development-on-the-2.45-branch.patch</Patch>
<Patch level="1">gentoo/0002-Re-Re-enable-development-on-the-2.45-branch.patch</Patch>
<Patch level="1">gentoo/0003-bfd-drop-unused-elt_no.patch</Patch>
<Patch level="1">gentoo/0004-binutils-drop-unused-note_size-contents-old-variable.patch</Patch>
<Patch level="1">gentoo/0005-Fix-unused-variable-warnings.patch</Patch>
<Patch level="1">gentoo/0006-Fix-more-unused-variable-warnings.patch</Patch>
<Patch level="1">gentoo/0012-Adjust-testsuites-for-flto-and-without-g.patch</Patch>
<Patch level="1">gentoo/0013-strip-Don-t-check-target_defaulted-in-input-BFD.patch</Patch>
<Patch level="1">gentoo/0014-strip-Don-t-treat-fat-IR-objects-as-plugin-object.patch</Patch>
<Patch level="1">gentoo/0015-PR-33229-nds32-gas-segfaults-on-gcc-output.patch</Patch>
<Patch level="1">gentoo/0016-Re-resbin-don-t-pass-NULL-as-printf-s-arg.patch</Patch>
<Patch level="1">gentoo/0017-libiberty-sync-with-gcc.patch</Patch>
<Patch level="1">gentoo/0018-LoongArch-Fix-symbol-size-after-relaxation.patch</Patch>
<Patch level="1">gentoo/0019-libctf-do-not-use-mmap-on-Solaris-11.patch</Patch>
<Patch level="1">gentoo/0020-libctf-get-libctf-nobfd.ver-from-the-right-place-wit.patch</Patch>
<Patch level="1">gentoo/0021-libctf-exclude-always-emitted-Solaris-symbols-from-t.patch</Patch>
<Patch level="1">gentoo/0022-libctf-don-t-run-tests-requiring-deduplicating-linke.patch</Patch>
<Patch level="1">gentoo/0023-libctf-link-rejig-lazy-opening-to-not-need-weak-symb.patch</Patch>
</Patches>
</Source>
@@ -38,6 +55,13 @@
</Package>
<History>
<Update release="17">
<Date>2025-11-06</Date>
<Version>2.45</Version>
<Comment>Rebuild.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="16">
<Date>2025-10-29</Date>
<Version>2.45</Version>