summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--toolchain/binutils/patches/2.40/005-libctf-update-regexp-to-allow-makeinfo-to-build-docu.patch70
-rw-r--r--toolchain/binutils/patches/2.40/007-Fix-version-number-snafu-in-some-configuration-files.patch444
-rw-r--r--toolchain/binutils/patches/2.40/010-toplevel-Makefile.def-add-install-strip-dependency-o.patch60
-rw-r--r--toolchain/binutils/patches/2.40/018-gprofng-PR29521-docs-man-pages-are-not-in-the-releas.patch703
-rw-r--r--toolchain/binutils/patches/2.40/020-gprofng-PR30043-libgprofng.so.-are-installed-to-a-wr.patch212
-rw-r--r--toolchain/binutils/patches/2.40/026-RISC-V-make-C-extension-JAL-available-again-for-32-b.patch115
-rw-r--r--toolchain/binutils/patches/2.40/034-bpf-fix-error-conversion-from-long-unsigned-int-to-u.patch209
-rw-r--r--toolchain/binutils/patches/2.40/035-Pass-JANSSON_LIBS-and-ZSTD_LIBS-to-ld-bootstrap-boot.patch50
-rw-r--r--toolchain/binutils/patches/2.40/036-Regen-config-files.patch714
-rw-r--r--toolchain/binutils/patches/2.40/040-configure-remove-dependencies-on-gmp-and-mpfr-when-g.patch51
-rw-r--r--toolchain/binutils/patches/2.40/046-gas-correct-symbol-name-comparison-in-.startof.-.siz.patch46
11 files changed, 2674 insertions, 0 deletions
diff --git a/toolchain/binutils/patches/2.40/005-libctf-update-regexp-to-allow-makeinfo-to-build-docu.patch b/toolchain/binutils/patches/2.40/005-libctf-update-regexp-to-allow-makeinfo-to-build-docu.patch
new file mode 100644
index 0000000000..19af34091c
--- /dev/null
+++ b/toolchain/binutils/patches/2.40/005-libctf-update-regexp-to-allow-makeinfo-to-build-docu.patch
@@ -0,0 +1,70 @@
+From f7c5db99b76e8dde89335d794c82fcbfbf53c612 Mon Sep 17 00:00:00 2001
+From: Enze Li <enze.li@hotmail.com>
+Date: Sat, 14 Jan 2023 11:33:48 +0800
+Subject: [PATCH 05/50] libctf: update regexp to allow makeinfo to build
+ document
+
+While trying to build gdb on latest openSUSE Tumbleweed, I noticed the
+following warning,
+
+ checking for makeinfo... makeinfo --split-size=5000000
+ configure: WARNING:
+ *** Makeinfo is too old. Info documentation will not be built.
+
+then I checked the version of makeinfo, it said,
+======
+$ makeinfo --version
+texi2any (GNU texinfo) 7.0.1
+
+Copyright (C) 2022 Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+======
+
+After digging a little bit, it became quite obvious that a dot is
+missing in regexp that makes it impossible to match versions higher than
+7.0, and here's the solution:
+
+- | egrep 'texinfo[^0-9]*(6\.[3-9]|[7-9][0-9])' >/dev/null 2>&1; then
++ | egrep 'texinfo[^0-9]*(6\.[3-9]|[7-9]\.[0-9])' >/dev/null 2>&1; then
+
+However, Eli pointed out that the solution above has another problem: it
+will stop working when Texinfo 10.1 will be released. Meanwhile, he
+suggested to solve this problem permanently. That is, we don't care
+about the minor version for Texinfo > 6.9, we only care about the major
+version.
+
+In this way, the problem will be resolved permanently, thanks to Eli.
+
+libctf/ChangeLog:
+
+ * configure: Regenerated.
+ * configure.ac: Update regexp to match versions higher than 7.0.
+---
+ libctf/configure | 2 +-
+ libctf/configure.ac | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/libctf/configure
++++ b/libctf/configure
+@@ -14865,7 +14865,7 @@ esac
+ # We require texinfo to be 6.3 or later, for a working synindex
+ # and validatemenus: otherwise we fall back to /bin/true.
+ if ${MAKEINFO} --version \
+- | egrep 'texinfo[^0-9]*(6\.[3-9]|[7-9][0-9])' >/dev/null 2>&1; then
++ | egrep 'texinfo[^0-9]*(6\.[3-9]|[7-9]|[1-6][0-9])' >/dev/null 2>&1; then
+ build_info=yes
+ else
+ build_info=
+--- a/libctf/configure.ac
++++ b/libctf/configure.ac
+@@ -184,7 +184,7 @@ changequote(,)
+ # We require texinfo to be 6.3 or later, for a working synindex
+ # and validatemenus: otherwise we fall back to /bin/true.
+ if ${MAKEINFO} --version \
+- | egrep 'texinfo[^0-9]*(6\.[3-9]|[7-9][0-9])' >/dev/null 2>&1; then
++ | egrep 'texinfo[^0-9]*(6\.[3-9]|[7-9]|[1-6][0-9])' >/dev/null 2>&1; then
+ build_info=yes
+ else
+ build_info=
diff --git a/toolchain/binutils/patches/2.40/007-Fix-version-number-snafu-in-some-configuration-files.patch b/toolchain/binutils/patches/2.40/007-Fix-version-number-snafu-in-some-configuration-files.patch
new file mode 100644
index 0000000000..0676240442
--- /dev/null
+++ b/toolchain/binutils/patches/2.40/007-Fix-version-number-snafu-in-some-configuration-files.patch
@@ -0,0 +1,444 @@
+From 59706683feafb6252d0ad369cf8759f75fd147be Mon Sep 17 00:00:00 2001
+From: Nick Clifton <nickc@redhat.com>
+Date: Tue, 17 Jan 2023 12:02:56 +0000
+Subject: [PATCH 07/50] Fix version number snafu in some configuration files:
+ 2.40.00 should be 2.40
+
+---
+ binutils/configure | 20 ++++++++++----------
+ gprof/configure | 20 ++++++++++----------
+ gprofng/configure | 20 ++++++++++----------
+ gprofng/doc/version.texi | 4 ++--
+ gprofng/libcollector/configure | 20 ++++++++++----------
+ ld/configure | 20 ++++++++++----------
+ 6 files changed, 52 insertions(+), 52 deletions(-)
+
+--- 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.40.00.
++# Generated by GNU Autoconf 2.69 for binutils 2.40.
+ #
+ #
+ # 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.40.00'
+-PACKAGE_STRING='binutils 2.40.00'
++PACKAGE_VERSION='2.40'
++PACKAGE_STRING='binutils 2.40'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1401,7 +1401,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.40.00 to adapt to many kinds of systems.
++\`configure' configures binutils 2.40 to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1472,7 +1472,7 @@ fi
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of binutils 2.40.00:";;
++ short | recursive ) echo "Configuration of binutils 2.40:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1631,7 +1631,7 @@ fi
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-binutils configure 2.40.00
++binutils configure 2.40
+ generated by GNU Autoconf 2.69
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+@@ -2099,7 +2099,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.40.00, which was
++It was created by binutils $as_me 2.40, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+@@ -3081,7 +3081,7 @@ fi
+
+ # Define the identity of the package.
+ PACKAGE='binutils'
+- VERSION='2.40.00'
++ VERSION='2.40'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -15326,7 +15326,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
+ # 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.40.00, which was
++This file was extended by binutils $as_me 2.40, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -15392,7 +15392,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.40.00
++binutils config.status 2.40
+ configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+--- 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.40.00.
++# Generated by GNU Autoconf 2.69 for gprof 2.40.
+ #
+ #
+ # 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.40.00'
+-PACKAGE_STRING='gprof 2.40.00'
++PACKAGE_VERSION='2.40'
++PACKAGE_STRING='gprof 2.40'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1338,7 +1338,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.40.00 to adapt to many kinds of systems.
++\`configure' configures gprof 2.40 to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1409,7 +1409,7 @@ fi
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of gprof 2.40.00:";;
++ short | recursive ) echo "Configuration of gprof 2.40:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1520,7 +1520,7 @@ fi
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-gprof configure 2.40.00
++gprof configure 2.40
+ generated by GNU Autoconf 2.69
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+@@ -1885,7 +1885,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.40.00, which was
++It was created by gprof $as_me 2.40, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+@@ -2864,7 +2864,7 @@ fi
+
+ # Define the identity of the package.
+ PACKAGE='gprof'
+- VERSION='2.40.00'
++ VERSION='2.40'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -12572,7 +12572,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
+ # 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.40.00, which was
++This file was extended by gprof $as_me 2.40, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -12638,7 +12638,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.40.00
++gprof config.status 2.40
+ configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+--- a/gprofng/configure
++++ b/gprofng/configure
+@@ -1,6 +1,6 @@
+ #! /bin/sh
+ # Guess values for system-dependent variables and create Makefiles.
+-# Generated by GNU Autoconf 2.69 for gprofng 2.40.00.
++# Generated by GNU Autoconf 2.69 for gprofng 2.40.
+ #
+ #
+ # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+@@ -587,8 +587,8 @@ MAKEFLAGS=
+ # Identity of this package.
+ PACKAGE_NAME='gprofng'
+ PACKAGE_TARNAME='gprofng'
+-PACKAGE_VERSION='2.40.00'
+-PACKAGE_STRING='gprofng 2.40.00'
++PACKAGE_VERSION='2.40'
++PACKAGE_STRING='gprofng 2.40'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1362,7 +1362,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 gprofng 2.40.00 to adapt to many kinds of systems.
++\`configure' configures gprofng 2.40 to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1433,7 +1433,7 @@ fi
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of gprofng 2.40.00:";;
++ short | recursive ) echo "Configuration of gprofng 2.40:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1547,7 +1547,7 @@ fi
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-gprofng configure 2.40.00
++gprofng configure 2.40
+ generated by GNU Autoconf 2.69
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+@@ -2079,7 +2079,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 gprofng $as_me 2.40.00, which was
++It was created by gprofng $as_me 2.40, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+@@ -3052,7 +3052,7 @@ fi
+
+ # Define the identity of the package.
+ PACKAGE='gprofng'
+- VERSION='2.40.00'
++ VERSION='2.40'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -17467,7 +17467,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
+ # report actual input values of CONFIG_FILES etc. instead of their
+ # values after options handling.
+ ac_log="
+-This file was extended by gprofng $as_me 2.40.00, which was
++This file was extended by gprofng $as_me 2.40, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -17533,7 +17533,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="\\
+-gprofng config.status 2.40.00
++gprofng config.status 2.40
+ configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+--- a/gprofng/doc/version.texi
++++ b/gprofng/doc/version.texi
+@@ -1,4 +1,4 @@
+ @set UPDATED 5 January 2023
+ @set UPDATED-MONTH January 2023
+-@set EDITION 2.40.00
+-@set VERSION 2.40.00
++@set EDITION 2.40
++@set VERSION 2.40
+--- a/gprofng/libcollector/configure
++++ b/gprofng/libcollector/configure
+@@ -1,6 +1,6 @@
+ #! /bin/sh
+ # Guess values for system-dependent variables and create Makefiles.
+-# Generated by GNU Autoconf 2.69 for gprofng 2.40.00.
++# Generated by GNU Autoconf 2.69 for gprofng 2.40.
+ #
+ #
+ # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+@@ -587,8 +587,8 @@ MAKEFLAGS=
+ # Identity of this package.
+ PACKAGE_NAME='gprofng'
+ PACKAGE_TARNAME='gprofng'
+-PACKAGE_VERSION='2.40.00'
+-PACKAGE_STRING='gprofng 2.40.00'
++PACKAGE_VERSION='2.40'
++PACKAGE_STRING='gprofng 2.40'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1325,7 +1325,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 gprofng 2.40.00 to adapt to many kinds of systems.
++\`configure' configures gprofng 2.40 to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1396,7 +1396,7 @@ fi
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of gprofng 2.40.00:";;
++ short | recursive ) echo "Configuration of gprofng 2.40:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1505,7 +1505,7 @@ fi
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-gprofng configure 2.40.00
++gprofng configure 2.40
+ generated by GNU Autoconf 2.69
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+@@ -1991,7 +1991,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 gprofng $as_me 2.40.00, which was
++It was created by gprofng $as_me 2.40, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+@@ -2968,7 +2968,7 @@ fi
+
+ # Define the identity of the package.
+ PACKAGE='gprofng'
+- VERSION='2.40.00'
++ VERSION='2.40'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -16098,7 +16098,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
+ # report actual input values of CONFIG_FILES etc. instead of their
+ # values after options handling.
+ ac_log="
+-This file was extended by gprofng $as_me 2.40.00, which was
++This file was extended by gprofng $as_me 2.40, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -16164,7 +16164,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="\\
+-gprofng config.status 2.40.00
++gprofng config.status 2.40
+ configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+--- 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.40.00.
++# Generated by GNU Autoconf 2.69 for ld 2.40.
+ #
+ #
+ # 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.40.00'
+-PACKAGE_STRING='ld 2.40.00'
++PACKAGE_VERSION='2.40'
++PACKAGE_STRING='ld 2.40'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1423,7 +1423,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.40.00 to adapt to many kinds of systems.
++\`configure' configures ld 2.40 to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1494,7 +1494,7 @@ fi
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of ld 2.40.00:";;
++ short | recursive ) echo "Configuration of ld 2.40:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1661,7 +1661,7 @@ fi
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-ld configure 2.40.00
++ld configure 2.40
+ generated by GNU Autoconf 2.69
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+@@ -2376,7 +2376,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.40.00, which was
++It was created by ld $as_me 2.40, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+@@ -3359,7 +3359,7 @@ fi
+
+ # Define the identity of the package.
+ PACKAGE='ld'
+- VERSION='2.40.00'
++ VERSION='2.40'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -18083,7 +18083,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
+ # 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.40.00, which was
++This file was extended by ld $as_me 2.40, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -18149,7 +18149,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.40.00
++ld config.status 2.40
+ configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
diff --git a/toolchain/binutils/patches/2.40/010-toplevel-Makefile.def-add-install-strip-dependency-o.patch b/toolchain/binutils/patches/2.40/010-toplevel-Makefile.def-add-install-strip-dependency-o.patch
new file mode 100644
index 0000000000..bef40f546f
--- /dev/null
+++ b/toolchain/binutils/patches/2.40/010-toplevel-Makefile.def-add-install-strip-dependency-o.patch
@@ -0,0 +1,60 @@
+From bcea253f5fa194e57f9564e8461c718e228bd26e Mon Sep 17 00:00:00 2001
+From: Indu Bhagat <indu.bhagat@oracle.com>
+Date: Wed, 18 Jan 2023 23:17:49 -0800
+Subject: [PATCH 10/50] toplevel: Makefile.def: add install-strip dependency on
+ libsframe
+
+As noted in PR libsframe/30014 - FTBFS: install-strip fails because
+bfdlib relinks and fails to find libsframe, the install time
+dependencies of libbfd need to be updated.
+
+ PR libsframe/30014
+ * Makefile.def: Reflect that libsframe needs to installed before
+ libbfd. Reorder a bit to better track libsframe dependencies.
+ * Makefile.in: Regenerate.
+
+(cherry picked from commit b8d21eb0cd10d6127e77cc437d82e949adb0c454)
+---
+ Makefile.def | 5 ++++-
+ Makefile.in | 3 ++-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+--- a/Makefile.def
++++ b/Makefile.def
+@@ -493,7 +493,6 @@ dependencies = { module=install-binutils
+ dependencies = { module=install-strip-binutils; on=install-strip-opcodes; };
+
+ // Likewise for ld, libctf, and bfd.
+-dependencies = { module=install-bfd; on=install-libsframe; };
+ dependencies = { module=install-libctf; on=install-bfd; };
+ dependencies = { module=install-ld; on=install-bfd; };
+ dependencies = { module=install-ld; on=install-libctf; };
+@@ -501,6 +500,10 @@ dependencies = { module=install-strip-li
+ dependencies = { module=install-strip-ld; on=install-strip-bfd; };
+ dependencies = { module=install-strip-ld; on=install-strip-libctf; };
+
++// libbfd depends on libsframe
++dependencies = { module=install-bfd; on=install-libsframe; };
++dependencies = { module=install-strip-bfd; on=install-strip-libsframe; };
++
+ // libopcodes depends on libbfd
+ dependencies = { module=configure-opcodes; on=configure-bfd; hard=true; };
+ dependencies = { module=install-opcodes; on=install-bfd; };
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -64549,13 +64549,14 @@ all-stageautoprofile-binutils: maybe-all
+ all-stageautofeedback-binutils: maybe-all-stageautofeedback-libsframe
+ install-binutils: maybe-install-opcodes
+ install-strip-binutils: maybe-install-strip-opcodes
+-install-bfd: maybe-install-libsframe
+ install-libctf: maybe-install-bfd
+ install-ld: maybe-install-bfd
+ install-ld: maybe-install-libctf
+ install-strip-libctf: maybe-install-strip-bfd
+ install-strip-ld: maybe-install-strip-bfd
+ install-strip-ld: maybe-install-strip-libctf
++install-bfd: maybe-install-libsframe
++install-strip-bfd: maybe-install-strip-libsframe
+ configure-opcodes: configure-bfd
+ configure-stage1-opcodes: configure-stage1-bfd
+ configure-stage2-opcodes: configure-stage2-bfd
diff --git a/toolchain/binutils/patches/2.40/018-gprofng-PR29521-docs-man-pages-are-not-in-the-releas.patch b/toolchain/binutils/patches/2.40/018-gprofng-PR29521-docs-man-pages-are-not-in-the-releas.patch
new file mode 100644
index 0000000000..ae557645c0
--- /dev/null
+++ b/toolchain/binutils/patches/2.40/018-gprofng-PR29521-docs-man-pages-are-not-in-the-releas.patch
@@ -0,0 +1,703 @@
+From c6e269febbc946a54ed9dbbb2dc70feba6017607 Mon Sep 17 00:00:00 2001
+From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
+Date: Fri, 20 Jan 2023 15:39:55 -0800
+Subject: [PATCH 18/50] gprofng: PR29521 [docs] man pages are not in the
+ release tarball
+
+gprofng/ChangeLog
+2023-01-20 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
+
+ PR gprofng/29521
+ * configure.ac: Check if $MAKEINFO and $HELP2MAN are missing.
+ * Makefile.am: Build doc if $MAKEINFO exists.
+ * doc/gprofng.texi: Update documentation for gprofng.
+ * doc/Makefile.am: Build gprofng.1.
+ * src/Makefile.am: Move the build of gprofng.1 to doc/Makefile.am.
+ * configure: Rebuild.
+ * Makefile.in: Rebuild.
+ * doc/Makefile.in: Rebuild.
+ * src/Makefile.in: Rebuild.
+---
+ gprofng/Makefile.am | 2 +-
+ gprofng/Makefile.in | 2 +-
+ gprofng/configure | 79 +++++++++++++++---
+ gprofng/configure.ac | 21 +++--
+ gprofng/doc/Makefile.am | 24 +++++-
+ gprofng/doc/Makefile.in | 93 ++++++++++++++++++---
+ gprofng/doc/gprofng.texi | 169 +++++++++++++++++++++++++++++++++++++++
+ gprofng/src/Makefile.am | 8 +-
+ gprofng/src/Makefile.in | 8 +-
+ 9 files changed, 364 insertions(+), 42 deletions(-)
+
+--- a/gprofng/Makefile.am
++++ b/gprofng/Makefile.am
+@@ -23,7 +23,7 @@ AUTOMAKE_OPTIONS = dejagnu foreign
+ if BUILD_COLLECTOR
+ COLLECTOR_SUBDIRS = libcollector
+ endif
+-if BUILD_MAN
++if BUILD_DOC
+ DOC_SUBDIR = doc
+ endif
+ if BUILD_SRC
+--- a/gprofng/Makefile.in
++++ b/gprofng/Makefile.in
+@@ -381,7 +381,7 @@ zlibinc = @zlibinc@
+ ACLOCAL_AMFLAGS = -I . -I ..
+ AUTOMAKE_OPTIONS = dejagnu foreign
+ @BUILD_COLLECTOR_TRUE@COLLECTOR_SUBDIRS = libcollector
+-@BUILD_MAN_TRUE@DOC_SUBDIR = doc
++@BUILD_DOC_TRUE@DOC_SUBDIR = doc
+ @BUILD_SRC_TRUE@SRC_SUBDIRS = src gp-display-html $(DOC_SUBDIR)
+ SUBDIRS = $(COLLECTOR_SUBDIRS) $(SRC_SUBDIRS)
+ DIST_SUBDIRS = libcollector src gp-display-html $(DOC_SUBDIR)
+--- a/gprofng/configure
++++ b/gprofng/configure
+@@ -639,6 +639,8 @@ GPROFNG_CPPFLAGS
+ GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS
+ GPROFNG_CFLAGS
+ LD_NO_AS_NEEDED
++BUILD_DOC_FALSE
++BUILD_DOC_TRUE
+ BUILD_MAN_FALSE
+ BUILD_MAN_TRUE
+ HELP2MAN
+@@ -12221,7 +12223,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 12224 "configure"
++#line 12226 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -12327,7 +12329,7 @@ else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 12330 "configure"
++#line 12332 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -16737,9 +16739,58 @@ fi
+
+ # Generate manpages, if possible.
+ build_man=false
++build_doc=false
+ if test $cross_compiling = no; then
++ for ac_prog in help2man
++do
++ # Extract the first word of "$ac_prog", so it can be a program name with args.
++set dummy $ac_prog; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_HELP2MAN+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$HELP2MAN"; then
++ ac_cv_prog_HELP2MAN="$HELP2MAN" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ ac_cv_prog_HELP2MAN="$ac_prog"
++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++ break 2
++ fi
++done
++ done
++IFS=$as_save_IFS
++
++fi
++fi
++HELP2MAN=$ac_cv_prog_HELP2MAN
++if test -n "$HELP2MAN"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HELP2MAN" >&5
++$as_echo "$HELP2MAN" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
+
+-HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"}
++
++ test -n "$HELP2MAN" && break
++done
++test -n "$HELP2MAN" || HELP2MAN="$MISSING help2man"
++
++ case "x$HELP2MAN" in
++ x | */missing\ help2man* )
++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gprofng: help2man is missing. Man pages will not be built." >&5
++$as_echo "$as_me: WARNING: gprofng: help2man is missing. Man pages will not be built." >&2;}
++ ;;
++ * ) build_man=true ;;
++ esac
+
+ for ac_prog in makeinfo
+ do
+@@ -16782,10 +16833,10 @@ fi
+
+ test -n "$MAKEINFO" && break
+ done
+-test -n "$MAKEINFO" || MAKEINFO=""@echo makeinfo missing; true""
++test -n "$MAKEINFO" || MAKEINFO="$MISSING makeinfo"
+
+- case "$MAKEINFO" in
+- *true)
++ case "x$MAKEINFO" in
++ x | */missing\ makeinfo*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gprofng: makeinfo is missing. Info documentation will not be built." >&5
+ $as_echo "$as_me: WARNING: gprofng: makeinfo is missing. Info documentation will not be built." >&2;}
+ ;;
+@@ -16796,9 +16847,7 @@ $as_echo "$as_me: WARNING: gprofng: make
+ $as_echo "$as_me: WARNING: gprofng: $MAKEINFO is too old. Info documentation will not be built." >&2;}
+ MAKEINFO="@echo $MAKEINFO is too old, 6.5 or newer required; true"
+ ;;
+- x* )
+- build_man=true
+- ;;
++ x* ) build_doc=true ;;
+ esac
+ ;;
+ esac
+@@ -16812,6 +16861,14 @@ else
+ BUILD_MAN_FALSE=
+ fi
+
++ if test x$build_doc = xtrue; then
++ BUILD_DOC_TRUE=
++ BUILD_DOC_FALSE='#'
++else
++ BUILD_DOC_TRUE='#'
++ BUILD_DOC_FALSE=
++fi
++
+
+ LD_NO_AS_NEEDED=${no_as_needed}
+
+@@ -17070,6 +17127,10 @@ if test -z "${BUILD_MAN_TRUE}" && test -
+ as_fn_error $? "conditional \"BUILD_MAN\" was never defined.
+ Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
++if test -z "${BUILD_DOC_TRUE}" && test -z "${BUILD_DOC_FALSE}"; then
++ as_fn_error $? "conditional \"BUILD_DOC\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
++fi
+
+ : "${CONFIG_STATUS=./config.status}"
+ ac_write_fail=0
+--- a/gprofng/configure.ac
++++ b/gprofng/configure.ac
+@@ -210,11 +210,19 @@ AM_ZLIB
+
+ # Generate manpages, if possible.
+ build_man=false
++build_doc=false
+ if test $cross_compiling = no; then
+- AM_MISSING_PROG(HELP2MAN, help2man)
+- AC_CHECK_PROGS([MAKEINFO], makeinfo, ["@echo makeinfo missing; true"])
+- case "$MAKEINFO" in
+- *true)
++ AC_CHECK_PROGS([HELP2MAN], help2man, [$MISSING help2man])
++ case "x$HELP2MAN" in
++ x | */missing\ help2man* )
++ AC_MSG_WARN([gprofng: help2man is missing. Man pages will not be built.])
++ ;;
++ * ) build_man=true ;;
++ esac
++
++ AC_CHECK_PROGS([MAKEINFO], makeinfo, [$MISSING makeinfo])
++ case "x$MAKEINFO" in
++ x | */missing\ makeinfo*)
+ AC_MSG_WARN([gprofng: makeinfo is missing. Info documentation will not be built.])
+ ;;
+ *)
+@@ -223,15 +231,14 @@ if test $cross_compiling = no; then
+ AC_MSG_WARN([gprofng: $MAKEINFO is too old. Info documentation will not be built.])
+ MAKEINFO="@echo $MAKEINFO is too old, 6.5 or newer required; true"
+ ;;
+- x* )
+- build_man=true
+- ;;
++ x* ) build_doc=true ;;
+ esac
+ ;;
+ esac
+ AC_SUBST(MAKEINFO)
+ fi
+ AM_CONDITIONAL([BUILD_MAN], [test x$build_man = xtrue])
++AM_CONDITIONAL([BUILD_DOC], [test x$build_doc = xtrue])
+
+ AC_SUBST(LD_NO_AS_NEEDED, [${no_as_needed}])
+ AC_SUBST(GPROFNG_CFLAGS, [${gprofng_cflags}])
+--- a/gprofng/doc/Makefile.am
++++ b/gprofng/doc/Makefile.am
+@@ -19,9 +19,31 @@
+
+ AUTOMAKE_OPTIONS = info-in-builddir foreign no-texinfo.tex
+
++# Options to extract the man page
++MANCONF = -Dman
++
++TEXI2POD = perl $(srcdir)/../../etc/texi2pod.pl $(AM_MAKEINFOFLAGS)
++POD2MAN = pod2man --center="User Commands" \
++ --release="binutils-$(VERSION)" --section=1
++
+ info_TEXINFOS = gprofng.texi
+ gprofng_TEXINFOS = fdl.texi
+ TEXINFO_TEX = .
+ MAKEINFOHTML = $(MAKEINFO) --html --no-split
+
+-MAINTAINERCLEANFILES = gprofng.info
++man_MANS = gprofng.1
++
++# Build the man page from the texinfo file
++# The sed command removes the no-adjust Nroff command so that
++# the man output looks standard.
++gprofng.1: $(srcdir)/gprofng.texi
++ $(AM_V_GEN)touch $@
++ $(AM_V_at)-$(TEXI2POD) $(MANCONF) < $(srcdir)/gprofng.texi > gprofng.pod
++ $(AM_V_at)-($(POD2MAN) gprofng.pod | \
++ sed -e '/^.if n .na/d' > $@.tmp && \
++ mv -f $@.tmp $@) || (rm -f $@.tmp && exit 1)
++ $(AM_V_at)rm -f gprofng.pod
++
++MAINTAINERCLEANFILES = gprofng.info $(man_MANS)
++
++info: $(man_MANS)
+--- a/gprofng/doc/Makefile.in
++++ b/gprofng/doc/Makefile.in
+@@ -182,7 +182,7 @@ am__can_run_installinfo = \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+-am__installdirs = "$(DESTDIR)$(infodir)"
++am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)"
+ am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+ am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+@@ -210,6 +210,9 @@ am__uninstall_files_from_dir = { \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
++man1dir = $(mandir)/man1
++NROFF = nroff
++MANS = $(man_MANS)
+ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+ am__DIST_COMMON = $(gprofng_TEXINFOS) $(srcdir)/Makefile.in \
+ $(top_srcdir)/../mkinstalldirs mdate-sh texinfo.tex
+@@ -361,11 +364,19 @@ top_srcdir = @top_srcdir@
+ zlibdir = @zlibdir@
+ zlibinc = @zlibinc@
+ AUTOMAKE_OPTIONS = info-in-builddir foreign no-texinfo.tex
++
++# Options to extract the man page
++MANCONF = -Dman
++TEXI2POD = perl $(srcdir)/../../etc/texi2pod.pl $(AM_MAKEINFOFLAGS)
++POD2MAN = pod2man --center="User Commands" \
++ --release="binutils-$(VERSION)" --section=1
++
+ info_TEXINFOS = gprofng.texi
+ gprofng_TEXINFOS = fdl.texi
+ TEXINFO_TEX = .
+ MAKEINFOHTML = $(MAKEINFO) --html --no-split
+-MAINTAINERCLEANFILES = gprofng.info
++man_MANS = gprofng.1
++MAINTAINERCLEANFILES = gprofng.info $(man_MANS)
+ all: all-am
+
+ .SUFFIXES:
+@@ -558,6 +569,49 @@ maintainer-clean-aminfo:
+ echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
+ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
+ done
++install-man1: $(man_MANS)
++ @$(NORMAL_INSTALL)
++ @list1=''; \
++ list2='$(man_MANS)'; \
++ test -n "$(man1dir)" \
++ && test -n "`echo $$list1$$list2`" \
++ || exit 0; \
++ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
++ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
++ { for i in $$list1; do echo "$$i"; done; \
++ if test -n "$$list2"; then \
++ for i in $$list2; do echo "$$i"; done \
++ | sed -n '/\.1[a-z]*$$/p'; \
++ fi; \
++ } | while read p; do \
++ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
++ echo "$$d$$p"; echo "$$p"; \
++ done | \
++ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
++ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
++ sed 'N;N;s,\n, ,g' | { \
++ list=; while read file base inst; do \
++ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
++ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
++ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
++ fi; \
++ done; \
++ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
++ while read files; do \
++ test -z "$$files" || { \
++ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
++ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
++ done; }
++
++uninstall-man1:
++ @$(NORMAL_UNINSTALL)
++ @list=''; test -n "$(man1dir)" || exit 0; \
++ files=`{ for i in $$list; do echo "$$i"; done; \
++ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
++ sed -n '/\.1[a-z]*$$/p'; \
++ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
++ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
++ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+ tags TAGS:
+
+ ctags CTAGS:
+@@ -600,9 +654,9 @@ distdir: $(DISTFILES)
+ dist-info
+ check-am: all-am
+ check: check-am
+-all-am: Makefile $(INFO_DEPS)
++all-am: Makefile $(INFO_DEPS) $(MANS)
+ installdirs:
+- for dir in "$(DESTDIR)$(infodir)"; do \
++ for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+ install: install-am
+@@ -652,11 +706,9 @@ html: html-am
+
+ html-am: $(HTMLS)
+
+-info: info-am
+-
+ info-am: $(INFO_DEPS)
+
+-install-data-am: install-info-am
++install-data-am: install-info-am install-man
+
+ install-dvi: install-dvi-am
+
+@@ -739,7 +791,7 @@ install-info-am: $(INFO_DEPS)
+ install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
+ done; \
+ else : ; fi
+-install-man:
++install-man: install-man1
+
+ install-pdf: install-pdf-am
+
+@@ -794,7 +846,9 @@ ps: ps-am
+ ps-am: $(PSS)
+
+ uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
+- uninstall-pdf-am uninstall-ps-am
++ uninstall-man uninstall-pdf-am uninstall-ps-am
++
++uninstall-man: uninstall-man1
+
+ .MAKE: install-am install-strip
+
+@@ -804,19 +858,32 @@ uninstall-am: uninstall-dvi-am uninstall
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+- install-info-am install-man install-pdf install-pdf-am \
+- install-ps install-ps-am install-strip installcheck \
+- installcheck-am installdirs maintainer-clean \
++ install-info-am install-man install-man1 install-pdf \
++ install-pdf-am install-ps install-ps-am install-strip \
++ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-aminfo maintainer-clean-generic \
+ maintainer-clean-vti mostlyclean mostlyclean-aminfo \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-vti pdf \
+ pdf-am ps ps-am tags-am uninstall uninstall-am \
+ uninstall-dvi-am uninstall-html-am uninstall-info-am \
+- uninstall-pdf-am uninstall-ps-am
++ uninstall-man uninstall-man1 uninstall-pdf-am uninstall-ps-am
+
+ .PRECIOUS: Makefile
+
+
++# Build the man page from the texinfo file
++# The sed command removes the no-adjust Nroff command so that
++# the man output looks standard.
++gprofng.1: $(srcdir)/gprofng.texi
++ $(AM_V_GEN)touch $@
++ $(AM_V_at)-$(TEXI2POD) $(MANCONF) < $(srcdir)/gprofng.texi > gprofng.pod
++ $(AM_V_at)-($(POD2MAN) gprofng.pod | \
++ sed -e '/^.if n .na/d' > $@.tmp && \
++ mv -f $@.tmp $@) || (rm -f $@.tmp && exit 1)
++ $(AM_V_at)rm -f gprofng.pod
++
++info: $(man_MANS)
++
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+ .NOEXPORT:
+--- a/gprofng/doc/gprofng.texi
++++ b/gprofng/doc/gprofng.texi
+@@ -1,5 +1,8 @@
+ \input texinfo @c -*-texinfo-*-
+
++@c for $sect (qw(NAME SYNOPSIS TARGET DESCRIPTION OPTIONS ENVIRONMENT FILES
++@c BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) {
++
+ @c ----------------------------------------------------------------------------
+ @c This is the Texinfo source file for the GPROFNG manual.
+ @c
+@@ -59,6 +62,10 @@ gprofng
+ @cindex \label\, \string\
+ @end macro
+
++@macro gcctabopt{body}
++@code{\body\}
++@end macro
++
+ @c -- Get the version information ---------------------------------------------
+ @include version.texi
+
+@@ -99,6 +106,20 @@ section entitled ``GNU Free Documentatio
+ @page
+ @vskip 0pt plus 1filll
+ @insertcopying
++
++@c man begin COPYRIGHT
++
++Copyright @copyright{} 2022-2023 Free Software Foundation, Inc.
++
++Permission is granted to copy, distribute and/or modify this document
++under the terms of the GNU Free Documentation License, Version 1.3
++or any later version published by the Free Software Foundation;
++with no Invariant Sections, with no Front-Cover Texts, and with no
++Back-Cover Texts. A copy of the license is included in the
++section entitled ``GNU Free Documentation License''.
++
++@c man end
++
+ @end titlepage
+
+ @c -- Generate the Table of Contents ------------------------------------------
+@@ -163,6 +184,154 @@ Terminology
+ @end menu
+ @end ifinfo
+
++@ifset man
++
++@c man title gprofng the driver for the gprofng tool suite
++
++@c man begin SYNOPSIS
++gprofng [OPTION(S)] ACTION [@b{QUALIFIER}] [ARGUMENTS] TARGET
++@c man end
++
++@c man begin DESCRIPTION
++This is the driver for the GPROFNG tools suite to gather and analyze performance data.
++
++The driver executes the action specified. An example of an action is @code{collect}
++to collect performance data. Depending on the action, a qualifier may be needed to
++define the command. Several qualifiers support options. The last item on the command
++is the target the command applies to.
++
++For example, to collect performance data for an application called @code{a.out} and
++store the results in experiment directory @code{mydata.er}, the following command may
++be used:
++
++@smallexample
++$ gprofng collect app -o mydata.er a.out
++@end smallexample
++
++In this example, the action is @code{collect}, the qualifier is @code{app}, the single
++argument is @code{-o mydata.er} and the target is @code{a.out}.
++
++If gprofng is executed without any additional option, action, or target, a usage
++overview is printed.
++
++@c man end
++
++@c man begin OPTIONS
++
++@table @gcctabopt
++
++@item @var{--version}
++print the version number and exit.
++
++@item @var{--help}
++print usage information and exit.
++
++@end table
++
++@c man end
++
++@c man begin NOTES
++
++The gprofng driver supports the following commands.
++
++@c The man pages for the commands below can be viewed using the command name with "gprofng" replaced by "gp" and the spaces replaced by a dash ("-"). For example the man page
++@c name for "gprofng collect app" is "gp-collect-app".
++
++Collect performance data:
++
++@table @code
++
++@item gprofng collect app
++collect application performance data.
++
++@end table
++
++Display the performance results:
++
++@table @code
++
++@item gprofng display text
++display the performance data in ASCII format.
++
++@item gprofng display html
++generate an HTML file from one or more experiments.
++
++@end table
++
++Miscellaneous commands:
++
++@table @code
++
++@item gprofng display src
++display source or disassembly with compiler annotations.
++
++@item gprofng archive
++include binaries and source code in an experiment directory.
++
++@end table
++
++It is also possible to invoke the lower level commands directly, but since
++these are subject to change, in particular the options, we recommend to
++use the driver.
++
++@c man end
++
++@c man begin ENVIRONMENT
++The following environment variables are supported:
++
++@table @code
++
++@item @env{GPROFNG_MAX_CALL_STACK_DEPTH}
++set the depth of the call stack (default is 256).
++
++@item @env{GPROFNG_USE_JAVA_OPTIONS}
++may be set when profiling a C/C++ application that uses dlopen() to execute Java code.
++
++@item @env{GPROFNG_SSH_REMOTE_DISPLAY}
++use this variable to define the ssh command executed by the remote display tool.
++
++@item @env{GPROFNG_SKIP_VALIDATION}
++set this variable to disable checking hardware, system, and Java versions.
++
++@item @env{GPROFNG_ALLOW_CORE_DUMP}
++set this variable to allow a core file to be generated; otherwise an error report is created on /tmp.
++
++@item @env{GPROFNG_ARCHIVE}
++use this variable to define the settings for automatic archiving upon experiment recording completion.
++
++@item @env{GPROFNG_ARCHIVE_COMMON_DIR}
++set this variable to the location of the common archive.
++
++@item @env{GPROFNG_JAVA_MAX_CALL_STACK_DEPTH}
++set the depth of the Java call stack; the default is 256; set to 0 to disable capturing of call stacks.
++
++@item @env{GPROFNG_JAVA_NATIVE_MAX_CALL_STACK_DEPTH}
++set the depth of the Java native call stack; the default is 256; set to 0 to disable capturing of call stacks (JNI and assembly call stacks are not captured).
++
++@end table
++
++@c man end
++
++@c man begin SEEALSO
++The man pages for the various gprofng commands are not available yet, but
++the @option{--help} option supported on each of the commands lists the options
++and provides more information.
++
++For example this displays the options supported on the @command{gprofng collect app}
++command:
++
++@smallexample
++$ gprofng collect app --help
++@end smallexample
++
++The user guide is available as an Info entry for @file{gprofng}.
++@c man end
++
++@end ifset
++
++@c man begin DESCRIPTION
++@c man end
++
+ @c -- A new node --------------------------------------------------------------
+ @node Introduction
+ @chapter Introduction
+--- a/gprofng/src/Makefile.am
++++ b/gprofng/src/Makefile.am
+@@ -160,7 +160,7 @@ gp_display_text_LDADD = $(LIBGPROFNG) $(
+
+ if BUILD_MAN
+
+-man_MANS = gprofng.1 \
++man_MANS = \
+ gp-archive.1 \
+ gp-collect-app.1 \
+ gp-display-src.1 \
+@@ -191,10 +191,6 @@ H2M_FILTER = | sed 's/\.TP/\.TP\n.B/' |
+ | sed 's/See also:/\.SH SEE ALSO/' | sed 's/Documentation:/.SH DOCUMENTATION/' \
+ | sed 's/Limitations:/.SH LIMITATIONS/'
+
+-gprofng.1: $(srcdir)/gprofng.cc $(common_mandeps) | ./gprofng$(EXEEXT)
+- $(AM_V_GEN)_BUILDING_MANPAGE=1 $(HELP2MAN) $(HELP2MAN_OPT) \
+- --name=$(TEXT_GPROFNG) ./gprofng$(EXEEXT) $(H2M_FILTER) > $@
+-
+ gp-archive.1: $(srcdir)/gp-archive.cc $(common_mandeps) | ./gp-archive$(EXEEXT)
+ $(AM_V_GEN)_BUILDING_MANPAGE=1 $(HELP2MAN) $(HELP2MAN_OPT) \
+ --name=$(TEXT_GP_ARCHIVE) ./gp-archive$(EXEEXT) $(H2M_FILTER) > $@
+@@ -223,3 +219,5 @@ dist-hook: $(LIBGPROFNG)
+
+ install-data-local: install-pkglibLTLIBRARIES
+ rm -f $(DESTDIR)/$(pkglibdir)/*.la $(DESTDIR)/$(pkglibdir)/*.a
++
++$(srcdir)/DbeSession.cc: QLParser.tab.hh
+--- a/gprofng/src/Makefile.in
++++ b/gprofng/src/Makefile.in
+@@ -572,7 +572,7 @@ gp_display_src_SOURCES = gp-display-src.
+ gp_display_src_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) $(ZLIB)
+ gp_display_text_SOURCES = gp-display-text.cc ipc.cc ipcio.cc
+ gp_display_text_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) $(ZLIB)
+-@BUILD_MAN_TRUE@man_MANS = gprofng.1 \
++@BUILD_MAN_TRUE@man_MANS = \
+ @BUILD_MAN_TRUE@ gp-archive.1 \
+ @BUILD_MAN_TRUE@ gp-collect-app.1 \
+ @BUILD_MAN_TRUE@ gp-display-src.1 \
+@@ -1176,10 +1176,6 @@ uninstall-man: uninstall-man1
+ QLParser.tab.cc QLParser.tab.hh: QLParser.yy
+ $(BISON) $^
+
+-@BUILD_MAN_TRUE@gprofng.1: $(srcdir)/gprofng.cc $(common_mandeps) | ./gprofng$(EXEEXT)
+-@BUILD_MAN_TRUE@ $(AM_V_GEN)_BUILDING_MANPAGE=1 $(HELP2MAN) $(HELP2MAN_OPT) \
+-@BUILD_MAN_TRUE@ --name=$(TEXT_GPROFNG) ./gprofng$(EXEEXT) $(H2M_FILTER) > $@
+-
+ @BUILD_MAN_TRUE@gp-archive.1: $(srcdir)/gp-archive.cc $(common_mandeps) | ./gp-archive$(EXEEXT)
+ @BUILD_MAN_TRUE@ $(AM_V_GEN)_BUILDING_MANPAGE=1 $(HELP2MAN) $(HELP2MAN_OPT) \
+ @BUILD_MAN_TRUE@ --name=$(TEXT_GP_ARCHIVE) ./gp-archive$(EXEEXT) $(H2M_FILTER) > $@
+@@ -1207,6 +1203,8 @@ dist-hook: $(LIBGPROFNG)
+ install-data-local: install-pkglibLTLIBRARIES
+ rm -f $(DESTDIR)/$(pkglibdir)/*.la $(DESTDIR)/$(pkglibdir)/*.a
+
++$(srcdir)/DbeSession.cc: QLParser.tab.hh
++
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+ .NOEXPORT:
diff --git a/toolchain/binutils/patches/2.40/020-gprofng-PR30043-libgprofng.so.-are-installed-to-a-wr.patch b/toolchain/binutils/patches/2.40/020-gprofng-PR30043-libgprofng.so.-are-installed-to-a-wr.patch
new file mode 100644
index 0000000000..d8d76a2961
--- /dev/null
+++ b/toolchain/binutils/patches/2.40/020-gprofng-PR30043-libgprofng.so.-are-installed-to-a-wr.patch
@@ -0,0 +1,212 @@
+From edd36b26f3506eeb259534ba2493e15c728cd280 Mon Sep 17 00:00:00 2001
+From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
+Date: Wed, 25 Jan 2023 19:21:38 -0800
+Subject: [PATCH 20/50] gprofng: PR30043 libgprofng.so.* are installed to a
+ wrong location
+
+gprofng/ChangeLog
+2023-01-25 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
+
+ PR gprofng/30043
+ PR gprofng/28972
+ * src/Makefile.am: Use lib_LTLIBRARIES instead of pkglib_LTLIBRARIES.
+ * src/Makefile.in: Rebuild.
+---
+ gprofng/src/Makefile.am | 7 +---
+ gprofng/src/Makefile.in | 76 +++++++++++++++++++----------------------
+ 2 files changed, 37 insertions(+), 46 deletions(-)
+
+--- a/gprofng/src/Makefile.am
++++ b/gprofng/src/Makefile.am
+@@ -124,7 +124,7 @@ BUILT_SOURCES = QLParser.tab.hh
+ EXTRA_DIST = QLParser.yy $(man_MANS)
+
+
+-pkglib_LTLIBRARIES = $(LIBGPROFNG)
++lib_LTLIBRARIES = $(LIBGPROFNG)
+ libgprofng_la_SOURCES = $(CCSOURCES) $(CSOURCES)
+ libgprofng_la_LDFLAGS = -version-info 0:0:0
+
+@@ -215,9 +215,4 @@ endif
+ # so ensure that the necessary libraries are built at dist time.
+ dist-hook: $(LIBGPROFNG)
+
+-.PHONY: install-data-local
+-
+-install-data-local: install-pkglibLTLIBRARIES
+- rm -f $(DESTDIR)/$(pkglibdir)/*.la $(DESTDIR)/$(pkglibdir)/*.a
+-
+ $(srcdir)/DbeSession.cc: QLParser.tab.hh
+--- a/gprofng/src/Makefile.in
++++ b/gprofng/src/Makefile.in
+@@ -155,9 +155,9 @@ am__uninstall_files_from_dir = { \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+-am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(bindir)" \
++am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(dbedir)"
+-LTLIBRARIES = $(pkglib_LTLIBRARIES)
++LTLIBRARIES = $(lib_LTLIBRARIES)
+ am__DEPENDENCIES_1 =
+ libgprofng_la_DEPENDENCIES = $(top_builddir)/../opcodes/libopcodes.la \
+ $(top_builddir)/../bfd/libbfd.la $(am__DEPENDENCIES_1)
+@@ -548,7 +548,7 @@ AM_CFLAGS = $(GPROFNG_CFLAGS) $(PTHREAD_
+ AM_CXXFLAGS = $(AM_CFLAGS)
+ BUILT_SOURCES = QLParser.tab.hh
+ EXTRA_DIST = QLParser.yy $(man_MANS)
+-pkglib_LTLIBRARIES = $(LIBGPROFNG)
++lib_LTLIBRARIES = $(LIBGPROFNG)
+ libgprofng_la_SOURCES = $(CCSOURCES) $(CSOURCES)
+ libgprofng_la_LDFLAGS = -version-info 0:0:0
+
+@@ -636,33 +636,33 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+ $(am__aclocal_m4_deps):
+
+-install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
++install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+- @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
++ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+- echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \
+- $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \
+- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \
+- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \
++ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
++ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
++ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
++ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+-uninstall-pkglibLTLIBRARIES:
++uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+- @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
++ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \
+- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \
++ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
++ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+-clean-pkglibLTLIBRARIES:
+- -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
+- @list='$(pkglib_LTLIBRARIES)'; \
++clean-libLTLIBRARIES:
++ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
++ @list='$(lib_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+@@ -672,7 +672,7 @@ clean-pkglibLTLIBRARIES:
+ }
+
+ libgprofng.la: $(libgprofng_la_OBJECTS) $(libgprofng_la_DEPENDENCIES) $(EXTRA_libgprofng_la_DEPENDENCIES)
+- $(AM_V_CXXLD)$(libgprofng_la_LINK) -rpath $(pkglibdir) $(libgprofng_la_OBJECTS) $(libgprofng_la_LIBADD) $(LIBS)
++ $(AM_V_CXXLD)$(libgprofng_la_LINK) -rpath $(libdir) $(libgprofng_la_OBJECTS) $(libgprofng_la_LIBADD) $(LIBS)
+ install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+@@ -1039,8 +1039,10 @@ check-am: all-am
+ check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+ all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(DATA)
++install-binPROGRAMS: install-libLTLIBRARIES
++
+ installdirs:
+- for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(dbedir)"; do \
++ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(dbedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+ install: $(BUILT_SOURCES)
+@@ -1078,8 +1080,8 @@ maintainer-clean-generic:
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+ clean: clean-am
+
+-clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+- clean-pkglibLTLIBRARIES mostlyclean-am
++clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
++ clean-libtool mostlyclean-am
+
+ distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+@@ -1099,13 +1101,13 @@ info: info-am
+
+ info-am:
+
+-install-data-am: install-data-local install-dbeDATA install-man
++install-data-am: install-dbeDATA install-man
+
+ install-dvi: install-dvi-am
+
+ install-dvi-am:
+
+-install-exec-am: install-binPROGRAMS install-pkglibLTLIBRARIES
++install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+
+ install-html: install-html-am
+
+@@ -1145,30 +1147,29 @@ ps: ps-am
+
+ ps-am:
+
+-uninstall-am: uninstall-binPROGRAMS uninstall-dbeDATA uninstall-man \
+- uninstall-pkglibLTLIBRARIES
++uninstall-am: uninstall-binPROGRAMS uninstall-dbeDATA \
++ uninstall-libLTLIBRARIES uninstall-man
+
+ uninstall-man: uninstall-man1
+
+ .MAKE: all check install install-am install-strip
+
+ .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+- clean-binPROGRAMS clean-generic clean-libtool \
+- clean-pkglibLTLIBRARIES cscopelist-am ctags ctags-am dist-hook \
+- distclean distclean-compile distclean-generic \
+- distclean-libtool distclean-tags distdir dvi dvi-am html \
+- html-am info info-am install install-am install-binPROGRAMS \
+- install-data install-data-am install-data-local \
+- install-dbeDATA install-dvi install-dvi-am install-exec \
+- install-exec-am install-html install-html-am install-info \
+- install-info-am install-man install-man1 install-pdf \
+- install-pdf-am install-pkglibLTLIBRARIES install-ps \
++ clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
++ clean-libtool cscopelist-am ctags ctags-am dist-hook distclean \
++ distclean-compile distclean-generic distclean-libtool \
++ distclean-tags distdir dvi dvi-am html html-am info info-am \
++ install install-am install-binPROGRAMS install-data \
++ install-data-am install-dbeDATA install-dvi install-dvi-am \
++ install-exec install-exec-am install-html install-html-am \
++ install-info install-info-am install-libLTLIBRARIES \
++ install-man install-man1 install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-dbeDATA \
+- uninstall-man uninstall-man1 uninstall-pkglibLTLIBRARIES
++ uninstall-libLTLIBRARIES uninstall-man uninstall-man1
+
+ .PRECIOUS: Makefile
+
+@@ -1198,11 +1199,6 @@ QLParser.tab.cc QLParser.tab.hh: QLParse
+ # so ensure that the necessary libraries are built at dist time.
+ dist-hook: $(LIBGPROFNG)
+
+-.PHONY: install-data-local
+-
+-install-data-local: install-pkglibLTLIBRARIES
+- rm -f $(DESTDIR)/$(pkglibdir)/*.la $(DESTDIR)/$(pkglibdir)/*.a
+-
+ $(srcdir)/DbeSession.cc: QLParser.tab.hh
+
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/toolchain/binutils/patches/2.40/026-RISC-V-make-C-extension-JAL-available-again-for-32-b.patch b/toolchain/binutils/patches/2.40/026-RISC-V-make-C-extension-JAL-available-again-for-32-b.patch
new file mode 100644
index 0000000000..4129a22906
--- /dev/null
+++ b/toolchain/binutils/patches/2.40/026-RISC-V-make-C-extension-JAL-available-again-for-32-b.patch
@@ -0,0 +1,115 @@
+From 27f59ec47a18277b6ea3548f405263ef558f5217 Mon Sep 17 00:00:00 2001
+From: Jan Beulich <jbeulich@suse.com>
+Date: Tue, 31 Jan 2023 09:47:22 +0100
+Subject: [PATCH 26/50] RISC-V: make C-extension JAL available again for
+ (32-bit) assembly
+
+Along with the normal JAL alias, the C-extension one should have been
+moved as well by 839189bc932e ("RISC-V: re-arrange opcode table for
+consistent alias handling"), for the assembler to actually be able to
+use it where/when possible.
+
+Since neither this nor any other compressed branch insn was being tested
+so far, take the opportunity and introduce a new testcase covering those.
+---
+ gas/config/tc-riscv.c | 3 +++
+ gas/testsuite/gas/riscv/c-branch-na.d | 20 ++++++++++++++++++++
+ gas/testsuite/gas/riscv/c-branch.d | 19 +++++++++++++++++++
+ gas/testsuite/gas/riscv/c-branch.s | 11 +++++++++++
+ opcodes/riscv-opc.c | 2 +-
+ 5 files changed, 54 insertions(+), 1 deletion(-)
+ create mode 100644 gas/testsuite/gas/riscv/c-branch-na.d
+ create mode 100644 gas/testsuite/gas/riscv/c-branch.d
+ create mode 100644 gas/testsuite/gas/riscv/c-branch.s
+
+--- a/gas/config/tc-riscv.c
++++ b/gas/config/tc-riscv.c
+@@ -2762,6 +2762,8 @@ riscv_ip (char *str, struct riscv_cl_ins
+ case 'p':
+ goto branch;
+ case 'a':
++ if (oparg == insn->args + 1)
++ goto jump_check_gpr;
+ goto jump;
+ case 'S': /* Floating-point RS1 x8-x15. */
+ if (!reg_lookup (&asarg, RCLASS_FPR, &regno)
+@@ -3271,6 +3273,7 @@ riscv_ip (char *str, struct riscv_cl_ins
+ but the 2nd (with 2 operands) might. */
+ if (oparg == insn->args)
+ {
++ jump_check_gpr:
+ asargStart = asarg;
+ if (reg_lookup (&asarg, RCLASS_GPR, NULL)
+ && (*asarg == ',' || (ISSPACE (*asarg) && asarg[1] == ',')))
+--- /dev/null
++++ b/gas/testsuite/gas/riscv/c-branch-na.d
+@@ -0,0 +1,20 @@
++#as: -march=rv32ic
++#source: c-branch.s
++#objdump: -drw -Mno-aliases
++
++.*:[ ]+file format .*
++
++
++Disassembly of section .text:
++
++0+ <target>:
++[ ]+[0-9a-f]+:[ ]+c001[ ]+c\.beqz[ ]+s0,0 <target>[ ]+0: R_RISCV_RVC_BRANCH .*
++[ ]+[0-9a-f]+:[ ]+dcfd[ ]+c\.beqz[ ]+s1,0 <target>[ ]+2: R_RISCV_RVC_BRANCH .*
++[ ]+[0-9a-f]+:[ ]+fc75[ ]+c\.bnez[ ]+s0,0 <target>[ ]+4: R_RISCV_RVC_BRANCH .*
++[ ]+[0-9a-f]+:[ ]+fced[ ]+c\.bnez[ ]+s1,0 <target>[ ]+6: R_RISCV_RVC_BRANCH .*
++[ ]+[0-9a-f]+:[ ]+bfe5[ ]+c\.j[ ]+0 <target>[ ]+8: R_RISCV_RVC_JUMP .*
++[ ]+[0-9a-f]+:[ ]+3fdd[ ]+c\.jal[ ]+0 <target>[ ]+a: R_RISCV_RVC_JUMP .*
++[ ]+[0-9a-f]+:[ ]+9302[ ]+c\.jalr[ ]+t1
++[ ]+[0-9a-f]+:[ ]+8382[ ]+c\.jr[ ]+t2
++[ ]+[0-9a-f]+:[ ]+8082[ ]+c\.jr[ ]+ra
++#...
+--- /dev/null
++++ b/gas/testsuite/gas/riscv/c-branch.d
+@@ -0,0 +1,19 @@
++#as: -march=rv64ic
++#objdump: -drw
++
++.*:[ ]+file format .*
++
++
++Disassembly of section .text:
++
++0+ <target>:
++[ ]+[0-9a-f]+:[ ]+c001[ ]+beqz[ ]+s0,0 <target>[ ]+0: R_RISCV_RVC_BRANCH .*
++[ ]+[0-9a-f]+:[ ]+dcfd[ ]+beqz[ ]+s1,0 <target>[ ]+2: R_RISCV_RVC_BRANCH .*
++[ ]+[0-9a-f]+:[ ]+fc75[ ]+bnez[ ]+s0,0 <target>[ ]+4: R_RISCV_RVC_BRANCH .*
++[ ]+[0-9a-f]+:[ ]+fced[ ]+bnez[ ]+s1,0 <target>[ ]+6: R_RISCV_RVC_BRANCH .*
++[ ]+[0-9a-f]+:[ ]+bfe5[ ]+j[ ]+0 <target>[ ]+8: R_RISCV_RVC_JUMP .*
++[ ]+[0-9a-f]+:[ ]+ff7ff0ef[ ]+jal[ ]+0 <target>[ ]+a: R_RISCV_JAL .*
++[ ]+[0-9a-f]+:[ ]+9302[ ]+jalr[ ]+t1
++[ ]+[0-9a-f]+:[ ]+8382[ ]+jr[ ]+t2
++[ ]+[0-9a-f]+:[ ]+8082[ ]+ret
++#...
+--- /dev/null
++++ b/gas/testsuite/gas/riscv/c-branch.s
+@@ -0,0 +1,11 @@
++ .text
++target:
++ beq x8, x0, target
++ beqz x9, target
++ bne x8, x0, target
++ bnez x9, target
++ j target
++ jal target
++ jalr x6
++ jr x7
++ ret
+--- a/opcodes/riscv-opc.c
++++ b/opcodes/riscv-opc.c
+@@ -340,9 +340,9 @@ const struct riscv_opcode riscv_opcodes[
+ {"jalr", 0, INSN_CLASS_I, "d,s,j", MATCH_JALR, MASK_JALR, match_opcode, INSN_JSR },
+ {"j", 0, INSN_CLASS_C, "Ca", MATCH_C_J, MASK_C_J, match_opcode, INSN_ALIAS|INSN_BRANCH },
+ {"j", 0, INSN_CLASS_I, "a", MATCH_JAL, MASK_JAL|MASK_RD, match_opcode, INSN_ALIAS|INSN_BRANCH },
++{"jal", 32, INSN_CLASS_C, "Ca", MATCH_C_JAL, MASK_C_JAL, match_opcode, INSN_ALIAS|INSN_JSR },
+ {"jal", 0, INSN_CLASS_I, "a", MATCH_JAL|(X_RA << OP_SH_RD), MASK_JAL|MASK_RD, match_opcode, INSN_ALIAS|INSN_JSR },
+ {"jal", 0, INSN_CLASS_I, "d,a", MATCH_JAL, MASK_JAL, match_opcode, INSN_JSR },
+-{"jal", 32, INSN_CLASS_C, "Ca", MATCH_C_JAL, MASK_C_JAL, match_opcode, INSN_ALIAS|INSN_JSR },
+ {"call", 0, INSN_CLASS_I, "d,c", (X_T1 << OP_SH_RS1), (int) M_CALL, match_never, INSN_MACRO },
+ {"call", 0, INSN_CLASS_I, "c", (X_RA << OP_SH_RS1)|(X_RA << OP_SH_RD), (int) M_CALL, match_never, INSN_MACRO },
+ {"tail", 0, INSN_CLASS_I, "c", (X_T1 << OP_SH_RS1), (int) M_CALL, match_never, INSN_MACRO },
diff --git a/toolchain/binutils/patches/2.40/034-bpf-fix-error-conversion-from-long-unsigned-int-to-u.patch b/toolchain/binutils/patches/2.40/034-bpf-fix-error-conversion-from-long-unsigned-int-to-u.patch
new file mode 100644
index 0000000000..d4317cdb0f
--- /dev/null
+++ b/toolchain/binutils/patches/2.40/034-bpf-fix-error-conversion-from-long-unsigned-int-to-u.patch
@@ -0,0 +1,209 @@
+From 3e888977f165594cf44dbe8f67e3a4960b22c11f Mon Sep 17 00:00:00 2001
+From: "Guillermo E. Martinez" <guillermo.e.martinez@oracle.com>
+Date: Fri, 3 Feb 2023 11:17:49 -0600
+Subject: [PATCH 34/50] bpf: fix error conversion from long unsigned int to
+ unsigned int [-Werror=overflow]
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Regenerating BPF target using the maintainer mode emits:
+.../opcodes/bpf-opc.c:57:11: error: conversion from ‘long unsigned int’ to ‘unsigned int’ changes value from ‘18446744073709486335’ to ‘4294902015’ [-Werror=overflow]
+ 57 | 64, 64, 0xffffffffffff00ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+
+The use of a narrow size to handle the mask CGEN in instruction format
+is causing this error. Additionally eBPF `call' instructions
+constructed by expressions using symbols (BPF_PSEUDO_CALL) emits
+annotations in `src' field of the instruction, used to identify BPF
+target endianness.
+
+cpu/
+ * bpf.cpu (define-call-insn): Remove `src' field from
+ instruction mask.
+
+include/
+ *opcode/cge.h (CGEN_IFMT): Adjust mask bit width.
+
+opcodes/
+ * bpf-opc.c: Regenerate.
+
+(cherry picked from commit 7f6ebecd56e690012b05af0a492280765b17f186)
+---
+ cpu/bpf.cpu | 2 +-
+ include/opcode/cgen.h | 2 +-
+ opcodes/bpf-opc.c | 54 +++++++++++++++++++++++--------------------
+ opcodes/cgen-dis.c | 2 +-
+ 4 files changed, 32 insertions(+), 28 deletions(-)
+
+--- a/cpu/bpf.cpu
++++ b/cpu/bpf.cpu
+@@ -768,7 +768,7 @@
+ "call"
+ (endian-isas x-endian)
+ "call $disp32"
+- (+ disp32 (f-offset16 0) (f-regs 0)
++ (+ disp32 (f-offset16 0) (.sym src x-endian) ((.sym f-dst x-endian) 0)
+ OP_CLASS_JMP OP_SRC_K OP_CODE_CALL)
+ (c-call VOID
+ "bpfbf_call" disp32 (ifield (.sym f-src x-endian)))
+--- a/include/opcode/cgen.h
++++ b/include/opcode/cgen.h
+@@ -914,7 +914,7 @@ typedef struct
+ Each insn's value is stored with the insn.
+ The first step in recognizing an insn for disassembly is
+ (opcode & mask) == value. */
+- CGEN_INSN_INT mask;
++ CGEN_INSN_LGUINT mask;
+ #define CGEN_IFMT_MASK(ifmt) ((ifmt)->mask)
+
+ /* Instruction fields.
+--- a/opcodes/bpf-opc.c
++++ b/opcodes/bpf-opc.c
+@@ -50,99 +50,103 @@ static const CGEN_IFMT ifmt_empty ATTRIB
+ };
+
+ static const CGEN_IFMT ifmt_addile ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xfffff0ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_addrle ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffffffffffff00ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_negle ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xfffffffffffff0ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_addibe ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffff0fff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_addrbe ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffffffffffff00ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_negbe ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffffffffffff0fff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_endlele ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xfffff0ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_endlebe ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffff0fff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_lddwle ATTRIBUTE_UNUSED = {
+- 64, 128, 0xff, { { F (F_IMM64) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_DSTLE) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 128, 0xfffff0ff, { { F (F_IMM64) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_DSTLE) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_lddwbe ATTRIBUTE_UNUSED = {
+- 64, 128, 0xff, { { F (F_IMM64) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_SRCBE) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 128, 0xffff0fff, { { F (F_IMM64) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_SRCBE) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_ldabsw ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_REGS) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffffffff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_REGS) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_ldindwle ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_DSTLE) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffff0fff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_DSTLE) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_ldindwbe ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_SRCBE) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xfffff0ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_SRCBE) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_ldxwle ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_DSTLE) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffffffff000000ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_DSTLE) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_ldxwbe ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_SRCBE) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffffffff000000ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_SRCBE) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_stble ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_DSTLE) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xf0ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_DSTLE) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_stbbe ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_SRCBE) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xfff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_MODE) }, { F (F_OP_SIZE) }, { F (F_SRCBE) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_jeqile ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xf0ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_jeqrle ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffffffff000000ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_jeqibe ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xfff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_jeqrbe ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffffffff000000ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_callle ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_REGS) }, { F (F_OP_CODE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffff0fff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++};
++
++static const CGEN_IFMT ifmt_callbe ATTRIBUTE_UNUSED = {
++ 64, 64, 0xfffff0ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_ja ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_REGS) }, { F (F_OP_CODE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffffffff0000ffff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_REGS) }, { F (F_OP_CODE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ static const CGEN_IFMT ifmt_exit ATTRIBUTE_UNUSED = {
+- 64, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_REGS) }, { F (F_OP_CODE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
++ 64, 64, 0xffffffffffffffff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_REGS) }, { F (F_OP_CODE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
+ };
+
+ #undef F
+@@ -1646,7 +1650,7 @@ static const CGEN_OPCODE bpf_cgen_insn_o
+ {
+ { 0, 0, 0, 0 },
+ { { MNEM, ' ', OP (DISP32), 0 } },
+- & ifmt_callle, { 0x85 }
++ & ifmt_callbe, { 0x85 }
+ },
+ /* call $dstle */
+ {
+--- a/opcodes/cgen-dis.c
++++ b/opcodes/cgen-dis.c
+@@ -39,7 +39,7 @@ static void add_insn_to_hash_chain (CG
+ static int
+ count_decodable_bits (const CGEN_INSN *insn)
+ {
+- unsigned mask = CGEN_INSN_BASE_MASK (insn);
++ CGEN_INSN_LGUINT mask = CGEN_INSN_BASE_MASK (insn);
+ #if GCC_VERSION >= 3004
+ return __builtin_popcount (mask);
+ #else
diff --git a/toolchain/binutils/patches/2.40/035-Pass-JANSSON_LIBS-and-ZSTD_LIBS-to-ld-bootstrap-boot.patch b/toolchain/binutils/patches/2.40/035-Pass-JANSSON_LIBS-and-ZSTD_LIBS-to-ld-bootstrap-boot.patch
new file mode 100644
index 0000000000..3741c08a0c
--- /dev/null
+++ b/toolchain/binutils/patches/2.40/035-Pass-JANSSON_LIBS-and-ZSTD_LIBS-to-ld-bootstrap-boot.patch
@@ -0,0 +1,50 @@
+From e1815414077347097e5bf0d75162add955e241d9 Mon Sep 17 00:00:00 2001
+From: Romain Geissler <romain.geissler@amadeus.com>
+Date: Sun, 5 Feb 2023 13:56:34 +0000
+Subject: [PATCH 35/50] Pass $JANSSON_LIBS and $ZSTD_LIBS to
+ ld-bootstrap/bootrap.exp
+
+---
+ ld/Makefile.am | 1 +
+ ld/Makefile.in | 1 +
+ ld/testsuite/ld-bootstrap/bootstrap.exp | 4 ++--
+ 3 files changed, 4 insertions(+), 2 deletions(-)
+
+--- a/ld/Makefile.am
++++ b/ld/Makefile.am
+@@ -992,6 +992,7 @@ check-DEJAGNU: site.exp
+ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+ OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" CTFLIB="$(TESTCTFLIB) $(ZLIB)" \
+ SFRAMELIB="$(TESTSFRAMELIB)" \
++ JANSSON_LIBS="$(JANSSON_LIBS)" ZSTD_LIBS="$(ZSTD_LIBS)" \
+ LIBIBERTY="$(LIBIBERTY) $(LIBINTL)" LIBS="$(LIBS)" \
+ DO_COMPARE="`echo '$(do_compare)' | sed -e 's,\\$$,,g'`" \
+ $(RUNTESTFLAGS); \
+--- a/ld/Makefile.in
++++ b/ld/Makefile.in
+@@ -2645,6 +2645,7 @@ check-DEJAGNU: site.exp
+ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
+ OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" CTFLIB="$(TESTCTFLIB) $(ZLIB)" \
+ SFRAMELIB="$(TESTSFRAMELIB)" \
++ JANSSON_LIBS="$(JANSSON_LIBS)" ZSTD_LIBS="$(ZSTD_LIBS)" \
+ LIBIBERTY="$(LIBIBERTY) $(LIBINTL)" LIBS="$(LIBS)" \
+ DO_COMPARE="`echo '$(do_compare)' | sed -e 's,\\$$,,g'`" \
+ $(RUNTESTFLAGS); \
+--- a/ld/testsuite/ld-bootstrap/bootstrap.exp
++++ b/ld/testsuite/ld-bootstrap/bootstrap.exp
+@@ -162,13 +162,13 @@ foreach flags $test_flags {
+ }
+
+ if { [lindex [remote_exec build grep "-q \"HAVE_ZSTD 1\" config.h" ] 0] == 0 } then {
+- set extralibs "$extralibs -lzstd"
++ set extralibs "$extralibs $ZSTD_LIBS"
+ }
+
+ # Check if the system's jansson library is used. If so, the object files will
+ # be using symbols from it, so link to it.
+ if { [lindex [remote_exec build grep "-q \"HAVE_JANSSON 1\" config.h" ] 0] == 0 } then {
+- set extralibs "$extralibs -ljansson"
++ set extralibs "$extralibs $JANSSON_LIBS"
+ }
+
+ # Plugin support requires linking with libdl.
diff --git a/toolchain/binutils/patches/2.40/036-Regen-config-files.patch b/toolchain/binutils/patches/2.40/036-Regen-config-files.patch
new file mode 100644
index 0000000000..1c80dde310
--- /dev/null
+++ b/toolchain/binutils/patches/2.40/036-Regen-config-files.patch
@@ -0,0 +1,714 @@
+From 1fc096a4c590f28e0efb1823cdca653f2db9de74 Mon Sep 17 00:00:00 2001
+From: Alan Modra <amodra@gmail.com>
+Date: Mon, 6 Feb 2023 10:48:59 +1030
+Subject: [PATCH 36/50] Regen config files
+
+For the version update to 2.40.0
+---
+ bfd/configure | 20 ++++++++++----------
+ binutils/configure | 20 ++++++++++----------
+ gas/configure | 20 ++++++++++----------
+ gprof/configure | 20 ++++++++++----------
+ gprofng/configure | 20 ++++++++++----------
+ gprofng/doc/version.texi | 8 ++++----
+ gprofng/libcollector/configure | 20 ++++++++++----------
+ intl/configure | 3 +++
+ ld/configure | 20 ++++++++++----------
+ opcodes/configure | 20 ++++++++++----------
+ 10 files changed, 87 insertions(+), 84 deletions(-)
+
+--- 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.40.
++# Generated by GNU Autoconf 2.69 for bfd 2.40.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.40'
+-PACKAGE_STRING='bfd 2.40'
++PACKAGE_VERSION='2.40.0'
++PACKAGE_STRING='bfd 2.40.0'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1400,7 +1400,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.40 to adapt to many kinds of systems.
++\`configure' configures bfd 2.40.0 to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1471,7 +1471,7 @@ fi
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of bfd 2.40:";;
++ short | recursive ) echo "Configuration of bfd 2.40.0:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1608,7 +1608,7 @@ fi
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-bfd configure 2.40
++bfd configure 2.40.0
+ generated by GNU Autoconf 2.69
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+@@ -2202,7 +2202,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.40, which was
++It was created by bfd $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+@@ -3184,7 +3184,7 @@ fi
+
+ # Define the identity of the package.
+ PACKAGE='bfd'
+- VERSION='2.40'
++ VERSION='2.40.0'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -15906,7 +15906,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
+ # 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.40, which was
++This file was extended by bfd $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -15972,7 +15972,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.40
++bfd config.status 2.40.0
+ configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+--- 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.40.
++# Generated by GNU Autoconf 2.69 for binutils 2.40.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.40'
+-PACKAGE_STRING='binutils 2.40'
++PACKAGE_VERSION='2.40.0'
++PACKAGE_STRING='binutils 2.40.0'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1401,7 +1401,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.40 to adapt to many kinds of systems.
++\`configure' configures binutils 2.40.0 to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1472,7 +1472,7 @@ fi
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of binutils 2.40:";;
++ short | recursive ) echo "Configuration of binutils 2.40.0:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1631,7 +1631,7 @@ fi
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-binutils configure 2.40
++binutils configure 2.40.0
+ generated by GNU Autoconf 2.69
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+@@ -2099,7 +2099,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.40, which was
++It was created by binutils $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+@@ -3081,7 +3081,7 @@ fi
+
+ # Define the identity of the package.
+ PACKAGE='binutils'
+- VERSION='2.40'
++ VERSION='2.40.0'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -15326,7 +15326,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
+ # 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.40, which was
++This file was extended by binutils $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -15392,7 +15392,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.40
++binutils config.status 2.40.0
+ configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+--- 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.40.
++# Generated by GNU Autoconf 2.69 for gas 2.40.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.40'
+-PACKAGE_STRING='gas 2.40'
++PACKAGE_VERSION='2.40.0'
++PACKAGE_STRING='gas 2.40.0'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1381,7 +1381,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.40 to adapt to many kinds of systems.
++\`configure' configures gas 2.40.0 to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1452,7 +1452,7 @@ fi
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of gas 2.40:";;
++ short | recursive ) echo "Configuration of gas 2.40.0:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1600,7 +1600,7 @@ fi
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-gas configure 2.40
++gas configure 2.40.0
+ generated by GNU Autoconf 2.69
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+@@ -2011,7 +2011,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.40, which was
++It was created by gas $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+@@ -2990,7 +2990,7 @@ fi
+
+ # Define the identity of the package.
+ PACKAGE='gas'
+- VERSION='2.40'
++ VERSION='2.40.0'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -14910,7 +14910,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
+ # 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.40, which was
++This file was extended by gas $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -14976,7 +14976,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.40
++gas config.status 2.40.0
+ configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+--- 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.40.
++# Generated by GNU Autoconf 2.69 for gprof 2.40.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.40'
+-PACKAGE_STRING='gprof 2.40'
++PACKAGE_VERSION='2.40.0'
++PACKAGE_STRING='gprof 2.40.0'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1338,7 +1338,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.40 to adapt to many kinds of systems.
++\`configure' configures gprof 2.40.0 to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1409,7 +1409,7 @@ fi
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of gprof 2.40:";;
++ short | recursive ) echo "Configuration of gprof 2.40.0:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1520,7 +1520,7 @@ fi
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-gprof configure 2.40
++gprof configure 2.40.0
+ generated by GNU Autoconf 2.69
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+@@ -1885,7 +1885,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.40, which was
++It was created by gprof $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+@@ -2864,7 +2864,7 @@ fi
+
+ # Define the identity of the package.
+ PACKAGE='gprof'
+- VERSION='2.40'
++ VERSION='2.40.0'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -12572,7 +12572,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
+ # 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.40, which was
++This file was extended by gprof $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -12638,7 +12638,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.40
++gprof config.status 2.40.0
+ configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+--- a/gprofng/configure
++++ b/gprofng/configure
+@@ -1,6 +1,6 @@
+ #! /bin/sh
+ # Guess values for system-dependent variables and create Makefiles.
+-# Generated by GNU Autoconf 2.69 for gprofng 2.40.
++# Generated by GNU Autoconf 2.69 for gprofng 2.40.0.
+ #
+ #
+ # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+@@ -587,8 +587,8 @@ MAKEFLAGS=
+ # Identity of this package.
+ PACKAGE_NAME='gprofng'
+ PACKAGE_TARNAME='gprofng'
+-PACKAGE_VERSION='2.40'
+-PACKAGE_STRING='gprofng 2.40'
++PACKAGE_VERSION='2.40.0'
++PACKAGE_STRING='gprofng 2.40.0'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1364,7 +1364,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 gprofng 2.40 to adapt to many kinds of systems.
++\`configure' configures gprofng 2.40.0 to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1435,7 +1435,7 @@ fi
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of gprofng 2.40:";;
++ short | recursive ) echo "Configuration of gprofng 2.40.0:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1549,7 +1549,7 @@ fi
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-gprofng configure 2.40
++gprofng configure 2.40.0
+ generated by GNU Autoconf 2.69
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+@@ -2081,7 +2081,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 gprofng $as_me 2.40, which was
++It was created by gprofng $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+@@ -3054,7 +3054,7 @@ fi
+
+ # Define the identity of the package.
+ PACKAGE='gprofng'
+- VERSION='2.40'
++ VERSION='2.40.0'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -17528,7 +17528,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
+ # report actual input values of CONFIG_FILES etc. instead of their
+ # values after options handling.
+ ac_log="
+-This file was extended by gprofng $as_me 2.40, which was
++This file was extended by gprofng $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -17594,7 +17594,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="\\
+-gprofng config.status 2.40
++gprofng config.status 2.40.0
+ configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+--- a/gprofng/doc/version.texi
++++ b/gprofng/doc/version.texi
+@@ -1,4 +1,4 @@
+-@set UPDATED 5 January 2023
+-@set UPDATED-MONTH January 2023
+-@set EDITION 2.40
+-@set VERSION 2.40
++@set UPDATED 1 February 2023
++@set UPDATED-MONTH February 2023
++@set EDITION 2.40.0
++@set VERSION 2.40.0
+--- a/gprofng/libcollector/configure
++++ b/gprofng/libcollector/configure
+@@ -1,6 +1,6 @@
+ #! /bin/sh
+ # Guess values for system-dependent variables and create Makefiles.
+-# Generated by GNU Autoconf 2.69 for gprofng 2.40.
++# Generated by GNU Autoconf 2.69 for gprofng 2.40.0.
+ #
+ #
+ # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+@@ -587,8 +587,8 @@ MAKEFLAGS=
+ # Identity of this package.
+ PACKAGE_NAME='gprofng'
+ PACKAGE_TARNAME='gprofng'
+-PACKAGE_VERSION='2.40'
+-PACKAGE_STRING='gprofng 2.40'
++PACKAGE_VERSION='2.40.0'
++PACKAGE_STRING='gprofng 2.40.0'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1325,7 +1325,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 gprofng 2.40 to adapt to many kinds of systems.
++\`configure' configures gprofng 2.40.0 to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1396,7 +1396,7 @@ fi
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of gprofng 2.40:";;
++ short | recursive ) echo "Configuration of gprofng 2.40.0:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1505,7 +1505,7 @@ fi
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-gprofng configure 2.40
++gprofng configure 2.40.0
+ generated by GNU Autoconf 2.69
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+@@ -1991,7 +1991,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 gprofng $as_me 2.40, which was
++It was created by gprofng $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+@@ -2968,7 +2968,7 @@ fi
+
+ # Define the identity of the package.
+ PACKAGE='gprofng'
+- VERSION='2.40'
++ VERSION='2.40.0'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -16098,7 +16098,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
+ # report actual input values of CONFIG_FILES etc. instead of their
+ # values after options handling.
+ ac_log="
+-This file was extended by gprofng $as_me 2.40, which was
++This file was extended by gprofng $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -16164,7 +16164,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="\\
+-gprofng config.status 2.40
++gprofng config.status 2.40.0
+ configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+--- a/intl/configure
++++ b/intl/configure
+@@ -6857,6 +6857,9 @@ case "${host}" in
+ # sets the default TLS model and affects inlining.
+ PICFLAG=-fPIC
+ ;;
++ loongarch*-*-*)
++ PICFLAG=-fpic
++ ;;
+ mips-sgi-irix6*)
+ # PIC is the default.
+ ;;
+--- 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.40.
++# Generated by GNU Autoconf 2.69 for ld 2.40.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.40'
+-PACKAGE_STRING='ld 2.40'
++PACKAGE_VERSION='2.40.0'
++PACKAGE_STRING='ld 2.40.0'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1423,7 +1423,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.40 to adapt to many kinds of systems.
++\`configure' configures ld 2.40.0 to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1494,7 +1494,7 @@ fi
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of ld 2.40:";;
++ short | recursive ) echo "Configuration of ld 2.40.0:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1661,7 +1661,7 @@ fi
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-ld configure 2.40
++ld configure 2.40.0
+ generated by GNU Autoconf 2.69
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+@@ -2376,7 +2376,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.40, which was
++It was created by ld $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+@@ -3359,7 +3359,7 @@ fi
+
+ # Define the identity of the package.
+ PACKAGE='ld'
+- VERSION='2.40'
++ VERSION='2.40.0'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -18083,7 +18083,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
+ # 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.40, which was
++This file was extended by ld $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -18149,7 +18149,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.40
++ld config.status 2.40.0
+ configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+--- 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.40.
++# Generated by GNU Autoconf 2.69 for opcodes 2.40.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.40'
+-PACKAGE_STRING='opcodes 2.40'
++PACKAGE_VERSION='2.40.0'
++PACKAGE_STRING='opcodes 2.40.0'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1360,7 +1360,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.40 to adapt to many kinds of systems.
++\`configure' configures opcodes 2.40.0 to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1431,7 +1431,7 @@ fi
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of opcodes 2.40:";;
++ short | recursive ) echo "Configuration of opcodes 2.40.0:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1545,7 +1545,7 @@ fi
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-opcodes configure 2.40
++opcodes configure 2.40.0
+ generated by GNU Autoconf 2.69
+
+ Copyright (C) 2012 Free Software Foundation, Inc.
+@@ -2139,7 +2139,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.40, which was
++It was created by opcodes $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+@@ -3118,7 +3118,7 @@ fi
+
+ # Define the identity of the package.
+ PACKAGE='opcodes'
+- VERSION='2.40'
++ VERSION='2.40.0'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -13191,7 +13191,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
+ # 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.40, which was
++This file was extended by opcodes $as_me 2.40.0, which was
+ generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -13257,7 +13257,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.40
++opcodes config.status 2.40.0
+ configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
diff --git a/toolchain/binutils/patches/2.40/040-configure-remove-dependencies-on-gmp-and-mpfr-when-g.patch b/toolchain/binutils/patches/2.40/040-configure-remove-dependencies-on-gmp-and-mpfr-when-g.patch
new file mode 100644
index 0000000000..261acb549e
--- /dev/null
+++ b/toolchain/binutils/patches/2.40/040-configure-remove-dependencies-on-gmp-and-mpfr-when-g.patch
@@ -0,0 +1,51 @@
+From 17294931e3e361bee6810b1a39493e214b38c5e5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= <chigot@adacore.com>
+Date: Tue, 3 Jan 2023 14:24:43 +0100
+Subject: [PATCH 40/50] configure: remove dependencies on gmp and mpfr when gdb
+ is disabled
+
+Since 991180627851801f1999d1ebbc0e569a17e47c74, the configure checks
+about GMP and MPFR for gdb builds have been moved to the toplevel
+configure.
+However, it doesn't take into account the --disable-gdb option. Meaning
+that a build without gdb will require these libraries even if not
+needed.
+
+ChangeLog:
+
+ * configure.ac: Skip GMP and MPFR when --disable-gdb is
+ provided.
+ * configure: Regenerate.
+
+(cherry picked from commit 5fb0e308577143ceb313fde5538dc9ecb038f29f)
+---
+ configure | 4 +++-
+ configure.ac | 4 +++-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+--- a/configure
++++ b/configure
+@@ -8032,7 +8032,9 @@ if test -d ${srcdir}/gcc ; then
+ require_mpc=yes
+ fi
+ if test -d ${srcdir}/gdb ; then
+- require_gmp=yes
++ if test "x$enable_gdb" != xno; then
++ require_gmp=yes
++ fi
+ fi
+
+ gmplibs="-lmpfr -lgmp"
+--- a/configure.ac
++++ b/configure.ac
+@@ -1585,7 +1585,9 @@ if test -d ${srcdir}/gcc ; then
+ require_mpc=yes
+ fi
+ if test -d ${srcdir}/gdb ; then
+- require_gmp=yes
++ if test "x$enable_gdb" != xno; then
++ require_gmp=yes
++ fi
+ fi
+
+ gmplibs="-lmpfr -lgmp"
diff --git a/toolchain/binutils/patches/2.40/046-gas-correct-symbol-name-comparison-in-.startof.-.siz.patch b/toolchain/binutils/patches/2.40/046-gas-correct-symbol-name-comparison-in-.startof.-.siz.patch
new file mode 100644
index 0000000000..4e31bb43ed
--- /dev/null
+++ b/toolchain/binutils/patches/2.40/046-gas-correct-symbol-name-comparison-in-.startof.-.siz.patch
@@ -0,0 +1,46 @@
+From b2bc62b7b4e7638c3a249d2d2728ceb4d5f2b22c Mon Sep 17 00:00:00 2001
+From: Jan Beulich <jbeulich@suse.com>
+Date: Tue, 14 Feb 2023 08:35:02 +0100
+Subject: [PATCH 46/50] gas: correct symbol name comparison in
+ .startof./.sizeof. handling
+
+In 162c6aef1f3a ("gas: fold symbol table entries generated for
+.startof.() / .sizeof.()") I screwed up quite badly, inverting the case
+sensitive and case insensitive comparison functions.
+---
+ gas/expr.c | 4 ++--
+ gas/testsuite/gas/elf/startof.d | 2 ++
+ gas/testsuite/gas/elf/startof.s | 3 +++
+ 3 files changed, 7 insertions(+), 2 deletions(-)
+
+--- a/gas/expr.c
++++ b/gas/expr.c
+@@ -149,8 +149,8 @@ symbol_lookup_or_make (const char *name,
+
+ name = S_GET_NAME (symbolP);
+ if ((symbols_case_sensitive
+- ? strcasecmp (buf, name)
+- : strcmp (buf, name)) == 0)
++ ? strcmp (buf, name)
++ : strcasecmp (buf, name)) == 0)
+ {
+ free (buf);
+ return symbolP;
+--- a/gas/testsuite/gas/elf/startof.d
++++ b/gas/testsuite/gas/elf/startof.d
+@@ -7,4 +7,6 @@ Symbol table .*
+ #...
+ [1-8]: 0+ .* UND \.startof\.\.text
+ [2-9]: 0+ .* UND \.sizeof\.\.text
++ +[1-9][0-9]*: 0+ .* UND \.startof\.\.Text
++ +[1-9][0-9]*: 0+ .* UND \.sizeof\.\.TEXT
+ #pass
+--- a/gas/testsuite/gas/elf/startof.s
++++ b/gas/testsuite/gas/elf/startof.s
+@@ -4,3 +4,6 @@
+ .dc.a 0
+ .dc.a .sizeof.(.text)
+ .dc.a .startof.(.text)
++ .dc.a 0
++ .dc.a .startof.(.Text)
++ .dc.a .sizeof.(.TEXT)