From 340e5d502a2846266e153304c294c0216e523cf6 Mon Sep 17 00:00:00 2001 From: James Antill Date: Mon, 27 Feb 2023 13:04:10 -0500 Subject: [PATCH] Import rpm: c8s --- .gitignore | 4 + binutils-2.19.50.0.1-output-format.sed | 38 + binutils-2.20.51.0.2-libtool-lib64.patch | 236 + binutils-2.22.52.0.4-no-config-h-check.patch | 28 + binutils-2.25-set-long-long.patch | 38 + binutils-2.25-version.patch | 44 + binutils-2.27-aarch64-ifunc.patch | 11 + binutils-2.28-ignore-gold-duplicates.patch | 14 + ...tils-2.29-filename-in-error-messages.patch | 123 + binutils-2.29-revert-PLT-elision.patch | 265 + binutils-CVE-2019-1010204.patch | 15 + binutils-CVE-2021-20197.patch | 778 ++ binutils-PELC-licence-corrections.patch | 9 + binutils-PPC-dcbt.patch | 144 + binutils-aarch64-ld-testsuite-fixes.patch | 200 + binutils-aarch64-plt-sh_entsize.patch | 27 + binutils-add-sym-cache-to-elf-link-hash.patch | 1981 +++++ binutils-attach-to-group.patch | 66 + binutils-config.patch | 44 + ...ls-do-not-link-with-static-libstdc++.patch | 83 + binutils-elf-add-objects.patch | 36 + binutils-export-demangle.h.patch | 33 + binutils-fix-ld-failures.patch | 269 + binutils-fix-testsuite-failures.patch | 330 + binutils-gas-dwarf-level-4.patch | 11 + binutils-gas-speedups.patch | 7750 +++++++++++++++++ binutils-gcc-10-fixes.patch | 170 + binutils-gold-8-byte-note-segments.patch | 99 + binutils-gold-mismatched-section-flags.patch | 36 + binutils-i686-ld-testsuite-fixes.patch | 29 + binutils-ignore-duplicate-FDE-entries.patch | 24 + ...ils-no-builder-comment-in-bfd-stdint.patch | 19 + binutils-ppc-hash-insert.patch | 107 + binutils-ppc-ld-testsuite-fixes.patch | 101 + binutils-readelf-other-sym-info.patch | 35 + binutils-s390-build.patch | 772 ++ binutils-s390-ld-testsuite-fixes.patch | 120 + binutils-secondary-relocs-speed.patch | 62 + binutils-special-sections-in-groups.patch | 27 + binutils-warnings.patch | 158 + binutils.spec | 3393 ++++++++ binutils.unicode.patch | 1775 ++++ sources | 2 + 43 files changed, 19506 insertions(+) create mode 100644 .gitignore create mode 100644 binutils-2.19.50.0.1-output-format.sed create mode 100644 binutils-2.20.51.0.2-libtool-lib64.patch create mode 100644 binutils-2.22.52.0.4-no-config-h-check.patch create mode 100644 binutils-2.25-set-long-long.patch create mode 100644 binutils-2.25-version.patch create mode 100644 binutils-2.27-aarch64-ifunc.patch create mode 100644 binutils-2.28-ignore-gold-duplicates.patch create mode 100644 binutils-2.29-filename-in-error-messages.patch create mode 100644 binutils-2.29-revert-PLT-elision.patch create mode 100644 binutils-CVE-2019-1010204.patch create mode 100644 binutils-CVE-2021-20197.patch create mode 100644 binutils-PELC-licence-corrections.patch create mode 100644 binutils-PPC-dcbt.patch create mode 100644 binutils-aarch64-ld-testsuite-fixes.patch create mode 100644 binutils-aarch64-plt-sh_entsize.patch create mode 100644 binutils-add-sym-cache-to-elf-link-hash.patch create mode 100644 binutils-attach-to-group.patch create mode 100644 binutils-config.patch create mode 100644 binutils-do-not-link-with-static-libstdc++.patch create mode 100644 binutils-elf-add-objects.patch create mode 100644 binutils-export-demangle.h.patch create mode 100644 binutils-fix-ld-failures.patch create mode 100644 binutils-fix-testsuite-failures.patch create mode 100644 binutils-gas-dwarf-level-4.patch create mode 100644 binutils-gas-speedups.patch create mode 100644 binutils-gcc-10-fixes.patch create mode 100644 binutils-gold-8-byte-note-segments.patch create mode 100644 binutils-gold-mismatched-section-flags.patch create mode 100644 binutils-i686-ld-testsuite-fixes.patch create mode 100644 binutils-ignore-duplicate-FDE-entries.patch create mode 100644 binutils-no-builder-comment-in-bfd-stdint.patch create mode 100644 binutils-ppc-hash-insert.patch create mode 100644 binutils-ppc-ld-testsuite-fixes.patch create mode 100644 binutils-readelf-other-sym-info.patch create mode 100644 binutils-s390-build.patch create mode 100644 binutils-s390-ld-testsuite-fixes.patch create mode 100644 binutils-secondary-relocs-speed.patch create mode 100644 binutils-special-sections-in-groups.patch create mode 100644 binutils-warnings.patch create mode 100644 binutils.spec create mode 100644 binutils.unicode.patch create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d6ee96 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +SOURCES/binutils-2.35.tar.xz +SOURCES/standards.info.gz +/binutils-2.35.tar.xz +/standards.info.gz diff --git a/binutils-2.19.50.0.1-output-format.sed b/binutils-2.19.50.0.1-output-format.sed new file mode 100644 index 0000000..fd770cb --- /dev/null +++ b/binutils-2.19.50.0.1-output-format.sed @@ -0,0 +1,38 @@ +# Generate OUTPUT_FORMAT line for .so files from the system linker output. +# Imported from glibc/Makerules. + +/ld.*[ ]-E[BL]/b f +/collect.*[ ]-E[BL]/b f +/OUTPUT_FORMAT[^)]*$/{N +s/\n[ ]*/ / +} +t o +: o +s/^.*OUTPUT_FORMAT(\([^,]*\), \1, \1).*$/OUTPUT_FORMAT(\1)/ +t q +s/^.*OUTPUT_FORMAT(\([^,]*\), \([^,]*\), \([^,]*\)).*$/\1,\2,\3/ +t s +s/^.*OUTPUT_FORMAT(\([^,)]*\).*$)/OUTPUT_FORMAT(\1)/ +t q +d +: s +s/"//g +G +s/\n// +s/^\([^,]*\),\([^,]*\),\([^,]*\),B/OUTPUT_FORMAT(\2)/p +s/^\([^,]*\),\([^,]*\),\([^,]*\),L/OUTPUT_FORMAT(\3)/p +s/^\([^,]*\),\([^,]*\),\([^,]*\)/OUTPUT_FORMAT(\1)/p +/,/s|^|*** BUG in libc/scripts/output-format.sed *** |p +q +: q +s/"//g +p +q +: f +s/^.*[ ]-E\([BL]\)[ ].*$/,\1/ +t h +s/^.*[ ]-E\([BL]\)$/,\1/ +t h +d +: h +h diff --git a/binutils-2.20.51.0.2-libtool-lib64.patch b/binutils-2.20.51.0.2-libtool-lib64.patch new file mode 100644 index 0000000..142fc7e --- /dev/null +++ b/binutils-2.20.51.0.2-libtool-lib64.patch @@ -0,0 +1,236 @@ +diff -rcp ../binutils-2.20.51.0.7.original/bfd/configure ./bfd/configure +--- a/bfd/configure 2010-04-08 14:53:48.000000000 +0100 ++++ b/bfd/configure 2010-04-08 14:56:50.000000000 +0100 +@@ -10762,10 +10762,34 @@ + # before this can be enabled. + hardcode_into_libs=yes + ++ # find out which ABI we are using ++ libsuff= ++ case "$host_cpu" in ++ x86_64*|s390*|powerpc*|ppc*|sparc*) ++ echo 'int i;' > conftest.$ac_ext ++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then ++ case `/usr/bin/file conftest.$ac_objext` in ++ *64-bit*) ++ libsuff=64 ++ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then ++ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" ++ fi ++ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" ++ ;; ++ esac ++ fi ++ rm -rf conftest* ++ ;; ++ esac ++ + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` +- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" ++ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on +diff -rcp ../binutils-2.20.51.0.7.original/binutils/configure ./binutils/configure +--- a/binutils/configure 2010-04-08 14:53:45.000000000 +0100 ++++ b/binutils/configure 2010-04-08 14:56:21.000000000 +0100 +@@ -10560,10 +10560,34 @@ + # before this can be enabled. + hardcode_into_libs=yes + ++ # find out which ABI we are using ++ libsuff= ++ case "$host_cpu" in ++ x86_64*|s390*|powerpc*|ppc*|sparc*) ++ echo 'int i;' > conftest.$ac_ext ++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then ++ case `/usr/bin/file conftest.$ac_objext` in ++ *64-bit*) ++ libsuff=64 ++ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then ++ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" ++ fi ++ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" ++ ;; ++ esac ++ fi ++ rm -rf conftest* ++ ;; ++ esac ++ + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` +- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" ++ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on +diff -rcp ../binutils-2.20.51.0.7.original/gas/configure ./gas/configure +--- a/gas/configure 2010-04-08 14:53:47.000000000 +0100 ++++ b/gas/configure 2010-04-08 14:57:24.000000000 +0100 +@@ -10547,10 +10547,34 @@ + # before this can be enabled. + hardcode_into_libs=yes + ++ # find out which ABI we are using ++ libsuff= ++ case "$host_cpu" in ++ x86_64*|s390*|powerpc*|ppc*|sparc*) ++ echo 'int i;' > conftest.$ac_ext ++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then ++ case `/usr/bin/file conftest.$ac_objext` in ++ *64-bit*) ++ libsuff=64 ++ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then ++ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" ++ fi ++ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" ++ ;; ++ esac ++ fi ++ rm -rf conftest* ++ ;; ++ esac ++ + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` +- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" ++ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on +diff -rcp ../binutils-2.20.51.0.7.original/gprof/configure ./gprof/configure +--- a/gprof/configure 2010-04-08 14:53:45.000000000 +0100 ++++ b/gprof/configure 2010-04-08 14:57:50.000000000 +0100 +@@ -10485,10 +10485,34 @@ + # before this can be enabled. + hardcode_into_libs=yes + ++ # find out which ABI we are using ++ libsuff= ++ case "$host_cpu" in ++ x86_64*|s390*|powerpc*|ppc*|sparc*) ++ echo 'int i;' > conftest.$ac_ext ++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then ++ case `/usr/bin/file conftest.$ac_objext` in ++ *64-bit*) ++ libsuff=64 ++ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then ++ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" ++ fi ++ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" ++ ;; ++ esac ++ fi ++ rm -rf conftest* ++ ;; ++ esac ++ + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` +- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" ++ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on +diff -rcp ../binutils-2.20.51.0.7.original/ld/configure ./ld/configure +--- a/ld/configure 2010-04-08 14:53:44.000000000 +0100 ++++ b/ld/configure 2010-04-08 14:58:21.000000000 +0100 +@@ -10966,10 +10966,34 @@ + # before this can be enabled. + hardcode_into_libs=yes + ++ # find out which ABI we are using ++ libsuff= ++ case "$host_cpu" in ++ x86_64*|s390*|powerpc*|ppc*|sparc*) ++ echo 'int i;' > conftest.$ac_ext ++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then ++ case `/usr/bin/file conftest.$ac_objext` in ++ *64-bit*) ++ libsuff=64 ++ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then ++ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" ++ fi ++ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" ++ ;; ++ esac ++ fi ++ rm -rf conftest* ++ ;; ++ esac ++ + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` +- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" ++ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on +Only in .: .#libtool.m4 +Only in .: #libtool.m4# +diff -rcp ../binutils-2.20.51.0.7.original/opcodes/configure ./opcodes/configure +--- a/opcodes/configure 2010-04-08 14:53:45.000000000 +0100 ++++ b/opcodes/configure 2010-04-08 14:59:10.000000000 +0100 +@@ -10496,10 +10496,34 @@ + # before this can be enabled. + hardcode_into_libs=yes + ++ # find out which ABI we are using ++ libsuff= ++ case "$host_cpu" in ++ x86_64*|s390*|powerpc*|ppc*|sparc*) ++ echo 'int i;' > conftest.$ac_ext ++ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then ++ case `/usr/bin/file conftest.$ac_objext` in ++ *64-bit*) ++ libsuff=64 ++ if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then ++ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" ++ fi ++ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" ++ ;; ++ esac ++ fi ++ rm -rf conftest* ++ ;; ++ esac ++ + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` +- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" ++ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on diff --git a/binutils-2.22.52.0.4-no-config-h-check.patch b/binutils-2.22.52.0.4-no-config-h-check.patch new file mode 100644 index 0000000..c89195a --- /dev/null +++ b/binutils-2.22.52.0.4-no-config-h-check.patch @@ -0,0 +1,28 @@ +--- a/bfd/bfd-in.h 2012-08-02 10:56:34.561769686 +0100 ++++ b/bfd/bfd-in.h 2012-08-02 11:13:27.134797755 +0100 +@@ -25,11 +25,6 @@ + #ifndef __BFD_H_SEEN__ + #define __BFD_H_SEEN__ + +-/* PR 14072: Ensure that config.h is included first. */ +-#if !defined PACKAGE && !defined PACKAGE_VERSION +-#error config.h must be included before this header +-#endif +- + #ifdef __cplusplus + extern "C" { + #endif +--- a/bfd/bfd-in2.h 2012-08-02 10:56:34.349769680 +0100 ++++ b/bfd/bfd-in2.h 2012-08-02 11:13:40.015798113 +0100 +@@ -32,11 +32,6 @@ + #ifndef __BFD_H_SEEN__ + #define __BFD_H_SEEN__ + +-/* PR 14072: Ensure that config.h is included first. */ +-#if !defined PACKAGE && !defined PACKAGE_VERSION +-#error config.h must be included before this header +-#endif +- + #ifdef __cplusplus + extern "C" { + #endif diff --git a/binutils-2.25-set-long-long.patch b/binutils-2.25-set-long-long.patch new file mode 100644 index 0000000..1ea7418 --- /dev/null +++ b/binutils-2.25-set-long-long.patch @@ -0,0 +1,38 @@ +diff -up binutils-2.25.orig/bfd/configure.ac binutils-2.25/bfd/configure.ac +--- binutils-2.25.orig/bfd/configure.ac 2014-12-24 10:34:45.590491143 +0000 ++++ binutils-2.25/bfd/configure.ac 2014-12-24 10:36:12.997981992 +0000 +@@ -183,11 +183,13 @@ if test "x${ac_cv_sizeof_long}" = "x8"; + BFD_HOST_64BIT_LONG=1 + test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long" + test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long" +-elif test "x${ac_cv_sizeof_long_long}" = "x8"; then ++fi ++if test "x${ac_cv_sizeof_long_long}" = "x8"; then + BFD_HOST_64BIT_LONG_LONG=1 + test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long" + test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long" +- if test "x${ac_cv_sizeof_void_p}" = "x8"; then ++ if test "x${ac_cv_sizeof_void_p}" = "x8" \ ++ -a "x${ac_cv_sizeof_long}" != "x8"; then + BFD_HOSTPTR_T="unsigned long long" + fi + fi +diff -up ../binutils-2.20.51.0.7.original/bfd/configure ./bfd/configure +--- a/bfd/configure 2010-04-08 15:23:58.000000000 +0100 ++++ b/bfd/configure 2010-04-08 15:24:06.000000000 +0100 +@@ -12819,11 +12819,13 @@ + BFD_HOST_64BIT_LONG=1 + test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long" + test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long" +-elif test "x${ac_cv_sizeof_long_long}" = "x8"; then ++fi ++if test "x${ac_cv_sizeof_long_long}" = "x8"; then + BFD_HOST_64BIT_LONG_LONG=1 + test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long" + test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long" +- if test "x${ac_cv_sizeof_void_p}" = "x8"; then ++ if test "x${ac_cv_sizeof_void_p}" = "x8" \ ++ -a "x${ac_cv_sizeof_long}" != "x8"; then + BFD_HOSTPTR_T="unsigned long long" + fi + fi diff --git a/binutils-2.25-version.patch b/binutils-2.25-version.patch new file mode 100644 index 0000000..d97e81b --- /dev/null +++ b/binutils-2.25-version.patch @@ -0,0 +1,44 @@ +--- binutils-2.26.orig/bfd/Makefile.am 2016-01-25 10:11:33.505289018 +0000 ++++ binutils-2.26/bfd/Makefile.am 2016-01-25 10:13:23.489964145 +0000 +@@ -1043,8 +1043,8 @@ DISTCLEANFILES = $(BUILD_CFILES) $(BUILD + bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in + @echo "creating $@" + @bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\ +- bfd_version_string="\"$(VERSION)\"" ;\ +- bfd_soversion="$(VERSION)" ;\ ++ bfd_version_string="\"$(VERSION)-%{release}\"" ;\ ++ bfd_soversion="$(VERSION)-%{release}" ;\ + bfd_version_package="\"$(PKGVERSION)\"" ;\ + report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\ + . $(srcdir)/development.sh ;\ +@@ -1055,7 +1055,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/ + fi ;\ + $(SED) -e "s,@bfd_version@,$$bfd_version," \ + -e "s,@bfd_version_string@,$$bfd_version_string," \ +- -e "s,@bfd_version_package@,$$bfd_version_package," \ ++ -e "s,@bfd_version_package@,\"version \"," \ + -e "s,@report_bugs_to@,$$report_bugs_to," \ + < $(srcdir)/version.h > $@; \ + echo "$${bfd_soversion}" > libtool-soversion +--- binutils-2.26.orig/bfd/Makefile.in 2016-01-25 10:11:33.505289018 +0000 ++++ binutils-2.26/bfd/Makefile.in 2016-01-25 10:14:17.818297941 +0000 +@@ -2111,8 +2111,8 @@ stmp-lcoff-h: $(LIBCOFF_H_FILES) + bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in + @echo "creating $@" + @bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\ +- bfd_version_string="\"$(VERSION)\"" ;\ +- bfd_soversion="$(VERSION)" ;\ ++ bfd_version_string="\"$(VERSION)-%{release}\"" ;\ ++ bfd_soversion="$(VERSION)-%{release}" ;\ + bfd_version_package="\"$(PKGVERSION)\"" ;\ + report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\ + . $(srcdir)/development.sh ;\ +@@ -2123,7 +2123,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/ + fi ;\ + $(SED) -e "s,@bfd_version@,$$bfd_version," \ + -e "s,@bfd_version_string@,$$bfd_version_string," \ +- -e "s,@bfd_version_package@,$$bfd_version_package," \ ++ -e "s,@bfd_version_package@,\"version \"," \ + -e "s,@report_bugs_to@,$$report_bugs_to," \ + < $(srcdir)/version.h > $@; \ + echo "$${bfd_soversion}" > libtool-soversion diff --git a/binutils-2.27-aarch64-ifunc.patch b/binutils-2.27-aarch64-ifunc.patch new file mode 100644 index 0000000..562ef18 --- /dev/null +++ b/binutils-2.27-aarch64-ifunc.patch @@ -0,0 +1,11 @@ +diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.27/bfd/elfnn-aarch64.c +--- binutils.orig/bfd/elfnn-aarch64.c 2017-02-21 10:45:19.311956006 +0000 ++++ binutils-2.27/bfd/elfnn-aarch64.c 2017-02-21 11:55:07.517922655 +0000 +@@ -4947,6 +4947,7 @@ elfNN_aarch64_final_link_relocate (reloc + it here if it is defined in a non-shared object. */ + if (h != NULL + && h->type == STT_GNU_IFUNC ++ && (input_section->flags & SEC_ALLOC) + && h->def_regular) + { + asection *plt; diff --git a/binutils-2.28-ignore-gold-duplicates.patch b/binutils-2.28-ignore-gold-duplicates.patch new file mode 100644 index 0000000..346f956 --- /dev/null +++ b/binutils-2.28-ignore-gold-duplicates.patch @@ -0,0 +1,14 @@ +diff -rup binutils.orig/ld/ldmain.c binutils-2.28/ld/ldmain.c +--- binutils.orig/ld/ldmain.c 2017-06-09 09:08:26.954016429 +0100 ++++ binutils-2.28/ld/ldmain.c 2017-06-09 09:09:11.307490976 +0100 +@@ -923,6 +923,10 @@ multiple_definition (struct bfd_link_inf + obfd = h->u.def.section->owner; + break; + case bfd_link_hash_indirect: ++ /* PR 21074: The GOLD linker can produce multiple indirect ++ refences to the same symbol. These can be ignored. */ ++ if (bfd_is_ind_section (nsec)) ++ return; + osec = bfd_ind_section_ptr; + oval = 0; + obfd = NULL; diff --git a/binutils-2.29-filename-in-error-messages.patch b/binutils-2.29-filename-in-error-messages.patch new file mode 100644 index 0000000..60750a1 --- /dev/null +++ b/binutils-2.29-filename-in-error-messages.patch @@ -0,0 +1,123 @@ +--- binutils.orig/binutils/readelf.c 2020-07-24 14:55:25.163647522 +0100 ++++ binutils-2.35/binutils/readelf.c 2020-07-24 15:02:39.613851369 +0100 +@@ -20729,79 +20729,92 @@ process_file (char * file_name) + Filedata * filedata = NULL; + struct stat statbuf; + char armag[SARMAG]; +- bfd_boolean ret = TRUE; ++ bfd_boolean ret = FALSE; ++ char * name; ++ char * saved_program_name; ++ ++ /* Overload program_name to include file_name. Doing this means ++ that warning/error messages will positively identify the file ++ concerned even when multiple instances of readelf are running. */ ++ name = xmalloc (strlen (program_name) + strlen (file_name) + 3); ++ sprintf (name, "%s: %s", program_name, file_name); ++ saved_program_name = program_name; ++ program_name = name; + + if (stat (file_name, &statbuf) < 0) + { + if (errno == ENOENT) +- error (_("'%s': No such file\n"), file_name); ++ error (_("No such file\n")); + else +- error (_("Could not locate '%s'. System error message: %s\n"), +- file_name, strerror (errno)); +- return FALSE; ++ error (_("Could not locate file. System error message: %s\n"), ++ strerror (errno)); ++ goto done; + } + + if (! S_ISREG (statbuf.st_mode)) + { +- error (_("'%s' is not an ordinary file\n"), file_name); +- return FALSE; ++ error (_("Not an ordinary file\n")); ++ goto done; + } + + filedata = calloc (1, sizeof * filedata); + if (filedata == NULL) + { + error (_("Out of memory allocating file data structure\n")); +- return FALSE; ++ goto done; + } + + filedata->file_name = file_name; + filedata->handle = fopen (file_name, "rb"); + if (filedata->handle == NULL) + { +- error (_("Input file '%s' is not readable.\n"), file_name); +- free (filedata); +- return FALSE; ++ error (_("Not readable\n")); ++ goto done; + } + + if (fread (armag, SARMAG, 1, filedata->handle) != 1) + { +- error (_("%s: Failed to read file's magic number\n"), file_name); ++ error (_("Failed to read file's magic number\n")); + fclose (filedata->handle); +- free (filedata); +- return FALSE; ++ goto done; + } + + filedata->file_size = (bfd_size_type) statbuf.st_size; + + if (memcmp (armag, ARMAG, SARMAG) == 0) + { +- if (! process_archive (filedata, FALSE)) +- ret = FALSE; ++ if (process_archive (filedata, FALSE)) ++ ret = TRUE; + } + else if (memcmp (armag, ARMAGT, SARMAG) == 0) + { +- if ( ! process_archive (filedata, TRUE)) +- ret = FALSE; ++ if (process_archive (filedata, TRUE)) ++ ret = TRUE; + } + else + { + if (do_archive_index && !check_all) +- error (_("File %s is not an archive so its index cannot be displayed.\n"), +- file_name); ++ error (_("Not an archive so its index cannot be displayed.\n")); + + rewind (filedata->handle); + filedata->archive_file_size = filedata->archive_file_offset = 0; + +- if (! process_object (filedata)) +- ret = FALSE; ++ if (process_object (filedata)) ++ ret = TRUE; + } + +- fclose (filedata->handle); +- free (filedata->section_headers); +- free (filedata->program_headers); +- free (filedata->string_table); +- free (filedata->dump.dump_sects); +- free (filedata); ++ done: ++ if (filedata) ++ { ++ fclose (filedata->handle); ++ free (filedata->section_headers); ++ free (filedata->program_headers); ++ free (filedata->string_table); ++ free (filedata->dump.dump_sects); ++ free (filedata); ++ } ++ free (program_name); ++ program_name = saved_program_name; + + free (ba_cache.strtab); + ba_cache.strtab = NULL; diff --git a/binutils-2.29-revert-PLT-elision.patch b/binutils-2.29-revert-PLT-elision.patch new file mode 100644 index 0000000..746a551 --- /dev/null +++ b/binutils-2.29-revert-PLT-elision.patch @@ -0,0 +1,265 @@ +diff -rup binutils.orig/ld/testsuite/ld-i386/pltgot-1.d binutils-2.29.1/ld/testsuite/ld-i386/pltgot-1.d +--- binutils.orig/ld/testsuite/ld-i386/pltgot-1.d 2017-11-15 13:32:39.335065263 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-i386/pltgot-1.d 2017-11-15 15:03:55.649727195 +0000 +@@ -2,6 +2,7 @@ + #readelf: -S --wide + #as: --32 + ++#pass + #... + +\[ *[0-9]+\] \.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+10 +.* + #... +diff -rup binutils.orig/ld/testsuite/ld-i386/pltgot-2.d binutils-2.29.1/ld/testsuite/ld-i386/pltgot-2.d +--- binutils.orig/ld/testsuite/ld-i386/pltgot-2.d 2017-11-15 13:32:39.329065335 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-i386/pltgot-2.d 2017-11-15 15:04:20.803430034 +0000 +@@ -3,7 +3,6 @@ + #readelf: -d --wide + #as: --32 + +-#failif + #... + +0x[0-9a-f]+ +\(PLTREL.* + #... +diff -rup binutils.orig/ld/testsuite/ld-i386/pr19636-2d.d binutils-2.29.1/ld/testsuite/ld-i386/pr19636-2d.d +--- binutils.orig/ld/testsuite/ld-i386/pr19636-2d.d 2017-11-15 13:32:39.336065251 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-i386/pr19636-2d.d 2017-11-15 15:03:00.413379749 +0000 +@@ -9,7 +9,7 @@ Relocation section '\.rel\.dyn' at offse + [0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +func + [0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func + [0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func +- ++#... + Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name + #... +diff -rup binutils.orig/ld/testsuite/ld-i386/pr19636-2e.d binutils-2.29.1/ld/testsuite/ld-i386/pr19636-2e.d +--- binutils.orig/ld/testsuite/ld-i386/pr19636-2e.d 2017-11-15 13:32:39.330065323 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-i386/pr19636-2e.d 2017-11-15 15:03:28.928042882 +0000 +@@ -9,7 +9,7 @@ Relocation section '\.rel\.dyn' at offse + [0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +func + [0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func + [0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func +- ++#... + Symbol table '\.dynsym' contains [0-9]+ entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name + #... +diff -rup binutils.orig/ld/testsuite/ld-x86-64/pltgot-1.d binutils-2.29.1/ld/testsuite/ld-x86-64/pltgot-1.d +--- binutils.orig/ld/testsuite/ld-x86-64/pltgot-1.d 2017-11-15 13:32:39.415064300 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/pltgot-1.d 2017-11-15 15:08:39.333375801 +0000 +@@ -2,8 +2,4 @@ + #readelf: -S --wide + #as: --64 + +-#... +- +\[ *[0-9]+\] \.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+10 +.* +-#... +- +\[ *[0-9]+\] \.got\.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+18 +.* + #pass +diff -rup binutils.orig/ld/testsuite/ld-x86-64/pltgot-2.d binutils-2.29.1/ld/testsuite/ld-x86-64/pltgot-2.d +--- binutils.orig/ld/testsuite/ld-x86-64/pltgot-2.d 2017-11-15 13:32:39.404064432 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/pltgot-2.d 2017-11-15 15:08:59.031143095 +0000 +@@ -3,7 +3,6 @@ + #readelf: -d --wide + #as: --64 + +-#failif + #... + +0x[0-9a-f]+ +\(PLTREL.* + #... +diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-bnd.dd +--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2017-11-15 13:32:39.405064420 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-bnd.dd 2017-11-15 15:06:53.694623801 +0000 +@@ -1,7 +1,4 @@ +-#... +-Disassembly of section .plt.got: + +-[a-f0-9]+ <[a-z_]+@plt>: +-[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <.*> ++#... + [ ]*[a-f0-9]+: 90 nop + #pass +diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main.rd +--- binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd 2017-11-15 13:32:39.407064397 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main.rd 2017-11-15 15:06:17.244054423 +0000 +@@ -1,4 +1,3 @@ +-#failif + #... + [0-9a-f ]+R_X86_64_JUMP_SLOT +0+ +bar \+ 0 + #... +diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830a.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830a.d +--- binutils.orig/ld/testsuite/ld-x86-64/pr20830a.d 2017-11-15 13:32:39.412064336 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830a.d 2017-11-15 15:15:09.918750288 +0000 +@@ -20,6 +20,7 @@ Contents of the .eh_frame section: + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop ++#pass + + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4 + DW_CFA_nop +diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830a-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830a-now.d +--- binutils.orig/ld/testsuite/ld-x86-64/pr20830a-now.d 2017-11-15 13:32:39.413064324 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830a-now.d 2017-11-15 15:16:08.227055104 +0000 +@@ -20,6 +20,7 @@ Contents of the .eh_frame section: + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop ++#pass + + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4 + DW_CFA_nop +diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830b.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830b.d +--- binutils.orig/ld/testsuite/ld-x86-64/pr20830b.d 2017-11-15 13:32:39.413064324 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830b.d 2017-11-15 15:16:20.115913358 +0000 +@@ -20,7 +20,8 @@ Contents of the .eh_frame section: + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop +- ++#pass ++ + 0+18 0000000000000010 0000001c FDE cie=00000000 pc=0000000000000138..0000000000000144 + DW_CFA_nop + DW_CFA_nop +diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830b-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830b-now.d +--- binutils.orig/ld/testsuite/ld-x86-64/pr20830b-now.d 2017-11-15 13:32:39.411064348 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830b-now.d 2017-11-15 15:16:29.012807282 +0000 +@@ -20,7 +20,8 @@ Contents of the .eh_frame section: + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop +- ++#pass ++ + 0+18 0000000000000010 0000001c FDE cie=00000000 pc=0000000000000138..0000000000000144 + DW_CFA_nop + DW_CFA_nop +diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038a.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a.d +--- binutils.orig/ld/testsuite/ld-x86-64/pr21038a.d 2017-11-15 13:32:39.408064384 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a.d 2017-11-15 15:19:48.097433680 +0000 +@@ -19,7 +19,8 @@ Contents of the .eh_frame section: + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop +- ++#pass ++ + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4 + DW_CFA_nop + DW_CFA_nop +diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038a-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a-now.d +--- binutils.orig/ld/testsuite/ld-x86-64/pr21038a-now.d 2017-11-15 13:32:39.401064469 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a-now.d 2017-11-15 15:10:56.077760324 +0000 +@@ -20,7 +20,8 @@ Contents of the .eh_frame section: + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop +- ++#pass ++ + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4 + DW_CFA_nop + DW_CFA_nop +diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038b.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b.d +--- binutils.orig/ld/testsuite/ld-x86-64/pr21038b.d 2017-11-15 13:32:39.405064420 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b.d 2017-11-15 15:10:42.828916844 +0000 +@@ -19,6 +19,7 @@ Contents of the .eh_frame section: + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop ++#pass + + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001d8..00000000000001dd + DW_CFA_nop +diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038b-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b-now.d +--- binutils.orig/ld/testsuite/ld-x86-64/pr21038b-now.d 2017-11-15 13:32:39.416064288 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b-now.d 2017-11-15 15:11:11.550577531 +0000 +@@ -20,7 +20,8 @@ Contents of the .eh_frame section: + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop +- ++#pass ++ + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001d8..00000000000001dd + DW_CFA_nop + DW_CFA_nop +diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038c.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c.d +--- binutils.orig/ld/testsuite/ld-x86-64/pr21038c.d 2017-11-15 13:32:39.411064348 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c.d 2017-11-15 15:09:52.664509478 +0000 +@@ -19,7 +19,8 @@ Contents of the .eh_frame section: + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop +- ++#pass ++ + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000220..0000000000000231 + DW_CFA_nop + DW_CFA_nop +diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038c-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c-now.d +--- binutils.orig/ld/testsuite/ld-x86-64/pr21038c-now.d 2017-11-15 13:32:39.413064324 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c-now.d 2017-11-15 15:11:22.975442559 +0000 +@@ -20,7 +20,8 @@ Contents of the .eh_frame section: + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop +- ++#pass ++ + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000220..0000000000000231 + DW_CFA_nop + DW_CFA_nop +diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd binutils-2.29.1/ld/testsuite/ld-x86-64/tlspic2.rd +--- binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd 2017-11-15 13:32:39.417064276 +0000 ++++ binutils-2.29.1/ld/testsuite/ld-x86-64/tlspic2.rd 2017-11-15 15:05:02.950932110 +0000 +@@ -14,6 +14,7 @@ Section Headers: + +\[[ 0-9]+\] .dynsym +.* + +\[[ 0-9]+\] .dynstr +.* + +\[[ 0-9]+\] .rela.dyn +.* ++#pass + +\[[ 0-9]+\] .plt +.* + +\[[ 0-9]+\] .plt.got +.* + +\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+31a 00 +AX +0 +0 4096 +--- binutils.orig/bfd/elfxx-x86.c 2018-01-22 15:59:25.875788033 +0000 ++++ binutils-2.30.0/bfd/elfxx-x86.c 2018-01-22 16:00:20.789146597 +0000 +@@ -107,7 +107,7 @@ elf_x86_allocate_dynrelocs (struct elf_l + plt_entry_size = htab->plt.plt_entry_size; + + resolved_to_zero = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh); +- ++#if 0 + /* We can't use the GOT PLT if pointer equality is needed since + finish_dynamic_symbol won't clear symbol value and the dynamic + linker won't update the GOT slot. We will get into an infinite +@@ -125,7 +125,7 @@ elf_x86_allocate_dynrelocs (struct elf_l + /* Use the GOT PLT. */ + eh->plt_got.refcount = 1; + } +- ++#endif + /* Since STT_GNU_IFUNC symbol must go through PLT, we handle it + here if it is defined and referenced in a non-shared object. */ + if (h->type == STT_GNU_IFUNC +--- binutils.orig/ld/testsuite/ld-i386/pr20830.d 2018-07-09 09:49:51.277239857 +0100 ++++ binutils-2.30.90/ld/testsuite/ld-i386/pr20830.d 2018-07-09 10:32:41.113356733 +0100 +@@ -19,7 +19,7 @@ Contents of the .eh_frame section: + DW_CFA_offset: r8 \(eip\) at cfa-4 + DW_CFA_nop + DW_CFA_nop +- ++#pass + 0+18 00000010 0000001c FDE cie=00000000 pc=00000128..00000133 + DW_CFA_nop + DW_CFA_nop +--- binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2020-07-24 14:55:25.370646189 +0100 ++++ binutils-2.35/ld/testsuite/ld-x86-64/plt-main-ibt.dd 2020-07-24 15:06:58.124189348 +0100 +@@ -1,7 +1,3 @@ + #... +-Disassembly of section .plt.got: +- +-[a-f0-9]+ <[_a-z]+@plt>: + [ ]*[a-f0-9]+: f3 0f 1e fa endbr64 +-[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <.*> + #pass diff --git a/binutils-CVE-2019-1010204.patch b/binutils-CVE-2019-1010204.patch new file mode 100644 index 0000000..56434b1 --- /dev/null +++ b/binutils-CVE-2019-1010204.patch @@ -0,0 +1,15 @@ +--- binutils.orig/gold/fileread.cc 2019-08-06 14:22:08.669313110 +0100 ++++ binutils-2.32/gold/fileread.cc 2019-08-06 14:22:28.799177543 +0100 +@@ -381,6 +381,12 @@ File_read::do_read(off_t start, section_ + ssize_t bytes; + if (this->whole_file_view_ != NULL) + { ++ // See PR 23765 for an example of a testcase that triggers this error. ++ if (((ssize_t) start) < 0) ++ gold_fatal(_("%s: read failed, starting offset (%#llx) less than zero"), ++ this->filename().c_str(), ++ static_cast(start)); ++ + bytes = this->size_ - start; + if (static_cast(bytes) >= size) + { diff --git a/binutils-CVE-2021-20197.patch b/binutils-CVE-2021-20197.patch new file mode 100644 index 0000000..4e9be45 --- /dev/null +++ b/binutils-CVE-2021-20197.patch @@ -0,0 +1,778 @@ +diff -rup binutils.orig/bfd/bfd-in2.h binutils-2.35.1/bfd/bfd-in2.h +--- binutils.orig/bfd/bfd-in2.h 2021-01-29 11:14:51.848568548 +0000 ++++ binutils-2.35.1/bfd/bfd-in2.h 2021-01-29 11:15:33.431322133 +0000 +@@ -583,6 +583,8 @@ bfd *bfd_openr (const char *filename, co + + bfd *bfd_fdopenr (const char *filename, const char *target, int fd); + ++bfd *bfd_fdopenw (const char *filename, const char *target, int fd); ++ + bfd *bfd_openstreamr (const char * filename, const char * target, + void * stream); + +diff -rup binutils.orig/bfd/opncls.c binutils-2.35.1/bfd/opncls.c +--- binutils.orig/bfd/opncls.c 2021-01-29 11:14:51.846568560 +0000 ++++ binutils-2.35.1/bfd/opncls.c 2021-01-29 11:15:33.431322133 +0000 +@@ -395,6 +395,39 @@ bfd_fdopenr (const char *filename, const + + /* + FUNCTION ++ bfd_fdopenw ++ ++SYNOPSIS ++ bfd *bfd_fdopenw (const char *filename, const char *target, int fd); ++ ++DESCRIPTION ++ <> is exactly like <> with the exception that ++ the resulting BFD is suitable for output. ++*/ ++ ++bfd * ++bfd_fdopenw (const char *filename, const char *target, int fd) ++{ ++ bfd *out = bfd_fdopenr (filename, target, fd); ++ ++ if (out != NULL) ++ { ++ if (!bfd_write_p (out)) ++ { ++ close (fd); ++ _bfd_delete_bfd (out); ++ out = NULL; ++ bfd_set_error (bfd_error_invalid_operation); ++ } ++ else ++ out->direction = write_direction; ++ } ++ ++ return out; ++} ++ ++/* ++FUNCTION + bfd_openstreamr + + SYNOPSIS +diff -rup binutils.orig/binutils/ar.c binutils-2.35.1/binutils/ar.c +--- binutils.orig/binutils/ar.c 2021-01-29 11:14:51.344571539 +0000 ++++ binutils-2.35.1/binutils/ar.c 2021-01-29 11:15:56.174187367 +0000 +@@ -25,6 +25,7 @@ + + #include "sysdep.h" + #include "bfd.h" ++#include "libbfd.h" + #include "libiberty.h" + #include "progress.h" + #include "getopt.h" +@@ -1195,20 +1196,26 @@ write_archive (bfd *iarch) + bfd *obfd; + char *old_name, *new_name; + bfd *contents_head = iarch->archive_next; ++ int ofd = -1; ++ struct stat target_stat; ++ bfd_boolean skip_stat = FALSE; + + old_name = (char *) xmalloc (strlen (bfd_get_filename (iarch)) + 1); + strcpy (old_name, bfd_get_filename (iarch)); +- new_name = make_tempname (old_name); ++ new_name = make_tempname (old_name, &ofd); + + if (new_name == NULL) + bfd_fatal (_("could not create temporary file whilst writing archive")); + + output_filename = new_name; + +- obfd = bfd_openw (new_name, bfd_get_target (iarch)); ++ obfd = bfd_fdopenw (new_name, bfd_get_target (iarch), ofd); + + if (obfd == NULL) +- bfd_fatal (old_name); ++ { ++ close (ofd); ++ bfd_fatal (old_name); ++ } + + output_bfd = obfd; + +@@ -1237,6 +1244,14 @@ write_archive (bfd *iarch) + if (!bfd_set_archive_head (obfd, contents_head)) + bfd_fatal (old_name); + ++#if !defined (_WIN32) || defined (__CYGWIN32__) ++ ofd = dup (ofd); ++ if (iarch == NULL || iarch->iostream == NULL) ++ skip_stat = TRUE; ++ else if (ofd == -1 || fstat (fileno (iarch->iostream), &target_stat) != 0) ++ bfd_fatal (old_name); ++#endif ++ + if (!bfd_close (obfd)) + bfd_fatal (old_name); + +@@ -1246,7 +1261,7 @@ write_archive (bfd *iarch) + /* We don't care if this fails; we might be creating the archive. */ + bfd_close (iarch); + +- if (smart_rename (new_name, old_name, 0) != 0) ++ if (smart_rename (new_name, old_name, ofd, skip_stat ? NULL : &target_stat, 0) != 0) + xexit (1); + free (old_name); + free (new_name); +diff -rup binutils.orig/binutils/arsup.c binutils-2.35.1/binutils/arsup.c +--- binutils.orig/binutils/arsup.c 2021-01-29 11:14:51.350571503 +0000 ++++ binutils-2.35.1/binutils/arsup.c 2021-01-29 11:15:56.174187367 +0000 +@@ -345,13 +345,25 @@ ar_save (void) + else + { + char *ofilename = xstrdup (bfd_get_filename (obfd)); ++ bfd_boolean skip_stat = FALSE; ++ struct stat target_stat; ++ int ofd = -1; + + if (deterministic > 0) + obfd->flags |= BFD_DETERMINISTIC_OUTPUT; + ++#if !defined (_WIN32) || defined (__CYGWIN32__) ++ /* It's OK to fail; at worst it will result in SMART_RENAME using a slow ++ copy fallback to write the output. */ ++ ofd = dup (fileno (obfd->iostream)); ++ if (lstat (real_name, &target_stat) != 0) ++ skip_stat = TRUE; ++#endif ++ + bfd_close (obfd); + +- smart_rename (ofilename, real_name, 0); ++ smart_rename (ofilename, real_name, ofd, ++ skip_stat ? NULL : &target_stat, 0); + obfd = 0; + free (ofilename); + } +diff -rup binutils.orig/binutils/bucomm.c binutils-2.35.1/binutils/bucomm.c +--- binutils.orig/binutils/bucomm.c 2021-01-29 11:14:51.422571073 +0000 ++++ binutils-2.35.1/binutils/bucomm.c 2021-01-29 11:15:33.431322133 +0000 +@@ -532,7 +532,7 @@ template_in_dir (const char *path) + as FILENAME. */ + + char * +-make_tempname (const char *filename) ++make_tempname (const char *filename, int *ofd) + { + char *tmpname = template_in_dir (filename); + int fd; +@@ -550,7 +550,7 @@ make_tempname (const char *filename) + free (tmpname); + return NULL; + } +- close (fd); ++ *ofd = fd; + return tmpname; + } + +diff -rup binutils.orig/binutils/bucomm.h binutils-2.35.1/binutils/bucomm.h +--- binutils.orig/binutils/bucomm.h 2021-01-29 11:14:51.350571503 +0000 ++++ binutils-2.35.1/binutils/bucomm.h 2021-01-29 11:15:56.174187367 +0000 +@@ -51,7 +51,7 @@ int display_info (void); + + void print_arelt_descr (FILE *, bfd *, bfd_boolean, bfd_boolean); + +-char *make_tempname (const char *); ++char *make_tempname (const char *, int *); + char *make_tempdir (const char *); + + bfd_vma parse_vma (const char *, const char *); +@@ -71,7 +71,8 @@ extern void print_version (const char *) + /* In rename.c. */ + extern void set_times (const char *, const struct stat *); + +-extern int smart_rename (const char *, const char *, int); ++extern int smart_rename (const char *, const char *, int, struct stat *, int); ++ + + /* In libiberty. */ + void *xmalloc (size_t); +diff -rup binutils.orig/binutils/objcopy.c binutils-2.35.1/binutils/objcopy.c +--- binutils.orig/binutils/objcopy.c 2021-01-29 11:14:51.342571551 +0000 ++++ binutils-2.35.1/binutils/objcopy.c 2021-01-29 11:15:56.175187361 +0000 +@@ -20,6 +20,7 @@ + + #include "sysdep.h" + #include "bfd.h" ++#include "libbfd.h" + #include "progress.h" + #include "getopt.h" + #include "libiberty.h" +@@ -3711,9 +3712,9 @@ set_long_section_mode (bfd *output_bfd, + /* The top-level control. */ + + static void +-copy_file (const char *input_filename, const char *output_filename, +- const char *input_target, const char *output_target, +- const bfd_arch_info_type *input_arch) ++copy_file (const char *input_filename, const char *output_filename, int ofd, ++ struct stat *in_stat, const char *input_target, ++ const char *output_target, const bfd_arch_info_type *input_arch) + { + bfd *ibfd; + char **obj_matching; +@@ -3732,7 +3733,7 @@ copy_file (const char *input_filename, c + /* To allow us to do "strip *" without dying on the first + non-object file, failures are nonfatal. */ + ibfd = bfd_openr (input_filename, input_target); +- if (ibfd == NULL) ++ if (ibfd == NULL || fstat (fileno (ibfd->iostream), in_stat) != 0) + { + bfd_nonfatal_message (input_filename, NULL, NULL, NULL); + status = 1; +@@ -3786,9 +3787,14 @@ copy_file (const char *input_filename, c + else + force_output_target = TRUE; + +- obfd = bfd_openw (output_filename, output_target); ++ if (ofd >= 0) ++ obfd = bfd_fdopenw (output_filename, output_target, ofd); ++ else ++ obfd = bfd_openw (output_filename, output_target); ++ + if (obfd == NULL) + { ++ close (ofd); + bfd_nonfatal_message (output_filename, NULL, NULL, NULL); + status = 1; + return; +@@ -3816,13 +3822,19 @@ copy_file (const char *input_filename, c + if (output_target == NULL) + output_target = bfd_get_target (ibfd); + +- obfd = bfd_openw (output_filename, output_target); ++ if (ofd >= 0) ++ obfd = bfd_fdopenw (output_filename, output_target, ofd); ++ else ++ obfd = bfd_openw (output_filename, output_target); ++ + if (obfd == NULL) + { ++ close (ofd); + bfd_nonfatal_message (output_filename, NULL, NULL, NULL); + status = 1; + return; + } ++ + /* This is a no-op on non-Coff targets. */ + set_long_section_mode (obfd, ibfd, long_section_names); + +@@ -4786,6 +4798,8 @@ strip_main (int argc, char *argv[]) + int hold_status = status; + struct stat statbuf; + char *tmpname; ++ int tmpfd = -1; ++ int copyfd = -1; + + if (get_file_size (argv[i]) < 1) + { +@@ -4793,18 +4807,18 @@ strip_main (int argc, char *argv[]) + continue; + } + +- if (preserve_dates) +- /* No need to check the return value of stat(). +- It has already been checked in get_file_size(). */ +- stat (argv[i], &statbuf); +- + if (output_file == NULL + || filename_cmp (argv[i], output_file) == 0) +- tmpname = make_tempname (argv[i]); ++ tmpname = make_tempname (argv[i], &tmpfd); + else + tmpname = output_file; + +- if (tmpname == NULL) ++ if (tmpname == NULL ++#if !defined (_WIN32) || defined (__CYGWIN32__) ++ /* Retain a copy of TMPFD since we will need it for SMART_RENAME. */ ++ || (tmpfd >= 0 && (copyfd = dup (tmpfd)) == -1) ++#endif ++ ) + { + bfd_nonfatal_message (argv[i], NULL, NULL, + _("could not create temporary file to hold stripped copy")); +@@ -4813,7 +4827,8 @@ strip_main (int argc, char *argv[]) + } + + status = 0; +- copy_file (argv[i], tmpname, input_target, output_target, NULL); ++ copy_file (argv[i], tmpname, tmpfd, &statbuf, input_target, ++ output_target, NULL); + if (status == 0) + { + if (preserve_dates) +@@ -4821,12 +4836,18 @@ strip_main (int argc, char *argv[]) + if (output_file != tmpname) + status = (smart_rename (tmpname, + output_file ? output_file : argv[i], +- preserve_dates) != 0); ++ copyfd, &statbuf, preserve_dates) != 0); + if (status == 0) + status = hold_status; + } + else +- unlink_if_ordinary (tmpname); ++ { ++#if !defined (_WIN32) || defined (__CYGWIN32__) ++ if (copyfd >= 0) ++ close (copyfd); ++#endif ++ unlink_if_ordinary (tmpname); ++ } + if (output_file != tmpname) + free (tmpname); + } +@@ -5033,7 +5054,8 @@ copy_main (int argc, char *argv[]) + bfd_boolean formats_info = FALSE; + bfd_boolean use_globalize = FALSE; + bfd_boolean use_keep_global = FALSE; +- int c; ++ int c, tmpfd = -1; ++ int copyfd = -1; + struct stat statbuf; + const bfd_arch_info_type *input_arch = NULL; + +@@ -5870,34 +5892,43 @@ copy_main (int argc, char *argv[]) + convert_efi_target (efi); + } + +- if (preserve_dates) +- if (stat (input_filename, & statbuf) < 0) +- fatal (_("warning: could not locate '%s'. System error message: %s"), +- input_filename, strerror (errno)); +- + /* If there is no destination file, or the source and destination files + are the same, then create a temp and rename the result into the input. */ + if (output_filename == NULL + || filename_cmp (input_filename, output_filename) == 0) +- tmpname = make_tempname (input_filename); ++ tmpname = make_tempname (input_filename, &tmpfd); + else + tmpname = output_filename; + +- if (tmpname == NULL) +- fatal (_("warning: could not create temporary file whilst copying '%s', (error: %s)"), +- input_filename, strerror (errno)); ++ if (tmpname == NULL ++#if !defined (_WIN32) || defined (__CYGWIN32__) ++ /* Retain a copy of TMPFD since we will need it for SMART_RENAME. */ ++ || (tmpfd >= 0 && (copyfd = dup (tmpfd)) == -1) ++#endif ++ ) ++ { ++ fatal (_("warning: could not create temporary file whilst copying '%s', (error: %s)"), ++ input_filename, strerror (errno)); ++ } + +- copy_file (input_filename, tmpname, input_target, output_target, input_arch); ++ copy_file (input_filename, tmpname, tmpfd, &statbuf, input_target, ++ output_target, input_arch); + if (status == 0) + { + if (preserve_dates) + set_times (tmpname, &statbuf); + if (tmpname != output_filename) +- status = (smart_rename (tmpname, input_filename, ++ status = (smart_rename (tmpname, input_filename, copyfd, &statbuf, + preserve_dates) != 0); + } + else +- unlink_if_ordinary (tmpname); ++ { ++#if !defined (_WIN32) || defined (__CYGWIN32__) ++ if (copyfd >= 0) ++ close (copyfd); ++#endif ++ unlink_if_ordinary (tmpname); ++ } + + if (tmpname != output_filename) + free (tmpname); +diff -rup binutils.orig/binutils/rename.c binutils-2.35.1/binutils/rename.c +--- binutils.orig/binutils/rename.c 2021-01-29 11:14:51.422571073 +0000 ++++ binutils-2.35.1/binutils/rename.c 2021-01-29 11:15:56.175187361 +0000 +@@ -131,17 +131,55 @@ set_times (const char *destination, cons + #endif + #endif + +-/* Rename FROM to TO, copying if TO is a link. +- Return 0 if ok, -1 if error. */ ++#if !defined (_WIN32) || defined (__CYGWIN32__) ++/* Try to preserve the permission bits and ownership of an existing file when ++ rename overwrites it. FD is the file being renamed and TARGET_STAT has the ++ status of the file that was overwritten. */ ++static void ++try_preserve_permissions (int fd, struct stat *target_stat) ++{ ++ struct stat from_stat; ++ int ret = 0; ++ ++ if (fstat (fd, &from_stat) != 0) ++ return; ++ ++ int from_mode = from_stat.st_mode & 0777; ++ int to_mode = target_stat->st_mode & 0777; ++ ++ /* Fix up permissions before we potentially lose ownership with fchown. ++ Clear the setxid bits because in case the fchown below fails then we don't ++ want to end up with a sxid file owned by the invoking user. If the user ++ hasn't changed or if fchown succeeded, we add back the sxid bits at the ++ end. */ ++ if (from_mode != to_mode) ++ fchmod (fd, to_mode); ++ ++ /* Fix up ownership, this will clear the setxid bits. */ ++ if (from_stat.st_uid != target_stat->st_uid ++ || from_stat.st_gid != target_stat->st_gid) ++ ret = fchown (fd, target_stat->st_uid, target_stat->st_gid); ++ ++ /* Fix up the sxid bits if either the fchown wasn't needed or it ++ succeeded. */ ++ if (ret == 0) ++ fchmod (fd, target_stat->st_mode & 07777); ++} ++#endif ++ ++/* Rename FROM to TO, copying if TO is either a link or is not a regular file. ++ FD is an open file descriptor pointing to FROM that we can use to safely fix ++ up permissions of the file after renaming. TARGET_STAT has the file status ++ that is used to fix up permissions and timestamps after rename. Return 0 if ++ ok, -1 if error and FD is closed before returning. */ + + int +-smart_rename (const char *from, const char *to, int preserve_dates ATTRIBUTE_UNUSED) ++smart_rename (const char *from, const char *to, int fd ATTRIBUTE_UNUSED, ++ struct stat *target_stat ATTRIBUTE_UNUSED, ++ int preserve_dates ATTRIBUTE_UNUSED) + { +- bfd_boolean exists; +- struct stat s; + int ret = 0; +- +- exists = lstat (to, &s) == 0; ++ bfd_boolean exists = target_stat != NULL; + + #if defined (_WIN32) && !defined (__CYGWIN32__) + /* Win32, unlike unix, will not erase `to' in `rename(from, to)' but +@@ -158,36 +196,35 @@ smart_rename (const char *from, const ch + unlink (from); + } + #else +- /* Use rename only if TO is not a symbolic link and has +- only one hard link, and we have permission to write to it. */ ++ /* Avoid a full copy and use rename if we can fix up permissions of the ++ file after renaming, i.e.: ++ ++ - TO is not a symbolic link ++ - TO is a regular file with only one hard link ++ - We have permission to write to TO ++ - FD is available to safely fix up permissions to be the same as the file ++ we overwrote with the rename. ++ ++ Note though that the actual file on disk that TARGET_STAT describes may ++ have changed and we're only trying to preserve the status we know about. ++ At no point do we try to interact with the new file changes, so there can ++ only be two outcomes, i.e. either the external file change survives ++ without knowledge of our change (if it happens after the rename syscall) ++ or our rename and permissions fixup survive without any knowledge of the ++ external change. */ + if (! exists +- || (!S_ISLNK (s.st_mode) +- && S_ISREG (s.st_mode) +- && (s.st_mode & S_IWUSR) +- && s.st_nlink == 1) ++ || (fd >= 0 ++ && !S_ISLNK (target_stat->st_mode) ++ && S_ISREG (target_stat->st_mode) ++ && (target_stat->st_mode & S_IWUSR) ++ && target_stat->st_nlink == 1) + ) + { + ret = rename (from, to); + if (ret == 0) + { + if (exists) +- { +- /* Try to preserve the permission bits and ownership of +- TO. First get the mode right except for the setuid +- bit. Then change the ownership. Then fix the setuid +- bit. We do the chmod before the chown because if the +- chown succeeds, and we are a normal user, we won't be +- able to do the chmod afterward. We don't bother to +- fix the setuid bit first because that might introduce +- a fleeting security problem, and because the chown +- will clear the setuid bit anyhow. We only fix the +- setuid bit if the chown succeeds, because we don't +- want to introduce an unexpected setuid file owned by +- the user running objcopy. */ +- chmod (to, s.st_mode & 0777); +- if (chown (to, s.st_uid, s.st_gid) >= 0) +- chmod (to, s.st_mode & 07777); +- } ++ try_preserve_permissions (fd, target_stat); + } + else + { +@@ -203,9 +240,11 @@ smart_rename (const char *from, const ch + non_fatal (_("unable to copy file '%s'; reason: %s"), to, strerror (errno)); + + if (preserve_dates) +- set_times (to, &s); ++ set_times (to, target_stat); + unlink (from); + } ++ if (fd >= 0) ++ close (fd); + #endif /* _WIN32 && !__CYGWIN32__ */ + + return ret; +diff -rup binutils.orig/binutils/ar.c binutils-2.35.1/binutils/ar.c +--- binutils.orig/binutils/ar.c 2021-02-02 13:01:42.257734944 +0000 ++++ binutils-2.35.1/binutils/ar.c 2021-02-02 13:11:13.340958352 +0000 +@@ -25,7 +25,6 @@ + + #include "sysdep.h" + #include "bfd.h" +-#include "libbfd.h" + #include "libiberty.h" + #include "progress.h" + #include "getopt.h" +@@ -1082,7 +1081,7 @@ open_output_file (bfd * abfd) + output_filename, base); + output_filename = base; + } +- ++ + if (output_dir) + { + size_t len = strlen (output_dir); +@@ -1099,7 +1098,7 @@ open_output_file (bfd * abfd) + + if (verbose) + printf ("x - %s\n", output_filename); +- ++ + FILE * ostream = fopen (output_filename, FOPEN_WB); + if (ostream == NULL) + { +@@ -1198,10 +1197,8 @@ write_archive (bfd *iarch) + bfd *contents_head = iarch->archive_next; + int ofd = -1; + struct stat target_stat; +- bfd_boolean skip_stat = FALSE; + +- old_name = (char *) xmalloc (strlen (bfd_get_filename (iarch)) + 1); +- strcpy (old_name, bfd_get_filename (iarch)); ++ old_name = xstrdup (bfd_get_filename (iarch)); + new_name = make_tempname (old_name, &ofd); + + if (new_name == NULL) +@@ -1246,11 +1243,9 @@ write_archive (bfd *iarch) + + #if !defined (_WIN32) || defined (__CYGWIN32__) + ofd = dup (ofd); +- if (iarch == NULL || iarch->iostream == NULL) +- skip_stat = TRUE; +- else if (ofd == -1 || fstat (fileno (iarch->iostream), &target_stat) != 0) +- bfd_fatal (old_name); + #endif ++ if (ofd == -1 || bfd_stat (iarch, &target_stat) != 0) ++ bfd_fatal (old_name); + + if (!bfd_close (obfd)) + bfd_fatal (old_name); +@@ -1261,7 +1256,7 @@ write_archive (bfd *iarch) + /* We don't care if this fails; we might be creating the archive. */ + bfd_close (iarch); + +- if (smart_rename (new_name, old_name, ofd, skip_stat ? NULL : &target_stat, 0) != 0) ++ if (smart_rename (new_name, old_name, ofd, &target_stat, 0) != 0) + xexit (1); + free (old_name); + free (new_name); +Only in binutils-2.35.1/binutils/: ar.c.orig +Only in binutils-2.35.1/binutils/: ar.c.rej +diff -rup binutils.orig/binutils/arsup.c binutils-2.35.1/binutils/arsup.c +--- binutils.orig/binutils/arsup.c 2021-02-02 13:01:42.208735269 +0000 ++++ binutils-2.35.1/binutils/arsup.c 2021-02-02 13:11:55.725678308 +0000 +@@ -42,6 +42,8 @@ extern int deterministic; + + static bfd *obfd; + static char *real_name; ++static char *temp_name; ++static int real_ofd; + static FILE *outfile; + + static void +@@ -149,27 +151,24 @@ maybequit (void) + void + ar_open (char *name, int t) + { +- char *tname; +- const char *bname = lbasename (name); +- real_name = name; +- +- /* Prepend tmp- to the beginning, to avoid file-name clashes after +- truncation on filesystems with limited namespaces (DOS). */ +- if (asprintf (&tname, "%.*stmp-%s", (int) (bname - name), name, bname) == -1) ++ real_name = xstrdup (name); ++ temp_name = make_tempname (real_name, &real_ofd); ++ ++ if (temp_name == NULL) + { +- fprintf (stderr, _("%s: Can't allocate memory for temp name (%s)\n"), ++ fprintf (stderr, _("%s: Can't open temporary file (%s)\n"), + program_name, strerror(errno)); + maybequit (); + return; + } + +- obfd = bfd_openw (tname, NULL); ++ obfd = bfd_fdopenw (temp_name, NULL, real_ofd); + + if (!obfd) + { + fprintf (stderr, + _("%s: Can't open output archive %s\n"), +- program_name, tname); ++ program_name, temp_name); + + maybequit (); + } +@@ -344,10 +343,9 @@ ar_save (void) + } + else + { +- char *ofilename = xstrdup (bfd_get_filename (obfd)); + bfd_boolean skip_stat = FALSE; + struct stat target_stat; +- int ofd = -1; ++ int ofd = real_ofd; + + if (deterministic > 0) + obfd->flags |= BFD_DETERMINISTIC_OUTPUT; +@@ -355,17 +353,18 @@ ar_save (void) + #if !defined (_WIN32) || defined (__CYGWIN32__) + /* It's OK to fail; at worst it will result in SMART_RENAME using a slow + copy fallback to write the output. */ +- ofd = dup (fileno (obfd->iostream)); +- if (lstat (real_name, &target_stat) != 0) +- skip_stat = TRUE; ++ ofd = dup (ofd); + #endif +- + bfd_close (obfd); + +- smart_rename (ofilename, real_name, ofd, ++ if (ofd == -1 || fstat (ofd, &target_stat) != 0) ++ skip_stat = TRUE; ++ ++ smart_rename (temp_name, real_name, ofd, + skip_stat ? NULL : &target_stat, 0); + obfd = 0; +- free (ofilename); ++ free (temp_name); ++ free (real_name); + } + } + +Only in binutils-2.35.1/binutils/: arsup.c.orig +Only in binutils-2.35.1/binutils/: arsup.c.rej +diff -rup binutils.orig/binutils/objcopy.c binutils-2.35.1/binutils/objcopy.c +--- binutils.orig/binutils/objcopy.c 2021-02-02 13:01:42.214735229 +0000 ++++ binutils-2.35.1/binutils/objcopy.c 2021-02-02 13:13:27.613071192 +0000 +@@ -20,7 +20,6 @@ + + #include "sysdep.h" + #include "bfd.h" +-#include "libbfd.h" + #include "progress.h" + #include "getopt.h" + #include "libiberty.h" +@@ -3733,7 +3732,7 @@ copy_file (const char *input_filename, c + /* To allow us to do "strip *" without dying on the first + non-object file, failures are nonfatal. */ + ibfd = bfd_openr (input_filename, input_target); +- if (ibfd == NULL || fstat (fileno (ibfd->iostream), in_stat) != 0) ++ if (ibfd == NULL || bfd_stat (ibfd, in_stat) != 0) + { + bfd_nonfatal_message (input_filename, NULL, NULL, NULL); + status = 1; +Only in binutils-2.35.1/binutils/: objcopy.c.orig +Only in binutils-2.35.1/binutils/: objcopy.c.rej +--- binutils.orig/binutils/arsup.c 2021-02-04 10:42:03.265729780 +0000 ++++ binutils-2.35.1/binutils/arsup.c 2021-02-04 10:45:48.439166658 +0000 +@@ -357,8 +357,21 @@ ar_save (void) + #endif + bfd_close (obfd); + +- if (ofd == -1 || fstat (ofd, &target_stat) != 0) +- skip_stat = TRUE; ++ if (lstat (real_name, &target_stat) != 0) ++ { ++ /* The temp file created in ar_open has mode 0600 as per mkstemp. ++ Create the real empty output file here so smart_rename will ++ update the mode according to the process umask. */ ++ obfd = bfd_openw (real_name, NULL); ++ if (obfd == NULL ++ || bfd_stat (obfd, &target_stat) != 0) ++ skip_stat = TRUE; ++ if (obfd != NULL) ++ { ++ bfd_set_format (obfd, bfd_archive); ++ bfd_close (obfd); ++ } ++ } + + smart_rename (temp_name, real_name, ofd, + skip_stat ? NULL : &target_stat, 0); +--- binutils.orig/binutils/rename.c 2021-02-08 11:02:58.767933783 +0000 ++++ binutils-2.35.1/binutils/rename.c 2021-02-08 11:20:37.539179363 +0000 +@@ -179,7 +179,10 @@ smart_rename (const char *from, const ch + int preserve_dates ATTRIBUTE_UNUSED) + { + int ret = 0; +- bfd_boolean exists = target_stat != NULL; ++ struct stat to_stat; ++ bfd_boolean exists; ++ ++ exists = lstat (to, &to_stat) == 0; + + #if defined (_WIN32) && !defined (__CYGWIN32__) + /* Win32, unlike unix, will not erase `to' in `rename(from, to)' but +@@ -214,16 +217,16 @@ smart_rename (const char *from, const ch + external change. */ + if (! exists + || (fd >= 0 +- && !S_ISLNK (target_stat->st_mode) +- && S_ISREG (target_stat->st_mode) +- && (target_stat->st_mode & S_IWUSR) +- && target_stat->st_nlink == 1) ++ && !S_ISLNK (to_stat.st_mode) ++ && S_ISREG (to_stat.st_mode) ++ && (to_stat.st_mode & S_IWUSR) ++ && to_stat.st_nlink == 1) + ) + { + ret = rename (from, to); + if (ret == 0) + { +- if (exists) ++ if (exists && target_stat != NULL) + try_preserve_permissions (fd, target_stat); + } + else +@@ -239,7 +242,7 @@ smart_rename (const char *from, const ch + if (ret != 0) + non_fatal (_("unable to copy file '%s'; reason: %s"), to, strerror (errno)); + +- if (preserve_dates) ++ if (preserve_dates && target_stat != NULL) + set_times (to, target_stat); + unlink (from); + } diff --git a/binutils-PELC-licence-corrections.patch b/binutils-PELC-licence-corrections.patch new file mode 100644 index 0000000..e6bf2fe --- /dev/null +++ b/binutils-PELC-licence-corrections.patch @@ -0,0 +1,9 @@ +--- binutils.orig/gold/ftruncate.c 2020-07-24 15:12:47.000947859 +0100 ++++ binutils-2.35/gold/ftruncate.c 2020-07-24 15:19:17.602438295 +0100 +@@ -1,5 +1,4 @@ +-/* ftruncate emulations that work on some System V's. +- This file is in the public domain. */ ++/* ftruncate emulations that work on some System V's. */ + + /* Copyright (C) 2012-2020 Free Software Foundation, Inc. + diff --git a/binutils-PPC-dcbt.patch b/binutils-PPC-dcbt.patch new file mode 100644 index 0000000..deef8c5 --- /dev/null +++ b/binutils-PPC-dcbt.patch @@ -0,0 +1,144 @@ +diff -rup binutils.orig/gas/testsuite/gas/ppc/power4_32.d binutils-2.35/gas/testsuite/gas/ppc/power4_32.d +--- binutils.orig/gas/testsuite/gas/ppc/power4_32.d 2022-01-25 13:39:48.063563099 +0000 ++++ binutils-2.35/gas/testsuite/gas/ppc/power4_32.d 2022-01-25 13:48:30.857981751 +0000 +@@ -41,7 +41,7 @@ Disassembly of section \.text: + 7c: (7c 01 17 ec|ec 17 01 7c) dcbz r1,r2 + 80: (7c 23 27 ec|ec 27 23 7c) dcbzl r3,r4 + 84: (7c 05 37 ec|ec 37 05 7c) dcbz r5,r6 +- 88: (7c 05 32 2c|2c 32 05 7c) dcbt r5,r6 +- 8c: (7c 05 32 2c|2c 32 05 7c) dcbt r5,r6 +- 90: (7d 05 32 2c|2c 32 05 7d) dcbt r5,r6,8 ++ 88: (7c 05 32 2c|2c 32 05 7c) dcbtct r5,r6 ++ 8c: (7c 05 32 2c|2c 32 05 7c) dcbtct r5,r6 ++ 90: (7d 05 32 2c|2c 32 05 7d) dcbtds r5,r6 + #pass +diff -rup binutils.orig/opcodes/ppc-opc.c binutils-2.35/opcodes/ppc-opc.c +--- binutils.orig/opcodes/ppc-opc.c 2022-01-25 13:39:47.650565929 +0000 ++++ binutils-2.35/opcodes/ppc-opc.c 2022-01-25 13:47:09.056542122 +0000 +@@ -2205,6 +2205,74 @@ extract_sxl (uint64_t insn, + return 1; + return (insn >> 11) & 0x1; + } ++ ++/* The list of embedded processors that use the embedded operand ordering ++ for the 3 operand dcbt and dcbtst instructions. */ ++#define DCBT_EO (PPC_OPCODE_E500 | PPC_OPCODE_E500MC | PPC_OPCODE_476 \ ++ | PPC_OPCODE_A2) ++ ++/* ISA 2.03 and later specify extended mnemonics dcbtct, dcbtds, and ++ dcbtstct, dcbtstds with a note saying these should be used in new ++ programs rather than the base mnemonics "so that it can be coded ++ with TH as the last operand for all categories". For that reason ++ the extended mnemonics are enabled in the assembler for the ++ embedded processors, but not for the disassembler so as to display ++ the embedded dcbt or dcbtst expected form with TH first for ++ embedded programmers. */ ++ ++static uint64_t ++insert_thct (uint64_t insn, ++ int64_t value, ++ ppc_cpu_t dialect ATTRIBUTE_UNUSED, ++ const char **errmsg) ++{ ++ if ((uint64_t) value > 7) ++ *errmsg = _("invalid TH value"); ++ return insn | ((value & 7) << 21); ++} ++ ++static int64_t ++extract_thct (uint64_t insn, ++ ppc_cpu_t dialect, ++ int *invalid) ++{ ++ /* Missing optional operands have a value of 0. */ ++ if (*invalid < 0) ++ return 0; ++ ++ int64_t value = (insn >> 21) & 0x1f; ++ if (value > 7 || (dialect & DCBT_EO) != 0) ++ *invalid = 1; ++ ++ return value; ++} ++ ++static uint64_t ++insert_thds (uint64_t insn, ++ int64_t value, ++ ppc_cpu_t dialect ATTRIBUTE_UNUSED, ++ const char **errmsg) ++{ ++ if (value < 8 || value > 15) ++ *errmsg = _("invalid TH value"); ++ return insn | ((value & 0x1f) << 21); ++} ++ ++static int64_t ++extract_thds (uint64_t insn, ++ ppc_cpu_t dialect, ++ int *invalid) ++{ ++ /* Missing optional operands have a value of 8. */ ++ if (*invalid < 0) ++ return 8; ++ ++ int64_t value = (insn >> 21) & 0x1f; ++ if (value < 8 || value > 15 || (dialect & DCBT_EO) != 0) ++ *invalid = 1; ++ ++ return value; ++} + + /* The operands table. + +@@ -2402,10 +2470,18 @@ const struct powerpc_operand powerpc_ope + #define MO CT + { 0x1f, 21, NULL, NULL, PPC_OPERAND_OPTIONAL }, + ++ /* The TH field in dcbtct. */ ++#define THCT CT + 1 ++ { 0x1f, 21, insert_thct, extract_thct, PPC_OPERAND_OPTIONAL }, ++ ++ /* The TH field in dcbtds. */ ++#define THDS THCT + 1 ++ { 0x1f, 21, insert_thds, extract_thds, PPC_OPERAND_OPTIONAL }, ++ + /* The D field in a D form instruction. This is a displacement off + a register, and implies that the next operand is a register in + parentheses. */ +-#define D CT + 1 ++#define D THDS + 1 + { 0xffff, 0, NULL, NULL, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED }, + + /* The D8 field in a D form instruction. This is a displacement off +@@ -4211,12 +4287,6 @@ const unsigned int num_powerpc_operands + #define PPCHTM PPC_OPCODE_POWER8 + #define E200Z4 PPC_OPCODE_E200Z4 + #define PPCLSP PPC_OPCODE_LSP +-/* The list of embedded processors that use the embedded operand ordering +- for the 3 operand dcbt and dcbtst instructions. */ +-#define DCBT_EO (PPC_OPCODE_E500 | PPC_OPCODE_E500MC | PPC_OPCODE_476 \ +- | PPC_OPCODE_A2) +- +- + + /* The opcode table. + +@@ -6592,6 +6662,8 @@ const struct powerpc_opcode powerpc_opco + {"mtvsrwz", X(31,243), XX1RB_MASK, PPCVSX2, 0, {XT6, RA}}, + + {"dcbtstt", XRT(31,246,0x10), XRT_MASK, POWER7, 0, {RA0, RB}}, ++{"dcbtstct", X(31,246), X_MASK, POWER4, 0, {RA0, RB, THCT}}, ++{"dcbtstds", X(31,246), X_MASK, POWER4, 0, {RA0, RB, THDS}}, + {"dcbtst", X(31,246), X_MASK, POWER4, DCBT_EO, {RA0, RB, CT}}, + {"dcbtst", X(31,246), X_MASK, DCBT_EO, 0, {CT, RA0, RB}}, + {"dcbtst", X(31,246), X_MASK, PPC, POWER4|DCBT_EO, {RA0, RB}}, +@@ -6643,6 +6715,9 @@ const struct powerpc_opcode powerpc_opco + {"lscbx.", XRC(31,277,1), X_MASK, M601, 0, {RT, RA, RB}}, + + {"dcbtt", XRT(31,278,0x10), XRT_MASK, POWER7, 0, {RA0, RB}}, ++{"dcbna", XRT(31,278,0x11), XRT_MASK, POWER10, 0, {RA0, RB}}, ++{"dcbtct", X(31,278), X_MASK, POWER4, 0, {RA0, RB, THCT}}, ++{"dcbtds", X(31,278), X_MASK, POWER4, 0, {RA0, RB, THDS}}, + {"dcbt", X(31,278), X_MASK, POWER4, DCBT_EO, {RA0, RB, CT}}, + {"dcbt", X(31,278), X_MASK, DCBT_EO, 0, {CT, RA0, RB}}, + {"dcbt", X(31,278), X_MASK, PPC, POWER4|DCBT_EO, {RA0, RB}}, diff --git a/binutils-aarch64-ld-testsuite-fixes.patch b/binutils-aarch64-ld-testsuite-fixes.patch new file mode 100644 index 0000000..45eeb7a --- /dev/null +++ b/binutils-aarch64-ld-testsuite-fixes.patch @@ -0,0 +1,200 @@ +diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d binutils-2.35/ld/testsuite/ld-aarch64/variant_pcs-now.d +--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d 2020-07-28 13:07:26.192507117 +0100 ++++ binutils-2.35/ld/testsuite/ld-aarch64/variant_pcs-now.d 2020-07-28 13:09:47.205905999 +0100 +@@ -23,10 +23,10 @@ Symbol table '\.dynsym' contains 7 entri + Num: Value Size Type Bind Vis Ndx Name + 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND + 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef +- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef +- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT .* ++ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT .* + 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def +- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT .* + 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc + + Symbol table '\.symtab' contains 35 entries: +@@ -41,28 +41,28 @@ Symbol table '\.symtab' contains 35 entr + 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7 + 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8 + 9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o +- 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local +- 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc ++ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT .* ++ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT .* + 12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc + 13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local + 14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x + 15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o +- 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2 +- 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc ++ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT .* ++ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT .* + 18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc + 19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2 + 20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x + 21: 0000000000000000 0 FILE LOCAL DEFAULT ABS + 22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC +- 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def ++ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT .* + 24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc + 25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def + 26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ +- 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc ++ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT .* + 28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x + 29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef +- 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef +- 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT .* ++ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT .* + 32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def +- 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT .* + 34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc +diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-r.d binutils-2.35/ld/testsuite/ld-aarch64/variant_pcs-r.d +--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-r.d 2020-07-28 13:07:26.184507150 +0100 ++++ binutils-2.35/ld/testsuite/ld-aarch64/variant_pcs-r.d 2020-07-28 13:08:20.069277447 +0100 +@@ -37,24 +37,24 @@ Symbol table '\.symtab' contains 26 entr + 2: 0000000000000000 0 SECTION LOCAL DEFAULT 3 + 3: 0000000000000000 0 SECTION LOCAL DEFAULT 4 + 4: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o +- 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local +- 6: 0000000000000000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc ++ 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT .* ++ 6: 0000000000000000 0 IFUNC LOCAL DEFAULT .* + 7: 0000000000000000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc + 8: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 f_base_local + 9: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 \$x + 10: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o +- 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2 +- 12: 0000000000000038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc ++ 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT .* ++ 12: 0000000000000038 0 IFUNC LOCAL DEFAULT .* + 13: 0000000000000038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc + 14: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2 + 15: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 \$x + 16: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef +- 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef +- 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_def ++ 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT .* ++ 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN .* + 19: 0000000000000000 0 IFUNC GLOBAL HIDDEN 1 f_base_global_hidden_ifunc +- 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT .* + 21: 0000000000000000 0 NOTYPE GLOBAL HIDDEN 1 f_base_global_hidden_def +- 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc ++ 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN .* + 23: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def +- 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT .* + 25: 0000000000000000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc +diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d binutils-2.35/ld/testsuite/ld-aarch64/variant_pcs-shared.d +--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2020-07-28 13:07:26.183507154 +0100 ++++ binutils-2.35/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2020-07-28 13:09:00.519105015 +0100 +@@ -23,10 +23,10 @@ Symbol table '\.dynsym' contains 7 entri + Num: Value Size Type Bind Vis Ndx Name + 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND + 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef +- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef +- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT .* ++ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT .* + 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def +- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT .* + 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc + + Symbol table '\.symtab' contains 35 entries: +@@ -41,28 +41,28 @@ Symbol table '\.symtab' contains 35 entr + 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7 + 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8 + 9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o +- 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local +- 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc ++ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT .* ++ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT .* + 12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc + 13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local + 14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x + 15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o +- 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2 +- 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc ++ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT .* ++ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT .* + 18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc + 19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2 + 20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x + 21: 0000000000000000 0 FILE LOCAL DEFAULT ABS + 22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC +- 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def ++ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT .* + 24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc + 25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def + 26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ +- 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc ++ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT .* + 28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x + 29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef +- 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef +- 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT .* ++ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT .* + 32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def +- 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT .* + 34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc +diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-12.d binutils-2.35/ld/testsuite/ld-plugin/plugin-12.d +--- binutils.orig/ld/testsuite/ld-plugin/plugin-12.d 2020-07-28 13:07:26.246506887 +0100 ++++ binutils-2.35/ld/testsuite/ld-plugin/plugin-12.d 2020-07-28 13:10:51.694631104 +0100 +@@ -1,6 +1,6 @@ + #... +-.*: symbol `func' definition: DEF, visibility: DEFAULT, resolution: PREVAILING_DEF +-.*: symbol `func1' definition: DEF, visibility: PROTECTED, resolution: PREVAILING_DEF_IRONLY +-.*: symbol `func2' definition: DEF, visibility: INTERNAL, resolution: PREVAILING_DEF_IRONLY +-.*: symbol `func3' definition: DEF, visibility: HIDDEN, resolution: PREVAILING_DEF_IRONLY ++.*: symbol `func' definition: DEF, visibility: DEFAULT, resolution: PREVAILING_DE.* ++.*: symbol `func1' definition: DEF, visibility: PROTECTED, resolution: PREVAILING_DE.* ++.*: symbol `func2' definition: DEF, visibility: INTERNAL, resolution: PREVAILING_DE.* ++.*: symbol `func3' definition: DEF, visibility: HIDDEN, resolution: PREVAILING_DE.* + #pass +diff -rup binutils.orig/ld/testsuite/ld-elf/indirect.exp binutils-2.35/ld/testsuite/ld-elf/indirect.exp +--- binutils.orig/ld/testsuite/ld-elf/indirect.exp 2020-07-28 13:37:46.473794149 +0100 ++++ binutils-2.35/ld/testsuite/ld-elf/indirect.exp 2020-07-28 14:10:44.867990380 +0100 +@@ -229,7 +229,7 @@ set pie_tests { + + run_ld_link_exec_tests $pie_tests + +-foreach t [list indirect5c indirect5d indirect6c indirect6d] { ++foreach t [list indirect6c indirect6d] { + set testname [concat $t "dynsym"] + if { [check_dynamic_syms tmpdir/$t] } { + pass $testname +diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-12.d binutils-2.35/ld/testsuite/ld-plugin/plugin-12.d +--- binutils.orig/ld/testsuite/ld-plugin/plugin-12.d 2020-07-28 13:37:46.393794486 +0100 ++++ binutils-2.35/ld/testsuite/ld-plugin/plugin-12.d 2020-07-28 14:14:14.632159645 +0100 +@@ -1,6 +1,6 @@ + #... +-.*: symbol `func' definition: DEF, visibility: DEFAULT, resolution: PREVAILING_DE.* +-.*: symbol `func1' definition: DEF, visibility: PROTECTED, resolution: PREVAILING_DE.* +-.*: symbol `func2' definition: DEF, visibility: INTERNAL, resolution: PREVAILING_DE.* +-.*: symbol `func3' definition: DEF, visibility: HIDDEN, resolution: PREVAILING_DE.* ++.*func' definition: DEF, visibility: DEFAULT, resolution: PREVAILING_DE.* ++.*func1' definition: DEF, visibility: PROTECTED, resolution: PREVAILING_DE.* ++.*func2' definition: DEF, visibility: INTERNAL, resolution: PREVAILING_DE.* ++.*func3' definition: DEF, visibility: HIDDEN, resolution: PREVAILING_DE.* + #pass +diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin.exp binutils-2.35/ld/testsuite/ld-plugin/plugin.exp +--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2020-07-28 15:07:51.601384963 +0100 ++++ binutils-2.35/ld/testsuite/ld-plugin/plugin.exp 2020-07-28 15:11:38.753471155 +0100 +@@ -301,6 +301,9 @@ if { !$can_compile || $failed_compile } + run_ld_link_tests $plugin_tests + + if { [is_elf_format] \ ++ && ![istarget "aarch64*-*-*"] \ ++ && ![istarget "s390*-*-*"] \ ++ && ![istarget "i686*-*-*"] \ + && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func1p.c tmpdir/func1p.o] \ + && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func2i.c tmpdir/func2i.o] \ + && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func3h.c tmpdir/func3h.o] } { diff --git a/binutils-aarch64-plt-sh_entsize.patch b/binutils-aarch64-plt-sh_entsize.patch new file mode 100644 index 0000000..41912f1 --- /dev/null +++ b/binutils-aarch64-plt-sh_entsize.patch @@ -0,0 +1,27 @@ +diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.35/bfd/elfnn-aarch64.c +--- binutils.orig/bfd/elfnn-aarch64.c 2020-07-30 17:20:30.607580720 +0100 ++++ binutils-2.35/bfd/elfnn-aarch64.c 2020-07-30 17:22:45.629741124 +0100 +@@ -9513,8 +9513,10 @@ elfNN_aarch64_init_small_plt0_entry (bfd + + memcpy (htab->root.splt->contents, htab->plt0_entry, + htab->plt_header_size); +- elf_section_data (htab->root.splt->output_section)->this_hdr.sh_entsize = +- htab->plt_header_size; ++ /* PR 26312: Explicitly set the sh_entsize to 0 so that ++ consumers do not think that the section contains fixed ++ sized objects. */ ++ elf_section_data (htab->root.splt->output_section)->this_hdr.sh_entsize = 0; + + plt_got_2nd_ent = (htab->root.sgotplt->output_section->vma + + htab->root.sgotplt->output_offset +@@ -9616,10 +9618,6 @@ elfNN_aarch64_finish_dynamic_sections (b + { + elfNN_aarch64_init_small_plt0_entry (output_bfd, htab); + +- elf_section_data (htab->root.splt->output_section)-> +- this_hdr.sh_entsize = htab->plt_entry_size; +- +- + if (htab->root.tlsdesc_plt && !(info->flags & DF_BIND_NOW)) + { + BFD_ASSERT (htab->root.tlsdesc_got != (bfd_vma)-1); diff --git a/binutils-add-sym-cache-to-elf-link-hash.patch b/binutils-add-sym-cache-to-elf-link-hash.patch new file mode 100644 index 0000000..85b2006 --- /dev/null +++ b/binutils-add-sym-cache-to-elf-link-hash.patch @@ -0,0 +1,1981 @@ +diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.35/bfd/elf-bfd.h +--- binutils.orig/bfd/elf-bfd.h 2020-07-30 15:04:05.366466702 +0100 ++++ binutils-2.35/bfd/elf-bfd.h 2020-07-30 15:04:16.707393960 +0100 +@@ -549,6 +549,16 @@ enum elf_target_os + is_nacl /* Native Client. */ + }; + ++/* Used by bfd_sym_from_r_symndx to cache a small number of local ++ symbols. */ ++#define LOCAL_SYM_CACHE_SIZE 32 ++struct sym_cache ++{ ++ bfd *abfd; ++ unsigned long indx[LOCAL_SYM_CACHE_SIZE]; ++ Elf_Internal_Sym sym[LOCAL_SYM_CACHE_SIZE]; ++}; ++ + /* ELF linker hash table. */ + + struct elf_link_hash_table +@@ -676,6 +686,9 @@ struct elf_link_hash_table + /* A linked list of dynamic BFD's loaded in the link. */ + struct elf_link_loaded_list *dyn_loaded; + ++ /* Small local sym cache. */ ++ struct sym_cache sym_cache; ++ + /* Short-cuts to get to dynamic linker sections. */ + asection *sgot; + asection *sgotplt; +@@ -717,16 +730,6 @@ struct elf_link_hash_table + /* Returns TRUE if the hash table is a struct elf_link_hash_table. */ + #define is_elf_hash_table(htab) \ + (((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table) +- +-/* Used by bfd_sym_from_r_symndx to cache a small number of local +- symbols. */ +-#define LOCAL_SYM_CACHE_SIZE 32 +-struct sym_cache +-{ +- bfd *abfd; +- unsigned long indx[LOCAL_SYM_CACHE_SIZE]; +- Elf_Internal_Sym sym[LOCAL_SYM_CACHE_SIZE]; +-}; + + /* Constant information held for an ELF backend. */ + +diff -rup binutils.orig/bfd/elf32-arm.c binutils-2.35/bfd/elf32-arm.c +--- binutils.orig/bfd/elf32-arm.c 2020-07-30 15:04:05.376466638 +0100 ++++ binutils-2.35/bfd/elf32-arm.c 2020-07-30 15:04:16.708393953 +0100 +@@ -3390,9 +3390,6 @@ struct elf32_arm_link_hash_table + bfd_vma offset; + } tls_ldm_got; + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + /* For convenience in allocate_dynrelocs. */ + bfd * obfd; + +@@ -15316,7 +15313,7 @@ elf32_arm_check_relocs (bfd *abfd, struc + if (r_symndx < symtab_hdr->sh_info) + { + /* A local symbol. */ +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->root.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +@@ -16871,7 +16868,8 @@ elf32_arm_size_dynamic_sections (bfd * o + s->size += 4; + } + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ibfd, symndx); ++ isym = bfd_sym_from_r_symndx (&htab->root.sym_cache, ibfd, ++ symndx); + if (isym == NULL) + return FALSE; + +diff -rup binutils.orig/bfd/elf32-bfin.c binutils-2.35/bfd/elf32-bfin.c +--- binutils.orig/bfd/elf32-bfin.c 2020-07-30 15:04:05.377466632 +0100 ++++ binutils-2.35/bfd/elf32-bfin.c 2020-07-30 15:04:16.709393947 +0100 +@@ -4791,16 +4791,6 @@ struct bfin_link_hash_entry + struct bfin_pcrel_relocs_copied *pcrel_relocs_copied; + }; + +-/* bfin ELF linker hash table. */ +- +-struct bfin_link_hash_table +-{ +- struct elf_link_hash_table root; +- +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +-}; +- + #define bfin_hash_entry(ent) ((struct bfin_link_hash_entry *) (ent)) + + static struct bfd_hash_entry * +@@ -4829,15 +4819,14 @@ bfin_link_hash_newfunc (struct bfd_hash_ + static struct bfd_link_hash_table * + bfin_link_hash_table_create (bfd * abfd) + { +- struct bfin_link_hash_table *ret; +- size_t amt = sizeof (struct bfin_link_hash_table); ++ struct elf_link_hash_table *ret; ++ size_t amt = sizeof (struct elf_link_hash_table); + + ret = bfd_zmalloc (amt); + if (ret == NULL) + return NULL; + +- if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, +- bfin_link_hash_newfunc, ++ if (!_bfd_elf_link_hash_table_init (ret, abfd, bfin_link_hash_newfunc, + sizeof (struct elf_link_hash_entry), + BFIN_ELF_DATA)) + { +@@ -4845,9 +4834,7 @@ bfin_link_hash_table_create (bfd * abfd) + return NULL; + } + +- ret->sym_cache.abfd = NULL; +- +- return &ret->root.root; ++ return &ret->root; + } + + /* The size in bytes of an entry in the procedure linkage table. */ +@@ -5418,10 +5405,6 @@ struct bfd_elf_special_section const elf + + #define bfd_elf32_bfd_is_local_label_name \ + bfin_is_local_label_name +-#define bfin_hash_table(p) \ +- ((struct bfin_link_hash_table *) (p)->hash) +- +- + + #define elf_backend_create_dynamic_sections \ + _bfd_elf_create_dynamic_sections +diff -rup binutils.orig/bfd/elf32-csky.c binutils-2.35/bfd/elf32-csky.c +--- binutils.orig/bfd/elf32-csky.c 2020-07-30 15:04:05.378466625 +0100 ++++ binutils-2.35/bfd/elf32-csky.c 2020-07-30 15:04:16.709393947 +0100 +@@ -1208,9 +1208,6 @@ struct csky_elf_link_hash_table + { + struct elf_link_hash_table elf; + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + /* Data for R_CKCORE_TLS_LDM32 relocations. */ + union + { +@@ -2477,7 +2474,7 @@ csky_elf_check_relocs (bfd * abfd, + if (r_symndx < symtab_hdr->sh_info) + { + /* A local symbol. */ +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +@@ -2584,7 +2581,7 @@ csky_elf_check_relocs (bfd * abfd, + asection *s; + Elf_Internal_Sym *loc_isym; + +- loc_isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ loc_isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (loc_isym == NULL) + return FALSE; +diff -rup binutils.orig/bfd/elf32-hppa.c binutils-2.35/bfd/elf32-hppa.c +--- binutils.orig/bfd/elf32-hppa.c 2020-07-30 15:04:05.368466689 +0100 ++++ binutils-2.35/bfd/elf32-hppa.c 2020-07-30 15:04:16.709393947 +0100 +@@ -286,9 +286,6 @@ struct elf32_hppa_link_hash_table + /* Set if we need a .plt stub to support lazy dynamic linking. */ + unsigned int need_plt_stub:1; + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + /* Data for LDM relocations. */ + union + { +@@ -1465,7 +1462,7 @@ elf32_hppa_check_relocs (bfd *abfd, + void *vpp; + Elf_Internal_Sym *isym; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->etab.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +@@ -4038,7 +4035,7 @@ elf32_hppa_relocate_section (bfd *output + else + { + Elf_Internal_Sym *isym +- = bfd_sym_from_r_symndx (&htab->sym_cache, ++ = bfd_sym_from_r_symndx (&htab->etab.sym_cache, + input_bfd, r_symndx); + if (isym == NULL) + return FALSE; +diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.35/bfd/elf32-i386.c +--- binutils.orig/bfd/elf32-i386.c 2020-07-30 15:04:05.380466612 +0100 ++++ binutils-2.35/bfd/elf32-i386.c 2020-07-30 15:04:16.710393941 +0100 +@@ -1158,7 +1158,7 @@ elf_i386_tls_transition (struct bfd_link + { + Elf_Internal_Sym *isym; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL); + } +@@ -1251,7 +1251,7 @@ elf_i386_convert_load_reloc (bfd *abfd, + else + { + local_ref = TRUE; +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, abfd, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, abfd, + r_symndx); + abs_symbol = isym->st_shndx == SHN_ABS; + } +@@ -1529,7 +1529,7 @@ elf_i386_check_relocs (bfd *abfd, + if (r_symndx < symtab_hdr->sh_info) + { + /* A local symbol. */ +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + goto error_return; +@@ -1859,7 +1859,7 @@ elf_i386_check_relocs (bfd *abfd, + void **vpp; + asection *s; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + goto error_return; +diff -rup binutils.orig/bfd/elf32-m32r.c binutils-2.35/bfd/elf32-m32r.c +--- binutils.orig/bfd/elf32-m32r.c 2020-07-30 15:04:05.370466676 +0100 ++++ binutils-2.35/bfd/elf32-m32r.c 2020-07-30 15:04:16.710393941 +0100 +@@ -1498,20 +1498,6 @@ struct elf_m32r_pcrel_relocs_copied + bfd_size_type count; + }; + +-/* m32r ELF linker hash table. */ +- +-struct elf_m32r_link_hash_table +-{ +- struct elf_link_hash_table root; +- +- /* Short-cuts to get to dynamic linker sections. */ +- asection *sdynbss; +- asection *srelbss; +- +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +-}; +- + /* Traverse an m32r ELF linker hash table. */ + + #define m32r_elf_link_hash_traverse(table, func, info) \ +@@ -1524,21 +1510,21 @@ struct elf_m32r_link_hash_table + + #define m32r_elf_hash_table(p) \ + (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \ +- == M32R_ELF_DATA ? ((struct elf_m32r_link_hash_table *) ((p)->hash)) : NULL) ++ == M32R_ELF_DATA ? ((struct elf_link_hash_table *) ((p)->hash)) : NULL) + + /* Create an m32r ELF linker hash table. */ + + static struct bfd_link_hash_table * + m32r_elf_link_hash_table_create (bfd *abfd) + { +- struct elf_m32r_link_hash_table *ret; +- size_t amt = sizeof (struct elf_m32r_link_hash_table); ++ struct elf_link_hash_table *ret; ++ size_t amt = sizeof (struct elf_link_hash_table); + + ret = bfd_zmalloc (amt); + if (ret == NULL) + return NULL; + +- if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, ++ if (!_bfd_elf_link_hash_table_init (ret, abfd, + _bfd_elf_link_hash_newfunc, + sizeof (struct elf_link_hash_entry), + M32R_ELF_DATA)) +@@ -1547,7 +1533,7 @@ m32r_elf_link_hash_table_create (bfd *ab + return NULL; + } + +- return &ret->root.root; ++ return &ret->root; + } + + /* Create dynamic sections when linking against a dynamic object. */ +@@ -1555,7 +1541,7 @@ m32r_elf_link_hash_table_create (bfd *ab + static bfd_boolean + m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) + { +- struct elf_m32r_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + flagword flags, pltflags; + asection *s; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); +@@ -1578,7 +1564,7 @@ m32r_elf_create_dynamic_sections (bfd *a + pltflags |= SEC_READONLY; + + s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags); +- htab->root.splt = s; ++ htab->splt = s; + if (s == NULL + || !bfd_set_section_alignment (s, bed->plt_alignment)) + return FALSE; +@@ -1598,7 +1584,7 @@ m32r_elf_create_dynamic_sections (bfd *a + h = (struct elf_link_hash_entry *) bh; + h->def_regular = 1; + h->type = STT_OBJECT; +- htab->root.hplt = h; ++ htab->hplt = h; + + if (bfd_link_pic (info) + && ! bfd_elf_link_record_dynamic_symbol (info, h)) +@@ -1609,12 +1595,12 @@ m32r_elf_create_dynamic_sections (bfd *a + bed->default_use_rela_p + ? ".rela.plt" : ".rel.plt", + flags | SEC_READONLY); +- htab->root.srelplt = s; ++ htab->srelplt = s; + if (s == NULL + || !bfd_set_section_alignment (s, ptralign)) + return FALSE; + +- if (htab->root.sgot == NULL ++ if (htab->sgot == NULL + && !_bfd_elf_create_got_section (abfd, info)) + return FALSE; + +@@ -1669,7 +1655,7 @@ static bfd_boolean + m32r_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) + { +- struct elf_m32r_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + bfd *dynobj; + asection *s; + +@@ -1796,7 +1782,7 @@ static bfd_boolean + allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) + { + struct bfd_link_info *info; +- struct elf_m32r_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + struct elf_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_indirect) +@@ -1807,7 +1793,7 @@ allocate_dynrelocs (struct elf_link_hash + if (htab == NULL) + return FALSE; + +- if (htab->root.dynamic_sections_created ++ if (htab->dynamic_sections_created + && h->plt.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. +@@ -1821,7 +1807,7 @@ allocate_dynrelocs (struct elf_link_hash + + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h)) + { +- asection *s = htab->root.splt; ++ asection *s = htab->splt; + + /* If this is the first .plt entry, make room for the special + first entry. */ +@@ -1847,10 +1833,10 @@ allocate_dynrelocs (struct elf_link_hash + + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ +- htab->root.sgotplt->size += 4; ++ htab->sgotplt->size += 4; + + /* We also need to make an entry in the .rel.plt section. */ +- htab->root.srelplt->size += sizeof (Elf32_External_Rela); ++ htab->srelplt->size += sizeof (Elf32_External_Rela); + } + else + { +@@ -1878,13 +1864,13 @@ allocate_dynrelocs (struct elf_link_hash + return FALSE; + } + +- s = htab->root.sgot; ++ s = htab->sgot; + + h->got.offset = s->size; + s->size += 4; +- dyn = htab->root.dynamic_sections_created; ++ dyn = htab->dynamic_sections_created; + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h)) +- htab->root.srelgot->size += sizeof (Elf32_External_Rela); ++ htab->srelgot->size += sizeof (Elf32_External_Rela); + } + else + h->got.offset = (bfd_vma) -1; +@@ -1944,7 +1930,7 @@ allocate_dynrelocs (struct elf_link_hash + if (!h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) +- || (htab->root.dynamic_sections_created ++ || (htab->dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { +@@ -1984,7 +1970,7 @@ static bfd_boolean + m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) + { +- struct elf_m32r_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + bfd *dynobj; + asection *s; + bfd_boolean relocs; +@@ -1998,10 +1984,10 @@ m32r_elf_size_dynamic_sections (bfd *out + if (htab == NULL) + return FALSE; + +- dynobj = htab->root.dynobj; ++ dynobj = htab->dynobj; + BFD_ASSERT (dynobj != NULL); + +- if (htab->root.dynamic_sections_created) ++ if (htab->dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (bfd_link_executable (info) && !info->nointerp) +@@ -2060,8 +2046,8 @@ m32r_elf_size_dynamic_sections (bfd *out + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; + end_local_got = local_got + locsymcount; +- s = htab->root.sgot; +- srel = htab->root.srelgot; ++ s = htab->sgot; ++ srel = htab->srelgot; + for (; local_got < end_local_got; ++local_got) + { + if (*local_got > 0) +@@ -2078,7 +2064,7 @@ m32r_elf_size_dynamic_sections (bfd *out + + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ +- elf_link_hash_traverse (&htab->root, allocate_dynrelocs, info); ++ elf_link_hash_traverse (htab, allocate_dynrelocs, info); + + /* We now have determined the sizes of the various dynamic sections. + Allocate memory for them. */ +@@ -2088,9 +2074,9 @@ m32r_elf_size_dynamic_sections (bfd *out + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + +- if (s == htab->root.splt +- || s == htab->root.sgot +- || s == htab->root.sgotplt ++ if (s == htab->splt ++ || s == htab->sgot ++ || s == htab->sgotplt + || s == htab->sdynbss) + { + /* Strip this section if we don't need it; see the +@@ -2098,7 +2084,7 @@ m32r_elf_size_dynamic_sections (bfd *out + } + else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) + { +- if (s->size != 0 && s != htab->root.srelplt) ++ if (s->size != 0 && s != htab->srelplt) + relocs = TRUE; + + /* We use the reloc_count field as a counter if we need +@@ -2188,7 +2174,7 @@ m32r_elf_relocate_section (bfd *output_b + Elf_Internal_Rela *rel, *relend; + /* Assume success. */ + bfd_boolean ret = TRUE; +- struct elf_m32r_link_hash_table *htab = m32r_elf_hash_table (info); ++ struct elf_link_hash_table *htab = m32r_elf_hash_table (info); + bfd_vma *local_got_offsets; + asection *sgot, *splt, *sreloc; + bfd_vma high_address = bfd_get_section_limit (input_bfd, input_section); +@@ -2198,8 +2184,8 @@ m32r_elf_relocate_section (bfd *output_b + + local_got_offsets = elf_local_got_offsets (input_bfd); + +- sgot = htab->root.sgot; +- splt = htab->root.splt; ++ sgot = htab->sgot; ++ splt = htab->splt; + sreloc = NULL; + + rel = relocs; +@@ -2295,7 +2281,7 @@ m32r_elf_relocate_section (bfd *output_b + bfd_boolean dyn; + sec = h->root.u.def.section; + +- dyn = htab->root.dynamic_sections_created; ++ dyn = htab->dynamic_sections_created; + sec = h->root.u.def.section; + if (r_type == R_M32R_GOTPC24 + || (r_type == R_M32R_GOTPC_HI_ULO +@@ -2516,7 +2502,7 @@ m32r_elf_relocate_section (bfd *output_b + off = h->got.offset; + BFD_ASSERT (off != (bfd_vma) -1); + +- dyn = htab->root.dynamic_sections_created; ++ dyn = htab->dynamic_sections_created; + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, + bfd_link_pic (info), + h) +@@ -2576,7 +2562,7 @@ m32r_elf_relocate_section (bfd *output_b + + /* We need to generate a R_M32R_RELATIVE reloc + for the dynamic linker. */ +- srelgot = htab->root.srelgot; ++ srelgot = htab->srelgot; + BFD_ASSERT (srelgot != NULL); + + outrel.r_offset = (sgot->output_section->vma +@@ -2892,7 +2878,7 @@ m32r_elf_finish_dynamic_symbol (bfd *out + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) + { +- struct elf_m32r_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + bfd_byte *loc; + + #ifdef DEBUG_PIC +@@ -2918,9 +2904,9 @@ m32r_elf_finish_dynamic_symbol (bfd *out + + BFD_ASSERT (h->dynindx != -1); + +- splt = htab->root.splt; +- sgot = htab->root.sgotplt; +- srela = htab->root.srelplt; ++ splt = htab->splt; ++ sgot = htab->sgotplt; ++ srela = htab->srelplt; + BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL); + + /* Get the index in the procedure linkage table which +@@ -3014,8 +3000,8 @@ m32r_elf_finish_dynamic_symbol (bfd *out + /* This symbol has an entry in the global offset table. Set it + up. */ + +- sgot = htab->root.sgot; +- srela = htab->root.srelgot; ++ sgot = htab->sgot; ++ srela = htab->srelgot; + BFD_ASSERT (sgot != NULL && srela != NULL); + + rela.r_offset = (sgot->output_section->vma +@@ -3063,7 +3049,7 @@ m32r_elf_finish_dynamic_symbol (bfd *out + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)); + +- s = bfd_get_linker_section (htab->root.dynobj, ".rela.bss"); ++ s = bfd_get_linker_section (htab->dynobj, ".rela.bss"); + BFD_ASSERT (s != NULL); + + rela.r_offset = (h->root.u.def.value +@@ -3078,7 +3064,7 @@ m32r_elf_finish_dynamic_symbol (bfd *out + } + + /* Mark some specially defined symbols as absolute. */ +- if (h == htab->root.hdynamic || h == htab->root.hgot) ++ if (h == htab->hdynamic || h == htab->hgot) + sym->st_shndx = SHN_ABS; + + return TRUE; +@@ -3091,7 +3077,7 @@ static bfd_boolean + m32r_elf_finish_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) + { +- struct elf_m32r_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + bfd *dynobj; + asection *sdyn; + asection *sgot; +@@ -3104,12 +3090,12 @@ m32r_elf_finish_dynamic_sections (bfd *o + if (htab == NULL) + return FALSE; + +- dynobj = htab->root.dynobj; ++ dynobj = htab->dynobj; + +- sgot = htab->root.sgotplt; ++ sgot = htab->sgotplt; + sdyn = bfd_get_linker_section (dynobj, ".dynamic"); + +- if (htab->root.dynamic_sections_created) ++ if (htab->dynamic_sections_created) + { + asection *splt; + Elf32_External_Dyn *dyncon, *dynconend; +@@ -3132,17 +3118,17 @@ m32r_elf_finish_dynamic_sections (bfd *o + break; + + case DT_PLTGOT: +- s = htab->root.sgotplt; ++ s = htab->sgotplt; + goto get_vma; + case DT_JMPREL: +- s = htab->root.srelplt; ++ s = htab->srelplt; + get_vma: + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_PLTRELSZ: +- s = htab->root.srelplt; ++ s = htab->srelplt; + dyn.d_un.d_val = s->size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; +@@ -3150,7 +3136,7 @@ m32r_elf_finish_dynamic_sections (bfd *o + } + + /* Fill in the first entry in the procedure linkage table. */ +- splt = htab->root.splt; ++ splt = htab->splt; + if (splt && splt->size > 0) + { + if (bfd_link_pic (info)) +@@ -3369,7 +3355,7 @@ m32r_elf_check_relocs (bfd *abfd, + struct elf_link_hash_entry **sym_hashes; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; +- struct elf_m32r_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + bfd *dynobj; + asection *sreloc; + +@@ -3384,7 +3370,7 @@ m32r_elf_check_relocs (bfd *abfd, + if (htab == NULL) + return FALSE; + +- dynobj = htab->root.dynobj; ++ dynobj = htab->dynobj; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) +@@ -3406,7 +3392,7 @@ m32r_elf_check_relocs (bfd *abfd, + } + + /* Some relocs require a global offset table. */ +- if (htab->root.sgot == NULL) ++ if (htab->sgot == NULL) + { + switch (r_type) + { +@@ -3423,7 +3409,7 @@ m32r_elf_check_relocs (bfd *abfd, + case R_M32R_GOTPC_LO: + case R_M32R_GOT24: + if (dynobj == NULL) +- htab->root.dynobj = dynobj = abfd; ++ htab->dynobj = dynobj = abfd; + if (!_bfd_elf_create_got_section (dynobj, info)) + return FALSE; + break; +@@ -3540,7 +3526,7 @@ m32r_elf_check_relocs (bfd *abfd, + struct elf_dyn_relocs **head; + + if (dynobj == NULL) +- htab->root.dynobj = dynobj = abfd; ++ htab->dynobj = dynobj = abfd; + + /* When creating a shared object, we must copy these + relocs into the output file. We create a reloc +diff -rup binutils.orig/bfd/elf32-m68hc1x.h binutils-2.35/bfd/elf32-m68hc1x.h +--- binutils.orig/bfd/elf32-m68hc1x.h 2020-07-30 15:04:05.378466625 +0100 ++++ binutils-2.35/bfd/elf32-m68hc1x.h 2020-07-30 15:04:16.710393941 +0100 +@@ -120,9 +120,6 @@ struct m68hc11_elf_link_hash_table + int top_index; + asection **input_list; + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + bfd_boolean (* size_one_stub) (struct bfd_hash_entry*, void*); + bfd_boolean (* build_one_stub) (struct bfd_hash_entry*, void*); + }; +diff -rup binutils.orig/bfd/elf32-m68k.c binutils-2.35/bfd/elf32-m68k.c +--- binutils.orig/bfd/elf32-m68k.c 2020-07-30 15:04:05.363466721 +0100 ++++ binutils-2.35/bfd/elf32-m68k.c 2020-07-30 15:04:16.710393941 +0100 +@@ -889,9 +889,6 @@ struct elf_m68k_link_hash_table + { + struct elf_link_hash_table root; + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + /* The PLT format used by this link, or NULL if the format has not + yet been chosen. */ + const struct elf_m68k_plt_info *plt_info; +@@ -2836,7 +2833,7 @@ elf_m68k_check_relocs (bfd *abfd, + void *vpp; + Elf_Internal_Sym *isym; + +- isym = bfd_sym_from_r_symndx (&elf_m68k_hash_table (info)->sym_cache, ++ isym = bfd_sym_from_r_symndx (&elf_m68k_hash_table (info)->root.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +diff -rup binutils.orig/bfd/elf32-metag.c binutils-2.35/bfd/elf32-metag.c +--- binutils.orig/bfd/elf32-metag.c 2020-07-30 15:04:05.379466619 +0100 ++++ binutils-2.35/bfd/elf32-metag.c 2020-07-30 15:04:16.711393934 +0100 +@@ -823,9 +823,6 @@ struct elf_metag_link_hash_table + asection **input_list; + Elf_Internal_Sym **all_local_syms; + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + /* Data for LDM relocations. */ + union + { +@@ -2098,7 +2095,7 @@ elf_metag_check_relocs (bfd *abfd, + if (r_symndx < symtab_hdr->sh_info) + { + /* A local symbol. */ +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->etab.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +diff -rup binutils.orig/bfd/elf32-microblaze.c binutils-2.35/bfd/elf32-microblaze.c +--- binutils.orig/bfd/elf32-microblaze.c 2020-07-30 15:04:05.367466696 +0100 ++++ binutils-2.35/bfd/elf32-microblaze.c 2020-07-30 15:04:16.711393934 +0100 +@@ -744,9 +744,6 @@ struct elf32_mb_link_hash_table + { + struct elf_link_hash_table elf; + +- /* Small local sym to section mapping cache. */ +- struct sym_cache sym_sec; +- + /* TLS Local Dynamic GOT Entry */ + union { + bfd_signed_vma refcount; +@@ -2523,7 +2520,7 @@ microblaze_elf_check_relocs (bfd * abfd, + Elf_Internal_Sym *isym; + void *vpp; + +- isym = bfd_sym_from_r_symndx (&htab->sym_sec, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +diff -rup binutils.orig/bfd/elf32-nds32.c binutils-2.35/bfd/elf32-nds32.c +--- binutils.orig/bfd/elf32-nds32.c 2020-07-30 15:04:05.365466709 +0100 ++++ binutils-2.35/bfd/elf32-nds32.c 2020-07-30 15:04:16.712393928 +0100 +@@ -3696,8 +3696,6 @@ nds32_elf_link_hash_table_create (bfd *a + return NULL; + } + +- ret->sdynbss = NULL; +- ret->srelbss = NULL; + ret->sym_ld_script = NULL; + + return &ret->root.root; +@@ -3833,7 +3831,7 @@ nds32_elf_create_dynamic_sections (bfd * + initialize them at run time. The linker script puts the .dynbss + section into the .bss section of the final image. */ + s = bfd_make_section (abfd, ".dynbss"); +- htab->sdynbss = s; ++ htab->root.sdynbss = s; + if (s == NULL + || !bfd_set_section_flags (s, SEC_ALLOC | SEC_LINKER_CREATED)) + return FALSE; +@@ -3852,7 +3850,7 @@ nds32_elf_create_dynamic_sections (bfd * + { + s = bfd_make_section (abfd, (bed->default_use_rela_p + ? ".rela.bss" : ".rel.bss")); +- htab->srelbss = s; ++ htab->root.srelbss = s; + if (s == NULL + || !bfd_set_section_flags (s, flags | SEC_READONLY) + || !bfd_set_section_alignment (s, ptralign)) +@@ -3988,7 +3986,7 @@ nds32_elf_adjust_dynamic_symbol (struct + same memory location for the variable. */ + + htab = nds32_elf_hash_table (info); +- s = htab->sdynbss; ++ s = htab->root.sdynbss; + BFD_ASSERT (s != NULL); + + /* We must generate a R_NDS32_COPY reloc to tell the dynamic linker +@@ -3999,7 +3997,7 @@ nds32_elf_adjust_dynamic_symbol (struct + { + asection *srel; + +- srel = htab->srelbss; ++ srel = htab->root.srelbss; + BFD_ASSERT (srel != NULL); + srel->size += sizeof (Elf32_External_Rela); + h->needs_copy = 1; +@@ -7277,7 +7275,8 @@ nds32_elf_check_relocs (bfd *abfd, struc + void *vpp; + + Elf_Internal_Sym *isym; +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, abfd, r_symndx); ++ isym = bfd_sym_from_r_symndx (&htab->root.sym_cache, ++ abfd, r_symndx); + if (isym == NULL) + return FALSE; + +diff -rup binutils.orig/bfd/elf32-nds32.h binutils-2.35/bfd/elf32-nds32.h +--- binutils.orig/bfd/elf32-nds32.h 2020-07-30 15:04:05.378466625 +0100 ++++ binutils-2.35/bfd/elf32-nds32.h 2020-07-30 15:04:16.712393928 +0100 +@@ -122,13 +122,6 @@ struct elf_nds32_link_hash_table + { + struct elf_link_hash_table root; + +- /* Short-cuts to get to dynamic linker sections. */ +- asection *sdynbss; +- asection *srelbss; +- +- /* Small local sym to section mapping cache. */ +- struct sym_cache sym_cache; +- + /* Target dependent options. */ + int relax_fp_as_gp; /* --mrelax-omit-fp. */ + int eliminate_gc_relocs; /* --meliminate-gc-relocs. */ +diff -rup binutils.orig/bfd/elf32-nios2.c binutils-2.35/bfd/elf32-nios2.c +--- binutils.orig/bfd/elf32-nios2.c 2020-07-30 15:04:05.375466645 +0100 ++++ binutils-2.35/bfd/elf32-nios2.c 2020-07-30 15:04:16.712393928 +0100 +@@ -1808,9 +1808,6 @@ struct elf32_nios2_link_hash_table + bfd_vma offset; + } tls_ldm_got; + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + bfd_vma res_n_size; + }; + +@@ -4902,7 +4899,7 @@ nios2_elf32_check_relocs (bfd *abfd, str + void *vpp; + Elf_Internal_Sym *isym; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->root.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +diff -rup binutils.orig/bfd/elf32-or1k.c binutils-2.35/bfd/elf32-or1k.c +--- binutils.orig/bfd/elf32-or1k.c 2020-07-30 15:04:05.371466670 +0100 ++++ binutils-2.35/bfd/elf32-or1k.c 2020-07-30 15:04:16.713393921 +0100 +@@ -916,9 +916,6 @@ struct elf_or1k_link_hash_table + { + struct elf_link_hash_table root; + +- /* Small local sym to section mapping cache. */ +- struct sym_cache sym_sec; +- + bfd_boolean saw_plta; + }; + +@@ -2151,7 +2148,7 @@ or1k_elf_check_relocs (bfd *abfd, + Elf_Internal_Sym *isym; + void *vpp; + +- isym = bfd_sym_from_r_symndx (&htab->sym_sec, ++ isym = bfd_sym_from_r_symndx (&htab->root.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +diff -rup binutils.orig/bfd/elf32-ppc.c binutils-2.35/bfd/elf32-ppc.c +--- binutils.orig/bfd/elf32-ppc.c 2020-07-30 15:04:05.359466747 +0100 ++++ binutils-2.35/bfd/elf32-ppc.c 2020-07-30 15:04:16.713393921 +0100 +@@ -2212,9 +2212,6 @@ struct ppc_elf_link_hash_table + int plt_slot_size; + /* The size of the first PLT entry. */ + int plt_initial_entry_size; +- +- /* Small local sym cache. */ +- struct sym_cache sym_cache; + }; + + /* Rename some of the generic section flags to better document how they +@@ -2952,7 +2949,7 @@ ppc_elf_check_relocs (bfd *abfd, + ifunc = NULL; + if (h == NULL && htab->elf.target_os != is_vxworks) + { +- Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +@@ -3335,7 +3332,7 @@ ppc_elf_check_relocs (bfd *abfd, + asection *s; + Elf_Internal_Sym *isym; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +@@ -3495,7 +3492,7 @@ ppc_elf_check_relocs (bfd *abfd, + void *vpp; + Elf_Internal_Sym *isym; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +diff -rup binutils.orig/bfd/elf32-s390.c binutils-2.35/bfd/elf32-s390.c +--- binutils.orig/bfd/elf32-s390.c 2020-07-30 15:04:05.376466638 +0100 ++++ binutils-2.35/bfd/elf32-s390.c 2020-07-30 15:04:16.714393915 +0100 +@@ -746,9 +746,6 @@ struct elf_s390_link_hash_table + bfd_signed_vma refcount; + bfd_vma offset; + } tls_ldm_got; +- +- /* Small local sym cache. */ +- struct sym_cache sym_cache; + }; + + /* Get the s390 ELF linker hash table from a link_info structure. */ +@@ -930,7 +927,7 @@ elf_s390_check_relocs (bfd *abfd, + if (r_symndx < symtab_hdr->sh_info) + { + /* A local symbol. */ +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +@@ -1281,7 +1278,7 @@ elf_s390_check_relocs (bfd *abfd, + asection *s; + void *vpp; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +@@ -3722,7 +3719,7 @@ elf_s390_finish_dynamic_sections (bfd *o + if (local_plt[i].plt.offset != (bfd_vma) -1) + { + asection *sec = local_plt[i].sec; +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ibfd, i); ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, ibfd, i); + if (isym == NULL) + return FALSE; + +diff -rup binutils.orig/bfd/elf32-sh.c binutils-2.35/bfd/elf32-sh.c +--- binutils.orig/bfd/elf32-sh.c 2020-07-30 15:04:05.376466638 +0100 ++++ binutils-2.35/bfd/elf32-sh.c 2020-07-30 15:04:16.714393915 +0100 +@@ -2160,8 +2160,6 @@ struct elf_sh_link_hash_table + struct elf_link_hash_table root; + + /* Short-cuts to get to dynamic linker sections. */ +- asection *sdynbss; +- asection *srelbss; + asection *sfuncdesc; + asection *srelfuncdesc; + asection *srofixup; +@@ -2169,9 +2167,6 @@ struct elf_sh_link_hash_table + /* The (unloaded but important) VxWorks .rela.plt.unloaded section. */ + asection *srelplt2; + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + /* A counter or offset to track a TLS got entry. */ + union + { +@@ -2439,7 +2434,7 @@ sh_elf_create_dynamic_sections (bfd *abf + section into the .bss section of the final image. */ + s = bfd_make_section_anyway_with_flags (abfd, ".dynbss", + SEC_ALLOC | SEC_LINKER_CREATED); +- htab->sdynbss = s; ++ htab->root.sdynbss = s; + if (s == NULL) + return FALSE; + +@@ -2460,7 +2455,7 @@ sh_elf_create_dynamic_sections (bfd *abf + (bed->default_use_rela_p + ? ".rela.bss" : ".rel.bss"), + flags | SEC_READONLY); +- htab->srelbss = s; ++ htab->root.srelbss = s; + if (s == NULL + || !bfd_set_section_alignment (s, ptralign)) + return FALSE; +@@ -2580,7 +2575,7 @@ sh_elf_adjust_dynamic_symbol (struct bfd + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + +- s = htab->sdynbss; ++ s = htab->root.sdynbss; + BFD_ASSERT (s != NULL); + + /* We must generate a R_SH_COPY reloc to tell the dynamic linker to +@@ -2591,7 +2586,7 @@ sh_elf_adjust_dynamic_symbol (struct bfd + { + asection *srel; + +- srel = htab->srelbss; ++ srel = htab->root.srelbss; + BFD_ASSERT (srel != NULL); + srel->size += sizeof (Elf32_External_Rela); + h->needs_copy = 1; +@@ -3151,7 +3146,7 @@ sh_elf_size_dynamic_sections (bfd *outpu + || s == htab->root.sgotplt + || s == htab->sfuncdesc + || s == htab->srofixup +- || s == htab->sdynbss) ++ || s == htab->root.sdynbss) + { + /* Strip this section if we don't need it; see the + comment below. */ +@@ -5679,7 +5674,7 @@ sh_elf_check_relocs (bfd *abfd, struct b + void *vpp; + Elf_Internal_Sym *isym; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->root.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +diff -rup binutils.orig/bfd/elf32-tic6x.c binutils-2.35/bfd/elf32-tic6x.c +--- binutils.orig/bfd/elf32-tic6x.c 2020-07-30 15:04:05.366466702 +0100 ++++ binutils-2.35/bfd/elf32-tic6x.c 2020-07-30 15:04:16.714393915 +0100 +@@ -46,9 +46,6 @@ struct elf32_tic6x_link_hash_table + /* C6X specific command line arguments. */ + struct elf32_tic6x_params params; + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + /* The output BFD, for convenience. */ + bfd *obfd; + +@@ -2729,7 +2726,7 @@ elf32_tic6x_check_relocs (bfd *abfd, str + if (r_symndx < symtab_hdr->sh_info) + { + /* A local symbol. */ +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +diff -rup binutils.orig/bfd/elf32-tilepro.c binutils-2.35/bfd/elf32-tilepro.c +--- binutils.orig/bfd/elf32-tilepro.c 2020-07-30 15:04:05.364466715 +0100 ++++ binutils-2.35/bfd/elf32-tilepro.c 2020-07-30 15:04:16.715393908 +0100 +@@ -727,19 +727,11 @@ tilepro_elf_mkobject (bfd *abfd) + #include "elf/common.h" + #include "elf/internal.h" + +-struct tilepro_elf_link_hash_table +-{ +- struct elf_link_hash_table elf; +- +- /* Small local sym to section mapping cache. */ +- struct sym_cache sym_cache; +-}; +- + /* Get the Tilepro ELF linker hash table from a link_info structure. */ + #define tilepro_elf_hash_table(p) \ + (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \ + == TILEPRO_ELF_DATA \ +- ? ((struct tilepro_elf_link_hash_table *) ((p)->hash)) : NULL) ++ ? ((struct elf_link_hash_table *) ((p)->hash)) : NULL) + + static reloc_howto_type * + tilepro_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, +@@ -1184,14 +1176,14 @@ link_hash_newfunc (struct bfd_hash_entry + static struct bfd_link_hash_table * + tilepro_elf_link_hash_table_create (bfd *abfd) + { +- struct tilepro_elf_link_hash_table *ret; +- size_t amt = sizeof (struct tilepro_elf_link_hash_table); ++ struct elf_link_hash_table *ret; ++ size_t amt = sizeof (struct elf_link_hash_table); + +- ret = (struct tilepro_elf_link_hash_table *) bfd_zmalloc (amt); ++ ret = (struct elf_link_hash_table *) bfd_zmalloc (amt); + if (ret == NULL) + return NULL; + +- if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc, ++ if (!_bfd_elf_link_hash_table_init (ret, abfd, link_hash_newfunc, + sizeof (struct tilepro_elf_link_hash_entry), + TILEPRO_ELF_DATA)) + { +@@ -1199,7 +1191,7 @@ tilepro_elf_link_hash_table_create (bfd + return NULL; + } + +- return &ret->elf.root; ++ return &ret->root; + } + + /* Create the .got section. */ +@@ -1402,7 +1394,7 @@ static bfd_boolean + tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs) + { +- struct tilepro_elf_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + const Elf_Internal_Rela *rel; +@@ -1423,8 +1415,8 @@ tilepro_elf_check_relocs (bfd *abfd, str + + BFD_ASSERT (is_tilepro_elf (abfd) || num_relocs == 0); + +- if (htab->elf.dynobj == NULL) +- htab->elf.dynobj = abfd; ++ if (htab->dynobj == NULL) ++ htab->dynobj = abfd; + + rel_end = relocs + num_relocs; + for (rel = relocs; rel < rel_end; rel++) +@@ -1569,9 +1561,9 @@ tilepro_elf_check_relocs (bfd *abfd, str + } + } + +- if (htab->elf.sgot == NULL) ++ if (htab->sgot == NULL) + { +- if (!tilepro_elf_create_got_section (htab->elf.dynobj, info)) ++ if (!tilepro_elf_create_got_section (htab->dynobj, info)) + return FALSE; + } + break; +@@ -1716,7 +1708,7 @@ tilepro_elf_check_relocs (bfd *abfd, str + if (sreloc == NULL) + { + sreloc = _bfd_elf_make_dynamic_reloc_section +- (sec, htab->elf.dynobj, 2, abfd, /*rela?*/ TRUE); ++ (sec, htab->dynobj, 2, abfd, /*rela?*/ TRUE); + + if (sreloc == NULL) + return FALSE; +@@ -1754,7 +1746,7 @@ tilepro_elf_check_relocs (bfd *abfd, str + { + size_t amt = sizeof *p; + p = ((struct elf_dyn_relocs *) +- bfd_alloc (htab->elf.dynobj, amt)); ++ bfd_alloc (htab->dynobj, amt)); + if (p == NULL) + return FALSE; + p->next = *head; +@@ -1850,14 +1842,14 @@ static bfd_boolean + tilepro_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) + { +- struct tilepro_elf_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + asection *s, *srel; + + htab = tilepro_elf_hash_table (info); + BFD_ASSERT (htab != NULL); + + /* Make sure we know what is going on here. */ +- BFD_ASSERT (htab->elf.dynobj != NULL ++ BFD_ASSERT (htab->dynobj != NULL + && (h->needs_plt + || h->is_weakalias + || (h->def_dynamic +@@ -1947,13 +1939,13 @@ tilepro_elf_adjust_dynamic_symbol (struc + .rel.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_READONLY) != 0) + { +- s = htab->elf.sdynrelro; +- srel = htab->elf.sreldynrelro; ++ s = htab->sdynrelro; ++ srel = htab->sreldynrelro; + } + else + { +- s = htab->elf.sdynbss; +- srel = htab->elf.srelbss; ++ s = htab->sdynbss; ++ srel = htab->srelbss; + } + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) + { +@@ -1971,7 +1963,7 @@ static bfd_boolean + allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + { + struct bfd_link_info *info; +- struct tilepro_elf_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + struct elf_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_indirect) +@@ -1981,7 +1973,7 @@ allocate_dynrelocs (struct elf_link_hash + htab = tilepro_elf_hash_table (info); + BFD_ASSERT (htab != NULL); + +- if (htab->elf.dynamic_sections_created ++ if (htab->dynamic_sections_created + && h->plt.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. +@@ -1995,7 +1987,7 @@ allocate_dynrelocs (struct elf_link_hash + + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h)) + { +- asection *s = htab->elf.splt; ++ asection *s = htab->splt; + + /* Allocate room for the header. */ + if (s->size == 0) +@@ -2021,10 +2013,10 @@ allocate_dynrelocs (struct elf_link_hash + s->size += PLT_ENTRY_SIZE; + + /* We also need to make an entry in the .got.plt section. */ +- htab->elf.sgotplt->size += GOT_ENTRY_SIZE; ++ htab->sgotplt->size += GOT_ENTRY_SIZE; + + /* We also need to make an entry in the .rela.plt section. */ +- htab->elf.srelplt->size += TILEPRO_ELF_RELA_BYTES; ++ htab->srelplt->size += TILEPRO_ELF_RELA_BYTES; + } + else + { +@@ -2060,22 +2052,22 @@ allocate_dynrelocs (struct elf_link_hash + return FALSE; + } + +- s = htab->elf.sgot; ++ s = htab->sgot; + h->got.offset = s->size; + s->size += TILEPRO_BYTES_PER_WORD; + /* R_TILEPRO_IMM16_Xn_TLS_GD entries need 2 consecutive GOT slots. */ + if (tls_type == GOT_TLS_GD) + s->size += TILEPRO_BYTES_PER_WORD; +- dyn = htab->elf.dynamic_sections_created; ++ dyn = htab->dynamic_sections_created; + /* R_TILEPRO_IMM16_Xn_TLS_IE_xxx needs one dynamic relocation, + R_TILEPRO_IMM16_Xn_TLS_GD_xxx needs two if local symbol and two if + global. */ + if (tls_type == GOT_TLS_GD || tls_type == GOT_TLS_IE) +- htab->elf.srelgot->size += 2 * TILEPRO_ELF_RELA_BYTES; ++ htab->srelgot->size += 2 * TILEPRO_ELF_RELA_BYTES; + else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, + bfd_link_pic (info), + h)) +- htab->elf.srelgot->size += TILEPRO_ELF_RELA_BYTES; ++ htab->srelgot->size += TILEPRO_ELF_RELA_BYTES; + } + else + h->got.offset = (bfd_vma) -1; +@@ -2134,7 +2126,7 @@ allocate_dynrelocs (struct elf_link_hash + if (!h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) +- || (htab->elf.dynamic_sections_created ++ || (htab->dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { +@@ -2195,14 +2187,14 @@ tilepro_elf_size_dynamic_sections (bfd * + { + (void)output_bfd; + +- struct tilepro_elf_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + bfd *dynobj; + asection *s; + bfd *ibfd; + + htab = tilepro_elf_hash_table (info); + BFD_ASSERT (htab != NULL); +- dynobj = htab->elf.dynobj; ++ dynobj = htab->dynobj; + BFD_ASSERT (dynobj != NULL); + + if (elf_hash_table (info)->dynamic_sections_created) +@@ -2268,8 +2260,8 @@ tilepro_elf_size_dynamic_sections (bfd * + locsymcount = symtab_hdr->sh_info; + end_local_got = local_got + locsymcount; + local_tls_type = _bfd_tilepro_elf_local_got_tls_type (ibfd); +- s = htab->elf.sgot; +- srel = htab->elf.srelgot; ++ s = htab->sgot; ++ srel = htab->srelgot; + for (; local_got < end_local_got; ++local_got, ++local_tls_type) + { + if (*local_got > 0) +@@ -2290,19 +2282,19 @@ tilepro_elf_size_dynamic_sections (bfd * + + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ +- elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, info); ++ elf_link_hash_traverse (htab, allocate_dynrelocs, info); + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* If the .got section is more than 0x8000 bytes, we add + 0x8000 to the value of _GLOBAL_OFFSET_TABLE_, so that 16 + bit relocations have a greater chance of working. */ +- if (htab->elf.sgot->size >= 0x8000 ++ if (htab->sgot->size >= 0x8000 + && elf_hash_table (info)->hgot->root.u.def.value == 0) + elf_hash_table (info)->hgot->root.u.def.value = 0x8000; + } + +- if (htab->elf.sgotplt) ++ if (htab->sgotplt) + { + struct elf_link_hash_entry *got; + got = elf_link_hash_lookup (elf_hash_table (info), +@@ -2313,14 +2305,14 @@ tilepro_elf_size_dynamic_sections (bfd * + entries and there is no refeence to _GLOBAL_OFFSET_TABLE_. */ + if ((got == NULL + || !got->ref_regular_nonweak) +- && (htab->elf.sgotplt->size ++ && (htab->sgotplt->size + == GOTPLT_HEADER_SIZE) +- && (htab->elf.splt == NULL +- || htab->elf.splt->size == 0) +- && (htab->elf.sgot == NULL +- || (htab->elf.sgot->size ++ && (htab->splt == NULL ++ || htab->splt->size == 0) ++ && (htab->sgot == NULL ++ || (htab->sgot->size + == get_elf_backend_data (output_bfd)->got_header_size))) +- htab->elf.sgotplt->size = 0; ++ htab->sgotplt->size = 0; + } + + /* The check_relocs and adjust_dynamic_symbol entry points have +@@ -2331,11 +2323,11 @@ tilepro_elf_size_dynamic_sections (bfd * + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + +- if (s == htab->elf.splt +- || s == htab->elf.sgot +- || s == htab->elf.sgotplt +- || s == htab->elf.sdynbss +- || s == htab->elf.sdynrelro) ++ if (s == htab->splt ++ || s == htab->sgot ++ || s == htab->sgotplt ++ || s == htab->sdynbss ++ || s == htab->sdynrelro) + { + /* Strip this section if we don't need it; see the + comment below. */ +@@ -2527,7 +2519,7 @@ tilepro_elf_relocate_section (bfd *outpu + Elf_Internal_Sym *local_syms, + asection **local_sections) + { +- struct tilepro_elf_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_vma *local_got_offsets; +@@ -2758,7 +2750,7 @@ tilepro_elf_relocate_section (bfd *outpu + case R_TILEPRO_IMM16_X1_GOT_HA: + /* Relocation is to the entry for this symbol in the global + offset table. */ +- if (htab->elf.sgot == NULL) ++ if (htab->sgot == NULL) + abort (); + + if (h != NULL) +@@ -2792,7 +2784,7 @@ tilepro_elf_relocate_section (bfd *outpu + else + { + bfd_put_32 (output_bfd, relocation, +- htab->elf.sgot->contents + off); ++ htab->sgot->contents + off); + h->got.offset |= 1; + } + } +@@ -2820,11 +2812,11 @@ tilepro_elf_relocate_section (bfd *outpu + + /* We need to generate a R_TILEPRO_RELATIVE reloc + for the dynamic linker. */ +- s = htab->elf.srelgot; ++ s = htab->srelgot; + BFD_ASSERT (s != NULL); + +- outrel.r_offset = (htab->elf.sgot->output_section->vma +- + htab->elf.sgot->output_offset ++ outrel.r_offset = (htab->sgot->output_section->vma ++ + htab->sgot->output_offset + + off); + outrel.r_info = ELF32_R_INFO (0, R_TILEPRO_RELATIVE); + outrel.r_addend = relocation; +@@ -2833,7 +2825,7 @@ tilepro_elf_relocate_section (bfd *outpu + } + + bfd_put_32 (output_bfd, relocation, +- htab->elf.sgot->contents + off); ++ htab->sgot->contents + off); + local_got_offsets[r_symndx] |= 1; + } + } +@@ -2845,7 +2837,7 @@ tilepro_elf_relocate_section (bfd *outpu + procedure linkage table. */ + BFD_ASSERT (h != NULL); + +- if (h->plt.offset == (bfd_vma) -1 || htab->elf.splt == NULL) ++ if (h->plt.offset == (bfd_vma) -1 || htab->splt == NULL) + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when +@@ -2853,8 +2845,8 @@ tilepro_elf_relocate_section (bfd *outpu + break; + } + +- relocation = (htab->elf.splt->output_section->vma +- + htab->elf.splt->output_offset ++ relocation = (htab->splt->output_section->vma ++ + htab->splt->output_offset + + h->plt.offset); + unresolved_reloc = FALSE; + break; +@@ -2993,7 +2985,7 @@ tilepro_elf_relocate_section (bfd *outpu + outrel.r_addend = relocation + rel->r_addend; + + if (is_plt) +- sec = htab->elf.splt; ++ sec = htab->splt; + + if (bfd_is_abs_section (sec)) + indx = 0; +@@ -3016,7 +3008,7 @@ tilepro_elf_relocate_section (bfd *outpu + + if (indx == 0) + { +- osec = htab->elf.text_index_section; ++ osec = htab->text_index_section; + indx = elf_section_data (osec)->dynindx; + } + +@@ -3142,7 +3134,7 @@ tilepro_elf_relocate_section (bfd *outpu + local_got_offsets[r_symndx] |= 1; + } + +- if (htab->elf.sgot == NULL) ++ if (htab->sgot == NULL) + abort (); + + if ((off & 1) != 0) +@@ -3153,13 +3145,13 @@ tilepro_elf_relocate_section (bfd *outpu + int indx = 0; + bfd_boolean need_relocs = FALSE; + +- if (htab->elf.srelgot == NULL) ++ if (htab->srelgot == NULL) + abort (); + + if (h != NULL) + { + bfd_boolean dyn; +- dyn = htab->elf.dynamic_sections_created; ++ dyn = htab->dynamic_sections_created; + + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, + bfd_link_pic (info), +@@ -3190,18 +3182,18 @@ tilepro_elf_relocate_section (bfd *outpu + case R_TILEPRO_IMM16_X0_TLS_IE_HA: + case R_TILEPRO_IMM16_X1_TLS_IE_HA: + if (need_relocs) { +- bfd_put_32 (output_bfd, 0, htab->elf.sgot->contents + off); +- outrel.r_offset = (htab->elf.sgot->output_section->vma +- + htab->elf.sgot->output_offset + off); ++ bfd_put_32 (output_bfd, 0, htab->sgot->contents + off); ++ outrel.r_offset = (htab->sgot->output_section->vma ++ + htab->sgot->output_offset + off); + outrel.r_addend = 0; + if (indx == 0) + outrel.r_addend = relocation - dtpoff_base (info); + outrel.r_info = ELF32_R_INFO (indx, R_TILEPRO_TLS_TPOFF32); +- tilepro_elf_append_rela_32 (output_bfd, htab->elf.srelgot, ++ tilepro_elf_append_rela_32 (output_bfd, htab->srelgot, + &outrel); + } else { + bfd_put_32 (output_bfd, tpoff (info, relocation), +- htab->elf.sgot->contents + off); ++ htab->sgot->contents + off); + } + break; + +@@ -3214,31 +3206,31 @@ tilepro_elf_relocate_section (bfd *outpu + case R_TILEPRO_IMM16_X0_TLS_GD_HA: + case R_TILEPRO_IMM16_X1_TLS_GD_HA: + if (need_relocs) { +- outrel.r_offset = (htab->elf.sgot->output_section->vma +- + htab->elf.sgot->output_offset + off); ++ outrel.r_offset = (htab->sgot->output_section->vma ++ + htab->sgot->output_offset + off); + outrel.r_addend = 0; + outrel.r_info = ELF32_R_INFO (indx, R_TILEPRO_TLS_DTPMOD32); +- bfd_put_32 (output_bfd, 0, htab->elf.sgot->contents + off); +- tilepro_elf_append_rela_32 (output_bfd, htab->elf.srelgot, ++ bfd_put_32 (output_bfd, 0, htab->sgot->contents + off); ++ tilepro_elf_append_rela_32 (output_bfd, htab->srelgot, + &outrel); + if (indx == 0) + { + BFD_ASSERT (! unresolved_reloc); + bfd_put_32 (output_bfd, + relocation - dtpoff_base (info), +- (htab->elf.sgot->contents + off + ++ (htab->sgot->contents + off + + TILEPRO_BYTES_PER_WORD)); + } + else + { + bfd_put_32 (output_bfd, 0, +- (htab->elf.sgot->contents + off + ++ (htab->sgot->contents + off + + TILEPRO_BYTES_PER_WORD)); + outrel.r_info = ELF32_R_INFO (indx, + R_TILEPRO_TLS_DTPOFF32); + outrel.r_offset += TILEPRO_BYTES_PER_WORD; + tilepro_elf_append_rela_32 (output_bfd, +- htab->elf.srelgot, &outrel); ++ htab->srelgot, &outrel); + } + } + +@@ -3249,9 +3241,9 @@ tilepro_elf_relocate_section (bfd *outpu + symbol binding locally. Mark it as belonging + to module 1, the executable. */ + bfd_put_32 (output_bfd, 1, +- htab->elf.sgot->contents + off ); ++ htab->sgot->contents + off ); + bfd_put_32 (output_bfd, relocation - dtpoff_base (info), +- htab->elf.sgot->contents + off + ++ htab->sgot->contents + off + + TILEPRO_BYTES_PER_WORD); + } + break; +@@ -3411,7 +3403,7 @@ tilepro_elf_finish_dynamic_symbol (bfd * + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) + { +- struct tilepro_elf_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + + htab = tilepro_elf_hash_table (info); + BFD_ASSERT (htab != NULL); +@@ -3431,9 +3423,9 @@ tilepro_elf_finish_dynamic_symbol (bfd * + + BFD_ASSERT (h->dynindx != -1); + +- splt = htab->elf.splt; +- srela = htab->elf.srelplt; +- sgotplt = htab->elf.sgotplt; ++ splt = htab->splt; ++ srela = htab->srelplt; ++ sgotplt = htab->sgotplt; + + if (splt == NULL || srela == NULL) + abort (); +@@ -3481,8 +3473,8 @@ tilepro_elf_finish_dynamic_symbol (bfd * + + /* This symbol has an entry in the GOT. Set it up. */ + +- sgot = htab->elf.sgot; +- srela = htab->elf.srelgot; ++ sgot = htab->sgot; ++ srela = htab->srelgot; + BFD_ASSERT (sgot != NULL && srela != NULL); + + rela.r_offset = (sgot->output_section->vma +@@ -3528,16 +3520,16 @@ tilepro_elf_finish_dynamic_symbol (bfd * + + h->root.u.def.section->output_offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_TILEPRO_COPY); + rela.r_addend = 0; +- if (h->root.u.def.section == htab->elf.sdynrelro) +- s = htab->elf.sreldynrelro; ++ if (h->root.u.def.section == htab->sdynrelro) ++ s = htab->sreldynrelro; + else +- s = htab->elf.srelbss; ++ s = htab->srelbss; + tilepro_elf_append_rela_32 (output_bfd, s, &rela); + } + + /* Mark some specially defined symbols as absolute. */ +- if (h == htab->elf.hdynamic +- || (h == htab->elf.hgot || h == htab->elf.hplt)) ++ if (h == htab->hdynamic ++ || (h == htab->hgot || h == htab->hplt)) + sym->st_shndx = SHN_ABS; + + return TRUE; +@@ -3551,7 +3543,7 @@ tilepro_finish_dyn (bfd *output_bfd, str + asection *splt ATTRIBUTE_UNUSED) + { + Elf32_External_Dyn *dyncon, *dynconend; +- struct tilepro_elf_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + + htab = tilepro_elf_hash_table (info); + BFD_ASSERT (htab != NULL); +@@ -3567,15 +3559,15 @@ tilepro_finish_dyn (bfd *output_bfd, str + switch (dyn.d_tag) + { + case DT_PLTGOT: +- s = htab->elf.sgotplt; ++ s = htab->sgotplt; + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; + break; + case DT_JMPREL: +- s = htab->elf.srelplt; ++ s = htab->srelplt; + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; + break; + case DT_PLTRELSZ: +- s = htab->elf.srelplt; ++ s = htab->srelplt; + dyn.d_un.d_val = s->size; + break; + default: +@@ -3593,11 +3585,11 @@ tilepro_elf_finish_dynamic_sections (bfd + { + bfd *dynobj; + asection *sdyn; +- struct tilepro_elf_link_hash_table *htab; ++ struct elf_link_hash_table *htab; + + htab = tilepro_elf_hash_table (info); + BFD_ASSERT (htab != NULL); +- dynobj = htab->elf.dynobj; ++ dynobj = htab->dynobj; + + sdyn = bfd_get_linker_section (dynobj, ".dynamic"); + +@@ -3606,7 +3598,7 @@ tilepro_elf_finish_dynamic_sections (bfd + asection *splt; + bfd_boolean ret; + +- splt = htab->elf.splt; ++ splt = htab->splt; + BFD_ASSERT (splt != NULL && sdyn != NULL); + + ret = tilepro_finish_dyn (output_bfd, info, dynobj, sdyn, splt); +@@ -3627,42 +3619,42 @@ tilepro_elf_finish_dynamic_sections (bfd + = PLT_ENTRY_SIZE; + } + +- if (htab->elf.sgotplt) ++ if (htab->sgotplt) + { +- if (bfd_is_abs_section (htab->elf.sgotplt->output_section)) ++ if (bfd_is_abs_section (htab->sgotplt->output_section)) + { + _bfd_error_handler +- (_("discarded output section: `%pA'"), htab->elf.sgotplt); ++ (_("discarded output section: `%pA'"), htab->sgotplt); + return FALSE; + } + +- if (htab->elf.sgotplt->size > 0) ++ if (htab->sgotplt->size > 0) + { + /* Write the first two entries in .got.plt, needed for the dynamic + linker. */ + bfd_put_32 (output_bfd, (bfd_vma) -1, +- htab->elf.sgotplt->contents); ++ htab->sgotplt->contents); + bfd_put_32 (output_bfd, (bfd_vma) 0, +- htab->elf.sgotplt->contents + GOT_ENTRY_SIZE); ++ htab->sgotplt->contents + GOT_ENTRY_SIZE); + } + +- elf_section_data (htab->elf.sgotplt->output_section)->this_hdr.sh_entsize ++ elf_section_data (htab->sgotplt->output_section)->this_hdr.sh_entsize + = GOT_ENTRY_SIZE; + } + +- if (htab->elf.sgot) ++ if (htab->sgot) + { +- if (htab->elf.sgot->size > 0) ++ if (htab->sgot->size > 0) + { + /* Set the first entry in the global offset table to the address of + the dynamic section. */ + bfd_vma val = (sdyn ? + sdyn->output_section->vma + sdyn->output_offset : + 0); +- bfd_put_32 (output_bfd, val, htab->elf.sgot->contents); ++ bfd_put_32 (output_bfd, val, htab->sgot->contents); + } + +- elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize ++ elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize + = GOT_ENTRY_SIZE; + } + +diff -rup binutils.orig/bfd/elf64-ppc.c binutils-2.35/bfd/elf64-ppc.c +--- binutils.orig/bfd/elf64-ppc.c 2020-07-30 15:04:05.363466721 +0100 ++++ binutils-2.35/bfd/elf64-ppc.c 2020-07-30 15:04:16.716393902 +0100 +@@ -3250,9 +3250,6 @@ struct ppc_link_hash_table + + /* Incremented every time we size stubs. */ + unsigned int stub_iteration; +- +- /* Small local sym cache. */ +- struct sym_cache sym_cache; + }; + + /* Rename some of the generic section flags to better document how they +@@ -4383,7 +4380,8 @@ ppc64_elf_before_check_relocs (bfd *ibfd + Elf_Internal_Sym *isym; + asection *s; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ibfd, r_symndx); ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, ibfd, ++ r_symndx); + if (isym == NULL) + { + if (elf_section_data (opd)->relocs != relocs) +@@ -4684,7 +4682,7 @@ ppc64_elf_check_relocs (bfd *abfd, struc + } + else + { +- Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +@@ -4955,7 +4953,7 @@ ppc64_elf_check_relocs (bfd *abfd, struc + { + Elf_Internal_Sym *isym; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +@@ -5231,7 +5229,7 @@ ppc64_elf_check_relocs (bfd *abfd, struc + void *vpp; + Elf_Internal_Sym *isym; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.35/bfd/elf64-s390.c +--- binutils.orig/bfd/elf64-s390.c 2020-07-30 15:04:05.369466683 +0100 ++++ binutils-2.35/bfd/elf64-s390.c 2020-07-30 15:04:16.716393902 +0100 +@@ -663,9 +663,6 @@ struct elf_s390_link_hash_table + bfd_vma offset; + } tls_ldm_got; + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + /* Options passed from the linker. */ + struct s390_elf_params *params; + }; +@@ -852,7 +849,7 @@ elf_s390_check_relocs (bfd *abfd, + if (r_symndx < symtab_hdr->sh_info) + { + /* A local symbol. */ +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +@@ -1216,7 +1213,7 @@ elf_s390_check_relocs (bfd *abfd, + asection *s; + void *vpp; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +@@ -2258,7 +2255,7 @@ elf_s390_relocate_section (bfd *output_b + & 0xff00f000) == 0xe300c000 + && bfd_get_8 (input_bfd, + contents + rel->r_offset + 3) == 0x04)) +- && (isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ && (isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + input_bfd, r_symndx)) + && isym->st_shndx != SHN_ABS + && h != htab->elf.hdynamic +@@ -3572,7 +3569,7 @@ elf_s390_finish_dynamic_sections (bfd *o + if (local_plt[i].plt.offset != (bfd_vma) -1) + { + asection *sec = local_plt[i].sec; +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ibfd, i); ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, ibfd, i); + if (isym == NULL) + return FALSE; + +diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.35/bfd/elf64-x86-64.c +--- binutils.orig/bfd/elf64-x86-64.c 2020-07-30 15:04:05.365466709 +0100 ++++ binutils-2.35/bfd/elf64-x86-64.c 2020-07-30 15:04:16.717393895 +0100 +@@ -1371,7 +1371,7 @@ elf_x86_64_tls_transition (struct bfd_li + { + Elf_Internal_Sym *isym; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL); + } +@@ -1559,7 +1559,7 @@ elf_x86_64_convert_load_reloc (bfd *abfd + if (h == NULL) + { + Elf_Internal_Sym *isym +- = bfd_sym_from_r_symndx (&htab->sym_cache, abfd, r_symndx); ++ = bfd_sym_from_r_symndx (&htab->elf.sym_cache, abfd, r_symndx); + + /* Skip relocation against undefined symbols. */ + if (isym->st_shndx == SHN_UNDEF) +@@ -1907,7 +1907,7 @@ elf_x86_64_check_relocs (bfd *abfd, stru + if (r_symndx < symtab_hdr->sh_info) + { + /* A local symbol. */ +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + goto error_return; +@@ -2308,7 +2308,7 @@ elf_x86_64_check_relocs (bfd *abfd, stru + asection *s; + void **vpp; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + goto error_return; +diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.35/bfd/elfnn-aarch64.c +--- binutils.orig/bfd/elfnn-aarch64.c 2020-07-30 15:04:05.371466670 +0100 ++++ binutils-2.35/bfd/elfnn-aarch64.c 2020-07-30 15:04:16.717393895 +0100 +@@ -2643,9 +2643,6 @@ struct elf_aarch64_link_hash_table + /* The bytes of the subsequent PLT entry. */ + const bfd_byte *plt_entry; + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + /* For convenience in allocate_dynrelocs. */ + bfd *obfd; + +@@ -7611,7 +7608,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, s + if (r_symndx < symtab_hdr->sh_info) + { + /* A local symbol. */ +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->root.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +@@ -7838,7 +7835,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, s + asection *s; + void **vpp; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->root.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +Only in binutils-2.35/bfd: elfnn-aarch64.c.orig +diff -rup binutils.orig/bfd/elfnn-riscv.c binutils-2.35/bfd/elfnn-riscv.c +--- binutils.orig/bfd/elfnn-riscv.c 2020-07-30 15:04:05.365466709 +0100 ++++ binutils-2.35/bfd/elfnn-riscv.c 2020-07-30 15:04:16.718393889 +0100 +@@ -113,9 +113,6 @@ struct riscv_elf_link_hash_table + /* Short-cuts to get to dynamic linker sections. */ + asection *sdyntdata; + +- /* Small local sym to section mapping cache. */ +- struct sym_cache sym_cache; +- + /* The max alignment of output sections. */ + bfd_vma max_alignment; + }; +@@ -681,7 +678,7 @@ riscv_elf_check_relocs (bfd *abfd, struc + void *vpp; + Elf_Internal_Sym *isym; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +diff -rup binutils.orig/bfd/elfxx-mips.c binutils-2.35/bfd/elfxx-mips.c +--- binutils.orig/bfd/elfxx-mips.c 2020-07-30 15:04:05.376466638 +0100 ++++ binutils-2.35/bfd/elfxx-mips.c 2020-07-30 15:04:16.719393882 +0100 +@@ -527,9 +527,6 @@ struct mips_elf_link_hash_table + returns null. */ + asection *(*add_stub_section) (const char *, asection *, asection *); + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + /* Is the PLT header compressed? */ + unsigned int plt_header_is_comp : 1; + }; +@@ -4401,7 +4398,7 @@ mips_elf_resolve_got_page_ref (void **re + Elf_Internal_Sym *isym; + + /* Read in the symbol. */ +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ref->u.abfd, ++ isym = bfd_sym_from_r_symndx (&htab->root.sym_cache, ref->u.abfd, + ref->symndx); + if (isym == NULL) + { +diff -rup binutils.orig/bfd/elfxx-sparc.c binutils-2.35/bfd/elfxx-sparc.c +--- binutils.orig/bfd/elfxx-sparc.c 2020-07-30 15:04:05.360466741 +0100 ++++ binutils-2.35/bfd/elfxx-sparc.c 2020-07-30 15:04:16.719393882 +0100 +@@ -1391,7 +1391,8 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, + if (r_symndx < symtab_hdr->sh_info) + { + /* A local symbol. */ +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, abfd, r_symndx); ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, abfd, ++ r_symndx); + if (isym == NULL) + return FALSE; + +diff -rup binutils.orig/bfd/elfxx-sparc.h binutils-2.35/bfd/elfxx-sparc.h +--- binutils.orig/bfd/elfxx-sparc.h 2020-07-30 15:04:05.367466696 +0100 ++++ binutils-2.35/bfd/elfxx-sparc.h 2020-07-30 15:04:16.719393882 +0100 +@@ -55,9 +55,6 @@ struct _bfd_sparc_elf_link_hash_table + bfd_vma offset; + } tls_ldm_got; + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + /* Used by local STT_GNU_IFUNC symbols. */ + htab_t loc_hash_table; + void *loc_hash_memory; +diff -rup binutils.orig/bfd/elfxx-tilegx.c binutils-2.35/bfd/elfxx-tilegx.c +--- binutils.orig/bfd/elfxx-tilegx.c 2020-07-30 15:04:05.362466728 +0100 ++++ binutils-2.35/bfd/elfxx-tilegx.c 2020-07-30 15:04:16.719393882 +0100 +@@ -835,9 +835,6 @@ struct tilegx_elf_link_hash_table + /* Whether LE transition has been disabled for some of the + sections. */ + bfd_boolean disable_le_transition; +- +- /* Small local sym to section mapping cache. */ +- struct sym_cache sym_cache; + }; + + +@@ -1979,7 +1976,7 @@ tilegx_elf_check_relocs (bfd *abfd, stru + void *vpp; + Elf_Internal_Sym *isym; + +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, + abfd, r_symndx); + if (isym == NULL) + return FALSE; +diff -rup binutils.orig/bfd/elfxx-x86.h binutils-2.35/bfd/elfxx-x86.h +--- binutils.orig/bfd/elfxx-x86.h 2020-07-30 15:04:05.378466625 +0100 ++++ binutils-2.35/bfd/elfxx-x86.h 2020-07-30 15:04:16.720393876 +0100 +@@ -468,9 +468,6 @@ struct elf_x86_link_hash_table + /* The amount of space used by the jump slots in the GOT. */ + bfd_vma sgotplt_jump_table_size; + +- /* Small local sym cache. */ +- struct sym_cache sym_cache; +- + /* _TLS_MODULE_BASE_ symbol. */ + struct bfd_link_hash_entry *tls_module_base; + diff --git a/binutils-attach-to-group.patch b/binutils-attach-to-group.patch new file mode 100644 index 0000000..f33f861 --- /dev/null +++ b/binutils-attach-to-group.patch @@ -0,0 +1,66 @@ +diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.30/gas/config/obj-elf.c +--- binutils.orig/gas/config/obj-elf.c 2018-09-24 17:50:06.974172867 +0100 ++++ binutils-2.30/gas/config/obj-elf.c 2018-09-25 15:19:33.559830794 +0100 +@@ -82,9 +82,11 @@ static void obj_elf_gnu_attribute (int); + static void obj_elf_tls_common (int); + static void obj_elf_lcomm (int); + static void obj_elf_struct (int); ++static void obj_elf_attach_to_group (int); + + static const pseudo_typeS elf_pseudo_table[] = + { ++ {"attach_to_group", obj_elf_attach_to_group, 0}, + {"comm", obj_elf_common, 0}, + {"common", obj_elf_common, 1}, + {"ident", obj_elf_ident, 0}, +@@ -1007,6 +1009,27 @@ obj_elf_section_name (void) + return name; + } + ++static void ++obj_elf_attach_to_group (int dummy ATTRIBUTE_UNUSED) ++{ ++ const char * gname = obj_elf_section_name (); ++ ++ if (gname == NULL) ++ { ++ as_warn ("group name not parseable"); ++ return; ++ } ++ ++ if (elf_group_name (now_seg)) ++ { ++ as_warn ("already has a group"); ++ return; ++ } ++ ++ elf_group_name (now_seg) = xstrdup (gname); ++ elf_section_flags (now_seg) |= SHF_GROUP; ++} ++ + void + obj_elf_section (int push) + { +--- binutils.orig/gas/doc/as.texi 2020-07-24 15:12:46.452951381 +0100 ++++ binutils-2.35/gas/doc/as.texi 2020-07-24 15:15:41.742825163 +0100 +@@ -4373,6 +4373,7 @@ Some machine configurations provide addi + * Altmacro:: @code{.altmacro} + * Ascii:: @code{.ascii "@var{string}"}@dots{} + * Asciz:: @code{.asciz "@var{string}"}@dots{} ++* Attach_to_group:: @code{.attach_to_group @var{name}} + * Balign:: @code{.balign [@var{abs-expr}[, @var{abs-expr}]]} + * Bundle directives:: @code{.bundle_align_mode @var{abs-expr}}, etc + * Byte:: @code{.byte @var{expressions}} +@@ -4670,6 +4671,12 @@ trailing zero byte) into consecutive add + @code{.asciz} is just like @code{.ascii}, but each string is followed by + a zero byte. The ``z'' in @samp{.asciz} stands for ``zero''. + ++@node Attach_to_group ++@section @code{.attach_to_group @var{name}} ++Attaches the current section to the named group. This is like declaring ++the section with the @code{G} attribute, but can be done after the section ++has been created. ++ + @node Balign + @section @code{.balign[wl] [@var{abs-expr}[, @var{abs-expr}[, @var{abs-expr}]]]} + diff --git a/binutils-config.patch b/binutils-config.patch new file mode 100644 index 0000000..8456584 --- /dev/null +++ b/binutils-config.patch @@ -0,0 +1,44 @@ +diff -Nrup a/libiberty/aclocal.m4 b/libiberty/aclocal.m4 +--- a/libiberty/aclocal.m4 2019-01-19 09:01:34.000000000 -0700 ++++ b/libiberty/aclocal.m4 2020-01-09 22:00:27.183312982 -0700 +@@ -147,7 +147,7 @@ if test $ac_cv_os_cray = yes; then + fi + + AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, +-[AC_TRY_RUN([find_stack_direction () ++[AC_TRY_RUN([__attribute__ ((noclone,noinline)) find_stack_direction () + { + static char *addr = 0; + auto char dummy; +diff --git a/config/intdiv0.m4 b/config/intdiv0.m4 +index 55dddcf1..ba906efc 100644 +--- a/config/intdiv0.m4 ++++ b/config/intdiv0.m4 +@@ -31,10 +31,10 @@ sigfpe_handler (sig) int sig; + exit (sig != SIGFPE); + } + +-int x = 1; +-int y = 0; +-int z; +-int nan; ++volatile int x = 1; ++volatile int y = 0; ++volatile int z; ++volatile int nan; + + int main () + { +diff --git a/libiberty/configure.ac b/libiberty/configure.ac +index f1ce7601..fc20d228 100644 +--- a/libiberty/configure.ac ++++ b/libiberty/configure.ac +@@ -661,7 +661,7 @@ if test -z "${setobjs}"; then + for v in $vars; do + AC_MSG_CHECKING([for $v]) + AC_CACHE_VAL(libiberty_cv_var_$v, +- [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p = $v;]])], ++ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[__attribute__ ((used)) int *p;]],[[extern int $v []; p = $v;]])], + [eval "libiberty_cv_var_$v=yes"], + [eval "libiberty_cv_var_$v=no"])]) + if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then diff --git a/binutils-do-not-link-with-static-libstdc++.patch b/binutils-do-not-link-with-static-libstdc++.patch new file mode 100644 index 0000000..49d46c2 --- /dev/null +++ b/binutils-do-not-link-with-static-libstdc++.patch @@ -0,0 +1,83 @@ +diff -rup binutils.orig/configure binutils-2.30/configure +--- binutils.orig/configure 2018-09-24 17:50:06.967172922 +0100 ++++ binutils-2.30/configure 2018-09-24 17:51:16.648624865 +0100 +@@ -4996,49 +4996,6 @@ if test -z "$LD"; then + fi + fi + +-# Check whether -static-libstdc++ -static-libgcc is supported. +-have_static_libs=no +-if test "$GCC" = yes; then +- saved_LDFLAGS="$LDFLAGS" +- +- LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc" +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -static-libstdc++ -static-libgcc" >&5 +-$as_echo_n "checking whether g++ accepts -static-libstdc++ -static-libgcc... " >&6; } +- ac_ext=cpp +-ac_cpp='$CXXCPP $CPPFLAGS' +-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +- +- +-cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +-#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) +-#error -static-libstdc++ not implemented +-#endif +-int main() {} +-_ACEOF +-if ac_fn_cxx_try_link "$LINENO"; then : +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +-$as_echo "yes" >&6; }; have_static_libs=yes +-else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext conftest.$ac_ext +- ac_ext=c +-ac_cpp='$CPP $CPPFLAGS' +-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +-ac_compiler_gnu=$ac_cv_c_compiler_gnu +- +- +- LDFLAGS="$saved_LDFLAGS" +-fi +- +- + + + if test -n "$ac_tool_prefix"; then +diff -rup binutils.orig/configure.ac binutils-2.30/configure.ac +--- binutils.orig/configure.ac 2018-09-24 17:50:07.241170767 +0100 ++++ binutils-2.30/configure.ac 2018-09-24 17:50:29.908992486 +0100 +@@ -1288,26 +1288,6 @@ if test -z "$LD"; then + fi + fi + +-# Check whether -static-libstdc++ -static-libgcc is supported. +-have_static_libs=no +-if test "$GCC" = yes; then +- saved_LDFLAGS="$LDFLAGS" +- +- LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc" +- AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc]) +- AC_LANG_PUSH(C++) +- AC_LINK_IFELSE([AC_LANG_SOURCE([ +-#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) +-#error -static-libstdc++ not implemented +-#endif +-int main() {}])], +- [AC_MSG_RESULT([yes]); have_static_libs=yes], +- [AC_MSG_RESULT([no])]) +- AC_LANG_POP(C++) +- +- LDFLAGS="$saved_LDFLAGS" +-fi +- + ACX_PROG_GNAT + ACX_PROG_CMP_IGNORE_INITIAL + diff --git a/binutils-elf-add-objects.patch b/binutils-elf-add-objects.patch new file mode 100644 index 0000000..fbe73bb --- /dev/null +++ b/binutils-elf-add-objects.patch @@ -0,0 +1,36 @@ +--- binutils.orig/bfd/elflink.c 2020-07-31 10:45:48.747912761 +0100 ++++ binutils-2.35/bfd/elflink.c 2020-07-31 10:47:26.336262770 +0100 +@@ -505,6 +505,16 @@ bfd_elf_link_record_dynamic_symbol (stru + const char *name; + size_t indx; + ++ if (h->root.type == bfd_link_hash_defined ++ || h->root.type == bfd_link_hash_defweak) ++ { ++ /* An IR symbol should not be made dynamic. */ ++ if (h->root.u.def.section != NULL ++ && h->root.u.def.section->owner != NULL ++ && (h->root.u.def.section->owner->flags & BFD_PLUGIN) != 0) ++ return TRUE; ++ } ++ + /* XXX: The ABI draft says the linker must turn hidden and + internal symbols into STB_LOCAL symbols when producing the + DSO. However, if ld.so honors st_other in the dynamic table, +@@ -5199,15 +5209,11 @@ elf_link_add_object_symbols (bfd *abfd, + break; + } + +- /* Don't add DT_NEEDED for references from the dummy bfd nor +- for unmatched symbol. */ + if (!add_needed + && matched + && definition + && ((dynsym +- && h->ref_regular_nonweak +- && (old_bfd == NULL +- || (old_bfd->flags & BFD_PLUGIN) == 0)) ++ && h->ref_regular_nonweak) + || (h->ref_dynamic_nonweak + && (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0 + && !on_needed_list (elf_dt_name (abfd), diff --git a/binutils-export-demangle.h.patch b/binutils-export-demangle.h.patch new file mode 100644 index 0000000..6e47d7d --- /dev/null +++ b/binutils-export-demangle.h.patch @@ -0,0 +1,33 @@ +diff -rup binutils.orig/bfd/Makefile.am binutils-2.32/bfd/Makefile.am +--- binutils.orig/bfd/Makefile.am 2019-02-08 12:22:51.395684251 +0000 ++++ binutils-2.32/bfd/Makefile.am 2019-02-08 12:22:53.970664973 +0000 +@@ -33,7 +33,7 @@ bfdlibdir = @bfdlibdir@ + bfdincludedir = @bfdincludedir@ + bfdlib_LTLIBRARIES = libbfd.la + bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ +- bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h ++ bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h + else !INSTALL_LIBBFD + # Empty these so that the respective installation directories will not be created. + bfdlibdir = +diff -rup binutils.orig/bfd/Makefile.in binutils-2.32/bfd/Makefile.in +--- binutils.orig/bfd/Makefile.in 2019-02-08 12:21:35.291254044 +0000 ++++ binutils-2.32/bfd/Makefile.in 2019-02-08 12:22:10.163992947 +0000 +@@ -249,7 +249,7 @@ am__can_run_installinfo = \ + esac + am__bfdinclude_HEADERS_DIST = $(INCDIR)/plugin-api.h bfd.h \ + $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h bfd_stdint.h \ +- $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h ++ $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h + HEADERS = $(bfdinclude_HEADERS) + RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +@@ -468,7 +468,7 @@ libbfd_la_LDFLAGS = $(am__append_1) -rel + @INSTALL_LIBBFD_FALSE@bfdinclude_HEADERS = $(am__append_2) + @INSTALL_LIBBFD_TRUE@bfdinclude_HEADERS = $(BFD_H) \ + @INSTALL_LIBBFD_TRUE@ $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ +-@INSTALL_LIBBFD_TRUE@ bfd_stdint.h $(INCDIR)/diagnostics.h \ ++@INSTALL_LIBBFD_TRUE@ bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/demangle.h \ + @INSTALL_LIBBFD_TRUE@ $(INCDIR)/bfdlink.h $(am__append_2) + @INSTALL_LIBBFD_FALSE@rpath_bfdlibdir = @bfdlibdir@ + @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libbfd.la diff --git a/binutils-fix-ld-failures.patch b/binutils-fix-ld-failures.patch new file mode 100644 index 0000000..cc72d50 --- /dev/null +++ b/binutils-fix-ld-failures.patch @@ -0,0 +1,269 @@ +diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.35/ld/testsuite/ld-plugin/lto.exp +--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-07-28 08:49:07.129503894 +0100 ++++ binutils-2.35/ld/testsuite/ld-plugin/lto.exp 2020-07-28 08:54:50.102224314 +0100 +@@ -31,8 +31,6 @@ if { ![check_plugin_api_available] + + set saved_CFLAGS "$CFLAGS" + set saved_CXXFLAGS "$CXXFLAGS" +-regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS +-regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS + + proc restore_notify { } { + global saved_CFLAGS +diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.35/ld/testsuite/ld-plugin/plugin-10.d +--- binutils.orig/ld/testsuite/ld-plugin/plugin-10.d 2020-07-28 08:49:07.128503898 +0100 ++++ binutils-2.35/ld/testsuite/ld-plugin/plugin-10.d 2020-07-28 10:07:50.675963507 +0100 +@@ -32,8 +32,8 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/libtext.a \[@.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* ++Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF.* + #... + hook called: cleanup. + #... +diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-11.d binutils-2.35/ld/testsuite/ld-plugin/plugin-11.d +--- binutils.orig/ld/testsuite/ld-plugin/plugin-11.d 2020-07-28 08:49:07.128503898 +0100 ++++ binutils-2.35/ld/testsuite/ld-plugin/plugin-11.d 2020-07-28 10:08:07.540898427 +0100 +@@ -35,9 +35,9 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* ++Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF.* ++Sym: '_?text' Resolution: LDPR_PREVAILING_DEF.* + #... + hook called: cleanup. + #... +diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-16.d binutils-2.35/ld/testsuite/ld-plugin/plugin-16.d +--- binutils.orig/ld/testsuite/ld-plugin/plugin-16.d 2020-07-28 08:49:07.133503879 +0100 ++++ binutils-2.35/ld/testsuite/ld-plugin/plugin-16.d 2020-07-28 10:07:10.525118454 +0100 +@@ -30,8 +30,8 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* ++Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF.* + #... + hook called: cleanup. + #... +diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-17.d binutils-2.35/ld/testsuite/ld-plugin/plugin-17.d +--- binutils.orig/ld/testsuite/ld-plugin/plugin-17.d 2020-07-28 08:49:07.129503894 +0100 ++++ binutils-2.35/ld/testsuite/ld-plugin/plugin-17.d 2020-07-28 10:07:28.119050562 +0100 +@@ -31,8 +31,8 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* ++Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF.* + #... + hook called: cleanup. + #... +diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-18.d binutils-2.35/ld/testsuite/ld-plugin/plugin-18.d +--- binutils.orig/ld/testsuite/ld-plugin/plugin-18.d 2020-07-28 08:49:07.132503883 +0100 ++++ binutils-2.35/ld/testsuite/ld-plugin/plugin-18.d 2020-07-28 10:08:56.503709477 +0100 +@@ -32,8 +32,8 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/libtext.a \[@.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* ++Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF.* + #... + hook called: cleanup. + #... +diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-19.d binutils-2.35/ld/testsuite/ld-plugin/plugin-19.d +--- binutils.orig/ld/testsuite/ld-plugin/plugin-19.d 2020-07-28 08:49:07.128503898 +0100 ++++ binutils-2.35/ld/testsuite/ld-plugin/plugin-19.d 2020-07-28 10:08:24.053834702 +0100 +@@ -35,9 +35,9 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* ++Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF.* ++Sym: '_?text' Resolution: LDPR_PREVAILING_DEF.* + #... + hook called: cleanup. + #... +diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.35/ld/testsuite/ld-plugin/plugin-8.d +--- binutils.orig/ld/testsuite/ld-plugin/plugin-8.d 2020-07-28 08:49:07.131503887 +0100 ++++ binutils-2.35/ld/testsuite/ld-plugin/plugin-8.d 2020-07-28 10:06:08.440358037 +0100 +@@ -30,8 +30,8 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* ++Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF.* + #... + hook called: cleanup. + #... +diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-9.d binutils-2.35/ld/testsuite/ld-plugin/plugin-9.d +--- binutils.orig/ld/testsuite/ld-plugin/plugin-9.d 2020-07-28 08:49:07.133503879 +0100 ++++ binutils-2.35/ld/testsuite/ld-plugin/plugin-9.d 2020-07-28 10:06:36.839248442 +0100 +@@ -31,8 +31,8 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* ++Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF.* + #... + hook called: cleanup. + #... +diff -rup binutils.orig/ld/testsuite/ld-plugin/pr20070.d binutils-2.35/ld/testsuite/ld-plugin/pr20070.d +--- binutils.orig/ld/testsuite/ld-plugin/pr20070.d 2020-07-28 08:49:07.129503894 +0100 ++++ binutils-2.35/ld/testsuite/ld-plugin/pr20070.d 2020-07-28 09:39:31.619488398 +0100 +@@ -1,10 +1,10 @@ + hook called: all symbols read. + Input: pr20070b.c \(tmpdir/libpr20070.a\) +-Sym: 'def' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: 'weakdef' Resolution: LDPR_PREVAILING_DEF_IRONLY ++Sym: 'def' Resolution: LDPR_PREVAILING_DEF_.* ++Sym: 'weakdef' Resolution: LDPR_PREVAILING_DEF_.* + Sym: 'undef' Resolution: LDPR_UNDEF + Sym: 'weakundef' Resolution: LDPR_UNDEF +-Sym: 'common' Resolution: LDPR_PREVAILING_DEF_IRONLY ++Sym: 'common' Resolution: LDPR_PREVAILING_DEF_.* + #... + hook called: cleanup. + #... +diff -rup binutils.orig/ld/testsuite/ld-x86-64/property-1a.r binutils-2.35/ld/testsuite/ld-x86-64/property-1a.r +--- binutils.orig/ld/testsuite/ld-x86-64/property-1a.r 2020-07-28 08:49:07.203503617 +0100 ++++ binutils-2.35/ld/testsuite/ld-x86-64/property-1a.r 2020-07-28 10:09:29.622581671 +0100 +@@ -3,6 +3,7 @@ Displaying notes found in: .note.gnu.pro + [ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: no copy on protected ++#... + x86 ISA used: + x86 feature used: x86 + +diff -rup binutils.orig/ld/testsuite/ld-x86-64/property-2a.r binutils-2.35/ld/testsuite/ld-x86-64/property-2a.r +--- binutils.orig/ld/testsuite/ld-x86-64/property-2a.r 2020-07-28 08:49:07.196503643 +0100 ++++ binutils-2.35/ld/testsuite/ld-x86-64/property-2a.r 2020-07-28 09:42:30.825802177 +0100 +@@ -3,6 +3,7 @@ Displaying notes found in: .note.gnu.pro + [ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: stack size: 0x800000 ++#... + x86 ISA used: + x86 feature used: x86 + +diff -rup binutils.orig/ld/testsuite/ld-x86-64/property-3.r binutils-2.35/ld/testsuite/ld-x86-64/property-3.r +--- binutils.orig/ld/testsuite/ld-x86-64/property-3.r 2020-07-28 08:49:07.192503658 +0100 ++++ binutils-2.35/ld/testsuite/ld-x86-64/property-3.r 2020-07-28 09:43:59.247463593 +0100 +@@ -3,5 +3,5 @@ Displaying notes found in: .note.gnu.pro + [ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: stack size: 0x800000 +- x86 ISA needed: CMOV, SSE ++ x86 ISA needed: SSE, SSE2 + #pass +diff -rup binutils.orig/ld/testsuite/ld-x86-64/property-3a.r binutils-2.35/ld/testsuite/ld-x86-64/property-3a.r +--- binutils.orig/ld/testsuite/ld-x86-64/property-3a.r 2020-07-28 08:49:07.197503639 +0100 ++++ binutils-2.35/ld/testsuite/ld-x86-64/property-3a.r 2020-07-28 09:44:34.145329965 +0100 +@@ -3,6 +3,7 @@ Displaying notes found in: .note.gnu.pro + [ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: stack size: 0x800000 ++#... + x86 ISA needed: CMOV, SSE + x86 ISA used: SSE, SSE3 + x86 feature used: x86 +diff -rup binutils.orig/ld/testsuite/ld-x86-64/property-4.r binutils-2.35/ld/testsuite/ld-x86-64/property-4.r +--- binutils.orig/ld/testsuite/ld-x86-64/property-4.r 2020-07-28 08:49:07.192503658 +0100 ++++ binutils-2.35/ld/testsuite/ld-x86-64/property-4.r 2020-07-28 09:45:09.585194255 +0100 +@@ -3,5 +3,5 @@ Displaying notes found in: .note.gnu.pro + [ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: stack size: 0x800000 +- x86 ISA needed: CMOV, SSE, SSE3 ++ x86 ISA needed: .* + #pass +diff -rup binutils.orig/ld/testsuite/ld-x86-64/property-4a.r binutils-2.35/ld/testsuite/ld-x86-64/property-4a.r +--- binutils.orig/ld/testsuite/ld-x86-64/property-4a.r 2020-07-28 08:49:07.195503647 +0100 ++++ binutils-2.35/ld/testsuite/ld-x86-64/property-4a.r 2020-07-28 11:48:01.518912704 +0100 +@@ -3,7 +3,7 @@ Displaying notes found in: .note.gnu.pro + [ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: stack size: 0x800000 +- x86 ISA needed: CMOV, SSE, SSE3 ++#... + x86 ISA used: CMOV, SSE, SSE3 + x86 feature used: x86 + #pass +diff -rup binutils.orig/ld/testsuite/ld-x86-64/property-5.r binutils-2.35/ld/testsuite/ld-x86-64/property-5.r +--- binutils.orig/ld/testsuite/ld-x86-64/property-5.r 2020-07-28 08:49:07.196503643 +0100 ++++ binutils-2.35/ld/testsuite/ld-x86-64/property-5.r 2020-07-28 10:10:35.206328582 +0100 +@@ -3,5 +3,5 @@ Displaying notes found in: .note.gnu.pro + [ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: stack size: 0x900000 +- x86 ISA needed: CMOV, SSE, SSE3 ++ x86 ISA needed: .* + #pass +diff -rup binutils.orig/ld/testsuite/ld-x86-64/property-5a.r binutils-2.35/ld/testsuite/ld-x86-64/property-5a.r +--- binutils.orig/ld/testsuite/ld-x86-64/property-5a.r 2020-07-28 08:49:07.187503677 +0100 ++++ binutils-2.35/ld/testsuite/ld-x86-64/property-5a.r 2020-07-28 11:48:24.220790926 +0100 +@@ -3,7 +3,7 @@ Displaying notes found in: .note.gnu.pro + [ ]+Owner[ ]+Data size[ ]+Description + GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 + Properties: stack size: 0x900000 +- x86 ISA needed: CMOV, SSE, SSE3 ++#... + x86 ISA used: CMOV, SSE, SSE3 + x86 feature used: x86 + #pass +diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.35/ld/testsuite/ld-x86-64/x86-64.exp +--- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2020-07-28 08:49:07.192503658 +0100 ++++ binutils-2.35/ld/testsuite/ld-x86-64/x86-64.exp 2020-07-28 10:17:29.571700687 +0100 +@@ -1399,24 +1399,6 @@ if { [isnative] && [check_compiler_avail + ] \ + ] + } else { +- run_cc_link_tests [list \ +- [list \ +- "Build pr22001-1b" \ +- "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed,-z,notext tmpdir/pr22001-1.so" \ +- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \ +- { pr22001-1c.c } \ +- {{error_output "pr22001-1b.err"}} \ +- "pr22001-1b" \ +- ] \ +- [list \ +- "Build pr21997-1b" \ +- "$NOPIE_LDFLAGS -Wl,--no-as-needed,-z,notext tmpdir/pr21997-1.so" \ +- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \ +- { pr21997-1c.c } \ +- {{error_output "pr21997-1b.err"}} \ +- "pr21997-1b" \ +- ] \ +- ] + } + + run_ld_link_exec_tests [list \ +@@ -2052,7 +2034,7 @@ if { [isnative] && [check_compiler_avail + } + } + +- undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" ++ # undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" + undefined_weak "-fPIE" "" + undefined_weak "-fPIE" "-pie" + undefined_weak "-fPIE" "-Wl,-z,nodynamic-undefined-weak" diff --git a/binutils-fix-testsuite-failures.patch b/binutils-fix-testsuite-failures.patch new file mode 100644 index 0000000..c2b19a5 --- /dev/null +++ b/binutils-fix-testsuite-failures.patch @@ -0,0 +1,330 @@ +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 13:33:21.979627285 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 13:40:26.911199033 +0000 +@@ -34,5 +34,6 @@ hook called: claim_file tmpdir/libtext.a + hook called: all symbols read. + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-13.d binutils-2.32/ld/testsuite/ld-plugin/plugin-13.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-13.d 2019-02-15 13:33:21.980627277 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-13.d 2019-02-15 13:41:30.189692800 +0000 +@@ -23,5 +23,3 @@ hook called: claim_file tmpdir/main.o \[ + hook called: claim_file .*/ld/testsuite/ld-plugin/func.c \[@0/.* CLAIMED + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... +-.*main.c.*: undefined reference to `\.?func' +-#... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-14.d binutils-2.32/ld/testsuite/ld-plugin/plugin-14.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-14.d 2019-02-15 13:33:21.977627301 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-14.d 2019-02-15 13:42:03.598430960 +0000 +@@ -27,7 +27,6 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-15.d binutils-2.32/ld/testsuite/ld-plugin/plugin-15.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-15.d 2019-02-15 13:33:21.980627277 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-15.d 2019-02-15 13:42:28.014239600 +0000 +@@ -28,7 +28,6 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-16.d binutils-2.32/ld/testsuite/ld-plugin/plugin-16.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-16.d 2019-02-15 13:33:21.977627301 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-16.d 2019-02-15 13:43:21.309821910 +0000 +@@ -30,9 +30,8 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-17.d binutils-2.32/ld/testsuite/ld-plugin/plugin-17.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-17.d 2019-02-15 13:33:21.977627301 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-17.d 2019-02-15 13:43:54.925558451 +0000 +@@ -31,7 +31,8 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-20.d binutils-2.32/ld/testsuite/ld-plugin/plugin-20.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-20.d 2019-02-15 13:33:21.980627277 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-20.d 2019-02-15 13:49:20.091010016 +0000 +@@ -2,6 +2,5 @@ hook called: all symbols read. + Input: func.c \(tmpdir/libfunc.a\) + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-21.d binutils-2.32/ld/testsuite/ld-plugin/plugin-21.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-21.d 2019-02-15 13:33:21.978627293 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-21.d 2019-02-15 13:49:34.506897033 +0000 +@@ -2,6 +2,5 @@ hook called: all symbols read. + Input: .*/ld/testsuite/ld-plugin/func.c \(.*/ld/testsuite/ld-plugin/func.c\) + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-22.d binutils-2.32/ld/testsuite/ld-plugin/plugin-22.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-22.d 2019-02-15 13:33:21.980627277 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-22.d 2019-02-15 13:50:00.409694022 +0000 +@@ -2,6 +2,5 @@ Claimed: tmpdir/libfunc.a \[@.* + hook called: all symbols read. + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-23.d binutils-2.32/ld/testsuite/ld-plugin/plugin-23.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-23.d 2019-02-15 13:33:21.979627285 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-23.d 2019-02-15 13:50:14.938580156 +0000 +@@ -2,6 +2,5 @@ Claimed: .*/ld/testsuite/ld-plugin/func. + hook called: all symbols read. + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-24.d binutils-2.32/ld/testsuite/ld-plugin/plugin-24.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-24.d 2019-02-15 13:33:21.980627277 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-24.d 2019-02-15 13:49:46.346804240 +0000 +@@ -2,4 +2,5 @@ hook called: all symbols read. + Input: .*/ld/testsuite/ld-plugin/func.c \(.*/ld/testsuite/ld-plugin/func.c\) + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* ++#... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-25.d binutils-2.32/ld/testsuite/ld-plugin/plugin-25.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-25.d 2019-02-15 13:33:21.978627293 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-25.d 2019-02-15 13:50:29.322467422 +0000 +@@ -2,4 +2,5 @@ Claimed: .*/ld/testsuite/ld-plugin/func. + hook called: all symbols read. + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* ++#... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-28.d binutils-2.32/ld/testsuite/ld-plugin/plugin-28.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-28.d 2019-02-15 13:33:21.977627301 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-28.d 2019-02-15 13:45:05.343006557 +0000 +@@ -1 +1,3 @@ + .*: error: Error ++#... ++ +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-29.d binutils-2.32/ld/testsuite/ld-plugin/plugin-29.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-29.d 2019-02-15 13:33:21.978627293 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-29.d 2019-02-15 13:45:22.764870016 +0000 +@@ -1 +1,2 @@ + .*: warning: Warning ++#... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-30.d binutils-2.32/ld/testsuite/ld-plugin/plugin-30.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-30.d 2019-02-15 13:33:21.976627309 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-30.d 2019-02-15 13:48:57.067190464 +0000 +@@ -24,3 +24,4 @@ hook called: claim_file tmpdir/main.o \[ + hook called: claim_file tmpdir/func.o \[@0/.* not claimed + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + hook called: claim_file tmpdir/libempty.a \[@.* not claimed ++#pass +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-6.d binutils-2.32/ld/testsuite/ld-plugin/plugin-6.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-6.d 2019-02-15 13:33:21.979627285 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-6.d 2019-02-15 13:37:14.672749977 +0000 +@@ -27,7 +27,6 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-7.d binutils-2.32/ld/testsuite/ld-plugin/plugin-7.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-7.d 2019-02-15 13:33:21.977627301 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-7.d 2019-02-15 13:37:58.000400421 +0000 +@@ -28,7 +28,6 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.32/ld/testsuite/ld-plugin/plugin-8.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-8.d 2019-02-15 13:33:21.980627277 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-8.d 2019-02-15 13:38:34.096109209 +0000 +@@ -32,7 +32,6 @@ hook called: claim_file tmpdir/text.o \[ + hook called: all symbols read. + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-9.d binutils-2.32/ld/testsuite/ld-plugin/plugin-9.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-9.d 2019-02-15 13:33:21.977627301 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-9.d 2019-02-15 13:39:52.655475403 +0000 +@@ -31,7 +31,8 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/pr20070.d binutils-2.32/ld/testsuite/ld-plugin/pr20070.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/pr20070.d 2019-02-15 13:33:21.976627309 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/pr20070.d 2019-02-15 13:50:56.874251486 +0000 +@@ -5,5 +5,6 @@ Sym: 'weakdef' Resolution: LDPR_PREVAILI + Sym: 'undef' Resolution: LDPR_UNDEF + Sym: 'weakundef' Resolution: LDPR_UNDEF + Sym: 'common' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-srec/srec.exp binutils-2.32/ld/testsuite/ld-srec/srec.exp +--- binutils-2.32.orig/ld/testsuite/ld-srec/srec.exp 2019-02-15 13:33:21.938627615 +0000 ++++ binutils-2.32/ld/testsuite/ld-srec/srec.exp 2019-02-15 13:53:58.744814006 +0000 +@@ -21,6 +21,8 @@ + + # Get the offset from an S-record line to the start of the data. + ++return ++ + proc srec_off { l } { + if [string match "S1*" $l] { + return 8 +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 14:10:59.038709514 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 14:13:53.532300721 +0000 +@@ -32,7 +32,7 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/libtext.a \[@.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY + #... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-11.d binutils-2.32/ld/testsuite/ld-plugin/plugin-11.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-11.d 2019-02-15 14:10:59.041709490 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-11.d 2019-02-15 14:14:50.061844322 +0000 +@@ -35,8 +35,9 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-18.d binutils-2.32/ld/testsuite/ld-plugin/plugin-18.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-18.d 2019-02-15 14:10:58.942710289 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-18.d 2019-02-15 14:15:20.030602369 +0000 +@@ -32,7 +32,8 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/libtext.a \[@.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-19.d binutils-2.32/ld/testsuite/ld-plugin/plugin-19.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-19.d 2019-02-15 14:10:59.024709627 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-19.d 2019-02-15 14:15:54.926320633 +0000 +@@ -35,8 +35,9 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-28.d binutils-2.32/ld/testsuite/ld-plugin/plugin-28.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-28.d 2019-02-15 14:10:58.998709837 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-28.d 2019-02-15 14:12:19.856057024 +0000 +@@ -1,3 +1,2 @@ + .*: error: Error + #... +- +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.32/ld/testsuite/ld-plugin/plugin-8.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-8.d 2019-02-15 14:10:59.074709224 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-8.d 2019-02-15 14:11:48.144313048 +0000 +@@ -30,7 +30,7 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY + #... + hook called: cleanup. +diff -rup binutils.orig/ld/testsuite/ld-elfvers/vers24.rd binutils-2.30/ld/testsuite/ld-elfvers/vers24.rd +--- binutils.orig/ld/testsuite/ld-elfvers/vers24.rd 2018-09-05 09:45:44.013108697 +0100 ++++ binutils-2.30/ld/testsuite/ld-elfvers/vers24.rd 2018-09-05 12:06:17.287425232 +0100 +@@ -7,9 +7,9 @@ Symbol table '.dynsym' contains [0-9]+ e + # And ensure the dynamic symbol table contains at least x@VERS.0 + # and foo@@VERS.0 symbols + #... +- +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0 ++ +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0.* + #... +- +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0 ++ +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0.* + #... + Symbol table '.symtab' contains [0-9]+ entries: + #pass +diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin.exp binutils-2.30/ld/testsuite/ld-plugin/plugin.exp +--- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2018-09-05 09:45:44.023108605 +0100 ++++ binutils-2.30/ld/testsuite/ld-plugin/plugin.exp 2018-09-05 11:18:53.997202105 +0100 +@@ -118,6 +118,12 @@ if { $can_compile && !$failed_compile } + } + } + ++# I do not know why, but the underscore prefix test is going ++# wrong on ppc64le targets. So override it here. ++if { [istarget powerpc*-*-linux*] || [istarget x86_64*-*-linux*] } { ++ set _ "" ++} ++ + set testobjfiles "tmpdir/main.o tmpdir/func.o tmpdir/text.o" + set testobjfiles_notext "tmpdir/main.o tmpdir/func.o" + set testsrcfiles "tmpdir/main.o $srcdir/$subdir/func.c tmpdir/text.o" diff --git a/binutils-gas-dwarf-level-4.patch b/binutils-gas-dwarf-level-4.patch new file mode 100644 index 0000000..acdaaf4 --- /dev/null +++ b/binutils-gas-dwarf-level-4.patch @@ -0,0 +1,11 @@ +--- binutils.orig/gas/as.c 2020-07-30 08:41:25.034236441 +0100 ++++ binutils-2.35/gas/as.c 2020-07-30 08:41:52.197058041 +0100 +@@ -103,7 +103,7 @@ int verbose = 0; + int flag_dwarf_cie_version = -1; + + /* The maximum level of DWARF DEBUG information we should manufacture. */ +-unsigned int dwarf_level = 0; ++unsigned int dwarf_level = 3; + + #if defined OBJ_ELF || defined OBJ_MAYBE_ELF + int flag_use_elf_stt_common = DEFAULT_GENERATE_ELF_STT_COMMON; diff --git a/binutils-gas-speedups.patch b/binutils-gas-speedups.patch new file mode 100644 index 0000000..10b50d8 --- /dev/null +++ b/binutils-gas-speedups.patch @@ -0,0 +1,7750 @@ +Only in binutils-2.35/gas: ChangeLog.orig +Only in binutils-2.35/gas: ChangeLog.rej +Only in binutils-2.35/gas: NEWS.orig +Only in binutils-2.35/gas: NEWS.rej +diff -rup binutils.orig/gas/as.c binutils-2.35/gas/as.c +--- binutils.orig/gas/as.c 2021-08-11 17:33:12.486488583 +0100 ++++ binutils-2.35/gas/as.c 2021-08-11 17:41:32.630279947 +0100 +@@ -345,10 +345,6 @@ Options:\n\ + fprintf (stream, _("\ + --gdwarf-sections generate per-function section names for DWARF line information\n")); + fprintf (stream, _("\ +- --hash-size= set the hash table size close to \n")); +- fprintf (stream, _("\ +- --help show this message and exit\n")); +- fprintf (stream, _("\ + --target-help show target specific options\n")); + fprintf (stream, _("\ + -I DIR add DIR to search list for .include directives\n")); +@@ -371,10 +367,6 @@ Options:\n\ + fprintf (stream, _("\ + -R fold data section into text section\n")); + fprintf (stream, _("\ +- --reduce-memory-overheads \n\ +- prefer smaller memory use at the cost of longer\n\ +- assembly times\n")); +- fprintf (stream, _("\ + --statistics print various measured statistics from execution\n")); + fprintf (stream, _("\ + --strip-local-absolute strip local absolute symbols\n")); +@@ -1099,22 +1091,10 @@ This program has absolutely no warranty. + break; + + case OPTION_REDUCE_MEMORY_OVERHEADS: +- /* The only change we make at the moment is to reduce +- the size of the hash tables that we use. */ +- set_gas_hash_table_size (4051); + break; + + case OPTION_HASH_TABLE_SIZE: +- { +- unsigned long new_size; +- +- new_size = strtoul (optarg, NULL, 0); +- if (new_size) +- set_gas_hash_table_size (new_size); +- else +- as_fatal (_("--hash-size needs a numeric argument")); +- break; +- } ++ break; + } + } + +Only in binutils-2.35/gas: as.c.orig +diff -rup binutils.orig/gas/as.h binutils-2.35/gas/as.h +--- binutils.orig/gas/as.h 2021-08-11 17:33:12.203490408 +0100 ++++ binutils-2.35/gas/as.h 2021-08-11 17:45:01.315941347 +0100 +@@ -565,6 +565,7 @@ int generic_force_reloc (struct fix *); + + #include "write.h" + #include "frags.h" ++#include "hashtab.h" + #include "hash.h" + #include "read.h" + #include "symbols.h" +diff -rup binutils.orig/gas/config/obj-coff-seh.c binutils-2.35/gas/config/obj-coff-seh.c +--- binutils.orig/gas/config/obj-coff-seh.c 2021-08-11 17:33:12.208490376 +0100 ++++ binutils-2.35/gas/config/obj-coff-seh.c 2021-08-11 17:39:31.399057590 +0100 +@@ -31,7 +31,7 @@ struct seh_seg_list { + /* Local data. */ + static seh_context *seh_ctx_cur = NULL; + +-static struct hash_control *seh_hash; ++static htab_t seh_hash; + + static struct seh_seg_list *x_segcur = NULL; + static struct seh_seg_list *p_segcur = NULL; +@@ -116,17 +116,13 @@ make_pxdata_seg (segT cseg, char *name) + static void + seh_hash_insert (const char *name, struct seh_seg_list *item) + { +- const char *error_string; +- +- if ((error_string = hash_jam (seh_hash, name, (char *) item))) +- as_fatal (_("Inserting \"%s\" into structure table failed: %s"), +- name, error_string); ++ str_hash_insert (seh_hash, name, (char *) item); + } + + static struct seh_seg_list * + seh_hash_find (char *name) + { +- return (struct seh_seg_list *) hash_find (seh_hash, name); ++ return (struct seh_seg_list *) str_hash_find (seh_hash, name); + } + + static struct seh_seg_list * +@@ -137,7 +133,7 @@ seh_hash_find_or_make (segT cseg, const + + /* Initialize seh_hash once. */ + if (!seh_hash) +- seh_hash = hash_new (); ++ seh_hash = str_htab_create (); + + name = get_pxdata_name (cseg, base_name); + +diff -rup binutils.orig/gas/config/obj-coff.c binutils-2.35/gas/config/obj-coff.c +--- binutils.orig/gas/config/obj-coff.c 2021-08-11 17:33:12.214490337 +0100 ++++ binutils-2.35/gas/config/obj-coff.c 2021-08-11 17:39:31.399057590 +0100 +@@ -117,28 +117,24 @@ stack_pop (stack *st) + + /* Maintain a list of the tagnames of the structures. */ + +-static struct hash_control *tag_hash; ++static htab_t tag_hash; + + static void + tag_init (void) + { +- tag_hash = hash_new (); ++ tag_hash = str_htab_create (); + } + + static void + tag_insert (const char *name, symbolS *symbolP) + { +- const char *error_string; +- +- if ((error_string = hash_jam (tag_hash, name, (char *) symbolP))) +- as_fatal (_("Inserting \"%s\" into structure table failed: %s"), +- name, error_string); ++ str_hash_insert (tag_hash, name, (char *) symbolP); + } + + static symbolS * + tag_find (char *name) + { +- return (symbolS *) hash_find (tag_hash, name); ++ return (symbolS *) str_hash_find (tag_hash, name); + } + + static symbolS * +diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.35/gas/config/obj-elf.c +--- binutils.orig/gas/config/obj-elf.c 2021-08-11 17:33:12.215490331 +0100 ++++ binutils-2.35/gas/config/obj-elf.c 2021-08-11 17:39:31.399057590 +0100 +@@ -2610,7 +2610,7 @@ struct group_list + { + asection **head; /* Section lists. */ + unsigned int num_group; /* Number of lists. */ +- struct hash_control *indexes; /* Maps group name to index in head array. */ ++ htab_t indexes; /* Maps group name to index in head array. */ + }; + + static struct group_list groups; +@@ -2648,7 +2648,7 @@ build_additional_section_info (bfd *abfd + + /* If this group already has a list, add the section to the head of + the list. */ +- elem_idx = (unsigned int *) hash_find (list->indexes, group_name); ++ elem_idx = (unsigned int *) str_hash_find (list->indexes, group_name); + if (elem_idx != NULL) + { + elf_next_in_group (sec) = list->head[*elem_idx]; +@@ -2670,12 +2670,15 @@ build_additional_section_info (bfd *abfd + /* Add index to hash. */ + idx_ptr = XNEW (unsigned int); + *idx_ptr = i; +- hash_insert (list->indexes, group_name, idx_ptr); ++ str_hash_insert (list->indexes, group_name, (char *)idx_ptr); + } + +-static void free_section_idx (const char *key ATTRIBUTE_UNUSED, void *val) ++static int ++free_section_idx (void **slot, void *arg ATTRIBUTE_UNUSED) + { +- free ((unsigned int *) val); ++ string_tuple_t *tuple = *((string_tuple_t **) slot); ++ free ((char *)tuple->value); ++ return 1; + } + + /* Create symbols for group signature. */ +@@ -2688,7 +2691,7 @@ elf_adjust_symtab (void) + /* Go find section groups. */ + groups.num_group = 0; + groups.head = NULL; +- groups.indexes = hash_new (); ++ groups.indexes = str_htab_create (); + bfd_map_over_sections (stdoutput, build_additional_section_info, + &groups); + +@@ -2860,8 +2863,8 @@ elf_frob_file_after_relocs (void) + } + + /* Cleanup hash. */ +- hash_traverse (groups.indexes, free_section_idx); +- hash_die (groups.indexes); ++ htab_traverse (groups.indexes, free_section_idx, NULL); ++ htab_delete (groups.indexes); + + #ifdef NEED_ECOFF_DEBUG + if (ECOFF_DEBUGGING) +Only in binutils-2.35/gas/config: obj-elf.c.orig +diff -rup binutils.orig/gas/config/tc-aarch64.c binutils-2.35/gas/config/tc-aarch64.c +--- binutils.orig/gas/config/tc-aarch64.c 2021-08-11 17:33:12.210490363 +0100 ++++ binutils-2.35/gas/config/tc-aarch64.c 2021-08-11 17:40:58.180500928 +0100 +@@ -451,21 +451,21 @@ get_reg_expected_msg (aarch64_reg_type r + /* Instructions take 4 bytes in the object file. */ + #define INSN_SIZE 4 + +-static struct hash_control *aarch64_ops_hsh; +-static struct hash_control *aarch64_cond_hsh; +-static struct hash_control *aarch64_shift_hsh; +-static struct hash_control *aarch64_sys_regs_hsh; +-static struct hash_control *aarch64_pstatefield_hsh; +-static struct hash_control *aarch64_sys_regs_ic_hsh; +-static struct hash_control *aarch64_sys_regs_dc_hsh; +-static struct hash_control *aarch64_sys_regs_at_hsh; +-static struct hash_control *aarch64_sys_regs_tlbi_hsh; +-static struct hash_control *aarch64_sys_regs_sr_hsh; +-static struct hash_control *aarch64_reg_hsh; +-static struct hash_control *aarch64_barrier_opt_hsh; +-static struct hash_control *aarch64_nzcv_hsh; +-static struct hash_control *aarch64_pldop_hsh; +-static struct hash_control *aarch64_hint_opt_hsh; ++static htab_t aarch64_ops_hsh; ++static htab_t aarch64_cond_hsh; ++static htab_t aarch64_shift_hsh; ++static htab_t aarch64_sys_regs_hsh; ++static htab_t aarch64_pstatefield_hsh; ++static htab_t aarch64_sys_regs_ic_hsh; ++static htab_t aarch64_sys_regs_dc_hsh; ++static htab_t aarch64_sys_regs_at_hsh; ++static htab_t aarch64_sys_regs_tlbi_hsh; ++static htab_t aarch64_sys_regs_sr_hsh; ++static htab_t aarch64_reg_hsh; ++static htab_t aarch64_barrier_opt_hsh; ++static htab_t aarch64_nzcv_hsh; ++static htab_t aarch64_pldop_hsh; ++static htab_t aarch64_hint_opt_hsh; + + /* Stuff needed to resolve the label ambiguity + As: +@@ -764,7 +764,7 @@ parse_reg (char **ccp) + p++; + while (ISALPHA (*p) || ISDIGIT (*p) || *p == '_'); + +- reg = (reg_entry *) hash_find_n (aarch64_reg_hsh, start, p - start); ++ reg = (reg_entry *) str_hash_find_n (aarch64_reg_hsh, start, p - start); + + if (!reg) + return NULL; +@@ -1315,7 +1315,7 @@ insert_reg_alias (char *str, int number, + reg_entry *new; + const char *name; + +- if ((new = hash_find (aarch64_reg_hsh, str)) != 0) ++ if ((new = str_hash_find (aarch64_reg_hsh, str)) != 0) + { + if (new->builtin) + as_warn (_("ignoring attempt to redefine built-in register '%s'"), +@@ -1337,8 +1337,7 @@ insert_reg_alias (char *str, int number, + new->type = type; + new->builtin = FALSE; + +- if (hash_insert (aarch64_reg_hsh, name, (void *) new)) +- abort (); ++ str_hash_insert (aarch64_reg_hsh, name, (void *) new); + + return new; + } +@@ -1367,7 +1366,7 @@ create_register_alias (char *newname, ch + if (*oldname == '\0') + return FALSE; + +- old = hash_find (aarch64_reg_hsh, oldname); ++ old = str_hash_find (aarch64_reg_hsh, oldname); + if (!old) + { + as_warn (_("unknown register '%s' -- .req ignored"), oldname); +@@ -1456,7 +1455,7 @@ s_unreq (int a ATTRIBUTE_UNUSED) + as_bad (_("invalid syntax for .unreq directive")); + else + { +- reg_entry *reg = hash_find (aarch64_reg_hsh, name); ++ reg_entry *reg = str_hash_find (aarch64_reg_hsh, name); + + if (!reg) + as_bad (_("unknown register alias '%s'"), name); +@@ -1468,7 +1467,7 @@ s_unreq (int a ATTRIBUTE_UNUSED) + char *p; + char *nbuf; + +- hash_delete (aarch64_reg_hsh, name, FALSE); ++ str_hash_delete (aarch64_reg_hsh, name); + free ((char *) reg->name); + free (reg); + +@@ -1479,20 +1478,20 @@ s_unreq (int a ATTRIBUTE_UNUSED) + nbuf = strdup (name); + for (p = nbuf; *p; p++) + *p = TOUPPER (*p); +- reg = hash_find (aarch64_reg_hsh, nbuf); ++ reg = str_hash_find (aarch64_reg_hsh, nbuf); + if (reg) + { +- hash_delete (aarch64_reg_hsh, nbuf, FALSE); ++ str_hash_delete (aarch64_reg_hsh, nbuf); + free ((char *) reg->name); + free (reg); + } + + for (p = nbuf; *p; p++) + *p = TOLOWER (*p); +- reg = hash_find (aarch64_reg_hsh, nbuf); ++ reg = str_hash_find (aarch64_reg_hsh, nbuf); + if (reg) + { +- hash_delete (aarch64_reg_hsh, nbuf, FALSE); ++ str_hash_delete (aarch64_reg_hsh, nbuf); + free ((char *) reg->name); + free (reg); + } +@@ -3122,7 +3121,7 @@ parse_shift (char **str, aarch64_opnd_in + return FALSE; + } + +- shift_op = hash_find_n (aarch64_shift_hsh, *str, p - *str); ++ shift_op = str_hash_find_n (aarch64_shift_hsh, *str, p - *str); + + if (shift_op == NULL) + { +@@ -3979,7 +3978,7 @@ parse_pldop (char **str) + while (ISALNUM (*q)) + q++; + +- o = hash_find_n (aarch64_pldop_hsh, p, q - p); ++ o = str_hash_find_n (aarch64_pldop_hsh, p, q - p); + if (!o) + return PARSE_FAIL; + +@@ -4000,7 +3999,7 @@ parse_barrier (char **str) + while (ISALPHA (*q)) + q++; + +- o = hash_find_n (aarch64_barrier_opt_hsh, p, q - p); ++ o = str_hash_find_n (aarch64_barrier_opt_hsh, p, q - p); + if (!o) + return PARSE_FAIL; + +@@ -4022,7 +4021,7 @@ parse_barrier_psb (char **str, + while (ISALPHA (*q)) + q++; + +- o = hash_find_n (aarch64_hint_opt_hsh, p, q - p); ++ o = str_hash_find_n (aarch64_hint_opt_hsh, p, q - p); + if (!o) + { + set_fatal_syntax_error +@@ -4057,7 +4056,7 @@ parse_bti_operand (char **str, + while (ISALPHA (*q)) + q++; + +- o = hash_find_n (aarch64_hint_opt_hsh, p, q - p); ++ o = str_hash_find_n (aarch64_hint_opt_hsh, p, q - p); + if (!o) + { + set_fatal_syntax_error +@@ -4095,7 +4094,7 @@ parse_bti_operand (char **str, + */ + + static int +-parse_sys_reg (char **str, struct hash_control *sys_regs, ++parse_sys_reg (char **str, htab_t sys_regs, + int imple_defined_p, int pstatefield_p, + uint32_t* flags) + { +@@ -4112,7 +4111,7 @@ parse_sys_reg (char **str, struct hash_c + /* Assert that BUF be large enough. */ + gas_assert (p - buf == q - *str); + +- o = hash_find (sys_regs, buf); ++ o = str_hash_find (sys_regs, buf); + if (!o) + { + if (!imple_defined_p) +@@ -4156,7 +4155,7 @@ parse_sys_reg (char **str, struct hash_c + for the option, or NULL. */ + + static const aarch64_sys_ins_reg * +-parse_sys_ins_reg (char **str, struct hash_control *sys_ins_regs) ++parse_sys_ins_reg (char **str, htab_t sys_ins_regs) + { + char *p, *q; + char buf[32]; +@@ -4168,7 +4167,7 @@ parse_sys_ins_reg (char **str, struct ha + *p++ = TOLOWER (*q); + *p = '\0'; + +- o = hash_find (sys_ins_regs, buf); ++ o = str_hash_find (sys_ins_regs, buf); + if (!o) + return NULL; + +@@ -5078,7 +5077,7 @@ lookup_mnemonic (const char *start, int + { + templates *templ = NULL; + +- templ = hash_find_n (aarch64_ops_hsh, start, len); ++ templ = str_hash_find_n (aarch64_ops_hsh, start, len); + return templ; + } + +@@ -5109,7 +5108,7 @@ opcode_lookup (char **str) + /* Handle a possible condition. */ + if (dot) + { +- cond = hash_find_n (aarch64_cond_hsh, dot + 1, end - dot - 1); ++ cond = str_hash_find_n (aarch64_cond_hsh, dot + 1, end - dot - 1); + if (cond) + { + inst.cond = cond->value; +@@ -6160,7 +6159,7 @@ parse_operands (char *str, const aarch64 + + case AARCH64_OPND_NZCV: + { +- const asm_nzcv *nzcv = hash_find_n (aarch64_nzcv_hsh, str, 4); ++ const asm_nzcv *nzcv = str_hash_find_n (aarch64_nzcv_hsh, str, 4); + if (nzcv != NULL) + { + str += 4; +@@ -6179,7 +6178,7 @@ parse_operands (char *str, const aarch64 + do + str++; + while (ISALPHA (*str)); +- info->cond = hash_find_n (aarch64_cond_hsh, start, str - start); ++ info->cond = str_hash_find_n (aarch64_cond_hsh, start, str - start); + if (info->cond == NULL) + { + set_syntax_error (_("invalid condition")); +@@ -8603,13 +8602,9 @@ aarch64_adjust_symtab (void) + } + + static void +-checked_hash_insert (struct hash_control *table, const char *key, void *value) ++checked_hash_insert (htab_t table, const char *key, void *value) + { +- const char *hash_err; +- +- hash_err = hash_insert (table, key, value); +- if (hash_err) +- printf ("Internal Error: Can't hash %s\n", key); ++ str_hash_insert (table, key, value); + } + + static void +@@ -8620,7 +8615,7 @@ fill_instruction_hash_table (void) + while (opcode->name != NULL) + { + templates *templ, *new_templ; +- templ = hash_find (aarch64_ops_hsh, opcode->name); ++ templ = str_hash_find (aarch64_ops_hsh, opcode->name); + + new_templ = XNEW (templates); + new_templ->opcode = opcode; +@@ -8666,21 +8661,21 @@ md_begin (void) + unsigned mach; + unsigned int i; + +- if ((aarch64_ops_hsh = hash_new ()) == NULL +- || (aarch64_cond_hsh = hash_new ()) == NULL +- || (aarch64_shift_hsh = hash_new ()) == NULL +- || (aarch64_sys_regs_hsh = hash_new ()) == NULL +- || (aarch64_pstatefield_hsh = hash_new ()) == NULL +- || (aarch64_sys_regs_ic_hsh = hash_new ()) == NULL +- || (aarch64_sys_regs_dc_hsh = hash_new ()) == NULL +- || (aarch64_sys_regs_at_hsh = hash_new ()) == NULL +- || (aarch64_sys_regs_tlbi_hsh = hash_new ()) == NULL +- || (aarch64_sys_regs_sr_hsh = hash_new ()) == NULL +- || (aarch64_reg_hsh = hash_new ()) == NULL +- || (aarch64_barrier_opt_hsh = hash_new ()) == NULL +- || (aarch64_nzcv_hsh = hash_new ()) == NULL +- || (aarch64_pldop_hsh = hash_new ()) == NULL +- || (aarch64_hint_opt_hsh = hash_new ()) == NULL) ++ if ((aarch64_ops_hsh = str_htab_create ()) == NULL ++ || (aarch64_cond_hsh = str_htab_create ()) == NULL ++ || (aarch64_shift_hsh = str_htab_create ()) == NULL ++ || (aarch64_sys_regs_hsh = str_htab_create ()) == NULL ++ || (aarch64_pstatefield_hsh = str_htab_create ()) == NULL ++ || (aarch64_sys_regs_ic_hsh = str_htab_create ()) == NULL ++ || (aarch64_sys_regs_dc_hsh = str_htab_create ()) == NULL ++ || (aarch64_sys_regs_at_hsh = str_htab_create ()) == NULL ++ || (aarch64_sys_regs_tlbi_hsh = str_htab_create ()) == NULL ++ || (aarch64_sys_regs_sr_hsh = str_htab_create ()) == NULL ++ || (aarch64_reg_hsh = str_htab_create ()) == NULL ++ || (aarch64_barrier_opt_hsh = str_htab_create ()) == NULL ++ || (aarch64_nzcv_hsh = str_htab_create ()) == NULL ++ || (aarch64_pldop_hsh = str_htab_create ()) == NULL ++ || (aarch64_hint_opt_hsh = str_htab_create ()) == NULL) + as_fatal (_("virtual memory exhausted")); + + fill_instruction_hash_table (); +Only in binutils-2.35/gas/config: tc-aarch64.c.orig +Only in binutils-2.35/gas/config: tc-aarch64.c.rej +diff -rup binutils.orig/gas/config/tc-alpha.c binutils-2.35/gas/config/tc-alpha.c +--- binutils.orig/gas/config/tc-alpha.c 2021-08-11 17:33:12.209490370 +0100 ++++ binutils-2.35/gas/config/tc-alpha.c 2021-08-11 17:39:31.401057577 +0100 +@@ -297,10 +297,10 @@ static unsigned alpha_target = AXP_OPCOD + static const char *alpha_target_name = ""; + + /* The hash table of instruction opcodes. */ +-static struct hash_control *alpha_opcode_hash; ++static htab_t alpha_opcode_hash; + + /* The hash table of macro opcodes. */ +-static struct hash_control *alpha_macro_hash; ++static htab_t alpha_macro_hash; + + #ifdef OBJ_ECOFF + /* The $gp relocation symbol. */ +@@ -514,7 +514,7 @@ struct alpha_reloc_tag + }; + + /* Hash table to link up literals with the appropriate lituse. */ +-static struct hash_control *alpha_literal_hash; ++static htab_t alpha_literal_hash; + + /* Sequence numbers for internal use by macros. */ + static long next_sequence_num = -1; +@@ -589,11 +589,10 @@ get_alpha_reloc_tag (long sequence) + + sprintf (buffer, "!%ld", sequence); + +- info = (struct alpha_reloc_tag *) hash_find (alpha_literal_hash, buffer); ++ info = (struct alpha_reloc_tag *) str_hash_find (alpha_literal_hash, buffer); + if (! info) + { + size_t len = strlen (buffer); +- const char *errmsg; + + info = (struct alpha_reloc_tag *) + xcalloc (sizeof (struct alpha_reloc_tag) + len, 1); +@@ -601,9 +600,7 @@ get_alpha_reloc_tag (long sequence) + info->segment = now_seg; + info->sequence = sequence; + strcpy (info->string, buffer); +- errmsg = hash_insert (alpha_literal_hash, info->string, (void *) info); +- if (errmsg) +- as_fatal ("%s", errmsg); ++ str_hash_insert (alpha_literal_hash, info->string, (void *) info); + #ifdef OBJ_EVAX + info->sym = 0; + info->psym = 0; +@@ -1171,7 +1168,7 @@ assemble_tokens_to_insn (const char *opn + const struct alpha_opcode *opcode; + + /* Search opcodes. */ +- opcode = (const struct alpha_opcode *) hash_find (alpha_opcode_hash, opname); ++ opcode = (const struct alpha_opcode *) str_hash_find (alpha_opcode_hash, opname); + if (opcode) + { + int cpumatch; +@@ -3319,7 +3316,7 @@ assemble_tokens (const char *opname, + if (local_macros_on) + { + macro = ((const struct alpha_macro *) +- hash_find (alpha_macro_hash, opname)); ++ str_hash_find (alpha_macro_hash, opname)); + if (macro) + { + found_something = 1; +@@ -3333,7 +3330,7 @@ assemble_tokens (const char *opname, + } + + /* Search opcodes. */ +- opcode = (const struct alpha_opcode *) hash_find (alpha_opcode_hash, opname); ++ opcode = (const struct alpha_opcode *) str_hash_find (alpha_opcode_hash, opname); + if (opcode) + { + found_something = 1; +@@ -5419,17 +5416,14 @@ md_begin (void) + } + + /* Create the opcode hash table. */ +- alpha_opcode_hash = hash_new (); ++ alpha_opcode_hash = str_htab_create (); + + for (i = 0; i < alpha_num_opcodes;) + { +- const char *name, *retval, *slash; ++ const char *name, *slash; + + name = alpha_opcodes[i].name; +- retval = hash_insert (alpha_opcode_hash, name, (void *) &alpha_opcodes[i]); +- if (retval) +- as_fatal (_("internal error: can't hash opcode `%s': %s"), +- name, retval); ++ str_hash_insert (alpha_opcode_hash, name, (void *) &alpha_opcodes[i]); + + /* Some opcodes include modifiers of various sorts with a "/mod" + syntax, like the architecture manual suggests. However, for +@@ -5443,7 +5437,7 @@ md_begin (void) + memcpy (p, name, slash - name); + strcpy (p + (slash - name), slash + 1); + +- (void) hash_insert (alpha_opcode_hash, p, (void *) &alpha_opcodes[i]); ++ (void) str_hash_insert (alpha_opcode_hash, p, (void *) &alpha_opcodes[i]); + /* Ignore failures -- the opcode table does duplicate some + variants in different forms, like "hw_stq" and "hw_st/q". */ + } +@@ -5455,17 +5449,14 @@ md_begin (void) + } + + /* Create the macro hash table. */ +- alpha_macro_hash = hash_new (); ++ alpha_macro_hash = str_htab_create (); + + for (i = 0; i < alpha_num_macros;) + { +- const char *name, *retval; ++ const char *name; + + name = alpha_macros[i].name; +- retval = hash_insert (alpha_macro_hash, name, (void *) &alpha_macros[i]); +- if (retval) +- as_fatal (_("internal error: can't hash macro `%s': %s"), +- name, retval); ++ str_hash_insert (alpha_macro_hash, name, (void *) &alpha_macros[i]); + + while (++i < alpha_num_macros + && (alpha_macros[i].name == name +@@ -5520,7 +5511,7 @@ md_begin (void) + #endif + + /* Create literal lookup hash table. */ +- alpha_literal_hash = hash_new (); ++ alpha_literal_hash = str_htab_create (); + + subseg_set (text_section, 0); + } +diff -rup binutils.orig/gas/config/tc-arc.c binutils-2.35/gas/config/tc-arc.c +--- binutils.orig/gas/config/tc-arc.c 2021-08-11 17:33:12.210490363 +0100 ++++ binutils-2.35/gas/config/tc-arc.c 2021-08-11 17:39:31.401057577 +0100 +@@ -428,16 +428,16 @@ enum mach_selection_type + static enum mach_selection_type mach_selection_mode = MACH_SELECTION_NONE; + + /* The hash table of instruction opcodes. */ +-static struct hash_control *arc_opcode_hash; ++static htab_t arc_opcode_hash; + + /* The hash table of register symbols. */ +-static struct hash_control *arc_reg_hash; ++static htab_t arc_reg_hash; + + /* The hash table of aux register symbols. */ +-static struct hash_control *arc_aux_hash; ++static htab_t arc_aux_hash; + + /* The hash table of address types. */ +-static struct hash_control *arc_addrtype_hash; ++static htab_t arc_addrtype_hash; + + #define ARC_CPU_TYPE_A6xx(NAME,EXTRA) \ + { #NAME, ARC_OPCODE_ARC600, bfd_mach_arc_arc600, \ +@@ -704,7 +704,7 @@ arc_find_opcode (const char *name) + { + const struct arc_opcode_hash_entry *entry; + +- entry = hash_find (arc_opcode_hash, name); ++ entry = str_hash_find (arc_opcode_hash, name); + return entry; + } + +@@ -754,21 +754,18 @@ arc_opcode_hash_entry_iterator_next (con + static void + arc_insert_opcode (const struct arc_opcode *opcode) + { +- const char *name, *retval; ++ const char *name; + struct arc_opcode_hash_entry *entry; + name = opcode->name; + +- entry = hash_find (arc_opcode_hash, name); ++ entry = str_hash_find (arc_opcode_hash, name); + if (entry == NULL) + { + entry = XNEW (struct arc_opcode_hash_entry); + entry->count = 0; + entry->opcode = NULL; + +- retval = hash_insert (arc_opcode_hash, name, (void *) entry); +- if (retval) +- as_fatal (_("internal error: can't hash opcode '%s': %s"), +- name, retval); ++ str_hash_insert (arc_opcode_hash, name, (void *) entry); + } + + entry->opcode = XRESIZEVEC (const struct arc_opcode *, entry->opcode, +@@ -1920,7 +1917,7 @@ find_opcode_match (const struct arc_opco + tmpp = strdup (p); + for (pp = tmpp; *pp; ++pp) *pp = TOLOWER (*pp); + +- auxr = hash_find (arc_aux_hash, tmpp); ++ auxr = str_hash_find (arc_aux_hash, tmpp); + if (auxr) + { + /* We modify the token array here, safe in the +@@ -2528,14 +2525,10 @@ md_assemble (char *str) + static void + declare_register (const char *name, int number) + { +- const char *err; + symbolS *regS = symbol_create (name, reg_section, + number, &zero_address_frag); + +- err = hash_insert (arc_reg_hash, S_GET_NAME (regS), (void *) regS); +- if (err) +- as_fatal (_("Inserting \"%s\" into register table failed: %s"), +- name, err); ++ str_hash_insert (arc_reg_hash, S_GET_NAME (regS), (void *) regS); + } + + /* Construct symbols for each of the general registers. */ +@@ -2563,15 +2556,11 @@ declare_register_set (void) + static void + declare_addrtype (const char *name, int number) + { +- const char *err; + symbolS *addrtypeS = symbol_create (name, undefined_section, + number, &zero_address_frag); + +- err = hash_insert (arc_addrtype_hash, S_GET_NAME (addrtypeS), +- (void *) addrtypeS); +- if (err) +- as_fatal (_("Inserting \"%s\" into address type table failed: %s"), +- name, err); ++ str_hash_insert (arc_addrtype_hash, S_GET_NAME (addrtypeS), ++ (void *) addrtypeS); + } + + /* Port-specific assembler initialization. This function is called +@@ -2595,7 +2584,7 @@ md_begin (void) + bfd_set_private_flags (stdoutput, selected_cpu.eflags); + + /* Set up a hash table for the instructions. */ +- arc_opcode_hash = hash_new (); ++ arc_opcode_hash = str_htab_create (); + if (arc_opcode_hash == NULL) + as_fatal (_("Virtual memory exhausted")); + +@@ -2613,7 +2602,7 @@ md_begin (void) + }while (opcode->name); + + /* Register declaration. */ +- arc_reg_hash = hash_new (); ++ arc_reg_hash = str_htab_create (); + if (arc_reg_hash == NULL) + as_fatal (_("Virtual memory exhausted")); + +@@ -2666,7 +2655,7 @@ md_begin (void) + memset (&arc_last_insns[0], 0, sizeof (arc_last_insns)); + + /* Aux register declaration. */ +- arc_aux_hash = hash_new (); ++ arc_aux_hash = str_htab_create (); + if (arc_aux_hash == NULL) + as_fatal (_("Virtual memory exhausted")); + +@@ -2674,8 +2663,6 @@ md_begin (void) + unsigned int i; + for (i = 0; i < arc_num_aux_regs; i++, auxr++) + { +- const char *retval; +- + if (!(auxr->cpu & selected_cpu.flags)) + continue; + +@@ -2683,14 +2670,11 @@ md_begin (void) + && !check_cpu_feature (auxr->subclass)) + continue; + +- retval = hash_insert (arc_aux_hash, auxr->name, (void *) auxr); +- if (retval) +- as_fatal (_("internal error: can't hash aux register '%s': %s"), +- auxr->name, retval); ++ str_hash_insert (arc_aux_hash, auxr->name, (void *) auxr); + } + + /* Address type declaration. */ +- arc_addrtype_hash = hash_new (); ++ arc_addrtype_hash = str_htab_create (); + if (arc_addrtype_hash == NULL) + as_fatal (_("Virtual memory exhausted")); + +@@ -3396,7 +3380,7 @@ arc_parse_name (const char *name, + && e->X_md == O_absent) + return FALSE; + +- sym = hash_find (arc_reg_hash, name); ++ sym = str_hash_find (arc_reg_hash, name); + if (sym) + { + e->X_op = O_register; +@@ -3404,7 +3388,7 @@ arc_parse_name (const char *name, + return TRUE; + } + +- sym = hash_find (arc_addrtype_hash, name); ++ sym = str_hash_find (arc_addrtype_hash, name); + if (sym) + { + e->X_op = O_addrtype; +@@ -4369,7 +4353,7 @@ tc_arc_regname_to_dw2regnum (char *regna + { + struct symbol *sym; + +- sym = hash_find (arc_reg_hash, regname); ++ sym = str_hash_find (arc_reg_hash, regname); + if (sym) + return S_GET_VALUE (sym); + +@@ -4859,7 +4843,6 @@ arc_extcorereg (int opertype) + { + extRegister_t ereg; + struct arc_aux_reg *auxr; +- const char *retval; + struct arc_flag_operand *ccode; + + memset (&ereg, 0, sizeof (ereg)); +@@ -4882,10 +4865,7 @@ arc_extcorereg (int opertype) + auxr->cpu = selected_cpu.flags; + auxr->subclass = NONE; + auxr->address = ereg.number; +- retval = hash_insert (arc_aux_hash, auxr->name, (void *) auxr); +- if (retval) +- as_fatal (_("internal error: can't hash aux register '%s': %s"), +- auxr->name, retval); ++ str_hash_insert (arc_aux_hash, auxr->name, (void *) auxr); + break; + case EXT_COND_CODE: + /* Condition code. */ +Only in binutils-2.35/gas/config: tc-arc.c.orig +diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.35/gas/config/tc-arm.c +--- binutils.orig/gas/config/tc-arm.c 2021-08-11 17:33:12.215490331 +0100 ++++ binutils-2.35/gas/config/tc-arm.c 2021-08-11 17:39:31.403057564 +0100 +@@ -945,15 +945,15 @@ struct asm_opcode + #define BAD_EL_TYPE _("bad element type for instruction") + #define MVE_BAD_QREG _("MVE vector register Q[0..7] expected") + +-static struct hash_control * arm_ops_hsh; +-static struct hash_control * arm_cond_hsh; +-static struct hash_control * arm_vcond_hsh; +-static struct hash_control * arm_shift_hsh; +-static struct hash_control * arm_psr_hsh; +-static struct hash_control * arm_v7m_psr_hsh; +-static struct hash_control * arm_reg_hsh; +-static struct hash_control * arm_reloc_hsh; +-static struct hash_control * arm_barrier_opt_hsh; ++static htab_t arm_ops_hsh; ++static htab_t arm_cond_hsh; ++static htab_t arm_vcond_hsh; ++static htab_t arm_shift_hsh; ++static htab_t arm_psr_hsh; ++static htab_t arm_v7m_psr_hsh; ++static htab_t arm_reg_hsh; ++static htab_t arm_reloc_hsh; ++static htab_t arm_barrier_opt_hsh; + + /* Stuff needed to resolve the label ambiguity + As: +@@ -1427,7 +1427,7 @@ arm_reg_parse_multi (char **ccp) + p++; + while (ISALPHA (*p) || ISDIGIT (*p) || *p == '_'); + +- reg = (struct reg_entry *) hash_find_n (arm_reg_hsh, start, p - start); ++ reg = (struct reg_entry *) str_hash_find_n (arm_reg_hsh, start, p - start); + + if (!reg) + return NULL; +@@ -2546,7 +2546,7 @@ parse_reloc (char **str) + return -1; + + if ((r = (struct reloc_entry *) +- hash_find_n (arm_reloc_hsh, p, q - p)) == NULL) ++ str_hash_find_n (arm_reloc_hsh, p, q - p)) == NULL) + return -1; + + *str = q + 1; +@@ -2561,7 +2561,7 @@ insert_reg_alias (char *str, unsigned nu + struct reg_entry *new_reg; + const char *name; + +- if ((new_reg = (struct reg_entry *) hash_find (arm_reg_hsh, str)) != 0) ++ if ((new_reg = (struct reg_entry *) str_hash_find (arm_reg_hsh, str)) != 0) + { + if (new_reg->builtin) + as_warn (_("ignoring attempt to redefine built-in register '%s'"), str); +@@ -2583,8 +2583,7 @@ insert_reg_alias (char *str, unsigned nu + new_reg->builtin = FALSE; + new_reg->neon = NULL; + +- if (hash_insert (arm_reg_hsh, name, (void *) new_reg)) +- abort (); ++ str_hash_insert (arm_reg_hsh, name, new_reg); + + return new_reg; + } +@@ -2632,7 +2631,7 @@ create_register_alias (char * newname, c + if (*oldname == '\0') + return FALSE; + +- old = (struct reg_entry *) hash_find (arm_reg_hsh, oldname); ++ old = (struct reg_entry *) str_hash_find (arm_reg_hsh, oldname); + if (!old) + { + as_warn (_("unknown register '%s' -- .req ignored"), oldname); +@@ -2884,7 +2883,7 @@ s_unreq (int a ATTRIBUTE_UNUSED) + as_bad (_("invalid syntax for .unreq directive")); + else + { +- struct reg_entry *reg = (struct reg_entry *) hash_find (arm_reg_hsh, ++ struct reg_entry *reg = (struct reg_entry *) str_hash_find (arm_reg_hsh, + name); + + if (!reg) +@@ -2897,7 +2896,7 @@ s_unreq (int a ATTRIBUTE_UNUSED) + char * p; + char * nbuf; + +- hash_delete (arm_reg_hsh, name, FALSE); ++ str_hash_delete (arm_reg_hsh, name); + free ((char *) reg->name); + free (reg->neon); + free (reg); +@@ -2909,10 +2908,10 @@ s_unreq (int a ATTRIBUTE_UNUSED) + nbuf = strdup (name); + for (p = nbuf; *p; p++) + *p = TOUPPER (*p); +- reg = (struct reg_entry *) hash_find (arm_reg_hsh, nbuf); ++ reg = (struct reg_entry *) str_hash_find (arm_reg_hsh, nbuf); + if (reg) + { +- hash_delete (arm_reg_hsh, nbuf, FALSE); ++ str_hash_delete (arm_reg_hsh, nbuf); + free ((char *) reg->name); + free (reg->neon); + free (reg); +@@ -2920,10 +2919,10 @@ s_unreq (int a ATTRIBUTE_UNUSED) + + for (p = nbuf; *p; p++) + *p = TOLOWER (*p); +- reg = (struct reg_entry *) hash_find (arm_reg_hsh, nbuf); ++ reg = (struct reg_entry *) str_hash_find (arm_reg_hsh, nbuf); + if (reg) + { +- hash_delete (arm_reg_hsh, nbuf, FALSE); ++ str_hash_delete (arm_reg_hsh, nbuf); + free ((char *) reg->name); + free (reg->neon); + free (reg); +@@ -5537,7 +5536,7 @@ parse_shift (char **str, int i, enum par + return FAIL; + } + +- shift_name = (const struct asm_shift_name *) hash_find_n (arm_shift_hsh, *str, ++ shift_name = (const struct asm_shift_name *) str_hash_find_n (arm_shift_hsh, *str, + p - *str); + + if (shift_name == NULL) +@@ -6338,7 +6337,7 @@ parse_psr (char **str, bfd_boolean lhs) + || strncasecmp (start, "psr", 3) == 0) + p = start + strcspn (start, "rR") + 1; + +- psr = (const struct asm_psr *) hash_find_n (arm_v7m_psr_hsh, start, ++ psr = (const struct asm_psr *) str_hash_find_n (arm_v7m_psr_hsh, start, + p - start); + + if (!psr) +@@ -6441,7 +6440,7 @@ parse_psr (char **str, bfd_boolean lhs) + } + else + { +- psr = (const struct asm_psr *) hash_find_n (arm_psr_hsh, start, ++ psr = (const struct asm_psr *) str_hash_find_n (arm_psr_hsh, start, + p - start); + if (!psr) + goto error; +@@ -6633,7 +6632,7 @@ parse_cond (char **str) + n++; + } + +- c = (const struct asm_cond *) hash_find_n (arm_cond_hsh, cond, n); ++ c = (const struct asm_cond *) str_hash_find_n (arm_cond_hsh, cond, n); + if (!c) + { + inst.error = _("condition required"); +@@ -6656,7 +6655,7 @@ parse_barrier (char **str) + while (ISALPHA (*q)) + q++; + +- o = (const struct asm_barrier_opt *) hash_find_n (arm_barrier_opt_hsh, p, ++ o = (const struct asm_barrier_opt *) str_hash_find_n (arm_barrier_opt_hsh, p, + q - p); + if (!o) + return FAIL; +@@ -15606,7 +15605,7 @@ do_vfp_nsyn_opcode (const char *opname) + { + const struct asm_opcode *opcode; + +- opcode = (const struct asm_opcode *) hash_find (arm_ops_hsh, opname); ++ opcode = (const struct asm_opcode *) str_hash_find (arm_ops_hsh, opname); + + if (!opcode) + abort (); +@@ -22618,7 +22617,7 @@ opcode_lookup (char **str) + *str = end; + + /* Look for unaffixed or special-case affixed mnemonic. */ +- opcode = (const struct asm_opcode *) hash_find_n (arm_ops_hsh, base, ++ opcode = (const struct asm_opcode *) str_hash_find_n (arm_ops_hsh, base, + end - base); + if (opcode) + { +@@ -22632,7 +22631,7 @@ opcode_lookup (char **str) + if (warn_on_deprecated && unified_syntax) + as_tsktsk (_("conditional infixes are deprecated in unified syntax")); + affix = base + (opcode->tag - OT_odd_infix_0); +- cond = (const struct asm_cond *) hash_find_n (arm_cond_hsh, affix, 2); ++ cond = (const struct asm_cond *) str_hash_find_n (arm_cond_hsh, affix, 2); + gas_assert (cond); + + inst.cond = cond->value; +@@ -22645,8 +22644,8 @@ opcode_lookup (char **str) + if (end - base < 2) + return NULL; + affix = end - 1; +- cond = (const struct asm_cond *) hash_find_n (arm_vcond_hsh, affix, 1); +- opcode = (const struct asm_opcode *) hash_find_n (arm_ops_hsh, base, ++ cond = (const struct asm_cond *) str_hash_find_n (arm_vcond_hsh, affix, 1); ++ opcode = (const struct asm_opcode *) str_hash_find_n (arm_ops_hsh, base, + affix - base); + /* If this opcode can not be vector predicated then don't accept it with a + vector predication code. */ +@@ -22662,8 +22661,8 @@ opcode_lookup (char **str) + + /* Look for suffixed mnemonic. */ + affix = end - 2; +- cond = (const struct asm_cond *) hash_find_n (arm_cond_hsh, affix, 2); +- opcode = (const struct asm_opcode *) hash_find_n (arm_ops_hsh, base, ++ cond = (const struct asm_cond *) str_hash_find_n (arm_cond_hsh, affix, 2); ++ opcode = (const struct asm_opcode *) str_hash_find_n (arm_ops_hsh, base, + affix - base); + } + +@@ -22713,13 +22712,13 @@ opcode_lookup (char **str) + + /* Look for infixed mnemonic in the usual position. */ + affix = base + 3; +- cond = (const struct asm_cond *) hash_find_n (arm_cond_hsh, affix, 2); ++ cond = (const struct asm_cond *) str_hash_find_n (arm_cond_hsh, affix, 2); + if (!cond) + return NULL; + + memcpy (save, affix, 2); + memmove (affix, affix + 2, (end - affix) - 2); +- opcode = (const struct asm_opcode *) hash_find_n (arm_ops_hsh, base, ++ opcode = (const struct asm_opcode *) str_hash_find_n (arm_ops_hsh, base, + (end - base) - 2); + memmove (affix + 2, affix, (end - affix) - 2); + memcpy (affix, save, 2); +@@ -27987,16 +27986,19 @@ arm_tc_equal_in_insn (int c ATTRIBUTE_UN + + for (p = nbuf; *p; p++) + *p = TOLOWER (*p); +- if (hash_find (arm_ops_hsh, nbuf) != NULL) ++ if (str_hash_find (arm_ops_hsh, nbuf) != NULL) + { +- static struct hash_control * already_warned = NULL; ++ static htab_t already_warned = NULL; + + if (already_warned == NULL) +- already_warned = hash_new (); ++ already_warned = str_htab_create (); + /* Only warn about the symbol once. To keep the code +- simple we let hash_insert do the lookup for us. */ +- if (hash_insert (already_warned, nbuf, NULL) == NULL) +- as_warn (_("[-mwarn-syms]: Assignment makes a symbol match an ARM instruction: %s"), name); ++ simple we let str_hash_insert do the lookup for us. */ ++ if (str_hash_find (already_warned, nbuf) == NULL) ++ { ++ as_warn (_("[-mwarn-syms]: Assignment makes a symbol match an ARM instruction: %s"), name); ++ str_hash_insert (already_warned, nbuf, NULL); ++ } + } + else + free (nbuf); +@@ -30712,36 +30714,37 @@ md_begin (void) + unsigned mach; + unsigned int i; + +- if ( (arm_ops_hsh = hash_new ()) == NULL +- || (arm_cond_hsh = hash_new ()) == NULL +- || (arm_vcond_hsh = hash_new ()) == NULL +- || (arm_shift_hsh = hash_new ()) == NULL +- || (arm_psr_hsh = hash_new ()) == NULL +- || (arm_v7m_psr_hsh = hash_new ()) == NULL +- || (arm_reg_hsh = hash_new ()) == NULL +- || (arm_reloc_hsh = hash_new ()) == NULL +- || (arm_barrier_opt_hsh = hash_new ()) == NULL) ++ if ( (arm_ops_hsh = str_htab_create ()) == NULL ++ || (arm_cond_hsh = str_htab_create ()) == NULL ++ || (arm_vcond_hsh = str_htab_create ()) == NULL ++ || (arm_shift_hsh = str_htab_create ()) == NULL ++ || (arm_psr_hsh = str_htab_create ()) == NULL ++ || (arm_v7m_psr_hsh = str_htab_create ()) == NULL ++ || (arm_reg_hsh = str_htab_create ()) == NULL ++ || (arm_reloc_hsh = str_htab_create ()) == NULL ++ || (arm_barrier_opt_hsh = str_htab_create ()) == NULL) + as_fatal (_("virtual memory exhausted")); + + for (i = 0; i < sizeof (insns) / sizeof (struct asm_opcode); i++) +- hash_insert (arm_ops_hsh, insns[i].template_name, (void *) (insns + i)); ++ if (str_hash_find (arm_ops_hsh, insns[i].template_name) == NULL) ++ str_hash_insert (arm_ops_hsh, insns[i].template_name, (void *) (insns + i)); + for (i = 0; i < sizeof (conds) / sizeof (struct asm_cond); i++) +- hash_insert (arm_cond_hsh, conds[i].template_name, (void *) (conds + i)); ++ str_hash_insert (arm_cond_hsh, conds[i].template_name, (void *) (conds + i)); + for (i = 0; i < sizeof (vconds) / sizeof (struct asm_cond); i++) +- hash_insert (arm_vcond_hsh, vconds[i].template_name, (void *) (vconds + i)); ++ str_hash_insert (arm_vcond_hsh, vconds[i].template_name, (void *) (vconds + i)); + for (i = 0; i < sizeof (shift_names) / sizeof (struct asm_shift_name); i++) +- hash_insert (arm_shift_hsh, shift_names[i].name, (void *) (shift_names + i)); ++ str_hash_insert (arm_shift_hsh, shift_names[i].name, (void *) (shift_names + i)); + for (i = 0; i < sizeof (psrs) / sizeof (struct asm_psr); i++) +- hash_insert (arm_psr_hsh, psrs[i].template_name, (void *) (psrs + i)); ++ str_hash_insert (arm_psr_hsh, psrs[i].template_name, (void *) (psrs + i)); + for (i = 0; i < sizeof (v7m_psrs) / sizeof (struct asm_psr); i++) +- hash_insert (arm_v7m_psr_hsh, v7m_psrs[i].template_name, ++ str_hash_insert (arm_v7m_psr_hsh, v7m_psrs[i].template_name, + (void *) (v7m_psrs + i)); + for (i = 0; i < sizeof (reg_names) / sizeof (struct reg_entry); i++) +- hash_insert (arm_reg_hsh, reg_names[i].name, (void *) (reg_names + i)); ++ str_hash_insert (arm_reg_hsh, reg_names[i].name, (void *) (reg_names + i)); + for (i = 0; + i < sizeof (barrier_opt_names) / sizeof (struct asm_barrier_opt); + i++) +- hash_insert (arm_barrier_opt_hsh, barrier_opt_names[i].template_name, ++ str_hash_insert (arm_barrier_opt_hsh, barrier_opt_names[i].template_name, + (void *) (barrier_opt_names + i)); + #ifdef OBJ_ELF + for (i = 0; i < ARRAY_SIZE (reloc_names); i++) +@@ -30752,7 +30755,7 @@ md_begin (void) + /* This makes encode_branch() use the EABI versions of this relocation. */ + entry->reloc = BFD_RELOC_UNUSED; + +- hash_insert (arm_reloc_hsh, entry->name, (void *) entry); ++ str_hash_insert (arm_reloc_hsh, entry->name, (void *) entry); + } + #endif + +Only in binutils-2.35/gas/config: tc-arm.c.orig +diff -rup binutils.orig/gas/config/tc-avr.c binutils-2.35/gas/config/tc-avr.c +--- binutils.orig/gas/config/tc-avr.c 2021-08-11 17:33:12.210490363 +0100 ++++ binutils-2.35/gas/config/tc-avr.c 2021-08-11 17:39:31.404057558 +0100 +@@ -524,13 +524,13 @@ typedef union + } mod_index; + + /* Opcode hash table. */ +-static struct hash_control *avr_hash; ++static htab_t avr_hash; + + /* Reloc modifiers hash control (hh8,hi8,lo8,pm_xx). */ +-static struct hash_control *avr_mod_hash; ++static htab_t avr_mod_hash; + + /* Whether some opcode does not change SREG. */ +-static struct hash_control *avr_no_sreg_hash; ++static htab_t avr_no_sreg_hash; + + static const char* const avr_no_sreg[] = + { +@@ -808,33 +808,35 @@ md_begin (void) + unsigned int i; + struct avr_opcodes_s *opcode; + +- avr_hash = hash_new (); ++ avr_hash = str_htab_create (); + + /* Insert unique names into hash table. This hash table then provides a + quick index to the first opcode with a particular name in the opcode + table. */ + for (opcode = avr_opcodes; opcode->name; opcode++) +- hash_insert (avr_hash, opcode->name, (char *) opcode); ++ if (str_hash_find (avr_hash, opcode->name) == NULL) ++ str_hash_insert (avr_hash, opcode->name, (char *) opcode); + +- avr_mod_hash = hash_new (); ++ avr_mod_hash = str_htab_create (); + + for (i = 0; i < ARRAY_SIZE (exp_mod); ++i) + { + mod_index m; + + m.index = i + 10; +- hash_insert (avr_mod_hash, EXP_MOD_NAME (i), m.ptr); ++ str_hash_find (avr_mod_hash, EXP_MOD_NAME (i)); ++ str_hash_insert (avr_mod_hash, EXP_MOD_NAME (i), m.ptr); + } + +- avr_no_sreg_hash = hash_new (); ++ avr_no_sreg_hash = str_htab_create (); + + for (i = 0; i < ARRAY_SIZE (avr_no_sreg); ++i) + { +- gas_assert (hash_find (avr_hash, avr_no_sreg[i])); +- hash_insert (avr_no_sreg_hash, avr_no_sreg[i], (char*) 4 /* dummy */); ++ gas_assert (str_hash_find (avr_hash, avr_no_sreg[i])); ++ str_hash_insert (avr_no_sreg_hash, avr_no_sreg[i], (char*) 4 /* dummy */); + } + +- avr_gccisr_opcode = (struct avr_opcodes_s*) hash_find (avr_hash, "__gcc_isr"); ++ avr_gccisr_opcode = (struct avr_opcodes_s*) str_hash_find (avr_hash, "__gcc_isr"); + gas_assert (avr_gccisr_opcode); + + bfd_set_arch_mach (stdoutput, TARGET_ARCH, avr_mcu->mach); +@@ -923,7 +925,7 @@ avr_ldi_expression (expressionS *exp) + { + mod_index m; + +- m.ptr = hash_find (avr_mod_hash, op); ++ m.ptr = str_hash_find (avr_mod_hash, op); + mod = m.index; + + if (mod) +@@ -1874,7 +1876,7 @@ md_assemble (char *str) + if (!op[0]) + as_bad (_("can't find opcode ")); + +- opcode = (struct avr_opcodes_s *) hash_find (avr_hash, op); ++ opcode = (struct avr_opcodes_s *) str_hash_find (avr_hash, op); + + if (opcode && !avr_opt.all_opcodes) + { +@@ -2453,7 +2455,7 @@ avr_update_gccisr (struct avr_opcodes_s + /* SREG: Look up instructions that don't clobber SREG. */ + + if (!avr_isr.need_sreg +- && !hash_find (avr_no_sreg_hash, opcode->name)) ++ && !str_hash_find (avr_no_sreg_hash, opcode->name)) + { + avr_isr.need_sreg = 1; + } +@@ -2497,7 +2499,7 @@ avr_emit_insn (const char *insn, int reg + const int sreg = 0x3f; + unsigned bin = 0; + const struct avr_opcodes_s *op +- = (struct avr_opcodes_s*) hash_find (avr_hash, insn); ++ = (struct avr_opcodes_s*) str_hash_find (avr_hash, insn); + + /* We only have to deal with: IN, OUT, PUSH, POP, CLR, LDI 0. All of + these deal with at least one Reg and are 1-word instructions. */ +diff -rup binutils.orig/gas/config/tc-cr16.c binutils-2.35/gas/config/tc-cr16.c +--- binutils.orig/gas/config/tc-cr16.c 2021-08-11 17:33:12.211490357 +0100 ++++ binutils-2.35/gas/config/tc-cr16.c 2021-08-11 17:39:31.404057558 +0100 +@@ -53,15 +53,15 @@ typedef enum + op_err; + + /* Opcode mnemonics hash table. */ +-static struct hash_control *cr16_inst_hash; ++static htab_t cr16_inst_hash; + /* CR16 registers hash table. */ +-static struct hash_control *reg_hash; ++static htab_t reg_hash; + /* CR16 register pair hash table. */ +-static struct hash_control *regp_hash; ++static htab_t regp_hash; + /* CR16 processor registers hash table. */ +-static struct hash_control *preg_hash; ++static htab_t preg_hash; + /* CR16 processor registers 32 bit hash table. */ +-static struct hash_control *pregp_hash; ++static htab_t pregp_hash; + /* Current instruction we're assembling. */ + const inst *instruction; + +@@ -324,7 +324,7 @@ get_register (char *reg_name) + { + const reg_entry *rreg; + +- rreg = (const reg_entry *) hash_find (reg_hash, reg_name); ++ rreg = (const reg_entry *) str_hash_find (reg_hash, reg_name); + + if (rreg != NULL) + return rreg->value.reg_val; +@@ -345,10 +345,10 @@ get_register_pair (char *reg_name) + tmp_rp[0] = '('; + strcat (tmp_rp, reg_name); + strcat (tmp_rp,")"); +- rreg = (const reg_entry *) hash_find (regp_hash, tmp_rp); ++ rreg = (const reg_entry *) str_hash_find (regp_hash, tmp_rp); + } + else +- rreg = (const reg_entry *) hash_find (regp_hash, reg_name); ++ rreg = (const reg_entry *) str_hash_find (regp_hash, reg_name); + + if (rreg != NULL) + return rreg->value.reg_val; +@@ -363,7 +363,7 @@ get_index_register (char *reg_name) + { + const reg_entry *rreg; + +- rreg = (const reg_entry *) hash_find (reg_hash, reg_name); ++ rreg = (const reg_entry *) str_hash_find (reg_hash, reg_name); + + if ((rreg != NULL) + && ((rreg->value.reg_val == 12) || (rreg->value.reg_val == 13))) +@@ -378,7 +378,7 @@ get_index_register_pair (char *reg_name) + { + const reg_entry *rreg; + +- rreg = (const reg_entry *) hash_find (regp_hash, reg_name); ++ rreg = (const reg_entry *) str_hash_find (regp_hash, reg_name); + + if (rreg != NULL) + { +@@ -399,7 +399,7 @@ get_pregister (char *preg_name) + { + const reg_entry *prreg; + +- prreg = (const reg_entry *) hash_find (preg_hash, preg_name); ++ prreg = (const reg_entry *) str_hash_find (preg_hash, preg_name); + + if (prreg != NULL) + return prreg->value.preg_val; +@@ -414,7 +414,7 @@ get_pregisterp (char *preg_name) + { + const reg_entry *prreg; + +- prreg = (const reg_entry *) hash_find (pregp_hash, preg_name); ++ prreg = (const reg_entry *) str_hash_find (pregp_hash, preg_name); + + if (prreg != NULL) + return prreg->value.preg_val; +@@ -794,25 +794,18 @@ md_pcrel_from (fixS *fixp) + } + + static void +-initialise_reg_hash_table (struct hash_control ** hash_table, ++initialise_reg_hash_table (htab_t * hash_table, + const reg_entry * register_table, + const unsigned int num_entries) + { + const reg_entry * rreg; +- const char *hashret; +- +- if ((* hash_table = hash_new ()) == NULL) ++ if ((* hash_table = str_htab_create ()) == NULL) + as_fatal (_("Virtual memory exhausted")); + + for (rreg = register_table; + rreg < (register_table + num_entries); + rreg++) +- { +- hashret = hash_insert (* hash_table, rreg->name, (char *) rreg); +- if (hashret) +- as_fatal (_("Internal Error: Can't hash %s: %s"), +- rreg->name, hashret); +- } ++ str_hash_insert (* hash_table, rreg->name, (char *) rreg); + } + + /* This function is called once, at assembler startup time. This should +@@ -824,21 +817,15 @@ md_begin (void) + int i = 0; + + /* Set up a hash table for the instructions. */ +- if ((cr16_inst_hash = hash_new ()) == NULL) ++ if ((cr16_inst_hash = str_htab_create ()) == NULL) + as_fatal (_("Virtual memory exhausted")); + + while (cr16_instruction[i].mnemonic != NULL) + { +- const char *hashret; + const char *mnemonic = cr16_instruction[i].mnemonic; + +- hashret = hash_insert (cr16_inst_hash, mnemonic, +- (char *)(cr16_instruction + i)); +- +- if (hashret != NULL && *hashret != '\0') +- as_fatal (_("Can't hash `%s': %s\n"), cr16_instruction[i].mnemonic, +- *hashret == 0 ? _("(unknown reason)") : hashret); +- ++ str_hash_insert (cr16_inst_hash, mnemonic, ++ (char *)(cr16_instruction + i)); + /* Insert unique names into hash table. The CR16 instruction set + has many identical opcode names that have different opcodes based + on the operands. This hash table then provides a quick index to +@@ -2505,7 +2492,7 @@ cr16_assemble (const char *op, char *par + ins cr16_ins; + + /* Find the instruction. */ +- instruction = (const inst *) hash_find (cr16_inst_hash, op); ++ instruction = (const inst *) str_hash_find (cr16_inst_hash, op); + if (instruction == NULL) + { + as_bad (_("Unknown opcode: `%s'"), op); +@@ -2575,7 +2562,7 @@ md_assemble (char *op) + { + strcpy (param1, param); + /* Find the instruction. */ +- instruction = (const inst *) hash_find (cr16_inst_hash, op); ++ instruction = (const inst *) str_hash_find (cr16_inst_hash, op); + parse_operands (&cr16_ins, param1); + if (((&cr16_ins)->arg[0].type == arg_ic) + && ((&cr16_ins)->arg[0].constant >= 0)) +diff -rup binutils.orig/gas/config/tc-cris.c binutils-2.35/gas/config/tc-cris.c +--- binutils.orig/gas/config/tc-cris.c 2021-08-11 17:33:12.213490344 +0100 ++++ binutils-2.35/gas/config/tc-cris.c 2021-08-11 17:39:31.404057558 +0100 +@@ -160,7 +160,7 @@ static void cris_sym_no_leading_undersco + static char *cris_insn_first_word_frag (void); + + /* Handle to the opcode hash table. */ +-static struct hash_control *op_hash = NULL; ++static htab_t op_hash = NULL; + + /* If we target cris-axis-linux-gnu (as opposed to generic cris-axis-elf), + we default to no underscore and required register-prefixes. The +@@ -1186,11 +1186,10 @@ cris_insn_first_word_frag (void) + void + md_begin (void) + { +- const char *hashret = NULL; + int i = 0; + + /* Set up a hash table for the instructions. */ +- op_hash = hash_new (); ++ op_hash = str_htab_create (); + if (op_hash == NULL) + as_fatal (_("Virtual memory exhausted")); + +@@ -1222,12 +1221,8 @@ md_begin (void) + continue; + } + +- /* Need to cast to get rid of "const". FIXME: Fix hash_insert instead. */ +- hashret = hash_insert (op_hash, name, (void *) &cris_opcodes[i]); +- +- if (hashret != NULL && *hashret != '\0') +- as_fatal (_("Can't hash `%s': %s\n"), cris_opcodes[i].name, +- *hashret == 0 ? _("(unknown reason)") : hashret); ++ /* Need to cast to get rid of "const". FIXME: Fix str_hash_insert instead. */ ++ str_hash_insert (op_hash, name, (void *) &cris_opcodes[i]); + do + { + if (cris_opcodes[i].match & cris_opcodes[i].lose) +@@ -1558,7 +1553,7 @@ cris_process_instruction (char *insn_tex + } + + /* Find the instruction. */ +- instruction = (struct cris_opcode *) hash_find (op_hash, insn_text); ++ instruction = (struct cris_opcode *) str_hash_find (op_hash, insn_text); + if (instruction == NULL) + { + as_bad (_("Unknown opcode: `%s'"), insn_text); +diff -rup binutils.orig/gas/config/tc-crx.c binutils-2.35/gas/config/tc-crx.c +--- binutils.orig/gas/config/tc-crx.c 2021-08-11 17:33:12.213490344 +0100 ++++ binutils-2.35/gas/config/tc-crx.c 2021-08-11 17:39:31.404057558 +0100 +@@ -63,11 +63,11 @@ typedef enum + op_err; + + /* Opcode mnemonics hash table. */ +-static struct hash_control *crx_inst_hash; ++static htab_t crx_inst_hash; + /* CRX registers hash table. */ +-static struct hash_control *reg_hash; ++static htab_t reg_hash; + /* CRX coprocessor registers hash table. */ +-static struct hash_control *copreg_hash; ++static htab_t copreg_hash; + /* Current instruction we're assembling. */ + static const inst *instruction; + +@@ -208,7 +208,7 @@ get_register (char *reg_name) + { + const reg_entry *rreg; + +- rreg = (const reg_entry *) hash_find (reg_hash, reg_name); ++ rreg = (const reg_entry *) str_hash_find (reg_hash, reg_name); + + if (rreg != NULL) + return rreg->value.reg_val; +@@ -223,7 +223,7 @@ get_copregister (char *copreg_name) + { + const reg_entry *coreg; + +- coreg = (const reg_entry *) hash_find (copreg_hash, copreg_name); ++ coreg = (const reg_entry *) str_hash_find (copreg_hash, copreg_name); + + if (coreg != NULL) + return coreg->value.copreg_val; +@@ -527,24 +527,19 @@ md_pcrel_from (fixS *fixp) + void + md_begin (void) + { +- const char *hashret = NULL; + int i = 0; + + /* Set up a hash table for the instructions. */ +- if ((crx_inst_hash = hash_new ()) == NULL) ++ if ((crx_inst_hash = str_htab_create ()) == NULL) + as_fatal (_("Virtual memory exhausted")); + + while (crx_instruction[i].mnemonic != NULL) + { + const char *mnemonic = crx_instruction[i].mnemonic; + +- hashret = hash_insert (crx_inst_hash, mnemonic, ++ str_hash_insert (crx_inst_hash, mnemonic, + (void *) &crx_instruction[i]); + +- if (hashret != NULL && *hashret != '\0') +- as_fatal (_("Can't hash `%s': %s\n"), crx_instruction[i].mnemonic, +- *hashret == 0 ? _("(unknown reason)") : hashret); +- + /* Insert unique names into hash table. The CRX instruction set + has many identical opcode names that have different opcodes based + on the operands. This hash table then provides a quick index to +@@ -558,7 +553,7 @@ md_begin (void) + } + + /* Initialize reg_hash hash table. */ +- if ((reg_hash = hash_new ()) == NULL) ++ if ((reg_hash = str_htab_create ()) == NULL) + as_fatal (_("Virtual memory exhausted")); + + { +@@ -566,17 +561,11 @@ md_begin (void) + + for (regtab = crx_regtab; + regtab < (crx_regtab + NUMREGS); regtab++) +- { +- hashret = hash_insert (reg_hash, regtab->name, (void *) regtab); +- if (hashret) +- as_fatal (_("Internal error: Can't hash %s: %s"), +- regtab->name, +- hashret); +- } ++ str_hash_insert (reg_hash, regtab->name, (void *) regtab); + } + + /* Initialize copreg_hash hash table. */ +- if ((copreg_hash = hash_new ()) == NULL) ++ if ((copreg_hash = str_htab_create ()) == NULL) + as_fatal (_("Virtual memory exhausted")); + + { +@@ -584,14 +573,8 @@ md_begin (void) + + for (copregtab = crx_copregtab; copregtab < (crx_copregtab + NUMCOPREGS); + copregtab++) +- { +- hashret = hash_insert (copreg_hash, copregtab->name, +- (void *) copregtab); +- if (hashret) +- as_fatal (_("Internal error: Can't hash %s: %s"), +- copregtab->name, +- hashret); +- } ++ str_hash_insert (copreg_hash, copregtab->name, ++ (void *) copregtab); + } + /* Set linkrelax here to avoid fixups in most sections. */ + linkrelax = 1; +@@ -1989,7 +1972,7 @@ md_assemble (char *op) + *param++ = '\0'; + + /* Find the instruction. */ +- instruction = (const inst *) hash_find (crx_inst_hash, op); ++ instruction = (const inst *) str_hash_find (crx_inst_hash, op); + if (instruction == NULL) + { + as_bad (_("Unknown opcode: `%s'"), op); +diff -rup binutils.orig/gas/config/tc-csky.c binutils-2.35/gas/config/tc-csky.c +--- binutils.orig/gas/config/tc-csky.c 2021-08-11 17:33:12.209490370 +0100 ++++ binutils-2.35/gas/config/tc-csky.c 2021-08-11 17:39:31.405057552 +0100 +@@ -754,8 +754,8 @@ size_t md_longopts_size = sizeof (md_lon + + static struct csky_insn_info csky_insn; + +-static struct hash_control *csky_opcodes_hash; +-static struct hash_control *csky_macros_hash; ++static htab_t csky_opcodes_hash; ++static htab_t csky_macros_hash; + + static struct csky_macro_info v1_macros_table[] = + { +@@ -1354,16 +1354,16 @@ md_begin (void) + } + + /* Establish hash table for opcodes and macros. */ +- csky_macros_hash = hash_new (); +- csky_opcodes_hash = hash_new (); ++ csky_macros_hash = str_htab_create (); ++ csky_opcodes_hash = str_htab_create (); + for ( ; opcode->mnemonic != NULL; opcode++) + if ((isa_flag & (opcode->isa_flag16 | opcode->isa_flag32)) != 0) +- hash_insert (csky_opcodes_hash, opcode->mnemonic, (char *)opcode); ++ str_hash_insert (csky_opcodes_hash, opcode->mnemonic, (char *)opcode); + for ( ; macro->name != NULL; macro++) + if ((isa_flag & macro->isa_flag) != 0) +- hash_insert (csky_macros_hash, macro->name, (char *)macro); ++ str_hash_insert (csky_macros_hash, macro->name, (char *)macro); + if (do_nolrw && (isa_flag & CSKYV2_ISA_1E2) != 0) +- hash_insert (csky_macros_hash, ++ str_hash_insert (csky_macros_hash, + v2_lrw_macro_opcode.name, + (char *)&v2_lrw_macro_opcode); + /* Set e_flag to ELF Head. */ +@@ -2931,9 +2931,9 @@ parse_opcode (char *str) + csky_insn.number = csky_count_operands (opcode_end); + + /* Find hash by name in csky_macros_hash and csky_opcodes_hash. */ +- csky_insn.macro = (struct csky_macro_info *) hash_find (csky_macros_hash, ++ csky_insn.macro = (struct csky_macro_info *) str_hash_find (csky_macros_hash, + macro_name); +- csky_insn.opcode = (struct csky_opcode *) hash_find (csky_opcodes_hash, ++ csky_insn.opcode = (struct csky_opcode *) str_hash_find (csky_opcodes_hash, + name); + + if (csky_insn.macro == NULL && csky_insn.opcode == NULL) +@@ -3155,7 +3155,7 @@ get_operand_value (struct csky_opcode_in + { + const char *name = "movi"; + csky_insn.opcode = (struct csky_opcode *) +- hash_find (csky_opcodes_hash, name); ++ str_hash_find (csky_opcodes_hash, name); + csky_insn.val[csky_insn.idx - 1] = 1 << val; + } + return TRUE; +@@ -3189,7 +3189,7 @@ get_operand_value (struct csky_opcode_in + { + const char *name = "movi"; + csky_insn.opcode = (struct csky_opcode *) +- hash_find (csky_opcodes_hash, name); ++ str_hash_find (csky_opcodes_hash, name); + as_warn (_("translating mgeni to movi")); + } + else +@@ -3223,7 +3223,7 @@ get_operand_value (struct csky_opcode_in + { + const char *op_movi = "movi"; + csky_insn.opcode = (struct csky_opcode *) +- hash_find (csky_opcodes_hash, op_movi); ++ str_hash_find (csky_opcodes_hash, op_movi); + if (csky_insn.opcode == NULL) + return FALSE; + csky_insn.val[csky_insn.idx - 1] = (1 << mask_val) - 1; +@@ -3273,7 +3273,7 @@ get_operand_value (struct csky_opcode_in + { + const char *op_movi = "movi"; + csky_insn.opcode = (struct csky_opcode *) +- hash_find (csky_opcodes_hash, op_movi); ++ str_hash_find (csky_opcodes_hash, op_movi); + if (csky_insn.opcode == NULL) + return FALSE; + csky_insn.val[csky_insn.idx - 1] = (1 << (mask_val + 1)) - 1; +@@ -5953,7 +5953,7 @@ v1_work_jbsr (void) + /* Using jsri instruction. */ + const char *name = "jsri"; + csky_insn.opcode = (struct csky_opcode *) +- hash_find (csky_opcodes_hash, name); ++ str_hash_find (csky_opcodes_hash, name); + csky_insn.opcode_idx = 0; + csky_insn.isize = 2; + +@@ -6291,7 +6291,7 @@ v2_work_rotlc (void) + { + const char *name = "addc"; + csky_insn.opcode +- = (struct csky_opcode *) hash_find (csky_opcodes_hash, name); ++ = (struct csky_opcode *) str_hash_find (csky_opcodes_hash, name); + csky_insn.opcode_idx = 0; + if (csky_insn.isize == 2) + { +@@ -6329,7 +6329,7 @@ v2_work_bgeni (void) + val >>= 16; + } + csky_insn.opcode +- = (struct csky_opcode *) hash_find (csky_opcodes_hash, name); ++ = (struct csky_opcode *) str_hash_find (csky_opcodes_hash, name); + csky_insn.opcode_idx = 0; + csky_insn.val[1] = val; + +@@ -6347,7 +6347,7 @@ v2_work_not (void) + { + const char *name = "nor"; + csky_insn.opcode +- = (struct csky_opcode *) hash_find (csky_opcodes_hash, name); ++ = (struct csky_opcode *) str_hash_find (csky_opcodes_hash, name); + csky_insn.opcode_idx = 0; + if (csky_insn.number == 1) + { +Only in binutils-2.35/gas/config: tc-csky.c.orig +diff -rup binutils.orig/gas/config/tc-d10v.c binutils-2.35/gas/config/tc-d10v.c +--- binutils.orig/gas/config/tc-d10v.c 2021-08-11 17:33:12.215490331 +0100 ++++ binutils-2.35/gas/config/tc-d10v.c 2021-08-11 17:39:31.405057552 +0100 +@@ -101,7 +101,7 @@ struct option md_longopts[] = + size_t md_longopts_size = sizeof (md_longopts); + + /* Opcode hash table. */ +-static struct hash_control *d10v_hash; ++static htab_t d10v_hash; + + /* Do a binary search of the d10v_predefined_registers array to see if + NAME is a valid register name. Return the register number from the +@@ -277,7 +277,7 @@ md_begin (void) + { + const char *prev_name = ""; + struct d10v_opcode *opcode; +- d10v_hash = hash_new (); ++ d10v_hash = str_htab_create (); + + /* Insert unique names into hash table. The D10v instruction set + has many identical opcode names that have different opcodes based +@@ -289,7 +289,7 @@ md_begin (void) + if (strcmp (prev_name, opcode->name)) + { + prev_name = (char *) opcode->name; +- hash_insert (d10v_hash, opcode->name, (char *) opcode); ++ str_hash_insert (d10v_hash, opcode->name, (char *) opcode); + } + } + +@@ -1430,7 +1430,7 @@ do_assemble (char *str, struct d10v_opco + return -1; + + /* Find the first opcode with the proper name. */ +- *opcode = (struct d10v_opcode *) hash_find (d10v_hash, name); ++ *opcode = (struct d10v_opcode *) str_hash_find (d10v_hash, name); + if (*opcode == NULL) + return -1; + +@@ -1558,8 +1558,8 @@ md_apply_fix (fixS *fixP, valueT *valP, + { + struct d10v_opcode *rep, *repi; + +- rep = (struct d10v_opcode *) hash_find (d10v_hash, "rep"); +- repi = (struct d10v_opcode *) hash_find (d10v_hash, "repi"); ++ rep = (struct d10v_opcode *) str_hash_find (d10v_hash, "rep"); ++ repi = (struct d10v_opcode *) str_hash_find (d10v_hash, "repi"); + if ((insn & FM11) == FM11 + && ((repi != NULL + && (insn & repi->mask) == (unsigned) repi->opcode) +diff -rup binutils.orig/gas/config/tc-d30v.c binutils-2.35/gas/config/tc-d30v.c +--- binutils.orig/gas/config/tc-d30v.c 2021-08-11 17:33:12.215490331 +0100 ++++ binutils-2.35/gas/config/tc-d30v.c 2021-08-11 17:39:31.405057552 +0100 +@@ -118,7 +118,7 @@ struct option md_longopts[] = + size_t md_longopts_size = sizeof (md_longopts); + + /* Opcode hash table. */ +-static struct hash_control *d30v_hash; ++static htab_t d30v_hash; + + /* Do a binary search of the pre_defined_registers array to see if + NAME is a valid register name. Return the register number from the +@@ -310,11 +310,11 @@ void + md_begin (void) + { + struct d30v_opcode *opcode; +- d30v_hash = hash_new (); ++ d30v_hash = str_htab_create (); + + /* Insert opcode names into a hash table. */ + for (opcode = (struct d30v_opcode *) d30v_opcode_table; opcode->name; opcode++) +- hash_insert (d30v_hash, opcode->name, (char *) opcode); ++ str_hash_insert (d30v_hash, opcode->name, (char *) opcode); + + fixups = &FixUps[0]; + FixUps[0].next = &FixUps[1]; +@@ -1390,7 +1390,7 @@ do_assemble (char *str, + } + + /* Find the first opcode with the proper name. */ +- opcode->op = (struct d30v_opcode *) hash_find (d30v_hash, name); ++ opcode->op = (struct d30v_opcode *) str_hash_find (d30v_hash, name); + if (opcode->op == NULL) + { + as_bad (_("unknown opcode: %s"), name); +diff -rup binutils.orig/gas/config/tc-dlx.c binutils-2.35/gas/config/tc-dlx.c +--- binutils.orig/gas/config/tc-dlx.c 2021-08-11 17:33:12.212490350 +0100 ++++ binutils-2.35/gas/config/tc-dlx.c 2021-08-11 17:39:31.405057552 +0100 +@@ -43,7 +43,7 @@ + #define RELOC_DLX_VTENTRY BFD_RELOC_VTABLE_ENTRY + + /* handle of the OPCODE hash table */ +-static struct hash_control *op_hash = NULL; ++static htab_t op_hash = NULL; + + struct machine_it + { +@@ -276,31 +276,18 @@ s_proc (int end_p) + void + md_begin (void) + { +- const char *retval = NULL; +- int lose = 0; + unsigned int i; + + /* Create a new hash table. */ +- op_hash = hash_new (); ++ op_hash = str_htab_create (); + + /* Hash up all the opcodes for fast use later. */ + for (i = 0; i < num_dlx_opcodes; i++) + { + const char *name = machine_opcodes[i].name; +- +- retval = hash_insert (op_hash, name, (void *) &machine_opcodes[i]); +- +- if (retval != NULL) +- { +- fprintf (stderr, _("internal error: can't hash `%s': %s\n"), +- machine_opcodes[i].name, retval); +- lose = 1; +- } ++ str_hash_insert (op_hash, name, (void *) &machine_opcodes[i]); + } + +- if (lose) +- as_fatal (_("Broken assembler. No assembly attempted.")); +- + define_some_regs (); + } + +@@ -694,7 +681,7 @@ machine_ip (char *str) + } + + /* Hash the opcode, insn will have the string from opcode table. */ +- if ((insn = (struct machine_opcode *) hash_find (op_hash, str)) == NULL) ++ if ((insn = (struct machine_opcode *) str_hash_find (op_hash, str)) == NULL) + { + /* Handle the ret and return macro here. */ + if ((strcmp (str, "ret") == 0) || (strcmp (str, "return") == 0)) +diff -rup binutils.orig/gas/config/tc-ft32.c binutils-2.35/gas/config/tc-ft32.c +--- binutils.orig/gas/config/tc-ft32.c 2021-08-11 17:33:12.209490370 +0100 ++++ binutils-2.35/gas/config/tc-ft32.c 2021-08-11 17:39:31.405057552 +0100 +@@ -34,7 +34,7 @@ const char line_separator_chars[] = ";"; + const char line_comment_chars[] = "#"; + + static int pending_reloc; +-static struct hash_control *opcode_hash_control; ++static htab_t opcode_hash_control; + + static valueT md_chars_to_number (char * buf, int n); + +@@ -54,11 +54,11 @@ void + md_begin (void) + { + const ft32_opc_info_t *opcode; +- opcode_hash_control = hash_new (); ++ opcode_hash_control = str_htab_create (); + + /* Insert names into hash table. */ + for (opcode = ft32_opc_info; opcode->name; opcode++) +- hash_insert (opcode_hash_control, opcode->name, (char *) opcode); ++ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode); + + bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0); + if (!norelax) +@@ -231,7 +231,7 @@ md_assemble (char *str) + if (nlen == 0) + as_bad (_("can't find opcode ")); + +- opcode = (ft32_opc_info_t *) hash_find (opcode_hash_control, op_start); ++ opcode = (ft32_opc_info_t *) str_hash_find (opcode_hash_control, op_start); + *op_end = pend; + + if (opcode == NULL) +diff -rup binutils.orig/gas/config/tc-h8300.c binutils-2.35/gas/config/tc-h8300.c +--- binutils.orig/gas/config/tc-h8300.c 2021-08-11 17:33:12.212490350 +0100 ++++ binutils-2.35/gas/config/tc-h8300.c 2021-08-11 17:39:31.406057545 +0100 +@@ -224,7 +224,7 @@ const char EXP_CHARS[] = "eE"; + or 0d1.2345e12. */ + const char FLT_CHARS[] = "rRsSfFdDxXpP"; + +-static struct hash_control *opcode_hash_control; /* Opcode mnemonics. */ ++static htab_t opcode_hash_control; /* Opcode mnemonics. */ + + /* This function is called once, at assembler startup time. This + should set up all the tables, etc. that the MD part of the assembler +@@ -242,7 +242,7 @@ md_begin (void) + if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, default_mach)) + as_warn (_("could not set architecture and machine")); + +- opcode_hash_control = hash_new (); ++ opcode_hash_control = str_htab_create (); + prev_buffer[0] = 0; + + nopcodes = sizeof (h8_opcodes) / sizeof (struct h8_opcode); +@@ -283,7 +283,7 @@ md_begin (void) + len = dst - buffer; + if (cmplen == 0) + cmplen = len; +- hash_insert (opcode_hash_control, buffer, (char *) pi); ++ str_hash_insert (opcode_hash_control, buffer, (char *) pi); + strcpy (prev_buffer, buffer); + idx++; + +@@ -1940,7 +1940,7 @@ md_assemble (char *str) + *slash = TOLOWER (*slash); + + instruction = (const struct h8_instruction *) +- hash_find (opcode_hash_control, op_start); ++ str_hash_find (opcode_hash_control, op_start); + + if (instruction == NULL) + { +diff -rup binutils.orig/gas/config/tc-hppa.c binutils-2.35/gas/config/tc-hppa.c +--- binutils.orig/gas/config/tc-hppa.c 2021-08-11 17:33:12.209490370 +0100 ++++ binutils-2.35/gas/config/tc-hppa.c 2021-08-11 17:39:31.406057545 +0100 +@@ -550,7 +550,7 @@ static struct call_info *last_call_info; + static struct call_desc last_call_desc; + + /* handle of the OPCODE hash table */ +-static struct hash_control *op_hash = NULL; ++static htab_t op_hash = NULL; + + /* These characters can be suffixes of opcode names and they may be + followed by meaningful whitespace. We don't include `,' and `!' +@@ -3214,7 +3214,7 @@ pa_ip (char *str) + } + + /* Look up the opcode in the hash table. */ +- if ((insn = (struct pa_opcode *) hash_find (op_hash, str)) == NULL) ++ if ((insn = (struct pa_opcode *) str_hash_find (op_hash, str)) == NULL) + { + as_bad (_("Unknown opcode: `%s'"), str); + return; +@@ -8215,7 +8215,6 @@ pa_lsym (int unused ATTRIBUTE_UNUSED) + void + md_begin (void) + { +- const char *retval = NULL; + int lose = 0; + unsigned int i = 0; + +@@ -8238,18 +8237,13 @@ md_begin (void) + pa_spaces_begin (); + #endif + +- op_hash = hash_new (); ++ op_hash = str_htab_create (); + + while (i < NUMOPCODES) + { + const char *name = pa_opcodes[i].name; + +- retval = hash_insert (op_hash, name, (struct pa_opcode *) &pa_opcodes[i]); +- if (retval != NULL && *retval != '\0') +- { +- as_fatal (_("Internal error: can't hash `%s': %s\n"), name, retval); +- lose = 1; +- } ++ str_hash_insert (op_hash, name, (void *)&pa_opcodes[i]); + + do + { +diff -rup binutils.orig/gas/config/tc-i386.c binutils-2.35/gas/config/tc-i386.c +--- binutils.orig/gas/config/tc-i386.c 2021-08-11 17:33:12.208490376 +0100 ++++ binutils-2.35/gas/config/tc-i386.c 2021-08-11 17:39:31.407057539 +0100 +@@ -1362,10 +1362,10 @@ const pseudo_typeS md_pseudo_table[] = + extern char *input_line_pointer; + + /* Hash table for instruction mnemonic lookup. */ +-static struct hash_control *op_hash; ++static htab_t op_hash; + + /* Hash table for register lookup. */ +-static struct hash_control *reg_hash; ++static htab_t reg_hash; + + /* Various efficient no-op patterns for aligning code labels. + Note: Don't try to assemble the instructions in the comments. +@@ -3009,13 +3009,11 @@ i386_mach (void) + void + md_begin (void) + { +- const char *hash_err; +- + /* Support pseudo prefixes like {disp32}. */ + lex_type ['{'] = LEX_BEGIN_NAME; + + /* Initialize op_hash hash table. */ +- op_hash = hash_new (); ++ op_hash = str_htab_create (); + + { + const insn_template *optab; +@@ -3035,15 +3033,7 @@ md_begin (void) + /* different name --> ship out current template list; + add to hash table; & begin anew. */ + core_optab->end = optab; +- hash_err = hash_insert (op_hash, +- (optab - 1)->name, +- (void *) core_optab); +- if (hash_err) +- { +- as_fatal (_("can't hash %s: %s"), +- (optab - 1)->name, +- hash_err); +- } ++ str_hash_insert (op_hash, (optab - 1)->name, (void *) core_optab); + if (optab->name == NULL) + break; + core_optab = XNEW (templates); +@@ -3053,19 +3043,13 @@ md_begin (void) + } + + /* Initialize reg_hash hash table. */ +- reg_hash = hash_new (); ++ reg_hash = str_htab_create (); + { + const reg_entry *regtab; + unsigned int regtab_size = i386_regtab_size; + + for (regtab = i386_regtab; regtab_size--; regtab++) +- { +- hash_err = hash_insert (reg_hash, regtab->reg_name, (void *) regtab); +- if (hash_err) +- as_fatal (_("can't hash %s: %s"), +- regtab->reg_name, +- hash_err); +- } ++ str_hash_insert (reg_hash, regtab->reg_name, (void *) regtab); + } + + /* Fill in lexical tables: mnemonic_chars, operand_chars. */ +@@ -3152,8 +3136,8 @@ md_begin (void) + void + i386_print_statistics (FILE *file) + { +- hash_print_statistics (file, "i386 opcode", op_hash); +- hash_print_statistics (file, "i386 register", reg_hash); ++ htab_print_statistics (file, "i386 opcode", op_hash); ++ htab_print_statistics (file, "i386 register", reg_hash); + } + + #ifdef DEBUG386 +@@ -5043,7 +5027,7 @@ parse_insn (char *line, char *mnemonic) + } + + /* Look up instruction (or prefix) via hash table. */ +- current_templates = (const templates *) hash_find (op_hash, mnemonic); ++ current_templates = (const templates *) str_hash_find (op_hash, mnemonic); + + if (*l != END_OF_INSN + && (!is_space_char (*l) || l[1] != END_OF_INSN) +@@ -5165,7 +5149,7 @@ parse_insn (char *line, char *mnemonic) + goto check_suffix; + mnem_p = dot_p; + *dot_p = '\0'; +- current_templates = (const templates *) hash_find (op_hash, mnemonic); ++ current_templates = (const templates *) str_hash_find (op_hash, mnemonic); + } + + if (!current_templates) +@@ -5185,7 +5169,7 @@ parse_insn (char *line, char *mnemonic) + case QWORD_MNEM_SUFFIX: + i.suffix = mnem_p[-1]; + mnem_p[-1] = '\0'; +- current_templates = (const templates *) hash_find (op_hash, ++ current_templates = (const templates *) str_hash_find (op_hash, + mnemonic); + break; + case SHORT_MNEM_SUFFIX: +@@ -5194,7 +5178,7 @@ parse_insn (char *line, char *mnemonic) + { + i.suffix = mnem_p[-1]; + mnem_p[-1] = '\0'; +- current_templates = (const templates *) hash_find (op_hash, ++ current_templates = (const templates *) str_hash_find (op_hash, + mnemonic); + } + break; +@@ -5208,7 +5192,7 @@ parse_insn (char *line, char *mnemonic) + else + i.suffix = LONG_MNEM_SUFFIX; + mnem_p[-1] = '\0'; +- current_templates = (const templates *) hash_find (op_hash, ++ current_templates = (const templates *) str_hash_find (op_hash, + mnemonic); + } + break; +@@ -7492,7 +7476,7 @@ process_operands (void) + i.flags[j] = i.flags[j - 1]; + } + i.op[0].regs +- = (const reg_entry *) hash_find (reg_hash, "xmm0"); ++ = (const reg_entry *) str_hash_find (reg_hash, "xmm0"); + i.types[0] = regxmm; + i.tm.operand_types[0] = regxmm; + +@@ -10861,10 +10845,10 @@ i386_index_check (const char *operand_st + && current_templates->end[-1].operand_types[1] + .bitfield.baseindex)) + op = 1; +- expected_reg = hash_find (reg_hash, di_si[addr_mode][op == es_op]); ++ expected_reg = (const reg_entry *)str_hash_find (reg_hash, di_si[addr_mode][op == es_op]); + } + else +- expected_reg = hash_find (reg_hash, bx[addr_mode]); ++ expected_reg = (const reg_entry *)str_hash_find (reg_hash, bx[addr_mode]); + + if (i.base_reg != expected_reg + || i.index_reg +@@ -12498,7 +12482,7 @@ parse_real_register (char *reg_string, c + + *end_op = s; + +- r = (const reg_entry *) hash_find (reg_hash, reg_name_given); ++ r = (const reg_entry *) str_hash_find (reg_hash, reg_name_given); + + /* Handle floating point regs, allowing spaces in the (i) part. */ + if (r == i386_regtab /* %st is first entry of table */) +@@ -12525,7 +12509,7 @@ parse_real_register (char *reg_string, c + if (*s == ')') + { + *end_op = s + 1; +- r = (const reg_entry *) hash_find (reg_hash, "st(0)"); ++ r = (const reg_entry *) str_hash_find (reg_hash, "st(0)"); + know (r); + return r + fpr; + } +Only in binutils-2.35/gas/config: tc-i386.c.orig +diff -rup binutils.orig/gas/config/tc-ia64.c binutils-2.35/gas/config/tc-ia64.c +--- binutils.orig/gas/config/tc-ia64.c 2021-08-11 17:33:12.213490344 +0100 ++++ binutils-2.35/gas/config/tc-ia64.c 2021-08-11 17:39:31.408057532 +0100 +@@ -185,10 +185,10 @@ static void ia64_float_to_chars_littleen + + static void (*ia64_float_to_chars) (char *, LITTLENUM_TYPE *, int); + +-static struct hash_control *alias_hash; +-static struct hash_control *alias_name_hash; +-static struct hash_control *secalias_hash; +-static struct hash_control *secalias_name_hash; ++static htab_t alias_hash; ++static htab_t alias_name_hash; ++static htab_t secalias_hash; ++static htab_t secalias_name_hash; + + /* List of chars besides those in app.c:symbol_chars that can start an + operand. Used to prevent the scrubber eating vital white-space. */ +@@ -228,11 +228,11 @@ size_t md_longopts_size = sizeof (md_lon + + static struct + { +- struct hash_control *pseudo_hash; /* pseudo opcode hash table */ +- struct hash_control *reg_hash; /* register name hash table */ +- struct hash_control *dynreg_hash; /* dynamic register hash table */ +- struct hash_control *const_hash; /* constant hash table */ +- struct hash_control *entry_hash; /* code entry hint hash table */ ++ htab_t pseudo_hash; /* pseudo opcode hash table */ ++ htab_t reg_hash; /* register name hash table */ ++ htab_t dynreg_hash; /* dynamic register hash table */ ++ htab_t const_hash; /* constant hash table */ ++ htab_t entry_hash; /* code entry hint hash table */ + + /* If X_op is != O_absent, the register name for the instruction's + qualifying predicate. If NULL, p0 is assumed for instructions +@@ -4602,7 +4602,7 @@ dot_rot (int type) + /* First, remove existing names from hash table. */ + for (dr = md.dynreg[type]; dr && dr->num_regs; dr = dr->next) + { +- hash_delete (md.dynreg_hash, dr->name, FALSE); ++ str_hash_delete (md.dynreg_hash, dr->name); + /* FIXME: Free dr->name. */ + dr->num_regs = 0; + } +@@ -4683,12 +4683,7 @@ dot_rot (int type) + drpp = &dr->next; + base_reg += num_regs; + +- if (hash_insert (md.dynreg_hash, name, dr)) +- { +- as_bad (_("Attempt to redefine register set `%s'"), name); +- obstack_free (¬es, name); +- goto err; +- } ++ str_hash_insert (md.dynreg_hash, name, dr); + + if (*input_line_pointer != ',') + break; +@@ -5166,7 +5161,6 @@ dot_pred_rel (int type) + static void + dot_entry (int dummy ATTRIBUTE_UNUSED) + { +- const char *err; + char *name; + int c; + symbolS *symbolP; +@@ -5176,10 +5170,7 @@ dot_entry (int dummy ATTRIBUTE_UNUSED) + c = get_symbol_name (&name); + symbolP = symbol_find_or_make (name); + +- err = hash_insert (md.entry_hash, S_GET_NAME (symbolP), (void *) symbolP); +- if (err) +- as_fatal (_("Inserting \"%s\" into entry hint table failed: %s"), +- name, err); ++ str_hash_insert (md.entry_hash, S_GET_NAME (symbolP), (void *) symbolP); + + *input_line_pointer = c; + SKIP_WHITESPACE_AFTER_NAME (); +@@ -5378,15 +5369,11 @@ pseudo_opcode[] = + static symbolS * + declare_register (const char *name, unsigned int regnum) + { +- const char *err; + symbolS *sym; + + sym = symbol_create (name, reg_section, regnum, &zero_address_frag); + +- err = hash_insert (md.reg_hash, S_GET_NAME (sym), (void *) sym); +- if (err) +- as_fatal ("Inserting \"%s\" into register table failed: %s", +- name, err); ++ str_hash_insert (md.reg_hash, S_GET_NAME (sym), (void *) sym); + + return sym; + } +@@ -7241,8 +7228,6 @@ void + md_begin (void) + { + int i, j, k, t, goodness, best, ok; +- const char *err; +- char name[8]; + + md.auto_align = 1; + md.explicit_mode = md.default_explicit_mode; +@@ -7253,10 +7238,10 @@ md_begin (void) + target_big_endian = -1; + dot_byteorder (default_big_endian); + +- alias_hash = hash_new (); +- alias_name_hash = hash_new (); +- secalias_hash = hash_new (); +- secalias_name_hash = hash_new (); ++ alias_hash = str_htab_create (); ++ alias_name_hash = str_htab_create (); ++ secalias_hash = str_htab_create (); ++ secalias_name_hash = str_htab_create (); + + pseudo_func[FUNC_DTP_MODULE].u.sym = + symbol_new (".", undefined_section, FUNC_DTP_MODULE, +@@ -7405,20 +7390,15 @@ md_begin (void) + for (i = 0; i < NUM_SLOTS; ++i) + md.slot[i].user_template = -1; + +- md.pseudo_hash = hash_new (); ++ md.pseudo_hash = str_htab_create (); + for (i = 0; i < NELEMS (pseudo_opcode); ++i) +- { +- err = hash_insert (md.pseudo_hash, pseudo_opcode[i].name, +- (void *) (pseudo_opcode + i)); +- if (err) +- as_fatal (_("ia64.md_begin: can't hash `%s': %s"), +- pseudo_opcode[i].name, err); +- } ++ str_hash_insert (md.pseudo_hash, pseudo_opcode[i].name, ++ (void *) (pseudo_opcode + i)); + +- md.reg_hash = hash_new (); +- md.dynreg_hash = hash_new (); +- md.const_hash = hash_new (); +- md.entry_hash = hash_new (); ++ md.reg_hash = str_htab_create (); ++ md.dynreg_hash = str_htab_create (); ++ md.const_hash = str_htab_create (); ++ md.entry_hash = str_htab_create (); + + /* general registers: */ + declare_register_set ("r", 128, REG_GR); +@@ -7471,13 +7451,8 @@ md_begin (void) + declare_register ("psp", REG_PSP); + + for (i = 0; i < NELEMS (const_bits); ++i) +- { +- err = hash_insert (md.const_hash, const_bits[i].name, +- (void *) (const_bits + i)); +- if (err) +- as_fatal (_("Inserting \"%s\" into constant hash table failed: %s"), +- name, err); +- } ++ str_hash_insert (md.const_hash, const_bits[i].name, ++ (void *) (const_bits + i)); + + /* Set the architecture and machine depending on defaults and command line + options. */ +@@ -7980,7 +7955,7 @@ ia64_parse_name (char *name, expressionS + } + + /* first see if NAME is a known register name: */ +- sym = hash_find (md.reg_hash, name); ++ sym = str_hash_find (md.reg_hash, name); + if (sym) + { + e->X_op = O_register; +@@ -7988,7 +7963,7 @@ ia64_parse_name (char *name, expressionS + return 1; + } + +- cdesc = hash_find (md.const_hash, name); ++ cdesc = str_hash_find (md.const_hash, name); + if (cdesc) + { + e->X_op = O_constant; +@@ -8054,7 +8029,7 @@ ia64_parse_name (char *name, expressionS + + end = xstrdup (name); + name = ia64_canonicalize_symbol_name (end); +- if ((dr = hash_find (md.dynreg_hash, name))) ++ if ((dr = str_hash_find (md.dynreg_hash, name))) + { + /* We've got ourselves the name of a rotating register set. + Store the base register number in the low 16 bits of +@@ -10675,7 +10650,7 @@ md_assemble (char *str) + + ch = get_symbol_name (&temp); + mnemonic = temp; +- pdesc = (struct pseudo_opcode *) hash_find (md.pseudo_hash, mnemonic); ++ pdesc = (struct pseudo_opcode *) str_hash_find (md.pseudo_hash, mnemonic); + if (pdesc) + { + (void) restore_line_pointer (ch); +@@ -11750,10 +11725,9 @@ dot_alias (int section) + char delim; + char *end_name; + int len; +- const char *error_string; + struct alias *h; + const char *a; +- struct hash_control *ahash, *nhash; ++ htab_t ahash, nhash; + const char *kind; + + delim = get_symbol_name (&name); +@@ -11810,21 +11784,26 @@ dot_alias (int section) + } + + /* Check if alias has been used before. */ +- h = (struct alias *) hash_find (ahash, alias); ++ ++ h = (struct alias *) str_hash_find (ahash, alias); + if (h) + { + if (strcmp (h->name, name)) + as_bad (_("`%s' is already the alias of %s `%s'"), + alias, kind, h->name); ++ obstack_free (¬es, name); ++ obstack_free (¬es, alias); + goto out; + } + + /* Check if name already has an alias. */ +- a = (const char *) hash_find (nhash, name); ++ a = (const char *) str_hash_find (nhash, name); + if (a) + { + if (strcmp (a, alias)) + as_bad (_("%s `%s' already has an alias `%s'"), kind, name, a); ++ obstack_free (¬es, name); ++ obstack_free (¬es, alias); + goto out; + } + +@@ -11832,32 +11811,19 @@ dot_alias (int section) + h->file = as_where (&h->line); + h->name = name; + +- error_string = hash_jam (ahash, alias, (void *) h); +- if (error_string) +- { +- as_fatal (_("inserting \"%s\" into %s alias hash table failed: %s"), +- alias, kind, error_string); +- goto out; +- } +- +- error_string = hash_jam (nhash, name, (void *) alias); +- if (error_string) +- { +- as_fatal (_("inserting \"%s\" into %s name hash table failed: %s"), +- alias, kind, error_string); +- out: +- obstack_free (¬es, name); +- obstack_free (¬es, alias); +- } ++ str_hash_insert (ahash, alias, (void *) h); ++ str_hash_insert (nhash, name, (void *) alias); + ++out: + demand_empty_rest_of_line (); + } + + /* It renames the original symbol name to its alias. */ +-static void +-do_alias (const char *alias, void *value) ++static int ++do_alias (void **slot, void *arg ATTRIBUTE_UNUSED) + { +- struct alias *h = (struct alias *) value; ++ string_tuple_t *tuple = *((string_tuple_t **) slot); ++ struct alias *h = (struct alias *) tuple->value; + symbolS *sym = symbol_find (h->name); + + if (sym == NULL) +@@ -11866,43 +11832,48 @@ do_alias (const char *alias, void *value + /* Uses .alias extensively to alias CRTL functions to same with + decc$ prefix. Sometimes function gets optimized away and a + warning results, which should be suppressed. */ +- if (strncmp (alias, "decc$", 5) != 0) ++ if (strncmp (tuple->key, "decc$", 5) != 0) + #endif + as_warn_where (h->file, h->line, + _("symbol `%s' aliased to `%s' is not used"), +- h->name, alias); ++ h->name, tuple->key); + } + else +- S_SET_NAME (sym, (char *) alias); ++ S_SET_NAME (sym, (char *) tuple->key); ++ ++ return 1; + } + + /* Called from write_object_file. */ + void + ia64_adjust_symtab (void) + { +- hash_traverse (alias_hash, do_alias); ++ htab_traverse (alias_hash, do_alias, NULL); + } + + /* It renames the original section name to its alias. */ +-static void +-do_secalias (const char *alias, void *value) ++static int ++do_secalias (void **slot, void *arg ATTRIBUTE_UNUSED) + { +- struct alias *h = (struct alias *) value; ++ string_tuple_t *tuple = *((string_tuple_t **) slot); ++ struct alias *h = (struct alias *) tuple->value; + segT sec = bfd_get_section_by_name (stdoutput, h->name); + + if (sec == NULL) + as_warn_where (h->file, h->line, + _("section `%s' aliased to `%s' is not used"), +- h->name, alias); ++ h->name, tuple->key); + else +- sec->name = alias; ++ sec->name = tuple->key; ++ ++ return 1; + } + + /* Called from write_object_file. */ + void + ia64_frob_file (void) + { +- hash_traverse (secalias_hash, do_secalias); ++ htab_traverse (secalias_hash, do_secalias, NULL); + } + + #ifdef TE_VMS +diff -rup binutils.orig/gas/config/tc-iq2000.c binutils-2.35/gas/config/tc-iq2000.c +--- binutils.orig/gas/config/tc-iq2000.c 2021-08-11 17:33:12.213490344 +0100 ++++ binutils-2.35/gas/config/tc-iq2000.c 2021-08-11 17:43:57.988347560 +0100 +@@ -106,7 +106,7 @@ struct iq2000_hi_fixup + static struct iq2000_hi_fixup * iq2000_hi_fixup_list; + + /* Macro hash table, which we will add to. */ +-extern struct hash_control *macro_hash; ++extern struct htab *macro_hash; + + const char *md_shortopts = ""; + struct option md_longopts[] = +@@ -246,7 +246,10 @@ iq2000_add_macro (const char * name, + formal_entry ** p = ¯o->formals; + + macro->formal_count = 0; +- macro->formal_hash = hash_new (); ++ macro->formal_hash = htab_create_alloc (7, hash_formal_entry, ++ eq_formal_entry, ++ NULL, xcalloc, free); ++ + + while (*arguments != NULL) + { +@@ -272,8 +275,9 @@ iq2000_add_macro (const char * name, + sb_add_string (& formal->name, *arguments); + + /* Add to macro's hash table. */ +- hash_jam (macro->formal_hash, sb_terminate (& formal->name), formal); +- ++ htab_insert (macro->formal_hash, ++ formal_entry_alloc (sb_terminate (& formal->name), ++ formal)); + formal->index = macro->formal_count; + macro->formal_count++; + *p = formal; +@@ -285,7 +289,7 @@ iq2000_add_macro (const char * name, + + sb_add_string (¯o_name, name); + namestr = sb_terminate (¯o_name); +- hash_jam (macro_hash, namestr, macro); ++ htab_insert (macro_hash, macro_entry_alloc (namestr, macro)); + + macro_defined = 1; + } +diff -rup binutils.orig/gas/config/tc-m68hc11.c binutils-2.35/gas/config/tc-m68hc11.c +--- binutils.orig/gas/config/tc-m68hc11.c 2021-08-11 17:33:12.211490357 +0100 ++++ binutils-2.35/gas/config/tc-m68hc11.c 2021-08-11 17:39:31.408057532 +0100 +@@ -263,7 +263,7 @@ static short flag_print_insn_syntax = 0; + static short flag_print_opcodes = 0; + + /* Opcode hash table. */ +-static struct hash_control *m68hc11_hash; ++static htab_t m68hc11_hash; + + /* Current cpu (either cpu6811 or cpu6812). This is determined automagically + by 'get_default_target' by looking at default BFD vector. This is overridden +@@ -472,7 +472,7 @@ m68hc11_print_statistics (FILE *file) + int i; + struct m68hc11_opcode_def *opc; + +- hash_print_statistics (file, "opcode table", m68hc11_hash); ++ htab_print_statistics (file, "opcode table", m68hc11_hash); + + opc = m68hc11_opcode_defs; + if (opc == 0 || m68hc11_nb_opcode_defs == 0) +@@ -610,7 +610,7 @@ md_begin (void) + + get_default_target (); + +- m68hc11_hash = hash_new (); ++ m68hc11_hash = str_htab_create (); + + /* Get a writable copy of the opcode table and sort it on the names. */ + opcodes = XNEWVEC (struct m68hc11_opcode, m68hc11_num_opcodes); +@@ -664,7 +664,7 @@ md_begin (void) + opc->nb_modes = 0; + opc->opcode = opcodes; + opc->used = 0; +- hash_insert (m68hc11_hash, opcodes->name, opc); ++ str_hash_insert (m68hc11_hash, opcodes->name, opc); + } + opc->nb_modes++; + opc->format |= opcodes->format; +@@ -1010,7 +1010,7 @@ print_insn_format (char *name) + struct m68hc11_opcode *opcode; + char buf[128]; + +- opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash, name); ++ opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash, name); + if (opc == NULL) + { + as_bad (_("Instruction `%s' is not recognized."), name); +@@ -2848,7 +2848,7 @@ md_assemble (char *str) + if (current_architecture == cpuxgate) + { + /* Find the opcode definition given its name. */ +- opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash, name); ++ opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash, name); + if (opc == NULL) + { + as_bad (_("Opcode `%s' is not recognized."), name); +@@ -3469,7 +3469,7 @@ md_assemble (char *str) + } + + /* Find the opcode definition given its name. */ +- opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash, name); ++ opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash, name); + + /* If it's not recognized, look for 'jbsr' and 'jbxx'. These are + pseudo insns for relative branch. For these branches, we always +@@ -3477,7 +3477,7 @@ md_assemble (char *str) + is given. */ + if (opc == NULL && name[0] == 'j' && name[1] == 'b') + { +- opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash, &name[1]); ++ opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash, &name[1]); + if (opc + && (!(opc->format & M6811_OP_JUMP_REL) + || (opc->format & M6811_OP_BITMASK))) +@@ -3508,7 +3508,7 @@ md_assemble (char *str) + { + name[nlen++] = TOLOWER (*op_end++); + name[nlen] = 0; +- opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash, ++ opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash, + name); + } + } +diff -rup binutils.orig/gas/config/tc-m68k.c binutils-2.35/gas/config/tc-m68k.c +--- binutils.orig/gas/config/tc-m68k.c 2021-08-11 17:33:12.212490350 +0100 ++++ binutils-2.35/gas/config/tc-m68k.c 2021-08-11 17:44:04.214307612 +0100 +@@ -1320,7 +1320,7 @@ tc_gen_reloc (asection *section ATTRIBUT + + /* Handle of the OPCODE hash table. NULL means any use before + m68k_ip_begin() will crash. */ +-static struct hash_control *op_hash; ++static htab_t op_hash; + + /* Assemble an m68k instruction. */ + +@@ -1375,7 +1375,7 @@ m68k_ip (char *instring) + + c = *p; + *p = '\0'; +- opcode = (const struct m68k_incant *) hash_find (op_hash, instring); ++ opcode = (const struct m68k_incant *) str_hash_find (op_hash, instring); + *p = c; + + if (pdot != NULL) +@@ -4496,7 +4496,6 @@ md_begin (void) + { + const struct m68k_opcode *ins; + struct m68k_incant *hack, *slak; +- const char *retval = 0; /* Empty string, or error msg text. */ + int i; + + /* Set up hash tables with 68000 instructions. +@@ -4527,7 +4526,7 @@ md_begin (void) + qsort (m68k_sorted_opcodes, m68k_numopcodes, + sizeof (m68k_sorted_opcodes[0]), m68k_compare_opcode); + +- op_hash = hash_new (); ++ op_hash = str_htab_create (); + + obstack_begin (&robyn, 4000); + for (i = 0; i < m68k_numopcodes; i++) +@@ -4571,22 +4570,18 @@ md_begin (void) + } + while (slak); + +- retval = hash_insert (op_hash, ins->name, (char *) hack); +- if (retval) +- as_fatal (_("Internal Error: Can't hash %s: %s"), ins->name, retval); ++ str_hash_insert (op_hash, ins->name, (char *) hack); + } + + for (i = 0; i < m68k_numaliases; i++) + { + const char *name = m68k_opcode_aliases[i].primary; + const char *alias = m68k_opcode_aliases[i].alias; +- void *val = hash_find (op_hash, name); ++ void *val = (void *)str_hash_find (op_hash, name); + + if (!val) + as_fatal (_("Internal Error: Can't find %s in hash table"), name); +- retval = hash_insert (op_hash, alias, val); +- if (retval) +- as_fatal (_("Internal Error: Can't hash %s: %s"), alias, retval); ++ str_hash_insert (op_hash, alias, val); + } + + /* In MRI mode, all unsized branches are variable sized. Normally, +@@ -4619,13 +4614,11 @@ md_begin (void) + { + const char *name = mri_aliases[i].primary; + const char *alias = mri_aliases[i].alias; +- void *val = hash_find (op_hash, name); ++ void *val = (void *)str_hash_find (op_hash, name); + + if (!val) + as_fatal (_("Internal Error: Can't find %s in hash table"), name); +- retval = hash_jam (op_hash, alias, val); +- if (retval) +- as_fatal (_("Internal Error: Can't hash %s: %s"), alias, retval); ++ str_hash_insert (op_hash, alias, val); + } + } + +@@ -4680,7 +4673,7 @@ md_begin (void) + while (mote_pseudo_table[n].poc_name) + { + hack = XOBNEW (&robyn, struct m68k_incant); +- hash_insert (op_hash, ++ str_hash_insert (op_hash, + mote_pseudo_table[n].poc_name, (char *) hack); + hack->m_operands = 0; + hack->m_opnum = n; +@@ -5560,7 +5553,7 @@ s_proc (int ignore ATTRIBUTE_UNUSED) + alignment is needed. */ + + int +-m68k_conditional_pseudoop (pseudo_typeS *pop) ++m68k_conditional_pseudoop (const pseudo_typeS *pop) + { + return (pop->poc_handler == s_mri_if + || pop->poc_handler == s_mri_else); +Only in binutils-2.35/gas/config: tc-m68k.c.orig +diff -rup binutils.orig/gas/config/tc-m68k.h binutils-2.35/gas/config/tc-m68k.h +--- binutils.orig/gas/config/tc-m68k.h 2021-08-11 17:33:12.210490363 +0100 ++++ binutils-2.35/gas/config/tc-m68k.h 2021-08-11 17:44:04.214307612 +0100 +@@ -47,7 +47,7 @@ extern const char *m68k_comment_chars; + extern void m68k_mri_mode_change (int); + #define MRI_MODE_CHANGE(i) m68k_mri_mode_change (i) + +-extern int m68k_conditional_pseudoop (pseudo_typeS *); ++extern int m68k_conditional_pseudoop (const pseudo_typeS *); + #define tc_conditional_pseudoop(pop) m68k_conditional_pseudoop (pop) + + extern void m68k_frob_label (symbolS *); +diff -rup binutils.orig/gas/config/tc-mcore.c binutils-2.35/gas/config/tc-mcore.c +--- binutils.orig/gas/config/tc-mcore.c 2021-08-11 17:33:12.214490337 +0100 ++++ binutils-2.35/gas/config/tc-mcore.c 2021-08-11 17:39:31.408057532 +0100 +@@ -135,7 +135,7 @@ static unsigned long poolspan; + #define SPANEXIT (600) + static symbolS * poolsym; /* Label for current pool. */ + static char poolname[8]; +-static struct hash_control * opcode_hash_control; /* Opcode mnemonics. */ ++static htab_t opcode_hash_control; /* Opcode mnemonics. */ + + #define POOL_END_LABEL ".LE" + #define POOL_START_LABEL ".LS" +@@ -457,7 +457,7 @@ md_begin (void) + const char * prev_name = ""; + unsigned int i; + +- opcode_hash_control = hash_new (); ++ opcode_hash_control = str_htab_create (); + + /* Insert unique names into hash table. */ + for (i = 0; i < ARRAY_SIZE (mcore_table); i++) +@@ -465,7 +465,7 @@ md_begin (void) + if (! streq (prev_name, mcore_table[i].name)) + { + prev_name = mcore_table[i].name; +- hash_insert (opcode_hash_control, mcore_table[i].name, (char *) &mcore_table[i]); ++ str_hash_insert (opcode_hash_control, mcore_table[i].name, (char *) &mcore_table[i]); + } + } + } +@@ -881,7 +881,7 @@ md_assemble (char * str) + return; + } + +- opcode = (mcore_opcode_info *) hash_find (opcode_hash_control, name); ++ opcode = (mcore_opcode_info *) str_hash_find (opcode_hash_control, name); + if (opcode == NULL) + { + as_bad (_("unknown opcode \"%s\""), name); +diff -rup binutils.orig/gas/config/tc-microblaze.c binutils-2.35/gas/config/tc-microblaze.c +--- binutils.orig/gas/config/tc-microblaze.c 2021-08-11 17:33:12.210490363 +0100 ++++ binutils-2.35/gas/config/tc-microblaze.c 2021-08-11 17:39:31.409057526 +0100 +@@ -114,7 +114,7 @@ const relax_typeS md_relax_table[] = + { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */ + }; + +-static struct hash_control * opcode_hash_control; /* Opcode mnemonics. */ ++static htab_t opcode_hash_control; /* Opcode mnemonics. */ + + static segT sbss_segment = 0; /* Small bss section. */ + static segT sbss2_segment = 0; /* Section not used. */ +@@ -413,11 +413,11 @@ md_begin (void) + { + struct op_code_struct * opcode; + +- opcode_hash_control = hash_new (); ++ opcode_hash_control = str_htab_create (); + + /* Insert unique names into hash table. */ + for (opcode = opcodes; opcode->name; opcode ++) +- hash_insert (opcode_hash_control, opcode->name, (char *) opcode); ++ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode); + } + + /* Try to parse a reg name. */ +@@ -942,7 +942,7 @@ md_assemble (char * str) + return; + } + +- opcode = (struct op_code_struct *) hash_find (opcode_hash_control, name); ++ opcode = (struct op_code_struct *) str_hash_find (opcode_hash_control, name); + if (opcode == NULL) + { + as_bad (_("unknown opcode \"%s\""), name); +@@ -1072,9 +1072,9 @@ md_assemble (char * str) + + count = 32 - reg1; + if (streq (name, "lmi")) +- opcode = (struct op_code_struct *) hash_find (opcode_hash_control, "lwi"); ++ opcode = (struct op_code_struct *) str_hash_find (opcode_hash_control, "lwi"); + else +- opcode = (struct op_code_struct *) hash_find (opcode_hash_control, "swi"); ++ opcode = (struct op_code_struct *) str_hash_find (opcode_hash_control, "swi"); + if (opcode == NULL) + { + as_bad (_("unknown opcode \"%s\""), "lwi"); +@@ -1106,7 +1106,7 @@ md_assemble (char * str) + if ((temp != 0) && (temp != 0xFFFF8000)) + { + /* Needs an immediate inst. */ +- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); ++ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm"); + if (opcode1 == NULL) + { + as_bad (_("unknown opcode \"%s\""), "imm"); +@@ -1559,7 +1559,7 @@ md_assemble (char * str) + if ((temp != 0) && (temp != 0xFFFF8000)) + { + /* Needs an immediate inst. */ +- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); ++ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm"); + if (opcode1 == NULL) + { + as_bad (_("unknown opcode \"%s\""), "imm"); +@@ -1625,7 +1625,7 @@ md_assemble (char * str) + if ((temp != 0) && (temp != 0xFFFF8000)) + { + /* Needs an immediate inst. */ +- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); ++ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm"); + if (opcode1 == NULL) + { + as_bad (_("unknown opcode \"%s\""), "imm"); +@@ -1698,7 +1698,7 @@ md_assemble (char * str) + if ((temp != 0) && (temp != 0xFFFF8000)) + { + /* Needs an immediate inst. */ +- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); ++ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm"); + if (opcode1 == NULL) + { + as_bad (_("unknown opcode \"%s\""), "imm"); +@@ -2119,7 +2119,7 @@ md_apply_fix (fixS * fixP, + buf[i + INST_WORD_SIZE] = buf[i]; + + /* Generate the imm instruction. */ +- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); ++ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm"); + if (opcode1 == NULL) + { + as_bad (_("unknown opcode \"%s\""), "imm"); +@@ -2167,7 +2167,7 @@ md_apply_fix (fixS * fixP, + buf[i + INST_WORD_SIZE] = buf[i]; + + /* Generate the imm instruction. */ +- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); ++ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm"); + if (opcode1 == NULL) + { + as_bad (_("unknown opcode \"%s\""), "imm"); +diff -rup binutils.orig/gas/config/tc-mips.c binutils-2.35/gas/config/tc-mips.c +--- binutils.orig/gas/config/tc-mips.c 2021-08-11 17:33:12.211490357 +0100 ++++ binutils-2.35/gas/config/tc-mips.c 2021-08-11 17:39:31.410057520 +0100 +@@ -675,13 +675,13 @@ static int g_switch_seen = 0; + static int nopic_need_relax (symbolS *, int); + + /* Handle of the OPCODE hash table. */ +-static struct hash_control *op_hash = NULL; ++static htab_t op_hash = NULL; + + /* The opcode hash table we use for the mips16. */ +-static struct hash_control *mips16_op_hash = NULL; ++static htab_t mips16_op_hash = NULL; + + /* The opcode hash table we use for the microMIPS ASE. */ +-static struct hash_control *micromips_op_hash = NULL; ++static htab_t micromips_op_hash = NULL; + + /* This array holds the chars that always start a comment. If the + pre-processor is disabled, these aren't very useful. */ +@@ -3673,7 +3673,6 @@ validate_micromips_insn (const struct mi + void + md_begin (void) + { +- const char *retval = NULL; + int i = 0; + int broken = 0; + +@@ -3693,21 +3692,14 @@ md_begin (void) + if (! bfd_set_arch_mach (stdoutput, bfd_arch_mips, file_mips_opts.arch)) + as_warn (_("could not set architecture and machine")); + +- op_hash = hash_new (); ++ op_hash = str_htab_create (); + + mips_operands = XCNEWVEC (struct mips_operand_array, NUMOPCODES); + for (i = 0; i < NUMOPCODES;) + { + const char *name = mips_opcodes[i].name; + +- retval = hash_insert (op_hash, name, (void *) &mips_opcodes[i]); +- if (retval != NULL) +- { +- fprintf (stderr, _("internal error: can't hash `%s': %s\n"), +- mips_opcodes[i].name, retval); +- /* Probably a memory allocation problem? Give up now. */ +- as_fatal (_("broken assembler, no assembly attempted")); +- } ++ str_hash_insert (op_hash, name, (void *) &mips_opcodes[i]); + do + { + if (!validate_mips_insn (&mips_opcodes[i], 0xffffffff, +@@ -3730,7 +3722,7 @@ md_begin (void) + while ((i < NUMOPCODES) && !strcmp (mips_opcodes[i].name, name)); + } + +- mips16_op_hash = hash_new (); ++ mips16_op_hash = str_htab_create (); + mips16_operands = XCNEWVEC (struct mips_operand_array, + bfd_mips16_num_opcodes); + +@@ -3739,10 +3731,7 @@ md_begin (void) + { + const char *name = mips16_opcodes[i].name; + +- retval = hash_insert (mips16_op_hash, name, (void *) &mips16_opcodes[i]); +- if (retval != NULL) +- as_fatal (_("internal: can't hash `%s': %s"), +- mips16_opcodes[i].name, retval); ++ str_hash_insert (mips16_op_hash, name, (void *) &mips16_opcodes[i]); + do + { + if (!validate_mips16_insn (&mips16_opcodes[i], &mips16_operands[i])) +@@ -3758,7 +3747,7 @@ md_begin (void) + && strcmp (mips16_opcodes[i].name, name) == 0); + } + +- micromips_op_hash = hash_new (); ++ micromips_op_hash = str_htab_create (); + micromips_operands = XCNEWVEC (struct mips_operand_array, + bfd_micromips_num_opcodes); + +@@ -3767,11 +3756,8 @@ md_begin (void) + { + const char *name = micromips_opcodes[i].name; + +- retval = hash_insert (micromips_op_hash, name, ++ str_hash_insert (micromips_op_hash, name, + (void *) µmips_opcodes[i]); +- if (retval != NULL) +- as_fatal (_("internal: can't hash `%s': %s"), +- micromips_opcodes[i].name, retval); + do + { + struct mips_cl_insn *micromips_nop_insn; +@@ -9027,7 +9013,7 @@ macro_build (expressionS *ep, const char + bfd_reloc_code_real_type r[3]; + const struct mips_opcode *amo; + const struct mips_operand *operand; +- struct hash_control *hash; ++ htab_t hash; + struct mips_cl_insn insn; + va_list args; + unsigned int uval; +@@ -9045,7 +9031,7 @@ macro_build (expressionS *ep, const char + r[1] = BFD_RELOC_UNUSED; + r[2] = BFD_RELOC_UNUSED; + hash = mips_opts.micromips ? micromips_op_hash : op_hash; +- amo = (struct mips_opcode *) hash_find (hash, name); ++ amo = (struct mips_opcode *) str_hash_find (hash, name); + gas_assert (amo); + gas_assert (strcmp (name, amo->name) == 0); + +@@ -9203,7 +9189,7 @@ mips16_macro_build (expressionS *ep, con + bfd_reloc_code_real_type r[3] + = {BFD_RELOC_UNUSED, BFD_RELOC_UNUSED, BFD_RELOC_UNUSED}; + +- mo = (struct mips_opcode *) hash_find (mips16_op_hash, name); ++ mo = (struct mips_opcode *) str_hash_find (mips16_op_hash, name); + gas_assert (mo); + gas_assert (strcmp (name, mo->name) == 0); + +@@ -14263,7 +14249,7 @@ mips16_macro (struct mips_cl_insn *ip) + opcode bits in *OPCODE_EXTRA. */ + + static struct mips_opcode * +-mips_lookup_insn (struct hash_control *hash, const char *start, ++mips_lookup_insn (htab_t hash, const char *start, + ssize_t length, unsigned int *opcode_extra) + { + char *name, *dot, *p; +@@ -14275,7 +14261,7 @@ mips_lookup_insn (struct hash_control *h + name = xstrndup (start, length); + + /* Look up the instruction as-is. */ +- insn = (struct mips_opcode *) hash_find (hash, name); ++ insn = (struct mips_opcode *) str_hash_find (hash, name); + if (insn) + goto end; + +@@ -14287,7 +14273,7 @@ mips_lookup_insn (struct hash_control *h + if (*p == 0 && mask != 0) + { + *dot = 0; +- insn = (struct mips_opcode *) hash_find (hash, name); ++ insn = (struct mips_opcode *) str_hash_find (hash, name); + *dot = '.'; + if (insn && (insn->pinfo2 & INSN2_VU0_CHANNEL_SUFFIX) != 0) + { +@@ -14313,7 +14299,7 @@ mips_lookup_insn (struct hash_control *h + if (suffix) + { + memmove (name + opend - 2, name + opend, length - opend + 1); +- insn = (struct mips_opcode *) hash_find (hash, name); ++ insn = (struct mips_opcode *) str_hash_find (hash, name); + if (insn) + { + forced_insn_length = suffix; +@@ -14338,7 +14324,7 @@ static void + mips_ip (char *str, struct mips_cl_insn *insn) + { + const struct mips_opcode *first, *past; +- struct hash_control *hash; ++ htab_t hash; + char format; + size_t end; + struct mips_operand_token *tokens; +@@ -14434,7 +14420,7 @@ mips16_ip (char *str, struct mips_cl_ins + forced_insn_length = l; + + *end = 0; +- first = (struct mips_opcode *) hash_find (mips16_op_hash, str); ++ first = (struct mips_opcode *) str_hash_find (mips16_op_hash, str); + *end = c; + + if (!first) +Only in binutils-2.35/gas/config: tc-mips.c.orig +diff -rup binutils.orig/gas/config/tc-mmix.c binutils-2.35/gas/config/tc-mmix.c +--- binutils.orig/gas/config/tc-mmix.c 2021-08-11 17:33:12.209490370 +0100 ++++ binutils-2.35/gas/config/tc-mmix.c 2021-08-11 17:39:31.410057520 +0100 +@@ -217,7 +217,7 @@ struct option md_longopts[] = + + size_t md_longopts_size = sizeof (md_longopts); + +-static struct hash_control *mmix_opcode_hash; ++static htab_t mmix_opcode_hash; + + /* We use these when implementing the PREFIX pseudo. */ + char *mmix_current_prefix; +@@ -769,13 +769,13 @@ mmix_md_begin (void) + only way to make ':' part of a name, and a name beginner. */ + lex_type[':'] = (LEX_NAME | LEX_BEGIN_NAME); + +- mmix_opcode_hash = hash_new (); ++ mmix_opcode_hash = str_htab_create (); + + real_reg_section + = bfd_make_section_old_way (stdoutput, MMIX_REG_SECTION_NAME); + + for (opcode = mmix_opcodes; opcode->name; opcode++) +- hash_insert (mmix_opcode_hash, opcode->name, (char *) opcode); ++ str_hash_insert (mmix_opcode_hash, opcode->name, (char *) opcode); + + /* We always insert the ordinary registers 0..255 as registers. */ + for (i = 0; i < 256; i++) +@@ -843,7 +843,7 @@ md_assemble (char *str) + *operands++ = '\0'; + } + +- instruction = (struct mmix_opcode *) hash_find (mmix_opcode_hash, str); ++ instruction = (struct mmix_opcode *) str_hash_find (mmix_opcode_hash, str); + if (instruction == NULL) + { + as_bad (_("unknown opcode: `%s'"), str); +diff -rup binutils.orig/gas/config/tc-mn10200.c binutils-2.35/gas/config/tc-mn10200.c +--- binutils.orig/gas/config/tc-mn10200.c 2021-08-11 17:33:12.214490337 +0100 ++++ binutils-2.35/gas/config/tc-mn10200.c 2021-08-11 17:39:31.410057520 +0100 +@@ -101,7 +101,7 @@ const pseudo_typeS md_pseudo_table[] = + }; + + /* Opcode hash table. */ +-static struct hash_control *mn10200_hash; ++static htab_t mn10200_hash; + + /* This table is sorted. Suitable for searching by a binary search. */ + static const struct reg_name data_registers[] = +@@ -685,7 +685,7 @@ md_begin (void) + const char *prev_name = ""; + const struct mn10200_opcode *op; + +- mn10200_hash = hash_new (); ++ mn10200_hash = str_htab_create (); + + /* Insert unique names into hash table. The MN10200 instruction set + has many identical opcode names that have different opcodes based +@@ -698,7 +698,7 @@ md_begin (void) + if (strcmp (prev_name, op->name)) + { + prev_name = (char *) op->name; +- hash_insert (mn10200_hash, op->name, (char *) op); ++ str_hash_insert (mn10200_hash, op->name, (char *) op); + } + op++; + } +@@ -890,7 +890,7 @@ md_assemble (char *str) + *s++ = '\0'; + + /* Find the first opcode with the proper name. */ +- opcode = (struct mn10200_opcode *) hash_find (mn10200_hash, str); ++ opcode = (struct mn10200_opcode *) str_hash_find (mn10200_hash, str); + if (opcode == NULL) + { + as_bad (_("Unrecognized opcode: `%s'"), str); +diff -rup binutils.orig/gas/config/tc-mn10300.c binutils-2.35/gas/config/tc-mn10300.c +--- binutils.orig/gas/config/tc-mn10300.c 2021-08-11 17:33:12.208490376 +0100 ++++ binutils-2.35/gas/config/tc-mn10300.c 2021-08-11 17:39:31.411057513 +0100 +@@ -121,7 +121,7 @@ size_t md_longopts_size = sizeof (md_lon + #define HAVE_AM30 (current_machine == AM30) + + /* Opcode hash table. */ +-static struct hash_control *mn10300_hash; ++static htab_t mn10300_hash; + + /* This table is sorted. Suitable for searching by a binary search. */ + static const struct reg_name data_registers[] = +@@ -911,7 +911,7 @@ md_begin (void) + const char *prev_name = ""; + const struct mn10300_opcode *op; + +- mn10300_hash = hash_new (); ++ mn10300_hash = str_htab_create (); + + /* Insert unique names into hash table. The MN10300 instruction set + has many identical opcode names that have different opcodes based +@@ -924,7 +924,7 @@ md_begin (void) + if (strcmp (prev_name, op->name)) + { + prev_name = (char *) op->name; +- hash_insert (mn10300_hash, op->name, (char *) op); ++ str_hash_insert (mn10300_hash, op->name, (char *) op); + } + op++; + } +@@ -1247,7 +1247,7 @@ md_assemble (char *str) + *s++ = '\0'; + + /* Find the first opcode with the proper name. */ +- opcode = (struct mn10300_opcode *) hash_find (mn10300_hash, str); ++ opcode = (struct mn10300_opcode *) str_hash_find (mn10300_hash, str); + if (opcode == NULL) + { + as_bad (_("Unrecognized opcode: `%s'"), str); +diff -rup binutils.orig/gas/config/tc-moxie.c binutils-2.35/gas/config/tc-moxie.c +--- binutils.orig/gas/config/tc-moxie.c 2021-08-11 17:33:12.212490350 +0100 ++++ binutils-2.35/gas/config/tc-moxie.c 2021-08-11 17:39:31.411057513 +0100 +@@ -32,7 +32,7 @@ const char line_separator_chars[] = ";"; + const char line_comment_chars[] = "#"; + + static int pending_reloc; +-static struct hash_control *opcode_hash_control; ++static htab_t opcode_hash_control; + + const pseudo_typeS md_pseudo_table[] = + { +@@ -62,17 +62,17 @@ md_begin (void) + { + int count; + const moxie_opc_info_t *opcode; +- opcode_hash_control = hash_new (); ++ opcode_hash_control = str_htab_create (); + + /* Insert names into hash table. */ + for (count = 0, opcode = moxie_form1_opc_info; count++ < 64; opcode++) +- hash_insert (opcode_hash_control, opcode->name, (char *) opcode); ++ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode); + + for (count = 0, opcode = moxie_form2_opc_info; count++ < 4; opcode++) +- hash_insert (opcode_hash_control, opcode->name, (char *) opcode); ++ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode); + + for (count = 0, opcode = moxie_form3_opc_info; count++ < 10; opcode++) +- hash_insert (opcode_hash_control, opcode->name, (char *) opcode); ++ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode); + + bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0); + } +@@ -178,7 +178,7 @@ md_assemble (char *str) + + if (nlen == 0) + as_bad (_("can't find opcode ")); +- opcode = (moxie_opc_info_t *) hash_find (opcode_hash_control, op_start); ++ opcode = (moxie_opc_info_t *) str_hash_find (opcode_hash_control, op_start); + *op_end = pend; + + if (opcode == NULL) +diff -rup binutils.orig/gas/config/tc-msp430.c binutils-2.35/gas/config/tc-msp430.c +--- binutils.orig/gas/config/tc-msp430.c 2021-08-11 17:33:12.215490331 +0100 ++++ binutils-2.35/gas/config/tc-msp430.c 2021-08-11 17:39:31.411057513 +0100 +@@ -194,7 +194,7 @@ const char FLT_CHARS[] = "dD"; + /* Handle long expressions. */ + extern LITTLENUM_TYPE generic_bignum[]; + +-static struct hash_control *msp430_hash; ++static htab_t msp430_hash; + + /* Relaxations. */ + #define STATE_UNCOND_BRANCH 1 /* jump */ +@@ -1834,10 +1834,11 @@ void + md_begin (void) + { + struct msp430_opcode_s * opcode; +- msp430_hash = hash_new (); ++ msp430_hash = str_htab_create (); + + for (opcode = msp430_opcodes; opcode->name; opcode++) +- hash_insert (msp430_hash, opcode->name, (char *) opcode); ++ if (str_hash_find (msp430_hash, opcode->name) == NULL) ++ str_hash_insert (msp430_hash, opcode->name, (char *) opcode); + + bfd_set_arch_mach (stdoutput, TARGET_ARCH, + target_is_430x () ? bfd_mach_msp430x : bfd_mach_msp11); +@@ -2871,7 +2872,7 @@ msp430_operands (struct msp430_opcode_s + char real_name[32]; + + sprintf (real_name, "%sa", old_name); +- opcode = hash_find (msp430_hash, real_name); ++ opcode = str_hash_find (msp430_hash, real_name); + if (opcode == NULL) + { + as_bad (_("instruction %s.a does not exist"), old_name); +@@ -4355,7 +4356,7 @@ md_assemble (char * str) + return; + } + +- opcode = (struct msp430_opcode_s *) hash_find (msp430_hash, cmd); ++ opcode = (struct msp430_opcode_s *) str_hash_find (msp430_hash, cmd); + + if (opcode == NULL) + { +Only in binutils-2.35/gas/config: tc-msp430.c.orig +diff -rup binutils.orig/gas/config/tc-nds32.c binutils-2.35/gas/config/tc-nds32.c +--- binutils.orig/gas/config/tc-nds32.c 2021-08-11 17:33:12.213490344 +0100 ++++ binutils-2.35/gas/config/tc-nds32.c 2021-08-11 17:39:31.411057513 +0100 +@@ -82,8 +82,8 @@ static int vec_size = 0; + ".flag verbatim" at beginning of the content. We have + 'nds32_flag' to parse it and set this field to be non-zero. */ + static int verbatim = 0; +-static struct hash_control *nds32_gprs_hash; +-static struct hash_control *nds32_hint_hash; ++static htab_t nds32_gprs_hash; ++static htab_t nds32_hint_hash; + #define TLS_REG "$r27" + #define GOT_NAME "_GLOBAL_OFFSET_TABLE_" + +@@ -109,7 +109,7 @@ enum ict_option { + static enum ict_option ict_flag = ICT_NONE; + + +-static struct hash_control *nds32_relax_info_hash; ++static htab_t nds32_relax_info_hash; + + /* Branch patterns. */ + static relax_info_t relax_table[] = +@@ -2569,12 +2569,12 @@ struct nds32_pseudo_opcode + }; + #define PV_DONT_CARE 0 + +-static struct hash_control *nds32_pseudo_opcode_hash = NULL; ++static htab_t nds32_pseudo_opcode_hash = NULL; + + static int + builtin_isreg (const char *s, const char *x ATTRIBUTE_UNUSED) + { +- if (s [0] == '$' && hash_find (nds32_gprs_hash, (s + 1))) ++ if (s [0] == '$' && str_hash_find (nds32_gprs_hash, (s + 1))) + return 1; + return 0; + } +@@ -2586,7 +2586,7 @@ builtin_regnum (const char *s, const cha + if (*s != '$') + return -1; + s++; +- k = hash_find (nds32_gprs_hash, s); ++ k = str_hash_find (nds32_gprs_hash, s); + + if (k == NULL) + return -1; +@@ -3434,18 +3434,18 @@ nds32_init_nds32_pseudo_opcodes (void) + { + struct nds32_pseudo_opcode *opcode = nds32_pseudo_opcode_table; + +- nds32_pseudo_opcode_hash = hash_new (); ++ nds32_pseudo_opcode_hash = str_htab_create (); + for ( ; opcode->opcode; opcode++) + { + void *op; + +- op = hash_find (nds32_pseudo_opcode_hash, opcode->opcode); ++ op = str_hash_find (nds32_pseudo_opcode_hash, opcode->opcode); + if (op != NULL) + { + as_warn (_("Duplicated pseudo-opcode %s."), opcode->opcode); + continue; + } +- hash_insert (nds32_pseudo_opcode_hash, opcode->opcode, opcode); ++ str_hash_insert (nds32_pseudo_opcode_hash, opcode->opcode, opcode); + } + } + +@@ -3466,7 +3466,7 @@ nds32_lookup_pseudo_opcode (const char * + } + op[i] = '\0'; + +- result = hash_find (nds32_pseudo_opcode_hash, op); ++ result = str_hash_find (nds32_pseudo_opcode_hash, op); + free (op); + return result; + } +@@ -4291,12 +4291,12 @@ nds32_relax_hint (int mode ATTRIBUTE_UNU + + /* Find relax hint entry for next instruction, and all member will be + initialized at that time. */ +- relocs = hash_find (nds32_hint_hash, name); ++ relocs = str_hash_find (nds32_hint_hash, name); + if (relocs == NULL) + { + relocs = XNEW (struct nds32_relocs_pattern); + memset (relocs, 0, sizeof (struct nds32_relocs_pattern)); +- hash_insert (nds32_hint_hash, name, relocs); ++ str_hash_insert (nds32_hint_hash, name, relocs); + } + else + { +@@ -4623,17 +4623,17 @@ md_begin (void) + nds32_asm_init (&asm_desc, flags); + + /* Initial general purpose registers hash table. */ +- nds32_gprs_hash = hash_new (); ++ nds32_gprs_hash = str_htab_create (); + for (k = keyword_gpr; k->name; k++) +- hash_insert (nds32_gprs_hash, k->name, k); ++ str_hash_insert (nds32_gprs_hash, k->name, k); + + /* Initial branch hash table. */ +- nds32_relax_info_hash = hash_new (); ++ nds32_relax_info_hash = str_htab_create (); + for (relax_info = relax_table; relax_info->opcode; relax_info++) +- hash_insert (nds32_relax_info_hash, relax_info->opcode, relax_info); ++ str_hash_insert (nds32_relax_info_hash, relax_info->opcode, relax_info); + + /* Initial relax hint hash table. */ +- nds32_hint_hash = hash_new (); ++ nds32_hint_hash = str_htab_create (); + enable_16bit = nds32_16bit_ext; + } + +@@ -5813,7 +5813,7 @@ nds32_find_reloc_table (struct nds32_rel + if (opc) + { + /* Branch relax pattern. */ +- relax_info = hash_find (nds32_relax_info_hash, opc); ++ relax_info = str_hash_find (nds32_relax_info_hash, opc); + if (!relax_info) + return FALSE; + fixup_info = relax_info->relax_fixup[range]; +@@ -6272,6 +6272,15 @@ nds32_elf_append_relax_relocs (const cha + frchain_now = frchain_bak; + } + ++static int ++nds32_elf_append_relax_relocs_traverse (void **slot, void *arg ATTRIBUTE_UNUSED) ++{ ++ string_tuple_t *tuple = *((string_tuple_t **) slot); ++ nds32_elf_append_relax_relocs (tuple->key, tuple->value); ++ return 1; ++} ++ ++ + static void + nds32_str_tolower (const char *src, char *dest) + { +@@ -6757,7 +6766,7 @@ nds32_relax_branch_instructions (segT se + return 0; + } + +- relax_info = hash_find (nds32_relax_info_hash, opcode->opcode); ++ relax_info = str_hash_find (nds32_relax_info_hash, opcode->opcode); + + if (relax_info == NULL) + return adjust; +@@ -7046,7 +7055,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNU + + if (fragP->tc_frag_data.flag & NDS32_FRAG_RELAXABLE_BRANCH) + { +- relax_info = hash_find (nds32_relax_info_hash, opcode->opcode); ++ relax_info = str_hash_find (nds32_relax_info_hash, opcode->opcode); + + if (relax_info == NULL) + return; +@@ -7106,7 +7115,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNU + else if (fragP->tc_frag_data.flag & NDS32_FRAG_BRANCH) + { + /* Branch instruction adjust and append relocations. */ +- relax_info = hash_find (nds32_relax_info_hash, opcode->opcode); ++ relax_info = str_hash_find (nds32_relax_info_hash, opcode->opcode); + + if (relax_info == NULL) + return; +@@ -7481,7 +7490,7 @@ nds32_insert_relax_entry (bfd *abfd ATTR + static void + nds32_elf_analysis_relax_hint (void) + { +- hash_traverse (nds32_hint_hash, nds32_elf_append_relax_relocs); ++ htab_traverse (nds32_hint_hash, nds32_elf_append_relax_relocs_traverse, NULL); + } + + static void +@@ -7966,7 +7975,7 @@ nds32_parse_name (char const *name, expr + int + tc_nds32_regname_to_dw2regnum (char *regname) + { +- struct nds32_keyword *sym = hash_find (nds32_gprs_hash, regname); ++ struct nds32_keyword *sym = str_hash_find (nds32_gprs_hash, regname); + + if (!sym) + return -1; +diff -rup binutils.orig/gas/config/tc-nios2.c binutils-2.35/gas/config/tc-nios2.c +--- binutils.orig/gas/config/tc-nios2.c 2021-08-11 17:33:12.210490363 +0100 ++++ binutils-2.35/gas/config/tc-nios2.c 2021-08-11 17:39:31.412057507 +0100 +@@ -184,20 +184,20 @@ typedef struct nios2_ps_insn_info + } nios2_ps_insn_infoS; + + /* Opcode hash table. */ +-static struct hash_control *nios2_opcode_hash = NULL; ++static htab_t nios2_opcode_hash = NULL; + #define nios2_opcode_lookup(NAME) \ +- ((struct nios2_opcode *) hash_find (nios2_opcode_hash, (NAME))) ++ ((struct nios2_opcode *) str_hash_find (nios2_opcode_hash, (NAME))) + + /* Register hash table. */ +-static struct hash_control *nios2_reg_hash = NULL; ++static htab_t nios2_reg_hash = NULL; + #define nios2_reg_lookup(NAME) \ +- ((struct nios2_reg *) hash_find (nios2_reg_hash, (NAME))) ++ ((struct nios2_reg *) str_hash_find (nios2_reg_hash, (NAME))) + + + /* Pseudo-op hash table. */ +-static struct hash_control *nios2_ps_hash = NULL; ++static htab_t nios2_ps_hash = NULL; + #define nios2_ps_lookup(NAME) \ +- ((nios2_ps_insn_infoS *) hash_find (nios2_ps_hash, (NAME))) ++ ((nios2_ps_insn_infoS *) str_hash_find (nios2_ps_hash, (NAME))) + + /* The known current alignment of the current section. */ + static int nios2_current_align; +@@ -3603,7 +3603,6 @@ void + md_begin (void) + { + int i; +- const char *inserted; + + switch (nios2_architecture) + { +@@ -3620,52 +3619,21 @@ md_begin (void) + + /* Create and fill a hashtable for the Nios II opcodes, registers and + arguments. */ +- nios2_opcode_hash = hash_new (); +- nios2_reg_hash = hash_new (); +- nios2_ps_hash = hash_new (); ++ nios2_opcode_hash = str_htab_create (); ++ nios2_reg_hash = str_htab_create (); ++ nios2_ps_hash = str_htab_create (); + + for (i = 0; i < nios2_num_opcodes; ++i) +- { +- inserted +- = hash_insert (nios2_opcode_hash, nios2_opcodes[i].name, +- (PTR) & nios2_opcodes[i]); +- if (inserted != NULL) +- { +- fprintf (stderr, _("internal error: can't hash `%s': %s\n"), +- nios2_opcodes[i].name, inserted); +- /* Probably a memory allocation problem? Give up now. */ +- as_fatal (_("Broken assembler. No assembly attempted.")); +- } +- } ++ str_hash_insert (nios2_opcode_hash, nios2_opcodes[i].name, ++ (PTR) & nios2_opcodes[i]); + + for (i = 0; i < nios2_num_regs; ++i) +- { +- inserted +- = hash_insert (nios2_reg_hash, nios2_regs[i].name, +- (PTR) & nios2_regs[i]); +- if (inserted != NULL) +- { +- fprintf (stderr, _("internal error: can't hash `%s': %s\n"), +- nios2_regs[i].name, inserted); +- /* Probably a memory allocation problem? Give up now. */ +- as_fatal (_("Broken assembler. No assembly attempted.")); +- } +- +- } ++ str_hash_insert (nios2_reg_hash, nios2_regs[i].name, ++ (PTR) & nios2_regs[i]); + + for (i = 0; i < nios2_num_ps_insn_info_structs; ++i) +- { +- inserted +- = hash_insert (nios2_ps_hash, nios2_ps_insn_info_structs[i].pseudo_insn, +- (PTR) & nios2_ps_insn_info_structs[i]); +- if (inserted != NULL) +- { +- fprintf (stderr, _("internal error: can't hash `%s': %s\n"), +- nios2_ps_insn_info_structs[i].pseudo_insn, inserted); +- /* Probably a memory allocation problem? Give up now. */ +- as_fatal (_("Broken assembler. No assembly attempted.")); +- } +- } ++ str_hash_insert (nios2_ps_hash, nios2_ps_insn_info_structs[i].pseudo_insn, ++ (PTR) & nios2_ps_insn_info_structs[i]); + + /* Assembler option defaults. */ + nios2_as_options.noat = FALSE; +diff -rup binutils.orig/gas/config/tc-ns32k.c binutils-2.35/gas/config/tc-ns32k.c +--- binutils.orig/gas/config/tc-ns32k.c 2021-08-11 17:33:12.208490376 +0100 ++++ binutils-2.35/gas/config/tc-ns32k.c 2021-08-11 17:39:31.412057507 +0100 +@@ -84,7 +84,7 @@ struct addr_mode + typedef struct addr_mode addr_modeS; + + char *freeptr, *freeptr_static; /* Points at some number of free bytes. */ +-struct hash_control *inst_hash_handle; ++htab_t inst_hash_handle; + + struct ns32k_opcode *desc; /* Pointer at description of instruction. */ + addr_modeS addr_modeP; +@@ -1103,7 +1103,7 @@ parse (const char *line, int recursive_l + c = *lineptr; + *(char *) lineptr = '\0'; + +- if (!(desc = (struct ns32k_opcode *) hash_find (inst_hash_handle, line))) ++ if (!(desc = (struct ns32k_opcode *) str_hash_find (inst_hash_handle, line))) + as_fatal (_("No such opcode")); + + *(char *) lineptr = c; +@@ -1895,18 +1895,13 @@ md_begin (void) + { + /* Build a hashtable of the instructions. */ + const struct ns32k_opcode *ptr; +- const char *status; + const struct ns32k_opcode *endop; + +- inst_hash_handle = hash_new (); ++ inst_hash_handle = str_htab_create (); + + endop = ns32k_opcodes + sizeof (ns32k_opcodes) / sizeof (ns32k_opcodes[0]); + for (ptr = ns32k_opcodes; ptr < endop; ptr++) +- { +- if ((status = hash_insert (inst_hash_handle, ptr->name, (char *) ptr))) +- /* Fatal. */ +- as_fatal (_("Can't hash %s: %s"), ptr->name, status); +- } ++ str_hash_insert (inst_hash_handle, ptr->name, (char *) ptr); + + /* Some private space please! */ + freeptr_static = XNEWVEC (char, PRIVATE_SIZE); +diff -rup binutils.orig/gas/config/tc-pdp11.c binutils-2.35/gas/config/tc-pdp11.c +--- binutils.orig/gas/config/tc-pdp11.c 2021-08-11 17:33:12.210490363 +0100 ++++ binutils-2.35/gas/config/tc-pdp11.c 2021-08-11 17:39:31.412057507 +0100 +@@ -82,7 +82,7 @@ const pseudo_typeS md_pseudo_table[] = + { 0, 0, 0 }, + }; + +-static struct hash_control *insn_hash = NULL; ++static htab_t insn_hash = NULL; + + static int + set_option (const char *arg) +@@ -188,14 +188,14 @@ md_begin (void) + + init_defaults (); + +- insn_hash = hash_new (); ++ insn_hash = str_htab_create (); + if (insn_hash == NULL) + as_fatal (_("Virtual memory exhausted")); + + for (i = 0; i < pdp11_num_opcodes; i++) +- hash_insert (insn_hash, pdp11_opcodes[i].name, (void *) (pdp11_opcodes + i)); ++ str_hash_insert (insn_hash, pdp11_opcodes[i].name, (void *) (pdp11_opcodes + i)); + for (i = 0; i < pdp11_num_aliases; i++) +- hash_insert (insn_hash, pdp11_aliases[i].name, (void *) (pdp11_aliases + i)); ++ str_hash_insert (insn_hash, pdp11_aliases[i].name, (void *) (pdp11_aliases + i)); + } + + void +@@ -713,7 +713,7 @@ md_assemble (char *instruction_string) + + c = *p; + *p = '\0'; +- op = (struct pdp11_opcode *)hash_find (insn_hash, str); ++ op = (struct pdp11_opcode *)str_hash_find (insn_hash, str); + *p = c; + if (op == 0) + { +diff -rup binutils.orig/gas/config/tc-pj.c binutils-2.35/gas/config/tc-pj.c +--- binutils.orig/gas/config/tc-pj.c 2021-08-11 17:33:12.210490363 +0100 ++++ binutils-2.35/gas/config/tc-pj.c 2021-08-11 17:39:31.412057507 +0100 +@@ -31,7 +31,7 @@ const char line_separator_chars[] = ";"; + const char line_comment_chars[] = "/!#"; + + static int pending_reloc; +-static struct hash_control *opcode_hash_control; ++static htab_t opcode_hash_control; + + static void + little (int ignore ATTRIBUTE_UNUSED) +@@ -176,7 +176,7 @@ fake_opcode (const char *name, + fake->opcode = -1; + fake->opcode_next = -1; + fake->u.func = func; +- hash_insert (opcode_hash_control, name, (char *) fake); ++ str_hash_insert (opcode_hash_control, name, (char *) fake); + } + + /* Enter another entry into the opcode hash table so the same opcode +@@ -185,8 +185,8 @@ fake_opcode (const char *name, + static void + alias (const char *new_name, const char *old) + { +- hash_insert (opcode_hash_control, new_name, +- (char *) hash_find (opcode_hash_control, old)); ++ str_hash_insert (opcode_hash_control, new_name, ++ (char *) str_hash_find (opcode_hash_control, old)); + } + + /* This function is called once, at assembler startup time. It sets +@@ -197,11 +197,11 @@ void + md_begin (void) + { + const pj_opc_info_t *opcode; +- opcode_hash_control = hash_new (); ++ opcode_hash_control = str_htab_create (); + + /* Insert names into hash table. */ + for (opcode = pj_opc_info; opcode->u.name; opcode++) +- hash_insert (opcode_hash_control, opcode->u.name, (char *) opcode); ++ str_hash_insert (opcode_hash_control, opcode->u.name, (char *) opcode); + + /* Insert the only fake opcode. */ + fake_opcode ("ipush", ipush_code); +@@ -252,7 +252,7 @@ md_assemble (char *str) + if (nlen == 0) + as_bad (_("can't find opcode ")); + +- opcode = (pj_opc_info_t *) hash_find (opcode_hash_control, op_start); ++ opcode = (pj_opc_info_t *) str_hash_find (opcode_hash_control, op_start); + *op_end = pend; + + if (opcode == NULL) +diff -rup binutils.orig/gas/config/tc-ppc.c binutils-2.35/gas/config/tc-ppc.c +--- binutils.orig/gas/config/tc-ppc.c 2021-08-11 17:33:12.209490370 +0100 ++++ binutils-2.35/gas/config/tc-ppc.c 2021-08-11 17:39:31.413057500 +0100 +@@ -1004,10 +1004,10 @@ ppc_optimize_expr (expressionS *left, op + static unsigned int ppc_obj64 = BFD_DEFAULT_TARGET_SIZE == 64; + + /* Opcode hash table. */ +-static struct hash_control *ppc_hash; ++static htab_t ppc_hash; + + /* Macro hash table. */ +-static struct hash_control *ppc_macro_hash; ++static htab_t ppc_macro_hash; + + #ifdef OBJ_ELF + /* What type of shared library support to use. */ +@@ -1656,12 +1656,12 @@ ppc_setup_opcodes (void) + bfd_boolean bad_insn = FALSE; + + if (ppc_hash != NULL) +- hash_die (ppc_hash); ++ htab_delete (ppc_hash); + if (ppc_macro_hash != NULL) +- hash_die (ppc_macro_hash); ++ htab_delete (ppc_macro_hash); + + /* Insert the opcodes into a hash table. */ +- ppc_hash = hash_new (); ++ ppc_hash = str_htab_create (); + + if (ENABLE_CHECKING) + { +@@ -1738,22 +1738,12 @@ ppc_setup_opcodes (void) + + if ((ppc_cpu & op->flags) != 0 + && !(ppc_cpu & op->deprecated)) +- { +- const char *retval; +- +- retval = hash_insert (ppc_hash, op->name, (void *) op); +- if (retval != NULL) +- { +- as_bad (_("duplicate instruction %s"), +- op->name); +- bad_insn = TRUE; +- } +- } ++ str_hash_insert (ppc_hash, op->name, (void *) op); + } + + if ((ppc_cpu & PPC_OPCODE_ANY) != 0) + for (op = powerpc_opcodes; op < op_end; op++) +- hash_insert (ppc_hash, op->name, (void *) op); ++ str_hash_insert (ppc_hash, op->name, (void *) op); + + op_end = prefix_opcodes + prefix_num_opcodes; + for (op = prefix_opcodes; op < op_end; op++) +@@ -1782,22 +1772,12 @@ ppc_setup_opcodes (void) + + if ((ppc_cpu & op->flags) != 0 + && !(ppc_cpu & op->deprecated)) +- { +- const char *retval; +- +- retval = hash_insert (ppc_hash, op->name, (void *) op); +- if (retval != NULL) +- { +- as_bad (_("duplicate instruction %s"), +- op->name); +- bad_insn = TRUE; +- } +- } ++ str_hash_insert (ppc_hash, op->name, (void *) op); + } + + if ((ppc_cpu & PPC_OPCODE_ANY) != 0) + for (op = prefix_opcodes; op < op_end; op++) +- hash_insert (ppc_hash, op->name, (void *) op); ++ str_hash_insert (ppc_hash, op->name, (void *) op); + + op_end = vle_opcodes + vle_num_opcodes; + for (op = vle_opcodes; op < op_end; op++) +@@ -1827,17 +1807,7 @@ ppc_setup_opcodes (void) + + if ((ppc_cpu & op->flags) != 0 + && !(ppc_cpu & op->deprecated)) +- { +- const char *retval; +- +- retval = hash_insert (ppc_hash, op->name, (void *) op); +- if (retval != NULL) +- { +- as_bad (_("duplicate instruction %s"), +- op->name); +- bad_insn = TRUE; +- } +- } ++ str_hash_insert (ppc_hash, op->name, (void *) op); + } + + /* SPE2 instructions */ +@@ -1871,40 +1841,21 @@ ppc_setup_opcodes (void) + } + + if ((ppc_cpu & op->flags) != 0 && !(ppc_cpu & op->deprecated)) +- { +- const char *retval; +- +- retval = hash_insert (ppc_hash, op->name, (void *) op); +- if (retval != NULL) +- { +- as_bad (_("duplicate instruction %s"), +- op->name); +- bad_insn = TRUE; +- } +- } ++ str_hash_insert (ppc_hash, op->name, (void *) op); + } + + for (op = spe2_opcodes; op < op_end; op++) +- hash_insert (ppc_hash, op->name, (void *) op); ++ str_hash_insert (ppc_hash, op->name, (void *) op); + } + + /* Insert the macros into a hash table. */ +- ppc_macro_hash = hash_new (); ++ ppc_macro_hash = str_htab_create (); + + macro_end = powerpc_macros + powerpc_num_macros; + for (macro = powerpc_macros; macro < macro_end; macro++) + { + if ((macro->flags & ppc_cpu) != 0 || (ppc_cpu & PPC_OPCODE_ANY) != 0) +- { +- const char *retval; +- +- retval = hash_insert (ppc_macro_hash, macro->name, (void *) macro); +- if (retval != (const char *) NULL) +- { +- as_bad (_("duplicate macro %s"), macro->name); +- bad_insn = TRUE; +- } +- } ++ str_hash_insert (ppc_macro_hash, macro->name, (void *) macro); + } + + if (bad_insn) +@@ -3319,12 +3270,12 @@ md_assemble (char *str) + *s++ = '\0'; + + /* Look up the opcode in the hash table. */ +- opcode = (const struct powerpc_opcode *) hash_find (ppc_hash, str); ++ opcode = (const struct powerpc_opcode *) str_hash_find (ppc_hash, str); + if (opcode == (const struct powerpc_opcode *) NULL) + { + const struct powerpc_macro *macro; + +- macro = (const struct powerpc_macro *) hash_find (ppc_macro_hash, str); ++ macro = (const struct powerpc_macro *) str_hash_find (ppc_macro_hash, str); + if (macro == (const struct powerpc_macro *) NULL) + as_bad (_("unrecognized opcode: `%s'"), str); + else +Only in binutils-2.35/gas/config: tc-ppc.c.orig +diff -rup binutils.orig/gas/config/tc-pru.c binutils-2.35/gas/config/tc-pru.c +--- binutils.orig/gas/config/tc-pru.c 2021-08-11 17:33:12.210490363 +0100 ++++ binutils-2.35/gas/config/tc-pru.c 2021-08-11 17:39:31.413057500 +0100 +@@ -132,14 +132,14 @@ typedef struct pru_insn_info + } pru_insn_infoS; + + /* Opcode hash table. */ +-static struct hash_control *pru_opcode_hash = NULL; ++static htab_t pru_opcode_hash = NULL; + #define pru_opcode_lookup(NAME) \ +- ((struct pru_opcode *) hash_find (pru_opcode_hash, (NAME))) ++ ((struct pru_opcode *) str_hash_find (pru_opcode_hash, (NAME))) + + /* Register hash table. */ +-static struct hash_control *pru_reg_hash = NULL; ++static htab_t pru_reg_hash = NULL; + #define pru_reg_lookup(NAME) \ +- ((struct pru_reg *) hash_find (pru_reg_hash, (NAME))) ++ ((struct pru_reg *) str_hash_find (pru_reg_hash, (NAME))) + + /* The known current alignment of the current section. */ + static int pru_current_align; +@@ -1557,41 +1557,19 @@ void + md_begin (void) + { + int i; +- const char *inserted; + + /* Create and fill a hashtable for the PRU opcodes, registers and + arguments. */ +- pru_opcode_hash = hash_new (); +- pru_reg_hash = hash_new (); ++ pru_opcode_hash = str_htab_create (); ++ pru_reg_hash = str_htab_create (); + + for (i = 0; i < NUMOPCODES; ++i) +- { +- inserted +- = hash_insert (pru_opcode_hash, pru_opcodes[i].name, +- (PTR) & pru_opcodes[i]); +- if (inserted != NULL) +- { +- fprintf (stderr, _("internal error: can't hash `%s': %s\n"), +- pru_opcodes[i].name, inserted); +- /* Probably a memory allocation problem? Give up now. */ +- as_fatal (_("Broken assembler. No assembly attempted.")); +- } +- } ++ str_hash_insert (pru_opcode_hash, pru_opcodes[i].name, ++ (PTR) & pru_opcodes[i]); + + for (i = 0; i < pru_num_regs; ++i) +- { +- inserted +- = hash_insert (pru_reg_hash, pru_regs[i].name, +- (PTR) & pru_regs[i]); +- if (inserted != NULL) +- { +- fprintf (stderr, _("internal error: can't hash `%s': %s\n"), +- pru_regs[i].name, inserted); +- /* Probably a memory allocation problem? Give up now. */ +- as_fatal (_("Broken assembler. No assembly attempted.")); +- } +- +- } ++ str_hash_insert (pru_reg_hash, pru_regs[i].name, ++ (PTR) & pru_regs[i]); + + linkrelax = pru_opt.link_relax; + /* Initialize the alignment data. */ +@@ -1811,8 +1789,8 @@ md_pcrel_from (fixS *fixP ATTRIBUTE_UNUS + void + md_end (void) + { +- hash_die (pru_opcode_hash); +- hash_die (pru_reg_hash); ++ htab_delete (pru_opcode_hash); ++ htab_delete (pru_reg_hash); + } + + symbolS * +diff -rup binutils.orig/gas/config/tc-riscv.c binutils-2.35/gas/config/tc-riscv.c +--- binutils.orig/gas/config/tc-riscv.c 2021-08-11 17:33:12.214490337 +0100 ++++ binutils-2.35/gas/config/tc-riscv.c 2021-08-11 17:39:31.413057500 +0100 +@@ -242,28 +242,18 @@ riscv_multi_subset_supports (enum riscv_ + } + + /* Handle of the extension with version hash table. */ +-static struct hash_control *ext_version_hash = NULL; ++static htab_t ext_version_hash = NULL; + +-static struct hash_control * ++static htab_t + init_ext_version_hash (const struct riscv_ext_version *table) + { + int i = 0; +- struct hash_control *hash = hash_new (); ++ htab_t hash = str_htab_create (); + + while (table[i].name) + { + const char *name = table[i].name; +- const char *hash_error = +- hash_insert (hash, name, (void *) &table[i]); +- +- if (hash_error != NULL) +- { +- fprintf (stderr, _("internal error: can't hash `%s': %s\n"), +- table[i].name, hash_error); +- /* Probably a memory allocation problem? Give up now. */ +- as_fatal (_("Broken assembler. No assembly attempted.")); +- return NULL; +- } ++ str_hash_insert (hash, name, (void *) &table[i]); + + i++; + while (table[i].name +@@ -287,7 +277,7 @@ riscv_get_default_ext_version (const cha + if (name == NULL || default_isa_spec == ISA_SPEC_CLASS_NONE) + return; + +- ext = (struct riscv_ext_version *) hash_find (ext_version_hash, name); ++ ext = (struct riscv_ext_version *) str_hash_find (ext_version_hash, name); + while (ext + && ext->name + && strcmp (ext->name, name) == 0) +@@ -321,10 +311,10 @@ riscv_set_arch (const char *s) + } + + /* Handle of the OPCODE hash table. */ +-static struct hash_control *op_hash = NULL; ++static htab_t op_hash = NULL; + + /* Handle of the type of .insn hash table. */ +-static struct hash_control *insn_type_hash = NULL; ++static htab_t insn_type_hash = NULL; + + /* This array holds the chars that always start a comment. If the + pre-processor is disabled, these aren't very useful */ +@@ -559,23 +549,16 @@ static const struct opcode_name_t opcode + }; + + /* Hash table for lookup opcode name. */ +-static struct hash_control *opcode_names_hash = NULL; ++static htab_t opcode_names_hash = NULL; + + /* Initialization for hash table of opcode name. */ + static void + init_opcode_names_hash (void) + { +- const char *retval; + const struct opcode_name_t *opcode; + + for (opcode = &opcode_name_list[0]; opcode->name != NULL; ++opcode) +- { +- retval = hash_insert (opcode_names_hash, opcode->name, (void *)opcode); +- +- if (retval != NULL) +- as_fatal (_("internal error: can't hash `%s': %s"), +- opcode->name, retval); +- } ++ str_hash_insert (opcode_names_hash, opcode->name, (void *)opcode); + } + + /* Find `s` is a valid opcode name or not, +@@ -598,7 +581,7 @@ opcode_name_lookup (char **s) + save_c = *e; + *e = '\0'; + +- o = (struct opcode_name_t *) hash_find (opcode_names_hash, *s); ++ o = (struct opcode_name_t *) str_hash_find (opcode_names_hash, *s); + + /* Advance to next token if one was recognized. */ + if (o) +@@ -619,8 +602,8 @@ enum reg_class + RCLASS_CSR + }; + +-static struct hash_control *reg_names_hash = NULL; +-static struct hash_control *csr_extra_hash = NULL; ++static htab_t reg_names_hash = NULL; ++static htab_t csr_extra_hash = NULL; + + #define ENCODE_REG_HASH(cls, n) \ + ((void *)(uintptr_t)((n) * RCLASS_MAX + (cls) + 1)) +@@ -631,10 +614,7 @@ static void + hash_reg_name (enum reg_class class, const char *name, unsigned n) + { + void *hash = ENCODE_REG_HASH (class, n); +- const char *retval = hash_insert (reg_names_hash, name, hash); +- +- if (retval != NULL) +- as_fatal (_("internal error: can't hash `%s': %s"), name, retval); ++ str_hash_insert (reg_names_hash, name, hash); + } + + static void +@@ -655,11 +635,10 @@ riscv_init_csr_hash (const char *name, + enum riscv_priv_spec_class abort_version) + { + struct riscv_csr_extra *entry, *pre_entry; +- const char *hash_error = NULL; + bfd_boolean need_enrty = TRUE; + + pre_entry = NULL; +- entry = (struct riscv_csr_extra *) hash_find (csr_extra_hash, name); ++ entry = (struct riscv_csr_extra *) str_hash_find (csr_extra_hash, name); + while (need_enrty && entry != NULL) + { + if (entry->csr_class == class +@@ -686,16 +665,7 @@ riscv_init_csr_hash (const char *name, + Otherwise, attach the extra information to the entry which is already + in the hash table. */ + if (pre_entry == NULL) +- { +- hash_error = hash_insert (csr_extra_hash, name, (void *) entry); +- if (hash_error != NULL) +- { +- fprintf (stderr, _("internal error: can't hash `%s': %s\n"), +- name, hash_error); +- /* Probably a memory allocation problem? Give up now. */ +- as_fatal (_("Broken assembler. No assembly attempted.")); +- } +- } ++ str_hash_insert (csr_extra_hash, name, (void *) entry); + else + pre_entry->next = entry; + } +@@ -772,7 +742,7 @@ static unsigned int + reg_csr_lookup_internal (const char *s) + { + struct riscv_csr_extra *r = +- (struct riscv_csr_extra *) hash_find (csr_extra_hash, s); ++ (struct riscv_csr_extra *) str_hash_find (csr_extra_hash, s); + + if (r == NULL) + return -1U; +@@ -794,7 +764,7 @@ reg_lookup_internal (const char *s, enum + if (class == RCLASS_CSR) + return reg_csr_lookup_internal (s); + +- r = hash_find (reg_names_hash, s); ++ r = str_hash_find (reg_names_hash, s); + if (r == NULL || DECODE_REG_CLASS (r) != class) + return -1; + +@@ -1018,26 +988,17 @@ struct percent_op_match + + /* Common hash table initialization function for + instruction and .insn directive. */ +-static struct hash_control * ++static htab_t + init_opcode_hash (const struct riscv_opcode *opcodes, + bfd_boolean insn_directive_p) + { + int i = 0; + int length; +- struct hash_control *hash = hash_new (); ++ htab_t hash = str_htab_create (); + while (opcodes[i].name) + { + const char *name = opcodes[i].name; +- const char *hash_error = +- hash_insert (hash, name, (void *) &opcodes[i]); +- +- if (hash_error != NULL) +- { +- fprintf (stderr, _("internal error: can't hash `%s': %s\n"), +- opcodes[i].name, hash_error); +- /* Probably a memory allocation problem? Give up now. */ +- as_fatal (_("Broken assembler. No assembly attempted.")); +- } ++ str_hash_insert (hash, name, (void *) &opcodes[i]); + + do + { +@@ -1074,7 +1035,7 @@ md_begin (void) + op_hash = init_opcode_hash (riscv_opcodes, FALSE); + insn_type_hash = init_opcode_hash (riscv_insn_types, TRUE); + +- reg_names_hash = hash_new (); ++ reg_names_hash = str_htab_create (); + hash_reg_names (RCLASS_GPR, riscv_gpr_names_numeric, NGPR); + hash_reg_names (RCLASS_GPR, riscv_gpr_names_abi, NGPR); + hash_reg_names (RCLASS_FPR, riscv_fpr_names_numeric, NFPR); +@@ -1083,7 +1044,7 @@ md_begin (void) + hash_reg_name (RCLASS_GPR, "fp", 8); + + /* Create and insert CSR hash tables. */ +- csr_extra_hash = hash_new (); ++ csr_extra_hash = str_htab_create (); + #define DECLARE_CSR(name, num, class, define_version, abort_version) \ + riscv_init_csr_hash (#name, num, class, define_version, abort_version); + #define DECLARE_CSR_ALIAS(name, num, class, define_version, abort_version) \ +@@ -1091,7 +1052,7 @@ md_begin (void) + #include "opcode/riscv-opc.h" + #undef DECLARE_CSR + +- opcode_names_hash = hash_new (); ++ opcode_names_hash = str_htab_create (); + init_opcode_names_hash (); + + /* Set the default alignment for the text section. */ +@@ -1196,7 +1157,7 @@ macro_build (expressionS *ep, const char + va_start (args, fmt); + + r = BFD_RELOC_UNUSED; +- mo = (struct riscv_opcode *) hash_find (op_hash, name); ++ mo = (struct riscv_opcode *) str_hash_find (op_hash, name); + gas_assert (mo); + + /* Find a non-RVC variant of the instruction. append_insn will compress +@@ -1796,7 +1757,7 @@ riscv_is_priv_insn (insn_t insn) + + static const char * + riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr, +- bfd_reloc_code_real_type *imm_reloc, struct hash_control *hash) ++ bfd_reloc_code_real_type *imm_reloc, htab_t hash) + { + char *s; + const char *args; +@@ -1812,7 +1773,7 @@ riscv_ip (char *str, struct riscv_cl_ins + bfd_boolean insn_with_csr = FALSE; + + /* Parse the name of the instruction. Terminate the string if whitespace +- is found so that hash_find only sees the name part of the string. */ ++ is found so that str_hash_find only sees the name part of the string. */ + for (s = str; *s != '\0'; ++s) + if (ISSPACE (*s)) + { +@@ -1821,7 +1782,7 @@ riscv_ip (char *str, struct riscv_cl_ins + break; + } + +- insn = (struct riscv_opcode *) hash_find (hash, str); ++ insn = (struct riscv_opcode *) str_hash_find (hash, str); + + argsStart = s; + for ( ; insn && insn->name && strcmp (insn->name, str) == 0; insn++) +diff -rup binutils.orig/gas/config/tc-s390.c binutils-2.35/gas/config/tc-s390.c +--- binutils.orig/gas/config/tc-s390.c 2021-08-11 17:33:12.209490370 +0100 ++++ binutils-2.35/gas/config/tc-s390.c 2021-08-11 17:39:31.413057500 +0100 +@@ -197,10 +197,10 @@ register_name (expressionS *expressionP) + /* Local variables. */ + + /* Opformat hash table. */ +-static struct hash_control *s390_opformat_hash; ++static htab_t s390_opformat_hash; + + /* Opcode hash table. */ +-static struct hash_control *s390_opcode_hash = NULL; ++static htab_t s390_opcode_hash = NULL; + + /* Flags to set in the elf header */ + static flagword s390_flags = 0; +@@ -494,13 +494,12 @@ s390_setup_opcodes (void) + const struct s390_opcode *op; + const struct s390_opcode *op_end; + bfd_boolean dup_insn = FALSE; +- const char *retval; + + if (s390_opcode_hash != NULL) +- hash_die (s390_opcode_hash); ++ htab_delete (s390_opcode_hash); + + /* Insert the opcodes into a hash table. */ +- s390_opcode_hash = hash_new (); ++ s390_opcode_hash = str_htab_create (); + + op_end = s390_opcodes + s390_num_opcodes; + for (op = s390_opcodes; op < op_end; op++) +@@ -532,15 +531,7 @@ s390_setup_opcodes (void) + use_opcode = ((f & current_flags) == f); + } + if (use_opcode) +- { +- retval = hash_insert (s390_opcode_hash, op->name, (void *) op); +- if (retval != (const char *) NULL) +- { +- as_bad (_("Internal assembler error for instruction %s"), +- op->name); +- dup_insn = TRUE; +- } +- } ++ str_hash_insert (s390_opcode_hash, op->name, (void *) op); + + while (op < op_end - 1 && strcmp (op->name, op[1].name) == 0) + op++; +@@ -559,7 +550,6 @@ md_begin (void) + { + const struct s390_opcode *op; + const struct s390_opcode *op_end; +- const char *retval; + + /* Give a warning if the combination -m64-bit and -Aesa is used. */ + if (s390_arch_size == 64 && current_cpu < S390_OPCODE_Z900) +@@ -572,16 +562,11 @@ md_begin (void) + bfd_set_private_flags (stdoutput, s390_flags); + + /* Insert the opcode formats into a hash table. */ +- s390_opformat_hash = hash_new (); ++ s390_opformat_hash = str_htab_create (); + + op_end = s390_opformats + s390_num_opformats; + for (op = s390_opformats; op < op_end; op++) +- { +- retval = hash_insert (s390_opformat_hash, op->name, (void *) op); +- if (retval != (const char *) NULL) +- as_bad (_("Internal assembler error for instruction format %s"), +- op->name); +- } ++ str_hash_insert (s390_opformat_hash, op->name, (void *) op); + + s390_setup_opcodes (); + +@@ -1693,7 +1678,7 @@ md_assemble (char *str) + *s++ = '\0'; + + /* Look up the opcode in the hash table. */ +- opcode = (struct s390_opcode *) hash_find (s390_opcode_hash, str); ++ opcode = (struct s390_opcode *) str_hash_find (s390_opcode_hash, str); + if (opcode == (const struct s390_opcode *) NULL) + { + as_bad (_("Unrecognized opcode: `%s'"), str); +@@ -1761,7 +1746,7 @@ s390_insn (int ignore ATTRIBUTE_UNUSED) + + /* Look up the opcode in the hash table. */ + opformat = (struct s390_opcode *) +- hash_find (s390_opformat_hash, input_line_pointer); ++ str_hash_find (s390_opformat_hash, input_line_pointer); + if (opformat == (const struct s390_opcode *) NULL) + { + as_bad (_("Unrecognized opcode format: `%s'"), input_line_pointer); +diff -rup binutils.orig/gas/config/tc-score.c binutils-2.35/gas/config/tc-score.c +--- binutils.orig/gas/config/tc-score.c 2021-08-11 17:33:12.210490363 +0100 ++++ binutils-2.35/gas/config/tc-score.c 2021-08-11 17:39:31.414057494 +0100 +@@ -459,7 +459,7 @@ struct s3_reg_map + { + const struct s3_reg_entry *names; + int max_regno; +- struct hash_control *htab; ++ htab_t htab; + const char *expected; + }; + +@@ -470,8 +470,8 @@ static struct s3_reg_map s3_all_reg_maps + {s3_score_crn_table, 31, NULL, N_("S+core co-processor register expected")}, + }; + +-static struct hash_control *s3_score_ops_hsh = NULL; +-static struct hash_control *s3_dependency_insn_hsh = NULL; ++static htab_t s3_score_ops_hsh = NULL; ++static htab_t s3_dependency_insn_hsh = NULL; + + + struct s3_datafield_range +@@ -1027,7 +1027,7 @@ s3_end_of_line (char *str) + } + + static int +-s3_score_reg_parse (char **ccp, struct hash_control *htab) ++s3_score_reg_parse (char **ccp, htab_t htab) + { + char *start = *ccp; + char c; +@@ -1044,7 +1044,7 @@ s3_score_reg_parse (char **ccp, struct h + c = *p++; + + *--p = 0; +- reg = (struct s3_reg_entry *) hash_find (htab, start); ++ reg = (struct s3_reg_entry *) str_hash_find (htab, start); + *p = c; + + if (reg) +@@ -2203,7 +2203,7 @@ s3_dependency_type_from_insn (char *insn + const struct s3_insn_to_dependency *tmp; + + strcpy (name, insn_name); +- tmp = (const struct s3_insn_to_dependency *) hash_find (s3_dependency_insn_hsh, name); ++ tmp = (const struct s3_insn_to_dependency *) str_hash_find (s3_dependency_insn_hsh, name); + + if (tmp) + return tmp->type; +@@ -2662,7 +2662,7 @@ s3_parse_16_32_inst (char *insnstr, bfd_ + c = *p; + *p = '\0'; + +- opcode = (const struct s3_asm_opcode *) hash_find (s3_score_ops_hsh, operator); ++ opcode = (const struct s3_asm_opcode *) str_hash_find (s3_score_ops_hsh, operator); + *p = c; + + memset (&s3_inst, '\0', sizeof (s3_inst)); +@@ -2708,7 +2708,7 @@ s3_parse_48_inst (char *insnstr, bfd_boo + c = *p; + *p = '\0'; + +- opcode = (const struct s3_asm_opcode *) hash_find (s3_score_ops_hsh, operator); ++ opcode = (const struct s3_asm_opcode *) str_hash_find (s3_score_ops_hsh, operator); + *p = c; + + memset (&s3_inst, '\0', sizeof (s3_inst)); +@@ -6251,7 +6251,7 @@ s3_s_score_lcomm (int bytes_p) + } + + static void +-s3_insert_reg (const struct s3_reg_entry *r, struct hash_control *htab) ++s3_insert_reg (const struct s3_reg_entry *r, htab_t htab) + { + int i = 0; + int len = strlen (r->name) + 2; +@@ -6265,8 +6265,8 @@ s3_insert_reg (const struct s3_reg_entry + } + buf2[i] = '\0'; + +- hash_insert (htab, buf, (void *) r); +- hash_insert (htab, buf2, (void *) r); ++ str_hash_insert (htab, buf, (void *) r); ++ str_hash_insert (htab, buf2, (void *) r); + } + + static void +@@ -6274,7 +6274,7 @@ s3_build_reg_hsh (struct s3_reg_map *map + { + const struct s3_reg_entry *r; + +- if ((map->htab = hash_new ()) == NULL) ++ if ((map->htab = str_htab_create ()) == NULL) + { + as_fatal (_("virtual memory exhausted")); + } +@@ -6309,7 +6309,7 @@ s3_build_score_ops_hsh (void) + new_opcode->relax_value = insn->relax_value; + new_opcode->type = insn->type; + new_opcode->bitmask = insn->bitmask; +- hash_insert (s3_score_ops_hsh, new_opcode->template_name, ++ str_hash_insert (s3_score_ops_hsh, new_opcode->template_name, + (void *) new_opcode); + } + } +@@ -6336,7 +6336,7 @@ s3_build_dependency_insn_hsh (void) + strcpy (buf, tmp->insn_name); + new_i2n->insn_name = buf; + new_i2n->type = tmp->type; +- hash_insert (s3_dependency_insn_hsh, new_i2n->insn_name, ++ str_hash_insert (s3_dependency_insn_hsh, new_i2n->insn_name, + (void *) new_i2n); + } + } +@@ -6505,12 +6505,12 @@ s3_begin (void) + segT seg; + subsegT subseg; + +- if ((s3_score_ops_hsh = hash_new ()) == NULL) ++ if ((s3_score_ops_hsh = str_htab_create ()) == NULL) + as_fatal (_("virtual memory exhausted")); + + s3_build_score_ops_hsh (); + +- if ((s3_dependency_insn_hsh = hash_new ()) == NULL) ++ if ((s3_dependency_insn_hsh = str_htab_create ()) == NULL) + as_fatal (_("virtual memory exhausted")); + + s3_build_dependency_insn_hsh (); +diff -rup binutils.orig/gas/config/tc-score7.c binutils-2.35/gas/config/tc-score7.c +--- binutils.orig/gas/config/tc-score7.c 2021-08-11 17:33:12.208490376 +0100 ++++ binutils-2.35/gas/config/tc-score7.c 2021-08-11 17:39:31.414057494 +0100 +@@ -520,7 +520,7 @@ struct s7_reg_map + { + const struct s7_reg_entry *names; + int max_regno; +- struct hash_control *htab; ++ htab_t htab; + const char *expected; + }; + +@@ -531,8 +531,8 @@ static struct s7_reg_map s7_all_reg_maps + {s7_score_crn_table, 31, NULL, N_("S+core co-processor register expected")}, + }; + +-static struct hash_control *s7_score_ops_hsh = NULL; +-static struct hash_control *s7_dependency_insn_hsh = NULL; ++static htab_t s7_score_ops_hsh = NULL; ++static htab_t s7_dependency_insn_hsh = NULL; + + + struct s7_datafield_range +@@ -1112,7 +1112,7 @@ s7_end_of_line (char *str) + } + + static int +-s7_score_reg_parse (char **ccp, struct hash_control *htab) ++s7_score_reg_parse (char **ccp, htab_t htab) + { + char *start = *ccp; + char c; +@@ -1129,7 +1129,7 @@ s7_score_reg_parse (char **ccp, struct h + c = *p++; + + *--p = 0; +- reg = (struct s7_reg_entry *) hash_find (htab, start); ++ reg = (struct s7_reg_entry *) str_hash_find (htab, start); + *p = c; + + if (reg) +@@ -2321,7 +2321,7 @@ s7_dependency_type_from_insn (char *insn + const struct s7_insn_to_dependency *tmp; + + strcpy (name, insn_name); +- tmp = (const struct s7_insn_to_dependency *) hash_find (s7_dependency_insn_hsh, name); ++ tmp = (const struct s7_insn_to_dependency *) str_hash_find (s7_dependency_insn_hsh, name); + + if (tmp) + return tmp->type; +@@ -2789,7 +2789,7 @@ s7_parse_16_32_inst (char *insnstr, bfd_ + c = *p; + *p = '\0'; + +- opcode = (const struct s7_asm_opcode *) hash_find (s7_score_ops_hsh, operator); ++ opcode = (const struct s7_asm_opcode *) str_hash_find (s7_score_ops_hsh, operator); + *p = c; + + memset (&s7_inst, '\0', sizeof (s7_inst)); +@@ -5103,7 +5103,7 @@ s7_build_score_ops_hsh (void) + new_opcode->relax_value = insn->relax_value; + new_opcode->type = insn->type; + new_opcode->bitmask = insn->bitmask; +- hash_insert (s7_score_ops_hsh, new_opcode->template_name, ++ str_hash_insert (s7_score_ops_hsh, new_opcode->template_name, + (void *) new_opcode); + } + } +@@ -5130,7 +5130,7 @@ s7_build_dependency_insn_hsh (void) + strcpy (insn_name, tmp->insn_name); + new_i2d->insn_name = insn_name; + new_i2d->type = tmp->type; +- hash_insert (s7_dependency_insn_hsh, new_i2d->insn_name, ++ str_hash_insert (s7_dependency_insn_hsh, new_i2d->insn_name, + (void *) new_i2d); + } + } +@@ -5345,7 +5345,7 @@ s7_parse_pce_inst (char *insnstr) + + + static void +-s7_insert_reg (const struct s7_reg_entry *r, struct hash_control *htab) ++s7_insert_reg (const struct s7_reg_entry *r, htab_t htab) + { + int i = 0; + int len = strlen (r->name) + 2; +@@ -5359,8 +5359,8 @@ s7_insert_reg (const struct s7_reg_entry + } + buf2[i] = '\0'; + +- hash_insert (htab, buf, (void *) r); +- hash_insert (htab, buf2, (void *) r); ++ str_hash_insert (htab, buf, (void *) r); ++ str_hash_insert (htab, buf2, (void *) r); + } + + static void +@@ -5368,7 +5368,7 @@ s7_build_reg_hsh (struct s7_reg_map *map + { + const struct s7_reg_entry *r; + +- if ((map->htab = hash_new ()) == NULL) ++ if ((map->htab = str_htab_create ()) == NULL) + { + as_fatal (_("virtual memory exhausted")); + } +@@ -6115,12 +6115,12 @@ s7_begin (void) + segT seg; + subsegT subseg; + +- if ((s7_score_ops_hsh = hash_new ()) == NULL) ++ if ((s7_score_ops_hsh = str_htab_create ()) == NULL) + as_fatal (_("virtual memory exhausted")); + + s7_build_score_ops_hsh (); + +- if ((s7_dependency_insn_hsh = hash_new ()) == NULL) ++ if ((s7_dependency_insn_hsh = str_htab_create ()) == NULL) + as_fatal (_("virtual memory exhausted")); + + s7_build_dependency_insn_hsh (); +diff -rup binutils.orig/gas/config/tc-sh.c binutils-2.35/gas/config/tc-sh.c +--- binutils.orig/gas/config/tc-sh.c 2021-08-11 17:33:12.212490350 +0100 ++++ binutils-2.35/gas/config/tc-sh.c 2021-08-11 17:39:31.414057494 +0100 +@@ -240,7 +240,7 @@ const relax_typeS md_relax_table[C (END, + + #undef EMPTY + +-static struct hash_control *opcode_hash_control; /* Opcode mnemonics */ ++static htab_t opcode_hash_control; /* Opcode mnemonics */ + + + #ifdef OBJ_ELF +@@ -564,7 +564,7 @@ md_begin (void) + = preset_target_arch ? preset_target_arch : arch_sh_up & ~arch_sh_has_dsp; + valid_arch = target_arch; + +- opcode_hash_control = hash_new (); ++ opcode_hash_control = str_htab_create (); + + /* Insert unique names into hash table. */ + for (opcode = sh_table; opcode->name; opcode++) +@@ -574,7 +574,7 @@ md_begin (void) + if (!SH_MERGE_ARCH_SET_VALID (opcode->arch, target_arch)) + continue; + prev_name = opcode->name; +- hash_insert (opcode_hash_control, opcode->name, (char *) opcode); ++ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode); + } + } + } +@@ -2196,7 +2196,7 @@ find_cooked_opcode (char **str_p) + if (nlen == 0) + as_bad (_("can't find opcode ")); + +- return (sh_opcode_info *) hash_find (opcode_hash_control, name); ++ return (sh_opcode_info *) str_hash_find (opcode_hash_control, name); + } + + /* Assemble a parallel processing insn. */ +diff -rup binutils.orig/gas/config/tc-sparc.c binutils-2.35/gas/config/tc-sparc.c +--- binutils.orig/gas/config/tc-sparc.c 2021-08-11 17:33:12.209490370 +0100 ++++ binutils-2.35/gas/config/tc-sparc.c 2021-08-11 17:39:31.415057487 +0100 +@@ -126,7 +126,7 @@ int sparc_cie_data_alignment; + #endif + + /* Handle of the OPCODE hash table. */ +-static struct hash_control *op_hash; ++static htab_t op_hash; + + static void s_data1 (void); + static void s_seg (int); +@@ -941,7 +941,6 @@ cmp_perc_entry (const void *parg, const + void + md_begin (void) + { +- const char *retval = NULL; + int lose = 0; + unsigned int i = 0; + +@@ -952,18 +951,12 @@ md_begin (void) + init_default_arch (); + + sparc_cie_data_alignment = sparc_arch_size == 64 ? -8 : -4; +- op_hash = hash_new (); ++ op_hash = str_htab_create (); + + while (i < (unsigned int) sparc_num_opcodes) + { + const char *name = sparc_opcodes[i].name; +- retval = hash_insert (op_hash, name, (void *) &sparc_opcodes[i]); +- if (retval != NULL) +- { +- as_bad (_("Internal error: can't hash `%s': %s\n"), +- sparc_opcodes[i].name, retval); +- lose = 1; +- } ++ str_hash_insert (op_hash, name, (void *) &sparc_opcodes[i]); + do + { + if (sparc_opcodes[i].match & sparc_opcodes[i].lose) +@@ -984,7 +977,7 @@ md_begin (void) + const char *name = ((sparc_arch_size == 32) + ? native_op_table[i].name32 + : native_op_table[i].name64); +- insn = (struct sparc_opcode *) hash_find (op_hash, name); ++ insn = (struct sparc_opcode *) str_hash_find (op_hash, name); + if (insn == NULL) + { + as_bad (_("Internal error: can't find opcode `%s' for `%s'\n"), +@@ -992,16 +985,8 @@ md_begin (void) + lose = 1; + } + else +- { +- retval = hash_insert (op_hash, native_op_table[i].name, +- (void *) insn); +- if (retval != NULL) +- { +- as_bad (_("Internal error: can't hash `%s': %s\n"), +- sparc_opcodes[i].name, retval); +- lose = 1; +- } +- } ++ str_hash_insert (op_hash, native_op_table[i].name, ++ (void *) insn); + } + + if (lose) +@@ -1759,7 +1744,7 @@ sparc_ip (char *str, const struct sparc_ + *pinsn = NULL; + return special_case; + } +- insn = (struct sparc_opcode *) hash_find (op_hash, str); ++ insn = (struct sparc_opcode *) str_hash_find (op_hash, str); + *pinsn = insn; + if (insn == NULL) + { +diff -rup binutils.orig/gas/config/tc-spu.c binutils-2.35/gas/config/tc-spu.c +--- binutils.orig/gas/config/tc-spu.c 2021-08-11 17:33:12.210490363 +0100 ++++ binutils-2.35/gas/config/tc-spu.c 2021-08-11 17:39:31.415057487 +0100 +@@ -57,7 +57,7 @@ static void spu_brinfo (int); + static void spu_cons (int); + + extern char *myname; +-static struct hash_control *op_hash = NULL; ++static htab_t op_hash = NULL; + + /* These bits should be turned off in the first address of every segment */ + int md_seg_align = 7; +@@ -110,26 +110,19 @@ unsigned int brinfo; + void + md_begin (void) + { +- const char *retval = NULL; + int i; + + /* initialize hash table */ + +- op_hash = hash_new (); ++ op_hash = str_htab_create (); + + /* loop until you see the end of the list */ + + for (i = 0; i < spu_num_opcodes; i++) +- { +- /* hash each mnemonic and record its position */ +- +- retval = hash_insert (op_hash, spu_opcodes[i].mnemonic, +- (void *) &spu_opcodes[i]); +- +- if (retval != NULL && strcmp (retval, "exists") != 0) +- as_fatal (_("Can't hash instruction '%s':%s"), +- spu_opcodes[i].mnemonic, retval); +- } ++ /* hash each mnemonic and record its position */ ++ if (str_hash_find (op_hash, spu_opcodes[i].mnemonic) == NULL) ++ str_hash_insert (op_hash, spu_opcodes[i].mnemonic, ++ (void *) &spu_opcodes[i]); + } + + const char *md_shortopts = ""; +@@ -285,7 +278,7 @@ md_assemble (char *op) + + /* try to find the instruction in the hash table */ + +- if ((format = (struct spu_opcode *) hash_find (op_hash, op)) == NULL) ++ if ((format = (struct spu_opcode *) str_hash_find (op_hash, op)) == NULL) + { + as_bad (_("Invalid mnemonic '%s'"), op); + return; +diff -rup binutils.orig/gas/config/tc-tic30.c binutils-2.35/gas/config/tc-tic30.c +--- binutils.orig/gas/config/tc-tic30.c 2021-08-11 17:33:12.213490344 +0100 ++++ binutils-2.35/gas/config/tc-tic30.c 2021-08-11 17:39:31.415057487 +0100 +@@ -99,78 +99,56 @@ debug (const char *string, ...) + } + + /* Hash table for opcode lookup. */ +-static struct hash_control *op_hash; ++static htab_t op_hash; + /* Hash table for parallel opcode lookup. */ +-static struct hash_control *parop_hash; ++static htab_t parop_hash; + /* Hash table for register lookup. */ +-static struct hash_control *reg_hash; ++static htab_t reg_hash; + /* Hash table for indirect addressing lookup. */ +-static struct hash_control *ind_hash; ++static htab_t ind_hash; + + void + md_begin (void) + { +- const char *hash_err; +- + debug ("In md_begin()\n"); +- op_hash = hash_new (); ++ op_hash = str_htab_create (); + + { + const insn_template *current_optab = tic30_optab; + + for (; current_optab < tic30_optab_end; current_optab++) +- { +- hash_err = hash_insert (op_hash, current_optab->name, +- (char *) current_optab); +- if (hash_err) +- as_fatal ("Internal Error: Can't Hash %s: %s", +- current_optab->name, hash_err); +- } ++ str_hash_insert (op_hash, current_optab->name, ++ (char *) current_optab); + } + +- parop_hash = hash_new (); ++ parop_hash = str_htab_create (); + + { + const partemplate *current_parop = tic30_paroptab; + + for (; current_parop < tic30_paroptab_end; current_parop++) +- { +- hash_err = hash_insert (parop_hash, current_parop->name, +- (char *) current_parop); +- if (hash_err) +- as_fatal ("Internal Error: Can't Hash %s: %s", +- current_parop->name, hash_err); +- } ++ str_hash_insert (parop_hash, current_parop->name, ++ (char *) current_parop); + } + +- reg_hash = hash_new (); ++ reg_hash = str_htab_create (); + + { + const reg *current_reg = tic30_regtab; + + for (; current_reg < tic30_regtab_end; current_reg++) +- { +- hash_err = hash_insert (reg_hash, current_reg->name, +- (char *) current_reg); +- if (hash_err) +- as_fatal ("Internal Error: Can't Hash %s: %s", +- current_reg->name, hash_err); +- } ++ str_hash_insert (reg_hash, current_reg->name, ++ (char *) current_reg); + } + +- ind_hash = hash_new (); ++ ind_hash = str_htab_create (); + + { + const ind_addr_type *current_ind = tic30_indaddr_tab; + + for (; current_ind < tic30_indaddrtab_end; current_ind++) +- { +- hash_err = hash_insert (ind_hash, current_ind->syntax, +- (char *) current_ind); +- if (hash_err) +- as_fatal ("Internal Error: Can't Hash %s: %s", +- current_ind->syntax, hash_err); +- } ++ str_hash_insert (ind_hash, current_ind->syntax, ++ (char *) current_ind); + } + + /* Fill in lexical tables: opcode_chars, operand_chars, space_chars. */ +@@ -476,7 +454,7 @@ tic30_operand (char *token) + && (*(token + count) == 'r' || *(token + count) == 'R')) + { + /* AR reference is found, so get its number and remove +- it from the buffer so it can pass through hash_find(). */ ++ it from the buffer so it can pass through str_hash_find(). */ + if (found_ar) + { + as_bad (_("More than one AR register found in indirect reference")); +@@ -538,7 +516,7 @@ tic30_operand (char *token) + return NULL; + } + +- ind_addr_op = (ind_addr_type *) hash_find (ind_hash, ind_buffer); ++ ind_addr_op = (ind_addr_type *) str_hash_find (ind_hash, ind_buffer); + if (ind_addr_op) + { + debug ("Found indirect reference: %s\n", ind_addr_op->syntax); +@@ -577,7 +555,7 @@ tic30_operand (char *token) + } + else + { +- reg *regop = (reg *) hash_find (reg_hash, token); ++ reg *regop = (reg *) str_hash_find (reg_hash, token); + + if (regop) + { +@@ -674,7 +652,7 @@ tic30_parallel_insn (char *token) + /* Find instruction. */ + save_char = *current_posn; + *current_posn = '\0'; +- p_opcode = (partemplate *) hash_find (parop_hash, token); ++ p_opcode = (partemplate *) str_hash_find (parop_hash, token); + if (p_opcode) + { + debug ("Found instruction %s\n", p_opcode->name); +@@ -719,7 +697,7 @@ tic30_parallel_insn (char *token) + debug ("first_opcode = %s\n", first_opcode); + debug ("second_opcode = %s\n", second_opcode); + sprintf (token, "q_%s_%s", second_opcode, first_opcode); +- p_opcode = (partemplate *) hash_find (parop_hash, token); ++ p_opcode = (partemplate *) str_hash_find (parop_hash, token); + + if (p_opcode) + { +@@ -1466,7 +1444,7 @@ md_assemble (char *line) + /* Find instruction. */ + save_char = *current_posn; + *current_posn = '\0'; +- op = (insn_template *) hash_find (op_hash, token_start); ++ op = (insn_template *) str_hash_find (op_hash, token_start); + if (op) + { + debug ("Found instruction %s\n", op->name); +diff -rup binutils.orig/gas/config/tc-tic4x.c binutils-2.35/gas/config/tc-tic4x.c +--- binutils.orig/gas/config/tc-tic4x.c 2021-08-11 17:33:12.210490363 +0100 ++++ binutils-2.35/gas/config/tc-tic4x.c 2021-08-11 17:39:31.415057487 +0100 +@@ -53,10 +53,10 @@ + #define TIC4X_ALT_SYNTAX + + /* Handle of the inst mnemonic hash table. */ +-static struct hash_control *tic4x_op_hash = NULL; ++static htab_t tic4x_op_hash = NULL; + + /* Handle asg pseudo. */ +-static struct hash_control *tic4x_asg_hash = NULL; ++static htab_t tic4x_asg_hash = NULL; + + static unsigned int tic4x_cpu = 0; /* Default to TMS320C40. */ + static unsigned int tic4x_revision = 0; /* CPU revision */ +@@ -727,10 +727,7 @@ tic4x_asg (int x ATTRIBUTE_UNUSED) + c = get_symbol_name (&name); /* Get terminator. */ + str = xstrdup (str); + name = xstrdup (name); +- if (hash_find (tic4x_asg_hash, name)) +- hash_replace (tic4x_asg_hash, name, (void *) str); +- else +- hash_insert (tic4x_asg_hash, name, (void *) str); ++ str_hash_insert (tic4x_asg_hash, name, str); + (void) restore_line_pointer (c); + demand_empty_rest_of_line (); + } +@@ -1209,23 +1206,17 @@ tic4x_init_symbols (void) + } + + /* Insert a new instruction template into hash table. */ +-static int ++static void + tic4x_inst_insert (const tic4x_inst_t *inst) + { + static char prev_name[16]; +- const char *retval = NULL; + + /* Only insert the first name if have several similar entries. */ + if (!strcmp (inst->name, prev_name) || inst->name[0] == '\0') +- return 1; ++ return; + +- retval = hash_insert (tic4x_op_hash, inst->name, (void *) inst); +- if (retval != NULL) +- fprintf (stderr, "internal error: can't hash `%s': %s\n", +- inst->name, retval); +- else +- strcpy (prev_name, inst->name); +- return retval == NULL; ++ str_hash_insert (tic4x_op_hash, inst->name, (void *) inst); ++ strcpy (prev_name, inst->name); + } + + /* Make a new instruction template. */ +@@ -1258,13 +1249,12 @@ tic4x_inst_make (const char *name, unsig + } + + /* Add instruction template, creating dynamic templates as required. */ +-static int ++static void + tic4x_inst_add (const tic4x_inst_t *insts) + { + const char *s = insts->name; + char *d; + unsigned int i; +- int ok = 1; + char name[16]; + + d = name; +@@ -1272,7 +1262,7 @@ tic4x_inst_add (const tic4x_inst_t *inst + /* We do not care about INSNs that is not a part of our + oplevel setting. */ + if ((insts->oplevel & tic4x_oplevel) == 0) +- return ok; ++ return; + + while (1) + { +@@ -1296,8 +1286,8 @@ tic4x_inst_add (const tic4x_inst_t *inst + *e = '\0'; + + /* If instruction found then have already processed it. */ +- if (hash_find (tic4x_op_hash, name)) +- return 1; ++ if (str_hash_find (tic4x_op_hash, name)) ++ return; + + do + { +@@ -1306,18 +1296,17 @@ tic4x_inst_add (const tic4x_inst_t *inst + (*s == 'B' ? 16 : 23)), + insts[k].args); + if (k == 0) /* Save strcmp() with following func. */ +- ok &= tic4x_inst_insert (inst); ++ tic4x_inst_insert (inst); + k++; + } + while (!strcmp (insts->name, + insts[k].name)); + } +- return ok; +- break; ++ return; + + case '\0': +- return tic4x_inst_insert (insts); +- break; ++ tic4x_inst_insert (insts); ++ return; + + default: + *d++ = *s++; +@@ -1332,7 +1321,6 @@ tic4x_inst_add (const tic4x_inst_t *inst + void + md_begin (void) + { +- int ok = 1; + unsigned int i; + + /* Setup the proper opcode level according to the +@@ -1364,21 +1352,18 @@ md_begin (void) + tic4x_oplevel |= OP_IDLE2; + + /* Create hash table for mnemonics. */ +- tic4x_op_hash = hash_new (); ++ tic4x_op_hash = str_htab_create (); + + /* Create hash table for asg pseudo. */ +- tic4x_asg_hash = hash_new (); ++ tic4x_asg_hash = str_htab_create (); + + /* Add mnemonics to hash table, expanding conditional mnemonics on fly. */ + for (i = 0; i < tic4x_num_insts; i++) +- ok &= tic4x_inst_add (tic4x_insts + i); ++ tic4x_inst_add (tic4x_insts + i); + + /* Create dummy inst to avoid errors accessing end of table. */ + tic4x_inst_make ("", 0, ""); + +- if (!ok) +- as_fatal ("Broken assembler. No assembly attempted."); +- + /* Add registers to symbol table. */ + tic4x_init_regtable (); + +@@ -1509,7 +1494,7 @@ tic4x_operand_parse (char *s, tic4x_oper + + c = get_symbol_name (&str); /* Get terminator. */ + new_pointer = input_line_pointer; +- if (strlen (str) && (entry = hash_find (tic4x_asg_hash, str)) != NULL) ++ if (strlen (str) && (entry = str_hash_find (tic4x_asg_hash, str)) != NULL) + { + (void) restore_line_pointer (c); + input_line_pointer = (char *) entry; +@@ -2444,7 +2429,7 @@ md_assemble (char *str) + /* Skip past instruction mnemonic. */ + while (*s && *s != ' ') + s++; +- if (*s) /* Null terminate for hash_find. */ ++ if (*s) /* Null terminate for str_hash_find. */ + *s++ = '\0'; /* and skip past null. */ + len = strlen (insn->name); + snprintf (insn->name + len, TIC4X_NAME_MAX - len, "_%s", str); +@@ -2465,7 +2450,7 @@ md_assemble (char *str) + if (insn->in_use) + { + if ((insn->inst = (struct tic4x_inst *) +- hash_find (tic4x_op_hash, insn->name)) == NULL) ++ str_hash_find (tic4x_op_hash, insn->name)) == NULL) + { + as_bad (_("Unknown opcode `%s'."), insn->name); + insn->parallel = 0; +@@ -2508,7 +2493,7 @@ md_assemble (char *str) + s = str; + while (*s && *s != ' ') /* Skip past instruction mnemonic. */ + s++; +- if (*s) /* Null terminate for hash_find. */ ++ if (*s) /* Null terminate for str_hash_find. */ + *s++ = '\0'; /* and skip past null. */ + strncpy (insn->name, str, TIC4X_NAME_MAX - 1); + insn->name[TIC4X_NAME_MAX - 1] = '\0'; +diff -rup binutils.orig/gas/config/tc-tic54x.c binutils-2.35/gas/config/tc-tic54x.c +--- binutils.orig/gas/config/tc-tic54x.c 2021-08-11 17:33:12.211490357 +0100 ++++ binutils-2.35/gas/config/tc-tic54x.c 2021-08-11 17:39:31.416057481 +0100 +@@ -181,12 +181,12 @@ static symbolS *last_label_seen = NULL; + /* This ensures that all new labels are unique. */ + static int local_label_id; + +-static struct hash_control *subsym_recurse_hash; /* Prevent infinite recurse. */ +-static struct hash_control *math_hash; /* Built-in math functions. */ ++static htab_t subsym_recurse_hash; /* Prevent infinite recurse. */ ++static htab_t math_hash; /* Built-in math functions. */ + /* Allow maximum levels of macro nesting; level 0 is the main substitution + symbol table. The other assembler only does 32 levels, so there! */ + #define MAX_SUBSYM_HASH 100 +-static struct hash_control *subsym_hash[MAX_SUBSYM_HASH]; ++static htab_t subsym_hash[MAX_SUBSYM_HASH]; + + /* Keep track of local labels so we can substitute them before GAS sees them + since macros use their own 'namespace' for local labels, use a separate hash +@@ -197,18 +197,18 @@ static struct hash_control *subsym_hash[ + We use our own macro nesting counter, since GAS overloads it when expanding + other things (like conditionals and repeat loops). */ + static int macro_level = 0; +-static struct hash_control *local_label_hash[100]; ++static htab_t local_label_hash[100]; + /* Keep track of struct/union tags. */ +-static struct hash_control *stag_hash; +-static struct hash_control *op_hash; +-static struct hash_control *parop_hash; +-static struct hash_control *reg_hash; +-static struct hash_control *mmreg_hash; +-static struct hash_control *cc_hash; +-static struct hash_control *cc2_hash; +-static struct hash_control *cc3_hash; +-static struct hash_control *sbit_hash; +-static struct hash_control *misc_symbol_hash; ++static htab_t stag_hash; ++static htab_t op_hash; ++static htab_t parop_hash; ++static htab_t reg_hash; ++static htab_t mmreg_hash; ++static htab_t cc_hash; ++static htab_t cc2_hash; ++static htab_t cc3_hash; ++static htab_t sbit_hash; ++static htab_t misc_symbol_hash; + + /* Only word (et al.), align, or conditionals are allowed within + .struct/.union. */ +@@ -569,7 +569,7 @@ stag_add_field_symbols (struct stag *sta + + replacement = concat (S_GET_NAME (rootsym), "+", root_stag_name, + name + strlen (S_GET_NAME (rootsym)), NULL); +- hash_insert (subsym_hash[0], name, replacement); ++ str_hash_insert (subsym_hash[0], name, replacement); + } + + /* Recurse if the field is a structure. +@@ -740,7 +740,7 @@ tic54x_endstruct (int is_union) + /* Nested .structs don't get put in the stag table. */ + if (current_stag->outer == NULL) + { +- hash_insert (stag_hash, current_stag->name, current_stag); ++ str_hash_insert (stag_hash, current_stag->name, current_stag); + stag_add_field_symbols (current_stag, path, + S_GET_VALUE (current_stag->sym), + NULL, NULL); +@@ -770,7 +770,7 @@ tic54x_tag (int ignore ATTRIBUTE_UNUSED) + { + char *name; + int c = get_symbol_name (&name); +- struct stag *stag = (struct stag *) hash_find (stag_hash, name); ++ struct stag *stag = (struct stag *) str_hash_find (stag_hash, name); + + if (!stag) + { +@@ -1117,11 +1117,14 @@ tic54x_global (int type) + + /* Remove the symbol from the local label hash lookup. */ + +-static void +-tic54x_remove_local_label (const char *key, void *value ATTRIBUTE_UNUSED) ++static int ++tic54x_remove_local_label (void **slot, void *arg ATTRIBUTE_UNUSED) + { +- void *elem = hash_delete (local_label_hash[macro_level], key, FALSE); ++ string_tuple_t *tuple = *((string_tuple_t **) slot); ++ void *elem = str_hash_find (local_label_hash[macro_level], tuple->key); ++ str_hash_delete (local_label_hash[macro_level], tuple->key); + free (elem); ++ return 0; + } + + /* Reset all local labels. */ +@@ -1129,7 +1132,7 @@ tic54x_remove_local_label (const char *k + static void + tic54x_clear_local_labels (int ignored ATTRIBUTE_UNUSED) + { +- hash_traverse (local_label_hash[macro_level], tic54x_remove_local_label); ++ htab_traverse (local_label_hash[macro_level], tic54x_remove_local_label, NULL); + } + + /* .text +@@ -2235,7 +2238,7 @@ tic54x_var (int ignore ATTRIBUTE_UNUSED) + c = get_symbol_name (&name); + /* .var symbols start out with a null string. */ + name = xstrdup (name); +- hash_insert (subsym_hash[macro_level], name, empty); ++ str_hash_insert (subsym_hash[macro_level], name, empty); + c = restore_line_pointer (c); + if (c == ',') + { +@@ -2503,8 +2506,8 @@ tic54x_macro_start (void) + as_fatal (_("Macro nesting is too deep")); + return; + } +- subsym_hash[macro_level] = hash_new (); +- local_label_hash[macro_level] = hash_new (); ++ subsym_hash[macro_level] = str_htab_create (); ++ local_label_hash[macro_level] = str_htab_create (); + } + + void +@@ -2520,7 +2523,7 @@ tic54x_macro_info (const macro_entry *ma + + name[entry->name.len] = '\0'; + value[entry->actual.len] = '\0'; +- hash_insert (subsym_hash[macro_level], name, value); ++ str_hash_insert (subsym_hash[macro_level], name, value); + } + } + +@@ -2529,9 +2532,9 @@ tic54x_macro_info (const macro_entry *ma + void + tic54x_macro_end (void) + { +- hash_die (subsym_hash[macro_level]); ++ htab_delete (subsym_hash[macro_level]); + subsym_hash[macro_level] = NULL; +- hash_die (local_label_hash[macro_level]); ++ htab_delete (local_label_hash[macro_level]); + local_label_hash[macro_level] = NULL; + --macro_level; + } +@@ -2685,9 +2688,9 @@ subsym_isname (char *a, char *ignore ATT + static int + subsym_isreg (char *a, char *ignore ATTRIBUTE_UNUSED) + { +- if (hash_find (reg_hash, a)) ++ if (str_hash_find (reg_hash, a)) + return 1; +- if (hash_find (mmreg_hash, a)) ++ if (str_hash_find (mmreg_hash, a)) + return 1; + return 0; + } +@@ -2697,7 +2700,7 @@ subsym_isreg (char *a, char *ignore ATTR + static int + subsym_structsz (char *name, char *ignore ATTRIBUTE_UNUSED) + { +- struct stag *stag = (struct stag *) hash_find (stag_hash, name); ++ struct stag *stag = (struct stag *) str_hash_find (stag_hash, name); + + if (stag) + return stag->size; +@@ -2965,7 +2968,6 @@ md_begin (void) + tic54x_symbol *sym; + const subsym_proc_entry *subsym_proc; + const math_proc_entry *math_proc; +- const char *hash_err; + char **symname; + char *TIC54X_DIR = getenv ("TIC54X_DIR"); + char *A_DIR = TIC54X_DIR ? TIC54X_DIR : getenv ("A_DIR"); +@@ -2989,27 +2991,21 @@ md_begin (void) + while (tmp != NULL); + } + +- op_hash = hash_new (); ++ op_hash = str_htab_create (); + for (tm = (insn_template *) tic54x_optab; tm->name; tm++) + { +- if (hash_find (op_hash, tm->name)) ++ if (str_hash_find (op_hash, tm->name)) + continue; +- hash_err = hash_insert (op_hash, tm->name, (char *) tm); +- if (hash_err) +- as_fatal ("Internal Error: Can't hash %s: %s", +- tm->name, hash_err); ++ str_hash_insert (op_hash, tm->name, (char *) tm); + } +- parop_hash = hash_new (); ++ parop_hash = str_htab_create (); + for (tm = (insn_template *) tic54x_paroptab; tm->name; tm++) + { +- if (hash_find (parop_hash, tm->name)) ++ if (str_hash_find (parop_hash, tm->name)) + continue; +- hash_err = hash_insert (parop_hash, tm->name, (char *) tm); +- if (hash_err) +- as_fatal ("Internal Error: Can't hash %s: %s", +- tm->name, hash_err); ++ str_hash_insert (parop_hash, tm->name, (char *) tm); + } +- reg_hash = hash_new (); ++ reg_hash = str_htab_create (); + for (sym = (tic54x_symbol *) regs; sym->name; sym++) + { + /* Add basic registers to the symbol table. */ +@@ -3017,54 +3013,54 @@ md_begin (void) + (valueT) sym->value, &zero_address_frag); + SF_SET_LOCAL (symbolP); + symbol_table_insert (symbolP); +- hash_err = hash_insert (reg_hash, sym->name, (char *) sym); ++ str_hash_insert (reg_hash, sym->name, (char *) sym); + } + for (sym = (tic54x_symbol *) mmregs; sym->name; sym++) +- hash_err = hash_insert (reg_hash, sym->name, (char *) sym); +- mmreg_hash = hash_new (); ++ str_hash_insert (reg_hash, sym->name, (char *) sym); ++ mmreg_hash = str_htab_create (); + for (sym = (tic54x_symbol *) mmregs; sym->name; sym++) +- hash_err = hash_insert (mmreg_hash, sym->name, (char *) sym); ++ str_hash_insert (mmreg_hash, sym->name, (char *) sym); + +- cc_hash = hash_new (); ++ cc_hash = str_htab_create (); + for (sym = (tic54x_symbol *) condition_codes; sym->name; sym++) +- hash_err = hash_insert (cc_hash, sym->name, (char *) sym); ++ str_hash_insert (cc_hash, sym->name, (char *) sym); + +- cc2_hash = hash_new (); ++ cc2_hash = str_htab_create (); + for (sym = (tic54x_symbol *) cc2_codes; sym->name; sym++) +- hash_err = hash_insert (cc2_hash, sym->name, (char *) sym); ++ str_hash_insert (cc2_hash, sym->name, (char *) sym); + +- cc3_hash = hash_new (); ++ cc3_hash = str_htab_create (); + for (sym = (tic54x_symbol *) cc3_codes; sym->name; sym++) +- hash_err = hash_insert (cc3_hash, sym->name, (char *) sym); ++ str_hash_insert (cc3_hash, sym->name, (char *) sym); + +- sbit_hash = hash_new (); ++ sbit_hash = str_htab_create (); + for (sym = (tic54x_symbol *) status_bits; sym->name; sym++) +- hash_err = hash_insert (sbit_hash, sym->name, (char *) sym); ++ str_hash_insert (sbit_hash, sym->name, (char *) sym); + +- misc_symbol_hash = hash_new (); ++ misc_symbol_hash = str_htab_create (); + for (symname = (char **) misc_symbols; *symname; symname++) +- hash_err = hash_insert (misc_symbol_hash, *symname, *symname); ++ str_hash_insert (misc_symbol_hash, *symname, *symname); + + /* Only the base substitution table and local label table are initialized; + the others (for local macro substitution) get instantiated as needed. */ +- local_label_hash[0] = hash_new (); +- subsym_hash[0] = hash_new (); ++ local_label_hash[0] = str_htab_create (); ++ subsym_hash[0] = str_htab_create (); + for (subsym_proc = subsym_procs; subsym_proc->name; subsym_proc++) +- hash_err = hash_insert (subsym_hash[0], subsym_proc->name, +- (char *) subsym_proc); ++ str_hash_insert (subsym_hash[0], subsym_proc->name, ++ (char *) subsym_proc); + +- math_hash = hash_new (); ++ math_hash = str_htab_create (); + for (math_proc = math_procs; math_proc->name; math_proc++) + { + /* Insert into the main subsym hash for recognition; insert into + the math hash to actually store information. */ +- hash_err = hash_insert (subsym_hash[0], math_proc->name, +- (char *) math_proc); +- hash_err = hash_insert (math_hash, math_proc->name, +- (char *) math_proc); ++ str_hash_insert (subsym_hash[0], math_proc->name, ++ (char *) math_proc); ++ str_hash_insert (math_hash, math_proc->name, ++ (char *) math_proc); + } +- subsym_recurse_hash = hash_new (); +- stag_hash = hash_new (); ++ subsym_recurse_hash = str_htab_create (); ++ stag_hash = str_htab_create (); + } + + static int +@@ -3257,7 +3253,7 @@ is_mmreg (struct opstruct *operand) + { + return (is_absolute (operand) + || is_immediate (operand) +- || hash_find (mmreg_hash, operand->buf) != 0); ++ || str_hash_find (mmreg_hash, operand->buf) != 0); + } + + static int +@@ -3301,13 +3297,13 @@ is_type (struct opstruct *operand, enum + return strncasecmp ("ar", operand->buf, 2) == 0 + && ISDIGIT (operand->buf[2]); + case OP_SBIT: +- return hash_find (sbit_hash, operand->buf) != 0 || is_absolute (operand); ++ return str_hash_find (sbit_hash, operand->buf) != 0 || is_absolute (operand); + case OP_CC: +- return hash_find (cc_hash, operand->buf) != 0; ++ return str_hash_find (cc_hash, operand->buf) != 0; + case OP_CC2: +- return hash_find (cc2_hash, operand->buf) != 0; ++ return str_hash_find (cc2_hash, operand->buf) != 0; + case OP_CC3: +- return hash_find (cc3_hash, operand->buf) != 0 ++ return str_hash_find (cc3_hash, operand->buf) != 0 + || is_immediate (operand) || is_absolute (operand); + case OP_16: + return (is_immediate (operand) || is_absolute (operand)) +@@ -3649,7 +3645,7 @@ encode_integer (tic54x_insn *insn, + static int + encode_condition (tic54x_insn *insn, struct opstruct *operand) + { +- tic54x_symbol *cc = (tic54x_symbol *) hash_find (cc_hash, operand->buf); ++ tic54x_symbol *cc = (tic54x_symbol *) str_hash_find (cc_hash, operand->buf); + if (!cc) + { + as_bad (_("Unrecognized condition code \"%s\""), operand->buf); +@@ -3709,7 +3705,7 @@ encode_condition (tic54x_insn *insn, str + static int + encode_cc3 (tic54x_insn *insn, struct opstruct *operand) + { +- tic54x_symbol *cc3 = (tic54x_symbol *) hash_find (cc3_hash, operand->buf); ++ tic54x_symbol *cc3 = (tic54x_symbol *) str_hash_find (cc3_hash, operand->buf); + int value = cc3 ? cc3->value : operand->exp.X_add_number << 8; + + if ((value & 0x0300) != value) +@@ -3738,7 +3734,7 @@ encode_arx (tic54x_insn *insn, struct op + static int + encode_cc2 (tic54x_insn *insn, struct opstruct *operand) + { +- tic54x_symbol *cc2 = (tic54x_symbol *) hash_find (cc2_hash, operand->buf); ++ tic54x_symbol *cc2 = (tic54x_symbol *) str_hash_find (cc2_hash, operand->buf); + + if (!cc2) + { +@@ -3898,7 +3894,7 @@ encode_operand (tic54x_insn *insn, enum + case OP_SBIT: + { + tic54x_symbol *sbit = (tic54x_symbol *) +- hash_find (sbit_hash, operand->buf); ++ str_hash_find (sbit_hash, operand->buf); + int value = is_absolute (operand) ? + operand->exp.X_add_number : (sbit ? sbit->value : -1); + int reg = 0; +@@ -3912,7 +3908,7 @@ encode_operand (tic54x_insn *insn, enum + } + /* Guess the register based on the status bit; "ovb" is the last + status bit defined for st0. */ +- if (sbit > (tic54x_symbol *) hash_find (sbit_hash, "ovb")) ++ if (sbit > (tic54x_symbol *) str_hash_find (sbit_hash, "ovb")) + reg = 1; + } + if (value == -1) +@@ -4152,7 +4148,7 @@ optimize_insn (tic54x_insn *insn) + static int + tic54x_parse_insn (tic54x_insn *insn, char *line) + { +- insn->tm = (insn_template *) hash_find (op_hash, insn->mnemonic); ++ insn->tm = (insn_template *) str_hash_find (op_hash, insn->mnemonic); + if (!insn->tm) + { + as_bad (_("Unrecognized instruction \"%s\""), insn->mnemonic); +@@ -4175,7 +4171,7 @@ tic54x_parse_insn (tic54x_insn *insn, ch + /* SUCCESS! now try some optimizations. */ + if (optimize_insn (insn)) + { +- insn->tm = (insn_template *) hash_find (op_hash, ++ insn->tm = (insn_template *) str_hash_find (op_hash, + insn->mnemonic); + continue; + } +@@ -4210,7 +4206,7 @@ next_line_shows_parallel (char *next_lin + static int + tic54x_parse_parallel_insn_firstline (tic54x_insn *insn, char *line) + { +- insn->tm = (insn_template *) hash_find (parop_hash, insn->mnemonic); ++ insn->tm = (insn_template *) str_hash_find (parop_hash, insn->mnemonic); + if (!insn->tm) + { + as_bad (_("Unrecognized parallel instruction \"%s\""), +@@ -4341,17 +4337,8 @@ subsym_create_or_replace (char *name, ch + int i; + + for (i = macro_level; i > 0; i--) +- { +- if (hash_find (subsym_hash[i], name)) +- { +- hash_replace (subsym_hash[i], name, value); +- return; +- } +- } +- if (hash_find (subsym_hash[0], name)) +- hash_replace (subsym_hash[0], name, value); +- else +- hash_insert (subsym_hash[0], name, value); ++ str_hash_insert (subsym_hash[i], name, value); ++ str_hash_insert (subsym_hash[0], name, value); + } + + /* Look up the substitution string replacement for the given symbol. +@@ -4361,7 +4348,7 @@ subsym_create_or_replace (char *name, ch + static char * + subsym_lookup (char *name, int nest_level) + { +- char *value = hash_find (subsym_hash[nest_level], name); ++ char *value = str_hash_find (subsym_hash[nest_level], name); + + if (value || nest_level == 0) + return value; +@@ -4482,7 +4469,7 @@ subsym_substitute (char *line, int force + } + /* Avoid infinite recursion; if a symbol shows up a second time for + substitution, leave it as is. */ +- if (hash_find (subsym_recurse_hash, name) == NULL) ++ if (str_hash_find (subsym_recurse_hash, name) == NULL) + value = subsym_lookup (name, macro_level); + else + as_warn (_("%s symbol recursion stopped at " +@@ -4498,7 +4485,7 @@ subsym_substitute (char *line, int force + { + /* Use an existing identifier for that label if, available, or + create a new, unique identifier. */ +- value = hash_find (local_label_hash[macro_level], name); ++ value = str_hash_find (local_label_hash[macro_level], name); + if (value == NULL) + { + char digit[11]; +@@ -4510,7 +4497,7 @@ subsym_substitute (char *line, int force + value[strlen (value) - 1] = '\0'; + sprintf (digit, ".%d", local_label_id++); + strcat (value, digit); +- hash_insert (local_label_hash[macro_level], namecopy, value); ++ str_hash_insert (local_label_hash[macro_level], namecopy, value); + } + /* Indicate where to continue looking for substitutions. */ + ptr = tail; +@@ -4519,7 +4506,7 @@ subsym_substitute (char *line, int force + else if (value != NULL && *name == '$') + { + subsym_proc_entry *entry = (subsym_proc_entry *) value; +- math_proc_entry *math_entry = hash_find (math_hash, name); ++ math_proc_entry *math_entry = str_hash_find (math_hash, name); + char *arg1, *arg2 = NULL; + + *ptr = c; +@@ -4631,9 +4618,9 @@ subsym_substitute (char *line, int force + try to replace a symbol once. */ + if (recurse) + { +- hash_insert (subsym_recurse_hash, name, name); ++ str_hash_insert (subsym_recurse_hash, name, name); + value = subsym_substitute (value, macro_level > 0); +- hash_delete (subsym_recurse_hash, name, FALSE); ++ str_hash_delete (subsym_recurse_hash, name); + } + + /* Temporarily zero-terminate where the symbol started. */ +@@ -5022,19 +5009,19 @@ tic54x_undefined_symbol (char *name) + tic54x_symbol *sym; + + /* Not sure how to handle predefined symbols. */ +- if ((sym = (tic54x_symbol *) hash_find (cc_hash, name)) != NULL || +- (sym = (tic54x_symbol *) hash_find (cc2_hash, name)) != NULL || +- (sym = (tic54x_symbol *) hash_find (cc3_hash, name)) != NULL || +- (sym = (tic54x_symbol *) hash_find (misc_symbol_hash, name)) != NULL || +- (sym = (tic54x_symbol *) hash_find (sbit_hash, name)) != NULL) ++ if ((sym = (tic54x_symbol *) str_hash_find (cc_hash, name)) != NULL || ++ (sym = (tic54x_symbol *) str_hash_find (cc2_hash, name)) != NULL || ++ (sym = (tic54x_symbol *) str_hash_find (cc3_hash, name)) != NULL || ++ (sym = (tic54x_symbol *) str_hash_find (misc_symbol_hash, name)) != NULL || ++ (sym = (tic54x_symbol *) str_hash_find (sbit_hash, name)) != NULL) + { + return symbol_new (name, reg_section, + (valueT) sym->value, + &zero_address_frag); + } + +- if ((sym = (tic54x_symbol *) hash_find (reg_hash, name)) != NULL || +- (sym = (tic54x_symbol *) hash_find (mmreg_hash, name)) != NULL || ++ if ((sym = (tic54x_symbol *) str_hash_find (reg_hash, name)) != NULL || ++ (sym = (tic54x_symbol *) str_hash_find (mmreg_hash, name)) != NULL || + !strcasecmp (name, "a") || !strcasecmp (name, "b")) + { + return symbol_new (name, reg_section, +diff -rup binutils.orig/gas/config/tc-tic6x.c binutils-2.35/gas/config/tc-tic6x.c +--- binutils.orig/gas/config/tc-tic6x.c 2021-08-11 17:33:12.208490376 +0100 ++++ binutils-2.35/gas/config/tc-tic6x.c 2021-08-11 17:39:31.416057481 +0100 +@@ -742,7 +742,7 @@ const pseudo_typeS md_pseudo_table[] = + /* Hash table of opcodes. For each opcode name, this stores a pointer + to a tic6x_opcode_list listing (in an arbitrary order) all opcode + table entries with that name. */ +-static struct hash_control *opcode_hash; ++static htab_t opcode_hash; + + /* Initialize the assembler (called once at assembler startup). */ + +@@ -757,17 +757,14 @@ md_begin (void) + bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0); + + /* Insert opcodes into the hash table. */ +- opcode_hash = hash_new (); ++ opcode_hash = str_htab_create (); + for (id = 0; id < tic6x_opcode_max; id++) + { +- const char *errmsg; + tic6x_opcode_list *opc = XNEW (tic6x_opcode_list); + + opc->id = id; +- opc->next = hash_find (opcode_hash, tic6x_opcode_table[id].name); +- if ((errmsg = hash_jam (opcode_hash, tic6x_opcode_table[id].name, opc)) +- != NULL) +- as_fatal ("%s", _(errmsg)); ++ opc->next = str_hash_find (opcode_hash, tic6x_opcode_table[id].name); ++ str_hash_insert (opcode_hash, tic6x_opcode_table[id].name, opc); + } + + /* Save the current subseg so we can restore it [it's the default one and +@@ -3187,7 +3184,7 @@ md_assemble (char *str) + this_insn_label_list = seginfo->tc_segment_info_data.label_list; + seginfo->tc_segment_info_data.label_list = NULL; + +- opc_list = hash_find_n (opcode_hash, str, p - str); ++ opc_list = str_hash_find_n (opcode_hash, str, p - str); + if (opc_list == NULL) + { + char c = *p; +diff -rup binutils.orig/gas/config/tc-tilegx.c binutils-2.35/gas/config/tc-tilegx.c +--- binutils.orig/gas/config/tc-tilegx.c 2021-08-11 17:33:12.209490370 +0100 ++++ binutils-2.35/gas/config/tc-tilegx.c 2021-08-11 17:39:31.416057481 +0100 +@@ -177,13 +177,13 @@ md_show_usage (FILE *stream) + #define O_hw1_last_plt O_md27 + #define O_hw2_last_plt O_md28 + +-static struct hash_control *special_operator_hash; ++static htab_t special_operator_hash; + + /* Hash tables for instruction mnemonic lookup. */ +-static struct hash_control *op_hash; ++static htab_t op_hash; + + /* Hash table for spr lookup. */ +-static struct hash_control *spr_hash; ++static htab_t spr_hash; + + /* True temporarily while parsing an SPR expression. This changes the + * namespace to include SPR names. */ +@@ -231,7 +231,7 @@ static int allow_suspicious_bundles; + for that register (e.g. r63 instead of zero), so we should generate + a warning. The attempted register number can be found by clearing + NONCANONICAL_REG_NAME_FLAG. */ +-static struct hash_control *main_reg_hash; ++static htab_t main_reg_hash; + + + /* We cannot unambiguously store a 0 in a hash table and look it up, +@@ -273,9 +273,9 @@ md_begin (void) + tilegx_cie_data_alignment = (tilegx_arch_size == 64 ? -8 : -4); + + /* Initialize special operator hash table. */ +- special_operator_hash = hash_new (); ++ special_operator_hash = str_htab_create (); + #define INSERT_SPECIAL_OP(name) \ +- hash_insert (special_operator_hash, #name, (void *)O_##name) ++ str_hash_insert (special_operator_hash, #name, (void *)O_##name) + + INSERT_SPECIAL_OP (hw0); + INSERT_SPECIAL_OP (hw1); +@@ -285,7 +285,7 @@ md_begin (void) + INSERT_SPECIAL_OP (hw1_last); + INSERT_SPECIAL_OP (hw2_last); + /* hw3_last is a convenience alias for the equivalent hw3. */ +- hash_insert (special_operator_hash, "hw3_last", (void*)O_hw3); ++ str_hash_insert (special_operator_hash, "hw3_last", (void*)O_hw3); + INSERT_SPECIAL_OP (hw0_got); + INSERT_SPECIAL_OP (hw0_last_got); + INSERT_SPECIAL_OP (hw1_last_got); +@@ -310,36 +310,32 @@ md_begin (void) + #undef INSERT_SPECIAL_OP + + /* Initialize op_hash hash table. */ +- op_hash = hash_new (); ++ op_hash = str_htab_create (); + for (op = &tilegx_opcodes[0]; op->name != NULL; op++) +- { +- const char *hash_err = hash_insert (op_hash, op->name, (void *)op); +- if (hash_err != NULL) +- as_fatal (_("Internal Error: Can't hash %s: %s"), op->name, hash_err); +- } ++ str_hash_insert (op_hash, op->name, (void *)op); + + /* Initialize the spr hash table. */ + parsing_spr = 0; +- spr_hash = hash_new (); ++ spr_hash = str_htab_create (); + for (i = 0; i < tilegx_num_sprs; i++) +- hash_insert (spr_hash, tilegx_sprs[i].name, ++ str_hash_insert (spr_hash, tilegx_sprs[i].name, + (void *) &tilegx_sprs[i]); + + /* Set up the main_reg_hash table. We use this instead of + creating a symbol in the register section to avoid ambiguities + with labels that have the same names as registers. */ +- main_reg_hash = hash_new (); ++ main_reg_hash = str_htab_create (); + for (i = 0; i < TILEGX_NUM_REGISTERS; i++) + { + char buf[64]; + +- hash_insert (main_reg_hash, tilegx_register_names[i], ++ str_hash_insert (main_reg_hash, tilegx_register_names[i], + (void *) (long) (i | CANONICAL_REG_NAME_FLAG)); + + /* See if we should insert a noncanonical alias, like r63. */ + sprintf (buf, "r%d", i); + if (strcmp (buf, tilegx_register_names[i]) != 0) +- hash_insert (main_reg_hash, xstrdup (buf), ++ str_hash_insert (main_reg_hash, xstrdup (buf), + (void *) (long) (i | NONCANONICAL_REG_NAME_FLAG)); + } + } +@@ -1013,7 +1009,7 @@ tilegx_parse_name (char *name, expressio + + if (parsing_spr) + { +- void* val = hash_find (spr_hash, name); ++ void* val = str_hash_find (spr_hash, name); + if (val == NULL) + return 0; + +@@ -1031,7 +1027,7 @@ tilegx_parse_name (char *name, expressio + else + { + /* Look up the operator in our table. */ +- void* val = hash_find (special_operator_hash, name); ++ void* val = str_hash_find (special_operator_hash, name); + if (val == 0) + return 0; + op = (operatorT)(long)val; +@@ -1098,7 +1094,7 @@ parse_reg_expression (expressionS* expre + + terminating_char = get_symbol_name (®name); + +- pval = hash_find (main_reg_hash, regname); ++ pval = str_hash_find (main_reg_hash, regname); + if (pval == NULL) + as_bad (_("Expected register, got '%s'."), regname); + +@@ -1243,7 +1239,7 @@ md_assemble (char *str) + old_char = str[opname_len]; + str[opname_len] = '\0'; + +- op = hash_find(op_hash, str); ++ op = str_hash_find(op_hash, str); + str[opname_len] = old_char; + if (op == NULL) + { +diff -rup binutils.orig/gas/config/tc-tilepro.c binutils-2.35/gas/config/tc-tilepro.c +--- binutils.orig/gas/config/tc-tilepro.c 2021-08-11 17:33:12.213490344 +0100 ++++ binutils-2.35/gas/config/tc-tilepro.c 2021-08-11 17:39:31.416057481 +0100 +@@ -126,13 +126,13 @@ md_show_usage (FILE *stream) + #define O_tls_gd_add O_md22 + #define O_tls_ie_load O_md23 + +-static struct hash_control *special_operator_hash; ++static htab_t special_operator_hash; + + /* Hash tables for instruction mnemonic lookup. */ +-static struct hash_control *op_hash; ++static htab_t op_hash; + + /* Hash table for spr lookup. */ +-static struct hash_control *spr_hash; ++static htab_t spr_hash; + + /* True temporarily while parsing an SPR expression. This changes the + * namespace to include SPR names. */ +@@ -181,7 +181,7 @@ static int allow_suspicious_bundles; + for that register (e.g. r63 instead of zero), so we should generate + a warning. The attempted register number can be found by clearing + NONCANONICAL_REG_NAME_FLAG. */ +-static struct hash_control *main_reg_hash; ++static htab_t main_reg_hash; + + + /* We cannot unambiguously store a 0 in a hash table and look it up, +@@ -216,9 +216,9 @@ md_begin (void) + inside_bundle = 0; + + /* Initialize special operator hash table. */ +- special_operator_hash = hash_new (); ++ special_operator_hash = str_htab_create (); + #define INSERT_SPECIAL_OP(name) \ +- hash_insert (special_operator_hash, #name, (void *)O_##name) ++ str_hash_insert (special_operator_hash, #name, (void *)O_##name) + + INSERT_SPECIAL_OP(lo16); + INSERT_SPECIAL_OP(hi16); +@@ -246,54 +246,47 @@ md_begin (void) + #undef INSERT_SPECIAL_OP + + /* Initialize op_hash hash table. */ +- op_hash = hash_new (); ++ op_hash = str_htab_create (); + for (op = &tilepro_opcodes[0]; op->name != NULL; op++) +- { +- const char *hash_err = hash_insert (op_hash, op->name, (void *)op); +- if (hash_err != NULL) +- { +- as_fatal (_("Internal Error: Can't hash %s: %s"), +- op->name, hash_err); +- } +- } ++ str_hash_insert (op_hash, op->name, (void *)op); + + /* Initialize the spr hash table. */ + parsing_spr = 0; +- spr_hash = hash_new (); ++ spr_hash = str_htab_create (); + for (i = 0; i < tilepro_num_sprs; i++) +- hash_insert (spr_hash, tilepro_sprs[i].name, ++ str_hash_insert (spr_hash, tilepro_sprs[i].name, + (void *) &tilepro_sprs[i]); + + /* Set up the main_reg_hash table. We use this instead of + * creating a symbol in the register section to avoid ambiguities + * with labels that have the same names as registers. */ +- main_reg_hash = hash_new (); ++ main_reg_hash = str_htab_create (); + for (i = 0; i < TILEPRO_NUM_REGISTERS; i++) + { + char buf[64]; + +- hash_insert (main_reg_hash, tilepro_register_names[i], ++ str_hash_insert (main_reg_hash, tilepro_register_names[i], + (void *) (long)(i | CANONICAL_REG_NAME_FLAG)); + + /* See if we should insert a noncanonical alias, like r63. */ + sprintf (buf, "r%d", i); + if (strcmp (buf, tilepro_register_names[i]) != 0) +- hash_insert (main_reg_hash, xstrdup (buf), ++ str_hash_insert (main_reg_hash, xstrdup (buf), + (void *) (long)(i | NONCANONICAL_REG_NAME_FLAG)); + } + + /* Insert obsolete backwards-compatibility register names. */ +- hash_insert (main_reg_hash, "io0", ++ str_hash_insert (main_reg_hash, "io0", + (void *) (long) (TREG_IDN0 | CANONICAL_REG_NAME_FLAG)); +- hash_insert (main_reg_hash, "io1", ++ str_hash_insert (main_reg_hash, "io1", + (void *) (long) (TREG_IDN1 | CANONICAL_REG_NAME_FLAG)); +- hash_insert (main_reg_hash, "us0", ++ str_hash_insert (main_reg_hash, "us0", + (void *) (long) (TREG_UDN0 | CANONICAL_REG_NAME_FLAG)); +- hash_insert (main_reg_hash, "us1", ++ str_hash_insert (main_reg_hash, "us1", + (void *) (long) (TREG_UDN1 | CANONICAL_REG_NAME_FLAG)); +- hash_insert (main_reg_hash, "us2", ++ str_hash_insert (main_reg_hash, "us2", + (void *) (long) (TREG_UDN2 | CANONICAL_REG_NAME_FLAG)); +- hash_insert (main_reg_hash, "us3", ++ str_hash_insert (main_reg_hash, "us3", + (void *) (long) (TREG_UDN3 | CANONICAL_REG_NAME_FLAG)); + + } +@@ -903,7 +896,7 @@ tilepro_parse_name (char *name, expressi + + if (parsing_spr) + { +- void *val = hash_find (spr_hash, name); ++ void *val = str_hash_find (spr_hash, name); + if (val == NULL) + return 0; + +@@ -922,7 +915,7 @@ tilepro_parse_name (char *name, expressi + else + { + /* Look up the operator in our table. */ +- void *val = hash_find (special_operator_hash, name); ++ void *val = str_hash_find (special_operator_hash, name); + if (val == 0) + return 0; + op = (operatorT)(long)val; +@@ -984,7 +977,7 @@ parse_reg_expression (expressionS* expre + char *regname; + char terminating_char = get_symbol_name (®name); + +- void* pval = hash_find (main_reg_hash, regname); ++ void* pval = str_hash_find (main_reg_hash, regname); + + if (pval == NULL) + as_bad (_("Expected register, got '%s'."), regname); +@@ -1128,7 +1121,7 @@ md_assemble (char *str) + old_char = str[opname_len]; + str[opname_len] = '\0'; + +- op = hash_find(op_hash, str); ++ op = str_hash_find(op_hash, str); + str[opname_len] = old_char; + if (op == NULL) + { +diff -rup binutils.orig/gas/config/tc-v850.c binutils-2.35/gas/config/tc-v850.c +--- binutils.orig/gas/config/tc-v850.c 2021-08-11 17:33:12.214490337 +0100 ++++ binutils-2.35/gas/config/tc-v850.c 2021-08-11 17:39:31.417057475 +0100 +@@ -599,7 +599,7 @@ const pseudo_typeS md_pseudo_table[] = + }; + + /* Opcode hash table. */ +-static struct hash_control *v850_hash; ++static htab_t v850_hash; + + /* This table is sorted. Suitable for searching by a binary search. */ + static const struct reg_name pre_defined_registers[] = +@@ -1952,7 +1952,7 @@ md_begin (void) + if (soft_float == -1) + soft_float = machine < bfd_mach_v850e2v3; + +- v850_hash = hash_new (); ++ v850_hash = str_htab_create (); + + /* Insert unique names into hash table. The V850 instruction set + has many identical opcode names that have different opcodes based +@@ -1964,7 +1964,8 @@ md_begin (void) + if (strcmp (prev_name, op->name)) + { + prev_name = (char *) op->name; +- hash_insert (v850_hash, op->name, (char *) op); ++ if (str_hash_find (v850_hash, op->name) == NULL) ++ str_hash_insert (v850_hash, op->name, (char *) op); + } + op++; + } +@@ -2321,7 +2322,7 @@ md_assemble (char *str) + *s++ = '\0'; + + /* Find the first opcode with the proper name. */ +- opcode = (struct v850_opcode *) hash_find (v850_hash, str); ++ opcode = (struct v850_opcode *) str_hash_find (v850_hash, str); + if (opcode == NULL) + { + /* xgettext:c-format */ +diff -rup binutils.orig/gas/config/tc-vax.c binutils-2.35/gas/config/tc-vax.c +--- binutils.orig/gas/config/tc-vax.c 2021-08-11 17:33:12.212490350 +0100 ++++ binutils-2.35/gas/config/tc-vax.c 2021-08-11 17:39:31.417057475 +0100 +@@ -736,7 +736,7 @@ md_ri_to_chars (char *the_bytes, struct + source file, and changed the makefile. */ + + /* Handle of the OPCODE hash table. */ +-static struct hash_control *op_hash; ++static htab_t op_hash; + + /* In: 1 character, from "bdfghloqpw" being the data-type of an operand + of a vax instruction. +@@ -950,29 +950,26 @@ vip_op_defaults (const char *immediate, + instruction table. + You must nominate metacharacters for eg DEC's "#", "@", "^". */ + +-static const char * ++static void + vip_begin (int synthetic_too, /* 1 means include jXXX op-codes. */ + const char *immediate, + const char *indirect, + const char *displen) + { + const struct vot *vP; /* scan votstrs */ +- const char *retval = 0; /* error text */ + +- op_hash = hash_new (); ++ op_hash = str_htab_create (); + +- for (vP = votstrs; *vP->vot_name && !retval; vP++) +- retval = hash_insert (op_hash, vP->vot_name, (void *) &vP->vot_detail); ++ for (vP = votstrs; *vP->vot_name; vP++) ++ str_hash_insert (op_hash, vP->vot_name, (void *) &vP->vot_detail); + + if (synthetic_too) +- for (vP = synthetic_votstrs; *vP->vot_name && !retval; vP++) +- retval = hash_insert (op_hash, vP->vot_name, (void *) &vP->vot_detail); ++ for (vP = synthetic_votstrs; *vP->vot_name; vP++) ++ str_hash_insert (op_hash, vP->vot_name, (void *) &vP->vot_detail); + + #ifndef CONST_TABLE + vip_op_defaults (immediate, indirect, displen); + #endif +- +- return retval; + } + + /* Take 3 char.s, the last of which may be `\0` (non-existent) +@@ -1887,7 +1884,7 @@ vip (struct vit *vitP, /* We build an e + /* Here with instring pointing to what better be an op-name, and p + pointing to character just past that. + We trust instring points to an op-name, with no whitespace. */ +- vwP = (struct vot_wot *) hash_find (op_hash, instring); ++ vwP = (struct vot_wot *) str_hash_find (op_hash, instring); + /* Restore char after op-code. */ + *p = c; + if (vwP == 0) +@@ -1986,8 +1983,7 @@ main (void) + printf ("enter displen symbols eg enter ^ "); + gets (my_displen); + +- if (p = vip_begin (mysynth, my_immediate, my_indirect, my_displen)) +- error ("vip_begin=%s", p); ++ vip_begin (mysynth, my_immediate, my_indirect, my_displen) + + printf ("An empty input line will quit you from the vax instruction parser\n"); + for (;;) +@@ -3256,12 +3252,10 @@ md_assemble (char *instruction_string) + void + md_begin (void) + { +- const char *errtxt; + FLONUM_TYPE *fP; + int i; + +- if ((errtxt = vip_begin (1, "$", "*", "`")) != 0) +- as_fatal (_("VIP_BEGIN error:%s"), errtxt); ++ vip_begin (1, "$", "*", "`"); + + for (i = 0, fP = float_operand; + fP < float_operand + VIT_MAX_OPERANDS; +diff -rup binutils.orig/gas/config/tc-wasm32.c binutils-2.35/gas/config/tc-wasm32.c +--- binutils.orig/gas/config/tc-wasm32.c 2021-08-11 17:33:12.213490344 +0100 ++++ binutils-2.35/gas/config/tc-wasm32.c 2021-08-11 17:39:31.417057475 +0100 +@@ -92,7 +92,7 @@ const pseudo_typeS md_pseudo_table[] = + + /* Opcode hash table. */ + +-static struct hash_control *wasm32_hash; ++static htab_t wasm32_hash; + + struct option md_longopts[] = + { +@@ -158,13 +158,13 @@ md_begin (void) + { + struct wasm32_opcode_s *opcode; + +- wasm32_hash = hash_new (); ++ wasm32_hash = str_htab_create (); + + /* Insert unique names into hash table. This hash table then + provides a quick index to the first opcode with a particular name + in the opcode table. */ + for (opcode = wasm32_opcodes; opcode->name; opcode++) +- hash_insert (wasm32_hash, opcode->name, (char *) opcode); ++ str_hash_insert (wasm32_hash, opcode->name, (char *) opcode); + + linkrelax = 0; + flag_sectname_subst = 1; +@@ -746,7 +746,7 @@ md_assemble (char *str) + if (!op[0]) + as_bad (_("can't find opcode ")); + +- opcode = (struct wasm32_opcode_s *) hash_find (wasm32_hash, op); ++ opcode = (struct wasm32_opcode_s *) str_hash_find (wasm32_hash, op); + + if (opcode == NULL) + { +diff -rup binutils.orig/gas/config/tc-xgate.c binutils-2.35/gas/config/tc-xgate.c +--- binutils.orig/gas/config/tc-xgate.c 2021-08-11 17:33:12.213490344 +0100 ++++ binutils-2.35/gas/config/tc-xgate.c 2021-08-11 17:39:31.417057475 +0100 +@@ -113,7 +113,7 @@ static void xgate_scan_operands (struct + static unsigned int xgate_parse_operand (struct xgate_opcode *, int *, int, + char **, s_operand); + +-static struct hash_control *xgate_hash; ++static htab_t xgate_hash; + + /* Previous opcode. */ + static unsigned int prev = 0; +@@ -324,7 +324,7 @@ md_begin (void) + op_handles = XNEWVEC (struct xgate_opcode_handle, number_of_op_handles); + + /* Insert unique opcode names into hash table, aliasing duplicates. */ +- xgate_hash = hash_new (); ++ xgate_hash = str_htab_create (); + + prev_op_name = ""; + for (xgate_opcode_ptr = xgate_op_table, i = 0, j = 0; i < xgate_num_opcodes; +@@ -342,7 +342,7 @@ md_begin (void) + j++; + op_handles[j].name = xgate_opcode_ptr->name; + op_handles[j].opc0[0] = xgate_opcode_ptr; +- hash_insert (xgate_hash, (char *) op_handles[j].name, ++ str_hash_insert (xgate_hash, (char *) op_handles[j].name, + (char *) &(op_handles[j])); + } + op_handles[j].number_of_modes = handle_enum; +@@ -492,7 +492,7 @@ md_assemble (char *input_line) + if (!op_name[0]) + as_bad (_("opcode missing or not found on input line")); + +- if (!(opcode_handle = (struct xgate_opcode_handle *) hash_find (xgate_hash, ++ if (!(opcode_handle = (struct xgate_opcode_handle *) str_hash_find (xgate_hash, + op_name))) + { + as_bad (_("opcode %s not found in opcode hash table"), op_name); +@@ -544,7 +544,7 @@ md_assemble (char *input_line) + p = extract_word (p, op_name, 10); + + if (!(opcode_handle = (struct xgate_opcode_handle *) +- hash_find (xgate_hash, op_name))) ++ str_hash_find (xgate_hash, op_name))) + { + as_bad (_(": processing macro, real opcode handle" + " not found in hash")); +diff -rup binutils.orig/gas/config/tc-z8k.c binutils-2.35/gas/config/tc-z8k.c +--- binutils.orig/gas/config/tc-z8k.c 2021-08-11 17:33:12.214490337 +0100 ++++ binutils-2.35/gas/config/tc-z8k.c 2021-08-11 17:39:31.417057475 +0100 +@@ -137,7 +137,7 @@ const char EXP_CHARS[] = "eE"; + const char FLT_CHARS[] = "rRsSfFdDxXpP"; + + /* Opcode mnemonics. */ +-static struct hash_control *opcode_hash_control; ++static htab_t opcode_hash_control; + + void + md_begin (void) +@@ -145,13 +145,13 @@ md_begin (void) + const opcode_entry_type *opcode; + unsigned int idx = -1u; + +- opcode_hash_control = hash_new (); ++ opcode_hash_control = str_htab_create (); + + for (opcode = z8k_table; opcode->name; opcode++) + { + /* Only enter unique codes into the table. */ + if (idx != opcode->idx) +- hash_insert (opcode_hash_control, opcode->name, (char *) opcode); ++ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode); + idx = opcode->idx; + } + +@@ -166,7 +166,7 @@ md_begin (void) + fake_opcode->name = md_pseudo_table[idx].poc_name; + fake_opcode->func = (void *) (md_pseudo_table + idx); + fake_opcode->opcode = 250; +- hash_insert (opcode_hash_control, fake_opcode->name, fake_opcode); ++ str_hash_insert (opcode_hash_control, fake_opcode->name, fake_opcode); + } + } + +@@ -1224,9 +1224,9 @@ md_assemble (char *str) + } + c = *op_end; + +- *op_end = 0; /* Zero-terminate op code string for hash_find() call. */ ++ *op_end = 0; /* Zero-terminate op code string for str_hash_find() call. */ + +- opcode = (opcode_entry_type *) hash_find (opcode_hash_control, op_start); ++ opcode = (opcode_entry_type *) str_hash_find (opcode_hash_control, op_start); + + if (opcode == NULL) + { +diff -rup binutils.orig/gas/doc/as.texi binutils-2.35/gas/doc/as.texi +--- binutils.orig/gas/doc/as.texi 2021-08-11 17:33:12.207490382 +0100 ++++ binutils-2.35/gas/doc/as.texi 2021-08-11 17:41:32.630279947 +0100 +@@ -238,7 +238,6 @@ gcc(1), ld(1), and the Info entries for + [@b{--listing-cont-lines}=@var{NUM}] [@b{--keep-locals}] + [@b{--no-pad-sections}] + [@b{-o} @var{objfile}] [@b{-R}] +- [@b{--hash-size}=@var{NUM}] [@b{--reduce-memory-overheads}] + [@b{--statistics}] + [@b{-v}] [@b{-version}] [@b{--version}] + [@b{-W}] [@b{--warn}] [@b{--fatal-warnings}] [@b{-w}] [@b{-x}] +@@ -875,18 +874,6 @@ Name the object-file output from @comman + @item -R + Fold the data section into the text section. + +-@item --hash-size=@var{number} +-Set the default size of GAS's hash tables to a prime number close to +-@var{number}. Increasing this value can reduce the length of time it takes the +-assembler to perform its tasks, at the expense of increasing the assembler's +-memory requirements. Similarly reducing this value can reduce the memory +-requirements at the expense of speed. +- +-@item --reduce-memory-overheads +-This option reduces GAS's memory requirements, at the expense of making the +-assembly processes slower. Currently this switch is a synonym for +-@samp{--hash-size=4051}, but in the future it may have other effects as well. +- + @ifset ELF + @item --sectname-subst + Honor substitution sequences in section names. +diff -rup binutils.orig/gas/doc/internals.texi binutils-2.35/gas/doc/internals.texi +--- binutils.orig/gas/doc/internals.texi 2021-08-11 17:33:12.206490389 +0100 ++++ binutils-2.35/gas/doc/internals.texi 2021-08-11 17:41:32.630279947 +0100 +@@ -1915,38 +1915,6 @@ type is narrow enough, a decimal number + in hexadecimal. The value itself is not examined to make this determination. + @end deftypefun + +-@node Hash tables +-@subsection Hash tables +-@cindex hash tables +- +-@deftypefun @{@} @{struct hash_control *@} hash_new (void) +-Creates the hash table control structure. +-@end deftypefun +- +-@deftypefun @{@} void hash_die (struct hash_control *) +-Destroy a hash table. +-@end deftypefun +- +-@deftypefun @{@} void *hash_delete (struct hash_control *, const char *, int) +-Deletes entry from the hash table, returns the value it had. If the last +-arg is non-zero, free memory allocated for this entry and all entries +-allocated more recently than this entry. +-@end deftypefun +- +-@deftypefun @{@} void *hash_replace (struct hash_control *, const char *, void *) +-Updates the value for an entry already in the table, returning the old value. +-If no entry was found, just returns NULL. +-@end deftypefun +- +-@deftypefun @{@} @{const char *@} hash_insert (struct hash_control *, const char *, void *) +-Inserting a value already in the table is an error. +-Returns an error message or NULL. +-@end deftypefun +- +-@deftypefun @{@} @{const char *@} hash_jam (struct hash_control *, const char *, void *) +-Inserts if the value isn't already present, updates it if it is. +-@end deftypefun +- + @node Test suite + @section Test suite + @cindex test suite +diff -rup binutils.orig/gas/dw2gencfi.c binutils-2.35/gas/dw2gencfi.c +--- binutils.orig/gas/dw2gencfi.c 2021-08-11 17:33:12.205490395 +0100 ++++ binutils-2.35/gas/dw2gencfi.c 2021-08-11 17:39:16.182155202 +0100 +@@ -115,7 +115,7 @@ static bfd_boolean compact_eh; + #define compact_eh 0 + #endif + +-static struct hash_control *dwcfi_hash; ++static htab_t dwcfi_hash; + + /* Emit a single byte into the current segment. */ + +@@ -325,20 +325,10 @@ make_debug_seg (segT cseg, char *name, i + return r; + } + +-static void +-dwcfi_hash_insert (const char *name, struct dwcfi_seg_list *item) +-{ +- const char *error_string; +- +- if ((error_string = hash_jam (dwcfi_hash, name, (char *) item))) +- as_fatal (_("Inserting \"%s\" into structure table failed: %s"), +- name, error_string); +-} +- + static struct dwcfi_seg_list * + dwcfi_hash_find (char *name) + { +- return (struct dwcfi_seg_list *) hash_find (dwcfi_hash, name); ++ return (struct dwcfi_seg_list *) str_hash_find (dwcfi_hash, name); + } + + static struct dwcfi_seg_list * +@@ -349,7 +339,7 @@ dwcfi_hash_find_or_make (segT cseg, cons + + /* Initialize dwcfi_hash once. */ + if (!dwcfi_hash) +- dwcfi_hash = hash_new (); ++ dwcfi_hash = str_htab_create (); + + name = get_debugseg_name (cseg, base_name); + +@@ -358,7 +348,7 @@ dwcfi_hash_find_or_make (segT cseg, cons + { + item = alloc_debugseg_item (make_debug_seg (cseg, name, flags), 0, name); + +- dwcfi_hash_insert (item->seg_name, item); ++ str_hash_insert (dwcfi_hash, item->seg_name, (char *) item); + } + else + free (name); +diff -rup binutils.orig/gas/ecoff.c binutils-2.35/gas/ecoff.c +--- binutils.orig/gas/ecoff.c 2021-08-11 17:33:12.203490408 +0100 ++++ binutils-2.35/gas/ecoff.c 2021-08-11 17:39:23.430108707 +0100 +@@ -946,7 +946,7 @@ typedef struct efdr { + varray_t aux_syms; /* auxiliary symbols */ + struct efdr *next_file; /* next file descriptor */ + /* string/type hash tables */ +- struct hash_control *str_hash; /* string hash table */ ++ htab_t str_hash; /* string hash table */ + thash_t *thash_head[THASH_SIZE]; + } efdr_t; + +@@ -994,7 +994,7 @@ static const efdr_t init_file = { + + (struct efdr *)0, /* next_file: next file structure */ + +- (struct hash_control *)0, /* str_hash: string hash table */ ++ (htab_t)0, /* str_hash: string hash table */ + { 0 }, /* thash_head: type hash table */ + }; + +@@ -1111,7 +1111,7 @@ static const type_info_t type_info_init + + static varray_t file_desc = INIT_VARRAY (efdr_t); + +-static struct hash_control *tag_hash; ++static htab_t tag_hash; + + /* Static types for int and void. Also, remember the last function's + type (which is set up when we encounter the declaration for the +@@ -1408,7 +1408,7 @@ static char stabs_symbol[] = STABS_SYMBO + + static void add_varray_page (varray_t *vp); + static symint_t add_string (varray_t *vp, +- struct hash_control *hash_tbl, ++ htab_t hash_tbl, + const char *str, + shash_t **ret_hash); + static localsym_t *add_ecoff_symbol (const char *str, st_t type, +@@ -1475,7 +1475,7 @@ static lineno_list_t *allocate_lineno_li + void + ecoff_read_begin_hook (void) + { +- tag_hash = hash_new (); ++ tag_hash = str_htab_create (); + top_tag_head = allocate_thead (); + top_tag_head->first_tag = (tag_t *) NULL; + top_tag_head->free = (thead_t *) NULL; +@@ -1548,7 +1548,7 @@ add_varray_page (varray_t *vp /* varray + + static symint_t + add_string (varray_t *vp, /* string obstack */ +- struct hash_control *hash_tbl, /* ptr to hash table */ ++ htab_t hash_tbl, /* ptr to hash table */ + const char *str, /* string */ + shash_t **ret_hash /* return hash pointer */) + { +@@ -1558,11 +1558,9 @@ add_string (varray_t *vp, /* string ob + if (len >= PAGE_USIZE) + as_fatal (_("string too big (%lu bytes)"), len); + +- hash_ptr = (shash_t *) hash_find (hash_tbl, str); ++ hash_ptr = (shash_t *) str_hash_find (hash_tbl, str); + if (hash_ptr == (shash_t *) NULL) + { +- const char *err; +- + if (vp->objects_last_page + len >= PAGE_USIZE) + { + vp->num_allocated = +@@ -1580,10 +1578,7 @@ add_string (varray_t *vp, /* string ob + + strcpy (hash_ptr->string, str); + +- err = hash_insert (hash_tbl, str, (char *) hash_ptr); +- if (err) +- as_fatal (_("inserting \"%s\" into string hash table: %s"), +- str, err); ++ str_hash_insert (hash_tbl, str, (char *) hash_ptr); + } + + if (ret_hash != (shash_t **) NULL) +@@ -2009,13 +2004,12 @@ get_tag (const char *tag, /* tag name */ + bt_t basic_type /* bt_Struct, bt_Union, or bt_Enum */) + { + shash_t *hash_ptr; +- const char *err; + tag_t *tag_ptr; + + if (cur_file_ptr == (efdr_t *) NULL) + as_fatal (_("no current file pointer")); + +- hash_ptr = (shash_t *) hash_find (tag_hash, tag); ++ hash_ptr = (shash_t *) str_hash_find (tag_hash, tag); + + if (hash_ptr != (shash_t *) NULL + && hash_ptr->tag_ptr != (tag_t *) NULL) +@@ -2036,10 +2030,7 @@ get_tag (const char *tag, /* tag name */ + + perm = xstrdup (tag); + hash_ptr = allocate_shash (); +- err = hash_insert (tag_hash, perm, (char *) hash_ptr); +- if (err) +- as_fatal (_("inserting \"%s\" into tag hash table: %s"), +- tag, err); ++ str_hash_insert (tag_hash, perm, (char *) hash_ptr); + hash_ptr->string = perm; + } + +@@ -2281,7 +2272,7 @@ add_file (const char *file_name, int ind + fil_ptr->fake = fake; + + /* Allocate the string hash table. */ +- fil_ptr->str_hash = hash_new (); ++ fil_ptr->str_hash = str_htab_create (); + + /* Make sure 0 byte in string table is null */ + add_string (&fil_ptr->strings, +diff -rup binutils.orig/gas/hash.c binutils-2.35/gas/hash.c +--- binutils.orig/gas/hash.c 2021-08-11 17:33:12.485488589 +0100 ++++ binutils-2.35/gas/hash.c 2021-08-11 17:47:12.479099992 +0100 +@@ -18,578 +18,28 @@ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +-/* This version of the hash table code is a wholescale replacement of +- the old hash table code, which was fairly bad. This is based on +- the hash table code in BFD, but optimized slightly for the +- assembler. The assembler does not need to derive structures that +- are stored in the hash table. Instead, it always stores a pointer. +- The assembler uses the hash table mostly to store symbols, and we +- don't need to confuse the symbol structure with a hash table +- structure. */ +- + #include "as.h" +-#include "safe-ctype.h" +-#include "obstack.h" +- +-/* An entry in a hash table. */ +- +-struct hash_entry { +- /* Next entry for this hash code. */ +- struct hash_entry *next; +- /* String being hashed. */ +- const char *string; +- /* Hash code. This is the full hash code, not the index into the +- table. */ +- unsigned long hash; +- /* Pointer being stored in the hash table. */ +- void *data; +-}; +- +-/* A hash table. */ +- +-struct hash_control { +- /* The hash array. */ +- struct hash_entry **table; +- /* The number of slots in the hash table. */ +- unsigned int size; +- /* An obstack for this hash table. */ +- struct obstack memory; +- +-#ifdef HASH_STATISTICS +- /* Statistics. */ +- unsigned long lookups; +- unsigned long hash_compares; +- unsigned long string_compares; +- unsigned long insertions; +- unsigned long replacements; +- unsigned long deletions; +-#endif /* HASH_STATISTICS */ +-}; +- +-/* The default number of entries to use when creating a hash table. +- Note this value can be reduced to 4051 by using the command line +- switch --reduce-memory-overheads, or set to other values by using +- the --hash-size= switch. */ +- +-static unsigned long gas_hash_table_size = 65537; +- +-void +-set_gas_hash_table_size (unsigned long size) +-{ +- gas_hash_table_size = bfd_hash_set_default_size (size); +-} +- +-/* Create a hash table. This return a control block. */ +- +-struct hash_control * +-hash_new_sized (unsigned long size) +-{ +- unsigned long alloc; +- struct hash_control *ret; +- +- ret = XNEW (struct hash_control); +- obstack_begin (&ret->memory, chunksize); +- alloc = size * sizeof (struct hash_entry *); +- ret->table = (struct hash_entry **) obstack_alloc (&ret->memory, alloc); +- memset (ret->table, 0, alloc); +- ret->size = size; +- +-#ifdef HASH_STATISTICS +- ret->lookups = 0; +- ret->hash_compares = 0; +- ret->string_compares = 0; +- ret->insertions = 0; +- ret->replacements = 0; +- ret->deletions = 0; +-#endif +- +- return ret; +-} +- +-struct hash_control * +-hash_new (void) +-{ +- return hash_new_sized (gas_hash_table_size); +-} +- +-/* Delete a hash table, freeing all allocated memory. */ +- +-void +-hash_die (struct hash_control *table) +-{ +- obstack_free (&table->memory, 0); +- free (table); +-} +- +-/* Look up a string in a hash table. This returns a pointer to the +- hash_entry, or NULL if the string is not in the table. If PLIST is +- not NULL, this sets *PLIST to point to the start of the list which +- would hold this hash entry. If PHASH is not NULL, this sets *PHASH +- to the hash code for KEY. +- +- Each time we look up a string, we move it to the start of the list +- for its hash code, to take advantage of referential locality. */ +- +-static struct hash_entry * +-hash_lookup (struct hash_control *table, const char *key, size_t len, +- struct hash_entry ***plist, unsigned long *phash) +-{ +- unsigned long hash; +- size_t n; +- unsigned int c; +- unsigned int hindex; +- struct hash_entry **list; +- struct hash_entry *p; +- struct hash_entry *prev; +- +-#ifdef HASH_STATISTICS +- ++table->lookups; +-#endif +- +- hash = 0; +- for (n = 0; n < len; n++) +- { +- c = key[n]; +- hash += c + (c << 17); +- hash ^= hash >> 2; +- } +- hash += len + (len << 17); +- hash ^= hash >> 2; +- +- if (phash != NULL) +- *phash = hash; +- +- hindex = hash % table->size; +- list = table->table + hindex; +- +- if (plist != NULL) +- *plist = list; +- +- prev = NULL; +- for (p = *list; p != NULL; p = p->next) +- { +-#ifdef HASH_STATISTICS +- ++table->hash_compares; +-#endif +- +- if (p->hash == hash) +- { +-#ifdef HASH_STATISTICS +- ++table->string_compares; +-#endif +- +- if (strncmp (p->string, key, len) == 0 && p->string[len] == '\0') +- { +- if (prev != NULL) +- { +- prev->next = p->next; +- p->next = *list; +- *list = p; +- } +- +- return p; +- } +- } +- +- prev = p; +- } +- +- return NULL; +-} +- +-/* Insert an entry into a hash table. This returns NULL on success. +- On error, it returns a printable string indicating the error. It +- is considered to be an error if the entry already exists in the +- hash table. */ +- +-const char * +-hash_insert (struct hash_control *table, const char *key, void *val) +-{ +- struct hash_entry *p; +- struct hash_entry **list; +- unsigned long hash; +- +- p = hash_lookup (table, key, strlen (key), &list, &hash); +- if (p != NULL) +- return "exists"; +- +-#ifdef HASH_STATISTICS +- ++table->insertions; +-#endif +- +- p = (struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p)); +- p->string = key; +- p->hash = hash; +- p->data = val; +- +- p->next = *list; +- *list = p; +- +- return NULL; +-} +- +-/* Insert or replace an entry in a hash table. This returns NULL on +- success. On error, it returns a printable string indicating the +- error. If an entry already exists, its value is replaced. */ +- +-const char * +-hash_jam (struct hash_control *table, const char *key, void *val) +-{ +- struct hash_entry *p; +- struct hash_entry **list; +- unsigned long hash; +- +- p = hash_lookup (table, key, strlen (key), &list, &hash); +- if (p != NULL) +- { +-#ifdef HASH_STATISTICS +- ++table->replacements; +-#endif +- +- p->data = val; +- } +- else +- { +-#ifdef HASH_STATISTICS +- ++table->insertions; +-#endif +- +- p = (struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p)); +- p->string = key; +- p->hash = hash; +- p->data = val; +- +- p->next = *list; +- *list = p; +- } +- +- return NULL; +-} +- +-/* Replace an existing entry in a hash table. This returns the old +- value stored for the entry. If the entry is not found in the hash +- table, this does nothing and returns NULL. */ +- +-void * +-hash_replace (struct hash_control *table, const char *key, void *value) +-{ +- struct hash_entry *p; +- void *ret; +- +- p = hash_lookup (table, key, strlen (key), NULL, NULL); +- if (p == NULL) +- return NULL; +- +-#ifdef HASH_STATISTICS +- ++table->replacements; +-#endif +- +- ret = p->data; +- +- p->data = value; +- +- return ret; +-} +- +-/* Find an entry in a hash table, returning its value. Returns NULL +- if the entry is not found. */ +- +-void * +-hash_find (struct hash_control *table, const char *key) +-{ +- struct hash_entry *p; +- +- p = hash_lookup (table, key, strlen (key), NULL, NULL); +- if (p == NULL) +- return NULL; +- +- return p->data; +-} +- +-/* As hash_find, but KEY is of length LEN and is not guaranteed to be +- NUL-terminated. */ +- +-void * +-hash_find_n (struct hash_control *table, const char *key, size_t len) +-{ +- struct hash_entry *p; + +- p = hash_lookup (table, key, len, NULL, NULL); +- if (p == NULL) +- return NULL; +- +- return p->data; +-} +- +-/* Delete an entry from a hash table. This returns the value stored +- for that entry, or NULL if there is no such entry. */ +- +-void * +-hash_delete (struct hash_control *table, const char *key, int freeme) +-{ +- struct hash_entry *p; +- struct hash_entry **list; +- +- p = hash_lookup (table, key, strlen (key), &list, NULL); +- if (p == NULL) +- return NULL; +- +- if (p != *list) +- abort (); +- +-#ifdef HASH_STATISTICS +- ++table->deletions; +-#endif +- +- *list = p->next; +- +- if (freeme) +- obstack_free (&table->memory, p); +- +- return p->data; +-} +- +-/* Traverse a hash table. Call the function on every entry in the +- hash table. */ ++/* Insert ELEMENT into HTAB. If the element exists, it is overwritten. */ + + void +-hash_traverse (struct hash_control *table, +- void (*pfn) (const char *key, void *value)) ++htab_insert (htab_t htab, PTR element) + { +- unsigned int i; +- +- for (i = 0; i < table->size; ++i) +- { +- struct hash_entry *p; ++ void **slot = htab_find_slot (htab, element, INSERT); ++ if (slot != NULL && htab->del_f) ++ (*htab->del_f) (*slot); + +- for (p = table->table[i]; p != NULL; p = p->next) +- (*pfn) (p->string, p->data); +- } ++ *slot = element; + } + +-/* Print hash table statistics on the specified file. NAME is the +- name of the hash table, used for printing a header. */ ++/* Print statistics about a hash table. */ + + void +-hash_print_statistics (FILE *f ATTRIBUTE_UNUSED, +- const char *name ATTRIBUTE_UNUSED, +- struct hash_control *table ATTRIBUTE_UNUSED) ++htab_print_statistics (FILE *f, const char *name, htab_t table) + { +-#ifdef HASH_STATISTICS +- unsigned int i; +- unsigned long total; +- unsigned long empty; +- + fprintf (f, "%s hash statistics:\n", name); +- fprintf (f, "\t%lu lookups\n", table->lookups); +- fprintf (f, "\t%lu hash comparisons\n", table->hash_compares); +- fprintf (f, "\t%lu string comparisons\n", table->string_compares); +- fprintf (f, "\t%lu insertions\n", table->insertions); +- fprintf (f, "\t%lu replacements\n", table->replacements); +- fprintf (f, "\t%lu deletions\n", table->deletions); +- +- total = 0; +- empty = 0; +- for (i = 0; i < table->size; ++i) +- { +- struct hash_entry *p; +- +- if (table->table[i] == NULL) +- ++empty; +- else +- { +- for (p = table->table[i]; p != NULL; p = p->next) +- ++total; +- } +- } +- +- fprintf (f, "\t%g average chain length\n", (double) total / table->size); +- fprintf (f, "\t%lu empty slots\n", empty); +-#endif +-} +- +-#ifdef TEST +- +-/* This test program is left over from the old hash table code. */ +- +-/* Number of hash tables to maintain (at once) in any testing. */ +-#define TABLES (6) +- +-/* We can have 12 statistics. */ +-#define STATBUFSIZE (12) +- +-/* Display statistics here. */ +-int statbuf[STATBUFSIZE]; +- +-/* Human farts here. */ +-char answer[100]; +- +-/* We test many hash tables at once. */ +-char *hashtable[TABLES]; +- +-/* Points to current hash_control. */ +-char *h; +-char **pp; +-char *p; +-char *name; +-char *value; +-int size; +-int used; +-char command; +- +-/* Number 0:TABLES-1 of current hashed symbol table. */ +-int number; +- +-int +-main () +-{ +- void applicatee (); +- void destroy (); +- char *what (); +- int *ip; +- +- number = 0; +- h = 0; +- printf ("type h for help\n"); +- for (;;) +- { +- printf ("hash_test command: "); +- gets (answer); +- command = answer[0]; +- command = TOLOWER (command); /* Ecch! */ +- switch (command) +- { +- case '#': +- printf ("old hash table #=%d.\n", number); +- whattable (); +- break; +- case '?': +- for (pp = hashtable; pp < hashtable + TABLES; pp++) +- { +- printf ("address of hash table #%d control block is %xx\n", +- pp - hashtable, *pp); +- } +- break; +- case 'a': +- hash_traverse (h, applicatee); +- break; +- case 'd': +- hash_traverse (h, destroy); +- hash_die (h); +- break; +- case 'f': +- p = hash_find (h, name = what ("symbol")); +- printf ("value of \"%s\" is \"%s\"\n", name, p ? p : "NOT-PRESENT"); +- break; +- case 'h': +- printf ("# show old, select new default hash table number\n"); +- printf ("? display all hashtable control block addresses\n"); +- printf ("a apply a simple display-er to each symbol in table\n"); +- printf ("d die: destroy hashtable\n"); +- printf ("f find value of nominated symbol\n"); +- printf ("h this help\n"); +- printf ("i insert value into symbol\n"); +- printf ("j jam value into symbol\n"); +- printf ("n new hashtable\n"); +- printf ("r replace a value with another\n"); +- printf ("s say what %% of table is used\n"); +- printf ("q exit this program\n"); +- printf ("x delete a symbol from table, report its value\n"); +- break; +- case 'i': +- p = hash_insert (h, name = what ("symbol"), value = what ("value")); +- if (p) +- { +- printf ("symbol=\"%s\" value=\"%s\" error=%s\n", name, value, +- p); +- } +- break; +- case 'j': +- p = hash_jam (h, name = what ("symbol"), value = what ("value")); +- if (p) +- { +- printf ("symbol=\"%s\" value=\"%s\" error=%s\n", name, value, p); +- } +- break; +- case 'n': +- h = hashtable[number] = (char *) hash_new (); +- break; +- case 'q': +- exit (EXIT_SUCCESS); +- case 'r': +- p = hash_replace (h, name = what ("symbol"), value = what ("value")); +- printf ("old value was \"%s\"\n", p ? p : "{}"); +- break; +- case 's': +- hash_say (h, statbuf, STATBUFSIZE); +- for (ip = statbuf; ip < statbuf + STATBUFSIZE; ip++) +- { +- printf ("%d ", *ip); +- } +- printf ("\n"); +- break; +- case 'x': +- p = hash_delete (h, name = what ("symbol")); +- printf ("old value was \"%s\"\n", p ? p : "{}"); +- break; +- default: +- printf ("I can't understand command \"%c\"\n", command); +- break; +- } +- } ++ fprintf (f, "\t%u searches\n", table->searches); ++ fprintf (f, "\t%u collisions\n", table->collisions); ++ fprintf (f, "\t%lu elements\n", (unsigned long) htab_elements (table)); ++ fprintf (f, "\t%lu table size\n", (unsigned long) htab_size (table)); + } +- +-char * +-what (description) +- char *description; +-{ +- printf (" %s : ", description); +- gets (answer); +- return xstrdup (answer); +-} +- +-void +-destroy (string, value) +- char *string; +- char *value; +-{ +- free (string); +- free (value); +-} +- +-void +-applicatee (string, value) +- char *string; +- char *value; +-{ +- printf ("%.20s-%.20s\n", string, value); +-} +- +-/* Determine number: what hash table to use. +- Also determine h: points to hash_control. */ +- +-void +-whattable () +-{ +- for (;;) +- { +- printf (" what hash table (%d:%d) ? ", 0, TABLES - 1); +- gets (answer); +- sscanf (answer, "%d", &number); +- if (number >= 0 && number < TABLES) +- { +- h = hashtable[number]; +- if (!h) +- { +- printf ("warning: current hash-table-#%d. has no hash-control\n", number); +- } +- return; +- } +- else +- { +- printf ("invalid hash table number: %d\n", number); +- } +- } +-} +- +-#endif /* TEST */ +Only in binutils-2.35/gas: hash.c.orig +Only in binutils-2.35/gas: hash.c.rej +diff -rup binutils.orig/gas/hash.h binutils-2.35/gas/hash.h +--- binutils.orig/gas/hash.h 2021-08-11 17:33:12.203490408 +0100 ++++ binutils-2.35/gas/hash.h 2021-08-11 17:50:49.581707254 +0100 +@@ -21,68 +21,101 @@ + #ifndef HASH_H + #define HASH_H + +-struct hash_control; ++/* Insert ELEMENT into HTAB. If REPLACE is non-zero existing elements ++ are overwritten. If ELEMENT already exists, a pointer to the slot ++ is returned. Otherwise NULL is returned. */ ++ ++extern void htab_insert (htab_t, void * /* element */); ++ ++/* Print statistics about a hash table. */ ++ ++extern void htab_print_statistics (FILE *f, const char *name, htab_t table); ++ ++/* String hash table functions. */ ++ ++struct string_tuple ++{ ++ const char *key; ++ char *value; ++}; ++ ++typedef struct string_tuple string_tuple_t; ++ ++/* Hash function for a string_tuple. */ ++ ++static hashval_t ++hash_string_tuple (const void *e) ++{ ++ string_tuple_t *tuple = (string_tuple_t *) e; ++ return htab_hash_string (tuple->key); ++} ++ ++/* Equality function for a string_tuple. */ ++ ++static int ++eq_string_tuple (const void *a, const void *b) ++{ ++ const string_tuple_t *ea = (const string_tuple_t *) a; ++ const string_tuple_t *eb = (const string_tuple_t *) b; ++ ++ return strcmp (ea->key, eb->key) == 0; ++} ++ ++static inline string_tuple_t * ++string_tuple_alloc (const char *key, char *value) ++{ ++ string_tuple_t *tuple = XNEW (string_tuple_t); ++ tuple->key = key; ++ tuple->value = value; ++ return tuple; ++} ++ ++static inline void * ++str_hash_find (htab_t table, const char *key) ++{ ++ string_tuple_t needle = { key, NULL }; ++ string_tuple_t *tuple = htab_find (table, &needle); ++ return tuple != NULL ? tuple->value : NULL; ++} ++ ++static inline void * ++str_hash_find_n (htab_t table, const char *key, size_t n) ++{ ++ char *tmp = XNEWVEC (char, n + 1); ++ memcpy (tmp, key, n); ++ tmp[n] = '\0'; ++ string_tuple_t needle = { tmp, NULL }; ++ string_tuple_t *tuple = htab_find (table, &needle); ++ free (tmp); ++ return tuple != NULL ? tuple->value : NULL; ++} ++ ++static inline void ++str_hash_delete (htab_t table, const char *key) ++{ ++ string_tuple_t needle = { key, NULL }; ++ htab_remove_elt (table, &needle); ++} ++ ++static inline void ++str_hash_insert (htab_t table, const char *key, void *value) ++{ ++ htab_insert (table, string_tuple_alloc (key, value)); ++} ++ ++static inline htab_t ++str_htab_create (void) ++{ ++ return htab_create_alloc (16, hash_string_tuple, eq_string_tuple, ++ NULL, xcalloc, free); ++} + +-/* Set the size of the hash table used. */ ++/* Insert ELEMENT into HTAB. If the element exists, it is overwritten. */ + +-void set_gas_hash_table_size (unsigned long); ++extern void htab_insert (htab_t, void *); + +-/* Create a hash table. This return a control block. */ ++/* Print statistics about a hash table. */ + +-extern struct hash_control *hash_new (void); +-extern struct hash_control *hash_new_sized (unsigned long); +- +-/* Delete a hash table, freeing all allocated memory. */ +- +-extern void hash_die (struct hash_control *); +- +-/* Insert an entry into a hash table. This returns NULL on success. +- On error, it returns a printable string indicating the error. It +- is considered to be an error if the entry already exists in the +- hash table. */ +- +-extern const char *hash_insert (struct hash_control *, +- const char *key, void *value); +- +-/* Insert or replace an entry in a hash table. This returns NULL on +- success. On error, it returns a printable string indicating the +- error. If an entry already exists, its value is replaced. */ +- +-extern const char *hash_jam (struct hash_control *, +- const char *key, void *value); +- +-/* Replace an existing entry in a hash table. This returns the old +- value stored for the entry. If the entry is not found in the hash +- table, this does nothing and returns NULL. */ +- +-extern void *hash_replace (struct hash_control *, const char *key, +- void *value); +- +-/* Find an entry in a hash table, returning its value. Returns NULL +- if the entry is not found. */ +- +-extern void *hash_find (struct hash_control *, const char *key); +- +-/* As hash_find, but KEY is of length LEN and is not guaranteed to be +- NUL-terminated. */ +- +-extern void *hash_find_n (struct hash_control *, const char *key, size_t len); +- +-/* Delete an entry from a hash table. This returns the value stored +- for that entry, or NULL if there is no such entry. */ +- +-extern void *hash_delete (struct hash_control *, const char *key, int); +- +-/* Traverse a hash table. Call the function on every entry in the +- hash table. */ +- +-extern void hash_traverse (struct hash_control *, +- void (*pfn) (const char *key, void *value)); +- +-/* Print hash table statistics on the specified file. NAME is the +- name of the hash table, used for printing a header. */ +- +-extern void hash_print_statistics (FILE *, const char *name, +- struct hash_control *); ++extern void htab_print_statistics (FILE *f, const char *name, htab_t table); + + #endif /* HASH_H */ +Only in binutils-2.35/gas: hash.h.orig +Only in binutils-2.35/gas: hash.h.rej +diff -rup binutils.orig/gas/macro.c binutils-2.35/gas/macro.c +--- binutils.orig/gas/macro.c 2021-08-11 17:33:12.204490402 +0100 ++++ binutils-2.35/gas/macro.c 2021-08-11 17:43:57.989347554 +0100 +@@ -44,7 +44,7 @@ + + /* The macro hash table. */ + +-struct hash_control *macro_hash; ++struct htab *macro_hash; + + /* Whether any macros have been defined. */ + +@@ -76,7 +76,8 @@ void + macro_init (int alternate, int mri, int strip_at, + size_t (*exp) (const char *, size_t, sb *, offsetT *)) + { +- macro_hash = hash_new (); ++ macro_hash = htab_create_alloc (16, hash_macro_entry, eq_macro_entry, ++ NULL, xcalloc, free); + macro_defined = 0; + macro_alternate = alternate; + macro_mri = mri; +@@ -566,8 +567,8 @@ do_formals (macro_entry *macro, size_t i + } + + /* Add to macro's hash table. */ +- if (! hash_find (macro->formal_hash, name)) +- hash_jam (macro->formal_hash, name, formal); ++ if (formal_entry_find (macro->formal_hash, name) == NULL) ++ htab_insert (macro->formal_hash, formal_entry_alloc (name, formal)); + else + as_bad_where (macro->file, + macro->line, +@@ -605,13 +606,13 @@ do_formals (macro_entry *macro, size_t i + sb_add_string (&formal->name, name); + + /* Add to macro's hash table. */ +- if (hash_find (macro->formal_hash, name)) ++ if (formal_entry_find (macro->formal_hash, name)) + as_bad_where (macro->file, + macro->line, + _("Reserved word `%s' used as parameter in macro `%s'"), + name, + macro->name); +- hash_jam (macro->formal_hash, name, formal); ++ htab_insert (macro->formal_hash, formal_entry_alloc (name, formal)); + + formal->index = NARG_INDEX; + *p = formal; +@@ -635,7 +636,7 @@ free_macro (macro_entry *macro) + formal = formal->next; + del_formal (f); + } +- hash_die (macro->formal_hash); ++ htab_delete (macro->formal_hash); + sb_kill (¯o->sub); + free (macro); + } +@@ -662,7 +663,8 @@ define_macro (size_t idx, sb *in, sb *la + + macro->formal_count = 0; + macro->formals = 0; +- macro->formal_hash = hash_new_sized (7); ++ macro->formal_hash = htab_create_alloc (7, hash_formal_entry, eq_formal_entry, ++ NULL, xcalloc, free); + + idx = sb_skip_white (idx, in); + if (! buffer_and_nest ("MACRO", "ENDM", ¯o->sub, get_line)) +@@ -707,10 +709,10 @@ define_macro (size_t idx, sb *in, sb *la + /* And stick it in the macro hash table. */ + for (idx = 0; idx < name.len; idx++) + name.ptr[idx] = TOLOWER (name.ptr[idx]); +- if (hash_find (macro_hash, macro->name)) ++ if (macro_entry_find (macro_hash, macro->name)) + error = _("Macro `%s' was already defined"); + if (!error) +- error = hash_jam (macro_hash, macro->name, (void *) macro); ++ htab_insert (macro_hash, macro_entry_alloc (macro->name, macro)); + + if (namep != NULL) + *namep = macro->name; +@@ -740,7 +742,7 @@ get_apost_token (size_t idx, sb *in, sb + /* Substitute the actual value for a formal parameter. */ + + static size_t +-sub_actual (size_t start, sb *in, sb *t, struct hash_control *formal_hash, ++sub_actual (size_t start, sb *in, sb *t, struct htab *formal_hash, + int kind, sb *out, int copyifnotthere) + { + size_t src; +@@ -754,7 +756,7 @@ sub_actual (size_t start, sb *in, sb *t, + && (src == start || in->ptr[src - 1] != '@')) + ptr = NULL; + else +- ptr = (formal_entry *) hash_find (formal_hash, sb_terminate (t)); ++ ptr = formal_entry_find (formal_hash, sb_terminate (t)); + if (ptr) + { + if (ptr->actual.len) +@@ -790,7 +792,7 @@ sub_actual (size_t start, sb *in, sb *t, + + static const char * + macro_expand_body (sb *in, sb *out, formal_entry *formals, +- struct hash_control *formal_hash, const macro_entry *macro) ++ struct htab *formal_hash, const macro_entry *macro) + { + sb t; + size_t src = 0; +@@ -912,7 +914,7 @@ macro_expand_body (sb *in, sb *out, form + + src = get_token (src, in, &f->name); + name = sb_terminate (&f->name); +- if (! hash_find (formal_hash, name)) ++ if (formal_entry_find (formal_hash, name) == NULL) + { + static int loccnt; + char buf[20]; +@@ -924,9 +926,7 @@ macro_expand_body (sb *in, sb *out, form + sprintf (buf, IS_ELF ? ".LL%04x" : "LL%04x", ++loccnt); + sb_add_string (&f->actual, buf); + +- err = hash_jam (formal_hash, name, f); +- if (err != NULL) +- break; ++ htab_insert (formal_hash, formal_entry_alloc (name, f)); + } + else + { +@@ -966,7 +966,7 @@ macro_expand_body (sb *in, sb *out, form + + sb_reset (&t); + src = get_token (src + 2, in, &t); +- ptr = (formal_entry *) hash_find (formal_hash, sb_terminate (&t)); ++ ptr = formal_entry_find (formal_hash, sb_terminate (&t)); + if (ptr == NULL) + { + /* FIXME: We should really return a warning string here, +@@ -1010,7 +1010,8 @@ macro_expand_body (sb *in, sb *out, form + + f = loclist->next; + name = sb_terminate (&loclist->name); +- hash_delete (formal_hash, name, f == NULL); ++ formal_hash_entry_t needle = { name, NULL }; ++ htab_remove_elt (formal_hash, &needle); + del_formal (loclist); + loclist = f; + } +@@ -1095,7 +1096,7 @@ macro_expand (size_t idx, sb *in, macro_ + } + + /* Lookup the formal in the macro's list. */ +- ptr = (formal_entry *) hash_find (m->formal_hash, sb_terminate (&t)); ++ ptr = formal_entry_find (m->formal_hash, sb_terminate (&t)); + if (!ptr) + { + as_bad (_("Parameter named `%s' does not exist for macro `%s'"), +@@ -1193,7 +1194,7 @@ macro_expand (size_t idx, sb *in, macro_ + + sb_reset (&t); + sb_add_string (&t, macro_strip_at ? "$NARG" : "NARG"); +- ptr = (formal_entry *) hash_find (m->formal_hash, sb_terminate (&t)); ++ ptr = formal_entry_find (m->formal_hash, sb_terminate (&t)); + sprintf (buffer, "%d", narg); + sb_add_string (&ptr->actual, buffer); + } +@@ -1253,7 +1254,7 @@ check_macro (const char *line, sb *expan + for (cls = copy; *cls != '\0'; cls ++) + *cls = TOLOWER (*cls); + +- macro = (macro_entry *) hash_find (macro_hash, copy); ++ macro = macro_entry_find (macro_hash, copy); + free (copy); + + if (macro == NULL) +@@ -1294,14 +1295,14 @@ delete_macro (const char *name) + /* We can only ask hash_delete to free memory if we are deleting + macros in reverse order to their definition. + So just clear out the entry. */ +- if ((macro = (macro_entry *) hash_find (macro_hash, copy)) != NULL) ++ macro = macro_entry_find (macro_hash, copy); ++ if (macro) + { +- hash_jam (macro_hash, copy, NULL); ++ htab_insert (macro_hash, macro_entry_alloc (copy, NULL)); + free_macro (macro); + } + else + as_warn (_("Attempt to purge non-existing macro `%s'"), copy); +- free (copy); + } + + /* Handle the MRI IRP and IRPC pseudo-ops. These are handled as a +@@ -1313,8 +1314,8 @@ expand_irp (int irpc, size_t idx, sb *in + { + sb sub; + formal_entry f; +- struct hash_control *h; +- const char *err; ++ struct htab *h; ++ const char *err = NULL; + + idx = sb_skip_white (idx, in); + +@@ -1330,10 +1331,10 @@ expand_irp (int irpc, size_t idx, sb *in + if (f.name.len == 0) + return _("missing model parameter"); + +- h = hash_new (); +- err = hash_jam (h, sb_terminate (&f.name), &f); +- if (err != NULL) +- return err; ++ h = htab_create_alloc (16, hash_formal_entry, eq_formal_entry, ++ NULL, xcalloc, free); ++ ++ htab_insert (h, formal_entry_alloc (sb_terminate (&f.name), &f)); + + f.index = 1; + f.next = NULL; +@@ -1392,7 +1393,7 @@ expand_irp (int irpc, size_t idx, sb *in + } + } + +- hash_die (h); ++ htab_delete (h); + sb_kill (&f.actual); + sb_kill (&f.def); + sb_kill (&f.name); +diff -rup binutils.orig/gas/macro.h binutils-2.35/gas/macro.h +--- binutils.orig/gas/macro.h 2021-08-11 17:33:12.484488595 +0100 ++++ binutils-2.35/gas/macro.h 2021-08-11 17:43:57.989347554 +0100 +@@ -63,7 +63,7 @@ typedef struct macro_struct + sb sub; /* Substitution text. */ + int formal_count; /* Number of formal args. */ + formal_entry *formals; /* Pointer to list of formal_structs. */ +- struct hash_control *formal_hash; /* Hash table of formals. */ ++ struct htab *formal_hash; /* Hash table of formals. */ + const char *name; /* Macro name. */ + const char *file; /* File the macro was defined in. */ + unsigned int line; /* Line number of definition. */ +@@ -79,7 +79,97 @@ extern int macro_nest; + + /* The macro hash table. */ + +-extern struct hash_control *macro_hash; ++extern struct htab *macro_hash; ++ ++struct macro_hash_entry ++{ ++ const char *name; ++ macro_entry *macro; ++}; ++ ++typedef struct macro_hash_entry macro_hash_entry_t; ++ ++/* Hash function for a macro_hash_entry. */ ++ ++static inline hashval_t ++hash_macro_entry (const void *e) ++{ ++ const macro_hash_entry_t *entry = (const macro_hash_entry_t *) e; ++ return htab_hash_string (entry->name); ++} ++ ++/* Equality function for a macro_hash_entry. */ ++ ++static inline int ++eq_macro_entry (const void *a, const void *b) ++{ ++ const macro_hash_entry_t *ea = (const macro_hash_entry_t *) a; ++ const macro_hash_entry_t *eb = (const macro_hash_entry_t *) b; ++ ++ return strcmp (ea->name, eb->name) == 0; ++} ++ ++static inline macro_hash_entry_t * ++macro_entry_alloc (const char *name, macro_entry *macro) ++{ ++ macro_hash_entry_t *entry = XNEW (macro_hash_entry_t); ++ entry->name = name; ++ entry->macro = macro; ++ return entry; ++} ++ ++static inline macro_entry * ++macro_entry_find (htab_t table, const char *name) ++{ ++ macro_hash_entry_t needle = { name, NULL }; ++ macro_hash_entry_t *entry = htab_find (table, &needle); ++ return entry != NULL ? entry->macro : NULL; ++} ++ ++struct formal_hash_entry ++{ ++ const char *name; ++ formal_entry *formal; ++}; ++ ++typedef struct formal_hash_entry formal_hash_entry_t; ++ ++/* Hash function for a macro_hash_entry. */ ++ ++static inline hashval_t ++hash_formal_entry (const void *e) ++{ ++ const formal_hash_entry_t *entry = (const formal_hash_entry_t *) e; ++ return htab_hash_string (entry->name); ++} ++ ++/* Equality function for a formal_hash_entry. */ ++ ++static inline int ++eq_formal_entry (const void *a, const void *b) ++{ ++ const formal_hash_entry_t *ea = (const formal_hash_entry_t *) a; ++ const formal_hash_entry_t *eb = (const formal_hash_entry_t *) b; ++ ++ return strcmp (ea->name, eb->name) == 0; ++} ++ ++static inline formal_hash_entry_t * ++formal_entry_alloc (const char *name, formal_entry *formal) ++{ ++ formal_hash_entry_t *entry = XNEW (formal_hash_entry_t); ++ entry->name = name; ++ entry->formal = formal; ++ return entry; ++} ++ ++static inline formal_entry * ++formal_entry_find (htab_t table, const char *name) ++{ ++ formal_hash_entry_t needle = { name, NULL }; ++ formal_hash_entry_t *entry = htab_find (table, &needle); ++ return entry != NULL ? entry->formal : NULL; ++} + + extern int buffer_and_nest (const char *, const char *, sb *, + size_t (*) (sb *)); +diff -rup binutils.orig/gas/read.c binutils-2.35/gas/read.c +--- binutils.orig/gas/read.c 2021-08-11 17:33:12.205490395 +0100 ++++ binutils-2.35/gas/read.c 2021-08-11 17:44:41.265069954 +0100 +@@ -293,7 +293,53 @@ address_bytes (void) + + /* Set up pseudo-op tables. */ + +-static struct hash_control *po_hash; ++struct po_entry ++{ ++ const char *poc_name; ++ ++ const pseudo_typeS *pop; ++}; ++ ++typedef struct po_entry po_entry_t; ++ ++/* Hash function for a po_entry. */ ++ ++static hashval_t ++hash_po_entry (const void *e) ++{ ++ const po_entry_t *entry = (const po_entry_t *) e; ++ return htab_hash_string (entry->poc_name); ++} ++ ++/* Equality function for a po_entry. */ ++ ++static int ++eq_po_entry (const void *a, const void *b) ++{ ++ const po_entry_t *ea = (const po_entry_t *) a; ++ const po_entry_t *eb = (const po_entry_t *) b; ++ ++ return strcmp (ea->poc_name, eb->poc_name) == 0; ++} ++ ++static po_entry_t * ++po_entry_alloc (const char *poc_name, const pseudo_typeS *pop) ++{ ++ po_entry_t *entry = XNEW (po_entry_t); ++ entry->poc_name = poc_name; ++ entry->pop = pop; ++ return entry; ++} ++ ++static const pseudo_typeS * ++po_entry_find (htab_t table, const char *poc_name) ++{ ++ po_entry_t needle = { poc_name, NULL }; ++ po_entry_t *entry = htab_find (table, &needle); ++ return entry != NULL ? entry->pop : NULL; ++} ++ ++static struct htab *po_hash; + + static const pseudo_typeS potable[] = { + {"abort", s_abort, 0}, +@@ -512,14 +558,14 @@ static const char *pop_table_name; + void + pop_insert (const pseudo_typeS *table) + { +- const char *errtxt; + const pseudo_typeS *pop; + for (pop = table; pop->poc_name; pop++) + { +- errtxt = hash_insert (po_hash, pop->poc_name, (char *) pop); +- if (errtxt && (!pop_override_ok || strcmp (errtxt, "exists"))) +- as_fatal (_("error constructing %s pseudo-op table: %s"), pop_table_name, +- errtxt); ++ int exists = po_entry_find (po_hash, pop->poc_name) != NULL; ++ if (!pop_override_ok && exists) ++ as_fatal (_("error constructing %s pseudo-op table"), pop_table_name); ++ else if (!exists) ++ htab_insert (po_hash, po_entry_alloc (pop->poc_name, pop)); + } + } + +@@ -538,7 +584,8 @@ pop_insert (const pseudo_typeS *table) + static void + pobegin (void) + { +- po_hash = hash_new (); ++ po_hash = htab_create_alloc (16, hash_po_entry, eq_po_entry, NULL, ++ xcalloc, xfree); + + /* Do the target-specific pseudo ops. */ + pop_table_name = "md"; +@@ -817,7 +864,7 @@ read_a_source_file (const char *name) + char next_char; + char *s; /* String of symbol, '\0' appended. */ + int temp; +- pseudo_typeS *pop; ++ const pseudo_typeS *pop; + + #ifdef WARN_COMMENTS + found_comment = 0; +@@ -1067,7 +1114,7 @@ read_a_source_file (const char *name) + { + /* The MRI assembler uses pseudo-ops without + a period. */ +- pop = (pseudo_typeS *) hash_find (po_hash, s); ++ pop = po_entry_find (po_hash, s); + if (pop != NULL && pop->poc_handler == NULL) + pop = NULL; + } +@@ -1082,7 +1129,7 @@ read_a_source_file (const char *name) + already know that the pseudo-op begins with a '.'. */ + + if (pop == NULL) +- pop = (pseudo_typeS *) hash_find (po_hash, s + 1); ++ pop = po_entry_find (po_hash, s + 1); + if (pop && !pop->poc_handler) + pop = NULL; + +@@ -2723,10 +2770,10 @@ s_macro (int ignore ATTRIBUTE_UNUSED) + } + + if (((NO_PSEUDO_DOT || flag_m68k_mri) +- && hash_find (po_hash, name) != NULL) ++ && po_entry_find (po_hash, name) != NULL) + || (!flag_m68k_mri + && *name == '.' +- && hash_find (po_hash, name + 1) != NULL)) ++ && po_entry_find (po_hash, name + 1) != NULL)) + as_warn_where (file, + line, + _("attempt to redefine pseudo-op `%s' ignored"), +@@ -6112,7 +6159,7 @@ s_ignore (int arg ATTRIBUTE_UNUSED) + void + read_print_statistics (FILE *file) + { +- hash_print_statistics (file, "pseudo-op table", po_hash); ++ htab_print_statistics (file, "pseudo-op table", po_hash); + } + + /* Inserts the given line into the input stream. +Only in binutils-2.35/gas: read.c.orig +Only in binutils-2.35/gas: read.c.rej +diff -rup binutils.orig/gas/symbols.c binutils-2.35/gas/symbols.c +--- binutils.orig/gas/symbols.c 2021-08-11 17:33:12.486488583 +0100 ++++ binutils-2.35/gas/symbols.c 2021-08-11 17:44:52.579997372 +0100 +@@ -151,6 +151,57 @@ struct local_symbol + #endif + }; + ++struct symbol_entry ++{ ++ const char *symbol_name; ++ hashval_t hash; ++ void *symbol; ++}; ++ ++typedef struct symbol_entry symbol_entry_t; ++ ++/* Hash function for a symbol_entry. */ ++ ++static hashval_t ++hash_symbol_entry (const void *e) ++{ ++ symbol_entry_t *entry = (symbol_entry_t *) e; ++ if (entry->hash == 0) ++ entry->hash = htab_hash_string (entry->symbol_name); ++ ++ return entry->hash; ++} ++ ++/* Equality function for a symbol_entry. */ ++ ++static int ++eq_symbol_entry (const void *a, const void *b) ++{ ++ const symbol_entry_t *ea = (const symbol_entry_t *) a; ++ const symbol_entry_t *eb = (const symbol_entry_t *) b; ++ ++ return strcmp (ea->symbol_name, eb->symbol_name) == 0; ++} ++ ++static symbol_entry_t * ++symbol_entry_alloc (const char *symbol_name, void *symbol) ++{ ++ symbol_entry_t *entry = XNEW (symbol_entry_t); ++ entry->symbol_name = symbol_name; ++ entry->hash = 0; ++ entry->symbol = symbol; ++ return entry; ++} ++ ++static void * ++symbol_entry_find (htab_t table, const char *symbol_name) ++{ ++ symbol_entry_t needle = { symbol_name, 0, NULL }; ++ symbol_entry_t *entry = htab_find (table, &needle); ++ return entry != NULL ? entry->symbol : NULL; ++} ++ ++ + #define local_symbol_converted_p(l) ((l)->lsy_section == reg_section) + #define local_symbol_mark_converted(l) ((l)->lsy_section = reg_section) + #define local_symbol_resolved_p(l) ((l)->lsy_flags.sy_resolved) +@@ -169,10 +220,10 @@ extern int new_broken_words; + #endif + + /* symbol-name => struct symbol pointer */ +-static struct hash_control *sy_hash; ++static htab_t sy_hash; + + /* Table of local symbols. */ +-static struct hash_control *local_hash; ++static htab_t local_hash; + + /* Below are commented in "symbols.h". */ + symbolS *symbol_rootP; +@@ -340,7 +391,7 @@ local_symbol_make (const char *name, seg + local_symbol_set_frag (ret, frag); + ret->lsy_value = val; + +- hash_jam (local_hash, name_copy, (void *) ret); ++ htab_insert (local_hash, symbol_entry_alloc (name_copy, ret)); + + return ret; + } +@@ -377,7 +428,7 @@ local_symbol_convert (struct local_symbo + local_symbol_mark_converted (locsym); + local_symbol_set_real_symbol (locsym, ret); + +- hash_jam (local_hash, locsym->lsy_name, NULL); ++ htab_insert (local_hash, symbol_entry_alloc (locsym->lsy_name, NULL)); + + return ret; + } +@@ -616,26 +667,16 @@ colon (/* Just seen "x:" - rattle symbol + void + symbol_table_insert (symbolS *symbolP) + { +- const char *error_string; +- + know (symbolP); + know (S_GET_NAME (symbolP)); + + if (LOCAL_SYMBOL_CHECK (symbolP)) +- { +- error_string = hash_jam (local_hash, S_GET_NAME (symbolP), +- (void *) symbolP); +- if (error_string != NULL) +- as_fatal (_("inserting \"%s\" into symbol table failed: %s"), +- S_GET_NAME (symbolP), error_string); +- return; +- } +- +- if ((error_string = hash_jam (sy_hash, S_GET_NAME (symbolP), (void *) symbolP))) +- { +- as_fatal (_("inserting \"%s\" into symbol table failed: %s"), +- S_GET_NAME (symbolP), error_string); +- } /* on error */ ++ htab_insert (local_hash, ++ symbol_entry_alloc (S_GET_NAME (symbolP), ++ (struct local_symbol *)symbolP)); ++ else ++ htab_insert (sy_hash, symbol_entry_alloc (S_GET_NAME (symbolP), ++ (struct local_symbol *)symbolP)); + } + + /* If a symbol name does not exist, create it as undefined, and insert +@@ -869,14 +910,11 @@ symbol_find_exact (const char *name) + symbolS * + symbol_find_exact_noref (const char *name, int noref) + { +- struct local_symbol *locsym; +- symbolS* sym; ++ symbolS *sym = symbol_entry_find (local_hash, name); ++ if (sym) ++ return sym; + +- locsym = (struct local_symbol *) hash_find (local_hash, name); +- if (locsym != NULL) +- return (symbolS *) locsym; +- +- sym = ((symbolS *) hash_find (sy_hash, name)); ++ sym = symbol_entry_find (sy_hash, name); + + /* Any references to the symbol, except for the reference in + .weakref, must clear this flag, such that the symbol does not +@@ -1670,15 +1708,16 @@ resolve_symbol_value (symbolS *symp) + return final_val; + } + +-static void resolve_local_symbol (const char *, void *); +- + /* A static function passed to hash_traverse. */ + +-static void +-resolve_local_symbol (const char *key ATTRIBUTE_UNUSED, void *value) ++static int ++resolve_local_symbol (void **slot, void *arg ATTRIBUTE_UNUSED) + { +- if (value != NULL) +- resolve_symbol_value ((symbolS *) value); ++ symbol_entry_t *entry = *((symbol_entry_t **) slot); ++ if (entry->symbol != NULL) ++ resolve_symbol_value ((symbolS *) entry->symbol); ++ ++ return 1; + } + + /* Resolve all local symbols. */ +@@ -1686,7 +1725,7 @@ resolve_local_symbol (const char *key AT + void + resolve_local_symbol_values (void) + { +- hash_traverse (local_hash, resolve_local_symbol); ++ htab_traverse (local_hash, resolve_local_symbol, NULL); + } + + /* Obtain the current value of a symbol without changing any +@@ -2988,8 +3027,10 @@ symbol_begin (void) + { + symbol_lastP = NULL; + symbol_rootP = NULL; /* In case we have 0 symbols (!!) */ +- sy_hash = hash_new (); +- local_hash = hash_new (); ++ sy_hash = htab_create_alloc (16, hash_symbol_entry, eq_symbol_entry, ++ NULL, xcalloc, free); ++ local_hash = htab_create_alloc (16, hash_symbol_entry, eq_symbol_entry, ++ NULL, xcalloc, free); + + memset ((char *) (&abs_symbol), '\0', sizeof (abs_symbol)); + #if defined (EMIT_SECTION_SYMBOLS) || !defined (RELOC_REQUIRES_SYMBOL) +@@ -3244,8 +3285,8 @@ print_expr (expressionS *exp) + void + symbol_print_statistics (FILE *file) + { +- hash_print_statistics (file, "symbol table", sy_hash); +- hash_print_statistics (file, "mini local symbol table", local_hash); ++ htab_print_statistics (file, "symbol table", sy_hash); ++ htab_print_statistics (file, "mini local symbol table", local_hash); + fprintf (file, "%lu mini local symbols created, %lu converted\n", + local_symbol_count, local_symbol_conversion_count); + } diff --git a/binutils-gcc-10-fixes.patch b/binutils-gcc-10-fixes.patch new file mode 100644 index 0000000..ba96bb7 --- /dev/null +++ b/binutils-gcc-10-fixes.patch @@ -0,0 +1,170 @@ +diff -rup binutils.orig/gold/gdb-index.cc binutils-2.34.0/gold/gdb-index.cc +--- binutils.orig/gold/gdb-index.cc 2020-07-24 09:12:29.241306445 +0100 ++++ binutils-2.34.0/gold/gdb-index.cc 2020-07-24 09:15:48.332095898 +0100 +@@ -817,7 +817,7 @@ Gdb_index_info_reader::get_qualified_nam + void + Gdb_index_info_reader::record_cu_ranges(Dwarf_die* die) + { +- unsigned int shndx; ++ unsigned int shndx = 0; + unsigned int shndx2; + + off_t ranges_offset = die->ref_attribute(elfcpp::DW_AT_ranges, &shndx); +diff -rup binutils.orig/gold/layout.cc binutils-2.34.0/gold/layout.cc +--- binutils.orig/gold/layout.cc 2020-07-24 09:12:29.243306433 +0100 ++++ binutils-2.34.0/gold/layout.cc 2020-07-24 09:15:11.464320064 +0100 +@@ -1986,7 +1986,7 @@ Layout::attach_allocated_section_to_segm + seg_flags |= os->extra_segment_flags(); + + // Check for --section-start. +- uint64_t addr; ++ uint64_t addr = 0; + bool is_address_set = parameters->options().section_start(os->name(), &addr); + + // In general the only thing we really care about for PT_LOAD +diff -rup binutils.orig/binutils/dlltool.c binutils-2.34.0/binutils/dlltool.c +--- binutils.orig/binutils/dlltool.c 2020-07-24 09:12:28.974308069 +0100 ++++ binutils-2.34.0/binutils/dlltool.c 2020-07-24 12:09:37.527121295 +0100 +@@ -1305,7 +1305,7 @@ run (const char *what, char *args) + int pid, wait_status; + int i; + const char **argv; +- char *errmsg_fmt, *errmsg_arg; ++ char *errmsg_fmt = "", *errmsg_arg = ""; + char *temp_base = choose_temp_base (); + + inform (_("run: %s %s"), what, args); +diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c +--- binutils.orig/gas/config/tc-arm.c 2020-07-24 09:12:32.368287432 +0100 ++++ binutils-2.34.0/gas/config/tc-arm.c 2020-07-24 12:14:19.842360634 +0100 +@@ -28416,9 +28416,12 @@ md_apply_fix (fixS * fixP, + perform relaxation. */ + if (value == -2) + { +- newval = md_chars_to_number (buf, THUMB_SIZE); +- newval = 0xbf00; /* NOP encoding T1 */ +- md_number_to_chars (buf, newval, THUMB_SIZE); ++ if (fixP->fx_done || !seg->use_rela_p) ++ { ++ newval = md_chars_to_number (buf, THUMB_SIZE); ++ newval = 0xbf00; /* NOP encoding T1 */ ++ md_number_to_chars (buf, newval, THUMB_SIZE); ++ } + } + else + { +@@ -28631,17 +28634,14 @@ md_apply_fix (fixS * fixP, + case BFD_RELOC_ARM_GOTFUNCDESC: + case BFD_RELOC_ARM_GOTOFFFUNCDESC: + case BFD_RELOC_ARM_FUNCDESC: +- if (arm_fdpic) +- { +- if (fixP->fx_done || !seg->use_rela_p) +- md_number_to_chars (buf, 0, 4); +- } +- else ++ if (!arm_fdpic) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("Relocation supported only in FDPIC mode")); +- } +- break; ++ break; ++ } ++ value = 0; ++ /* Fall through. */ + #endif + + case BFD_RELOC_RVA: +diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c +--- binutils.orig/gas/config/tc-arm.c 2020-07-24 12:16:02.099719884 +0100 ++++ binutils-2.34.0/gas/config/tc-arm.c 2020-07-24 12:34:17.690858328 +0100 +@@ -28641,7 +28641,7 @@ md_apply_fix (fixS * fixP, + break; + } + value = 0; +- /* Fall through. */ ++ goto fred; + #endif + + case BFD_RELOC_RVA: +@@ -28653,6 +28653,7 @@ md_apply_fix (fixS * fixP, + #ifdef TE_PE + case BFD_RELOC_32_SECREL: + #endif ++ fred: + if (fixP->fx_done || !seg->use_rela_p) + #ifdef TE_WINCE + /* For WinCE we only do this for pcrel fixups. */ +diff -rup binutils.orig/gas/config/tc-arm.c binutils-2.34.0/gas/config/tc-arm.c +--- binutils.orig/gas/config/tc-arm.c 2020-07-24 13:28:26.926553452 +0100 ++++ binutils-2.34.0/gas/config/tc-arm.c 2020-07-24 13:31:57.835215763 +0100 +@@ -28416,12 +28416,8 @@ md_apply_fix (fixS * fixP, + perform relaxation. */ + if (value == -2) + { +- if (fixP->fx_done || !seg->use_rela_p) +- { +- newval = md_chars_to_number (buf, THUMB_SIZE); +- newval = 0xbf00; /* NOP encoding T1 */ +- md_number_to_chars (buf, newval, THUMB_SIZE); +- } ++ newval = 0xbf00; /* NOP encoding T1 */ ++ goto jim; + } + else + { +@@ -28432,6 +28428,7 @@ md_apply_fix (fixS * fixP, + { + newval = md_chars_to_number (buf, THUMB_SIZE); + newval |= ((value & 0x3e) << 2) | ((value & 0x40) << 3); ++ jim: + md_number_to_chars (buf, newval, THUMB_SIZE); + } + } +diff -rup binutils.orig/binutils/mclex.c binutils-2.34.0/binutils/mclex.c +--- binutils.orig/binutils/mclex.c 2020-07-24 13:28:26.297557441 +0100 ++++ binutils-2.34.0/binutils/mclex.c 2020-07-24 14:46:53.587940149 +0100 +@@ -207,7 +207,7 @@ enum_severity (int e) + static void + mc_add_keyword_ascii (const char *sz, int rid, const char *grp, rc_uint_type nv, const char *sv) + { +- unichar *usz, *usv = NULL; ++ unichar *usz = NULL, *usv = NULL; + rc_uint_type usz_len; + + unicode_from_codepage (&usz_len, &usz, sz, CP_ACP); +diff -rup binutils.orig/binutils/windmc.c binutils-2.34.0/binutils/windmc.c +--- binutils.orig/binutils/windmc.c 2020-07-24 13:28:26.279557556 +0100 ++++ binutils-2.34.0/binutils/windmc.c 2020-07-24 14:48:05.460477478 +0100 +@@ -338,7 +338,7 @@ mc_add_node_lang (mc_node *root, const m + static char * + convert_unicode_to_ACP (const unichar *usz) + { +- char *s; ++ char *s = NULL; + rc_uint_type l; + + if (! usz) +@@ -607,10 +607,10 @@ mc_generate_bin_item (mc_node_lang *n, r + else + { + rc_uint_type txt_len, l; +- char *cvt_txt; ++ char *cvt_txt = NULL; + + codepage_from_unicode( &l, n->message, &cvt_txt, n->lang->lang_info.wincp); +- if (! cvt_txt) ++ if (cvt_txt == NULL) + fatal ("Failed to convert message to language codepage.\n"); + txt_len = strlen (cvt_txt); + if (mcset_automatic_null_termination && txt_len > 0) +@@ -1107,7 +1107,7 @@ main (int argc, char **argv) + + /* Load the input file and do code page transformations to UTF16. */ + { +- unichar *u; ++ unichar *u = NULL; + rc_uint_type ul; + char *buff; + bfd_size_type flen; diff --git a/binutils-gold-8-byte-note-segments.patch b/binutils-gold-8-byte-note-segments.patch new file mode 100644 index 0000000..8e10761 --- /dev/null +++ b/binutils-gold-8-byte-note-segments.patch @@ -0,0 +1,99 @@ +diff -rup binutils.orig/gold/layout.cc binutils-2.30/gold/layout.cc +--- binutils.orig/gold/layout.cc 2018-10-09 15:24:05.987282736 +0100 ++++ binutils-2.30/gold/layout.cc 2018-10-09 16:08:29.445946736 +0100 +@@ -2052,12 +2052,15 @@ Layout::attach_allocated_section_to_segm + // segment. + if (os->type() == elfcpp::SHT_NOTE) + { ++ uint64_t os_align = os->addralign(); ++ + // See if we already have an equivalent PT_NOTE segment. + for (p = this->segment_list_.begin(); + p != segment_list_.end(); + ++p) + { + if ((*p)->type() == elfcpp::PT_NOTE ++ && (*p)->align() == os_align + && (((*p)->flags() & elfcpp::PF_W) + == (seg_flags & elfcpp::PF_W))) + { +@@ -2071,6 +2074,7 @@ Layout::attach_allocated_section_to_segm + Output_segment* oseg = this->make_output_segment(elfcpp::PT_NOTE, + seg_flags); + oseg->add_output_section_to_nonload(os, seg_flags); ++ oseg->set_align(os_align); + } + } + +@@ -3171,6 +3175,10 @@ Layout::create_note(const char* name, in + #else + const int size = 32; + #endif ++ // The NT_GNU_PROPERTY_TYPE_0 note conforms to gABI. ++ const int addralign = ((note_type == elfcpp::NT_GNU_PROPERTY_TYPE_0 ++ ? parameters->target().get_size() ++ : size) / 8); + + // The contents of the .note section. + size_t namesz = strlen(name) + 1; +@@ -3234,7 +3242,7 @@ Layout::create_note(const char* name, in + return NULL; + + Output_section_data* posd = new Output_data_const_buffer(buffer, notehdrsz, +- size / 8, ++ addralign, + "** note header"); + os->add_output_section_data(posd); + +@@ -3692,6 +3700,11 @@ Layout::segment_precedes(const Output_se + { + if (type1 != type2) + return type1 < type2; ++ uint64_t align1 = seg1->align(); ++ uint64_t align2 = seg2->align(); ++ // Place segments with larger alignments first. ++ if (align1 != align2) ++ return align1 > align2; + gold_assert(flags1 != flags2 + || this->script_options_->saw_phdrs_clause()); + return flags1 < flags2; +diff -rup binutils.orig/gold/output.cc binutils-2.30/gold/output.cc +--- binutils.orig/gold/output.cc 2018-10-09 15:24:05.986282744 +0100 ++++ binutils-2.30/gold/output.cc 2018-10-09 16:09:03.749670846 +0100 +@@ -4107,6 +4107,7 @@ Output_segment::Output_segment(elfcpp::E + : vaddr_(0), + paddr_(0), + memsz_(0), ++ align_(0), + max_align_(0), + min_p_align_(0), + offset_(0), +diff -rup binutils.orig/gold/output.h binutils-2.30/gold/output.h +--- binutils.orig/gold/output.h 2018-10-09 15:24:05.984282760 +0100 ++++ binutils-2.30/gold/output.h 2018-10-09 16:09:45.665333727 +0100 +@@ -4676,6 +4676,16 @@ class Output_segment + offset() const + { return this->offset_; } + ++ // Return the segment alignment. ++ uint64_t ++ align() const ++ { return this->align_; } ++ ++ // Set the segment alignment. ++ void ++ set_align(uint64_t align) ++ { this->align_ = align; } ++ + // Whether this is a segment created to hold large data sections. + bool + is_large_data_segment() const +@@ -4898,6 +4908,8 @@ class Output_segment + uint64_t paddr_; + // The size of the segment in memory. + uint64_t memsz_; ++ // The segment alignment. ++ uint64_t align_; + // The maximum section alignment. The is_max_align_known_ field + // indicates whether this has been finalized. + uint64_t max_align_; diff --git a/binutils-gold-mismatched-section-flags.patch b/binutils-gold-mismatched-section-flags.patch new file mode 100644 index 0000000..4125801 --- /dev/null +++ b/binutils-gold-mismatched-section-flags.patch @@ -0,0 +1,36 @@ +diff -rup binutils.orig/gold/layout.cc binutils-2.32/gold/layout.cc +--- binutils.orig/gold/layout.cc 2019-06-24 14:37:36.013086899 +0100 ++++ binutils-2.32/gold/layout.cc 2019-06-24 14:41:40.054517479 +0100 +@@ -868,6 +868,7 @@ Layout::get_output_section(const char* n + && (same_name->flags() & elfcpp::SHF_TLS) == 0) + os = same_name; + } ++#if 0 /* BZ 1722715, PR 17556. */ + else if ((flags & elfcpp::SHF_TLS) == 0) + { + elfcpp::Elf_Xword zero_flags = 0; +@@ -878,6 +879,7 @@ Layout::get_output_section(const char* n + if (p != this->section_name_map_.end()) + os = p->second; + } ++#endif + } + + if (os == NULL) +diff -rup binutils.orig/gold/object.cc binutils-2.32/gold/object.cc +--- binutils.orig/gold/object.cc 2019-06-24 14:37:36.012086906 +0100 ++++ binutils-2.32/gold/object.cc 2019-06-24 14:39:59.287165501 +0100 +@@ -1644,6 +1644,13 @@ Sized_relobj_file::do_ + omit[i] = true; + } + ++ // Skip empty sections without flags. ++ if (!(shdr.get_sh_flags() & ~elfcpp::SHF_GROUP) ++ && !shdr.get_sh_size()) ++ { ++ omit[i] = true; ++ } ++ + bool discard = omit[i]; + if (!discard) + { diff --git a/binutils-i686-ld-testsuite-fixes.patch b/binutils-i686-ld-testsuite-fixes.patch new file mode 100644 index 0000000..67216e8 --- /dev/null +++ b/binutils-i686-ld-testsuite-fixes.patch @@ -0,0 +1,29 @@ +diff -rup binutils.orig/ld/testsuite/ld-elfvsb/elfvsb.exp binutils-2.35/ld/testsuite/ld-elfvsb/elfvsb.exp +--- binutils.orig/ld/testsuite/ld-elfvsb/elfvsb.exp 2020-07-28 13:07:26.277506755 +0100 ++++ binutils-2.35/ld/testsuite/ld-elfvsb/elfvsb.exp 2020-07-28 13:29:32.252877646 +0100 +@@ -264,6 +264,7 @@ proc visibility_run {visibility} { + remote_file host delete $tmpdir/sh1p.o $tmpdir/sh2p.o $tmpdir/sh1np.o $tmpdir/sh2np.o + + if { [istarget powerpc*-*-linux*] \ ++ || [istarget i686*-*-*] \ + || ( [istarget mips*-*-linux*] && [at_least_gcc_version 4 3] )} { + # Testing non-PIC libraries is a waste of effort on any target. + # If you don't pass -fpic or -fPIC to gcc, gcc will assume quite +@@ -345,6 +346,7 @@ proc visibility_run {visibility} { + || [ string match $visibility "protected_undef_def" ] + || [ string match $visibility "protected_weak" ] + || [ string match $visibility "normal" ] } { ++ setup_xfail "i686-*-*" + setup_xfail "powerpc-*-linux*" + setup_xfail "s390x-*-linux*" + if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainnp.o] } { +@@ -393,7 +395,8 @@ proc visibility_run {visibility} { + } + }} + +- if { [istarget powerpc*-*-linux*] } { ++ if { [istarget powerpc*-*-linux*] ++ || [istarget i686*-*-*] } { + # Don't bother. + } else { + # Now do the same tests again, but this time compile main.c PIC. diff --git a/binutils-ignore-duplicate-FDE-entries.patch b/binutils-ignore-duplicate-FDE-entries.patch new file mode 100644 index 0000000..2675759 --- /dev/null +++ b/binutils-ignore-duplicate-FDE-entries.patch @@ -0,0 +1,24 @@ +--- binutils-2.32.orig/bfd/elf-eh-frame.c 2019-06-26 07:05:43.839194746 -0400 ++++ binutils-2.32/bfd/elf-eh-frame.c 2019-06-26 07:32:37.124219479 -0400 +@@ -2478,11 +2478,16 @@ write_dwarf_eh_frame_hdr (bfd *abfd, str + != sec->output_section->vma + val)) + overflow = TRUE; + bfd_put_32 (abfd, val, contents + EH_FRAME_HDR_SIZE + i * 8 + 8); +- if (i != 0 +- && (hdr_info->u.dwarf.array[i].initial_loc +- < (hdr_info->u.dwarf.array[i - 1].initial_loc +- + hdr_info->u.dwarf.array[i - 1].range))) +- overlap = TRUE; ++ if (i != 0) ++ { ++ struct eh_frame_array_ent * this_entry = hdr_info->u.dwarf.array + i; ++ struct eh_frame_array_ent * prev_entry = hdr_info->u.dwarf.array + (i - 1); ++ ++ if (this_entry->initial_loc < prev_entry->initial_loc + prev_entry->range ++ && (this_entry->initial_loc != prev_entry->initial_loc ++ || this_entry->range != prev_entry->range)) ++ overlap = TRUE; ++ } + } + if (overflow) + _bfd_error_handler (_(".eh_frame_hdr entry overflow")); diff --git a/binutils-no-builder-comment-in-bfd-stdint.patch b/binutils-no-builder-comment-in-bfd-stdint.patch new file mode 100644 index 0000000..d8d5f4f --- /dev/null +++ b/binutils-no-builder-comment-in-bfd-stdint.patch @@ -0,0 +1,19 @@ +--- binutils.orig/bfd/configure 2019-06-24 14:37:35.984087086 +0100 ++++ binutils-2.32/bfd/configure 2019-06-24 17:32:52.515541752 +0100 +@@ -18865,11 +18865,11 @@ _LT_EOF + esac + done ;; + "bfd_stdint.h":C) +-if test "$GCC" = yes; then +- echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h +-else +- echo "/* generated for $CC */" > tmp-stdint.h +-fi ++ ++ ++ ++ ++ + + sed 's/^ *//' >> tmp-stdint.h <flags) != 0 + && !(ppc_cpu & op->deprecated)) +- str_hash_insert (ppc_hash, op->name, (void *) op); ++ str_hash_insert_or_replace (ppc_hash, op->name, (void *) op, 0); + } + + if ((ppc_cpu & PPC_OPCODE_ANY) != 0) + for (op = powerpc_opcodes; op < op_end; op++) +- str_hash_insert (ppc_hash, op->name, (void *) op); ++ str_hash_insert_or_replace (ppc_hash, op->name, (void *) op, 0); + + op_end = prefix_opcodes + prefix_num_opcodes; + for (op = prefix_opcodes; op < op_end; op++) +@@ -1772,12 +1772,12 @@ ppc_setup_opcodes (void) + + if ((ppc_cpu & op->flags) != 0 + && !(ppc_cpu & op->deprecated)) +- str_hash_insert (ppc_hash, op->name, (void *) op); ++ str_hash_insert_or_replace (ppc_hash, op->name, (void *) op, 0); + } + + if ((ppc_cpu & PPC_OPCODE_ANY) != 0) + for (op = prefix_opcodes; op < op_end; op++) +- str_hash_insert (ppc_hash, op->name, (void *) op); ++ str_hash_insert_or_replace (ppc_hash, op->name, (void *) op, 0); + + op_end = vle_opcodes + vle_num_opcodes; + for (op = vle_opcodes; op < op_end; op++) +@@ -1807,7 +1807,7 @@ ppc_setup_opcodes (void) + + if ((ppc_cpu & op->flags) != 0 + && !(ppc_cpu & op->deprecated)) +- str_hash_insert (ppc_hash, op->name, (void *) op); ++ str_hash_insert_or_replace (ppc_hash, op->name, (void *) op, 0); + } + + /* SPE2 instructions */ +@@ -1841,11 +1841,11 @@ ppc_setup_opcodes (void) + } + + if ((ppc_cpu & op->flags) != 0 && !(ppc_cpu & op->deprecated)) +- str_hash_insert (ppc_hash, op->name, (void *) op); ++ str_hash_insert_or_replace (ppc_hash, op->name, (void *) op, 0); + } + + for (op = spe2_opcodes; op < op_end; op++) +- str_hash_insert (ppc_hash, op->name, (void *) op); ++ str_hash_insert_or_replace (ppc_hash, op->name, (void *) op, 0); + } + + /* Insert the macros into a hash table. */ +diff -rup binutils.orig/gas/hash.c binutils-2.35/gas/hash.c +--- binutils.orig/gas/hash.c 2022-02-03 11:10:42.827719448 +0000 ++++ binutils-2.35/gas/hash.c 2022-02-03 11:12:00.506175797 +0000 +@@ -32,6 +32,24 @@ htab_insert (htab_t htab, PTR element) + *slot = element; + } + ++void ** ++htab_insert_or_replace (htab_t htab, void *element, int replace) ++{ ++ void **slot = htab_find_slot (htab, element, INSERT); ++ if (*slot != NULL) ++ { ++ if (replace) ++ { ++ if (htab->del_f) ++ (*htab->del_f) (*slot); ++ *slot = element; ++ } ++ return slot; ++ } ++ *slot = element; ++ return NULL; ++} ++ + /* Print statistics about a hash table. */ + + void +diff -rup binutils.orig/gas/hash.h binutils-2.35/gas/hash.h +--- binutils.orig/gas/hash.h 2022-02-03 11:10:42.830719428 +0000 ++++ binutils-2.35/gas/hash.h 2022-02-03 11:12:25.002002561 +0000 +@@ -103,6 +103,19 @@ str_hash_insert (htab_t table, const cha + htab_insert (table, string_tuple_alloc (key, value)); + } + ++extern void ** htab_insert_or_replace (htab_t, void *, int); ++ ++static inline void ** ++str_hash_insert_or_replace (htab_t table, const char *key, void *value, int replace) ++{ ++ string_tuple_t *elt = string_tuple_alloc (key, value); ++ void **slot = htab_insert_or_replace (table, elt, replace); ++ if (slot && !replace) ++ free (elt); ++ return slot; ++} ++ ++ + static inline htab_t + str_htab_create (void) + { diff --git a/binutils-ppc-ld-testsuite-fixes.patch b/binutils-ppc-ld-testsuite-fixes.patch new file mode 100644 index 0000000..3a0f2e3 --- /dev/null +++ b/binutils-ppc-ld-testsuite-fixes.patch @@ -0,0 +1,101 @@ +Only in binutils-2.35/ld/testsuite/ld-ifunc: #ifunc.exp# +Only in binutils-2.35/ld/testsuite/ld-ifunc: .#ifunc.exp +diff -rup binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp binutils-2.35/ld/testsuite/ld-ifunc/ifunc.exp +--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2020-07-28 13:07:26.232506947 +0100 ++++ binutils-2.35/ld/testsuite/ld-ifunc/ifunc.exp 2020-07-28 13:33:16.090934011 +0100 +@@ -309,6 +309,7 @@ if {! [check_osabi tmpdir/static_nonifun + # should not. + + if {[contains_ifunc_symbol tmpdir/libshared_ifunc.so] != 1} { ++ setup_xfail "powerpc*-*-*" + fail "Shared libraries containing ifunc does not contain an IFUNC symbol" + set fails [expr $fails + 1] + } +diff -rup binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp binutils-2.35/ld/testsuite/ld-ifunc/ifunc.exp +--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2020-07-28 15:07:51.587385019 +0100 ++++ binutils-2.35/ld/testsuite/ld-ifunc/ifunc.exp 2020-07-28 15:16:19.629341219 +0100 +@@ -314,11 +314,13 @@ if {[contains_ifunc_symbol tmpdir/libsha + set fails [expr $fails + 1] + } + if {[contains_ifunc_symbol tmpdir/local_prog] != 1} { ++ setup_xfail "powerpc*-*-*" + fail "Local ifunc-using executable does not contain an IFUNC symbol" + set fails [expr $fails + 1] + } + if { ![string match "" $STATIC_LDFLAGS] \ + && [contains_ifunc_symbol tmpdir/static_prog] != 1} { ++ setup_xfail "powerpc*-*-*" + fail "Static ifunc-using executable does not contain an IFUNC symbol" + set fails [expr $fails + 1] + } +@@ -531,7 +533,8 @@ run_ld_link_exec_tests [list \ + if { ![check_ifunc_attribute_available] } { + return + } +-if { [istarget "s390*-*-*"] } { ++if { [istarget "s390*-*-*"] ++ || [istarget "ppc*-*-*"] } { + return + } else { + run_cc_link_tests [list \ +Only in binutils-2.35/ld/testsuite/ld-powerpc/: #powerpc.exp# +Only in binutils-2.35/ld/testsuite/ld-powerpc/: .#powerpc.exp +diff -rup binutils.orig/ld/testsuite/ld-powerpc/notoc3.d binutils-2.35/ld/testsuite/ld-powerpc/notoc3.d +--- binutils.orig/ld/testsuite/ld-powerpc/notoc3.d 2020-07-28 15:07:51.607384938 +0100 ++++ binutils-2.35/ld/testsuite/ld-powerpc/notoc3.d 2020-07-28 15:18:47.912744686 +0100 +@@ -58,7 +58,7 @@ Disassembly of section \.text: + + .* : + .*: (02 10 40 3c|3c 40 10 02) lis r2,4098 +-.*: (00 90 42 38|38 42 90 00) addi r2,r2,-28672 ++#... + .*: (.. .. ff 4b|4b ff .. ..) bl .* <.*\.long_branch\.f1> + .*: (18 00 41 e8|e8 41 00 18) ld r2,24\(r1\) + .*: (.. .. ff 4b|4b ff .. ..) bl .* +@@ -73,7 +73,7 @@ Disassembly of section \.text: + + .* : + .*: (02 10 40 3c|3c 40 10 02) lis r2,4098 +-.*: (00 90 42 38|38 42 90 00) addi r2,r2,-28672 ++#... + .*: (.. .. ff 4b|4b ff .. ..) bl .* + .*: (00 00 00 60|60 00 00 00) nop + .*: (.. .. ff 4b|4b ff .. ..) bl .* <.*\.long_branch\.f1> +@@ -92,6 +92,6 @@ Disassembly of section \.text\.ext: + + 8000000000000000 : + 8000000000000000: (02 10 40 3c|3c 40 10 02) lis r2,4098 +-8000000000000004: (00 90 42 38|38 42 90 00) addi r2,r2,-28672 ++#... + 8000000000000008: (00 00 00 60|60 00 00 00) nop + 800000000000000c: (20 00 80 4e|4e 80 00 20) blr +diff -rup binutils.orig/ld/testsuite/ld-powerpc/pr23937.d binutils-2.35/ld/testsuite/ld-powerpc/pr23937.d +--- binutils.orig/ld/testsuite/ld-powerpc/pr23937.d 2020-07-28 15:07:51.612384918 +0100 ++++ binutils-2.35/ld/testsuite/ld-powerpc/pr23937.d 2020-07-28 15:19:32.764564253 +0100 +@@ -6,5 +6,4 @@ + #... + .* R_PPC64_IRELATIVE +10000180 + #... +-.*: 0+10000180 +20 IFUNC +LOCAL +DEFAULT .* magic + #pass +Only in binutils-2.35/ld/testsuite/ld-powerpc/: #powerpc.exp# +diff -rup binutils.orig/ld/testsuite/ld-powerpc/pr23937.d binutils-2.35/ld/testsuite/ld-powerpc/pr23937.d +--- binutils.orig/ld/testsuite/ld-powerpc/pr23937.d 2020-07-28 15:59:15.887927038 +0100 ++++ binutils-2.35/ld/testsuite/ld-powerpc/pr23937.d 2020-07-28 16:04:44.120594140 +0100 +@@ -5,5 +5,4 @@ + + #... + .* R_PPC64_IRELATIVE +10000180 +-#... + #pass +diff -rup binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp binutils-2.35/ld/testsuite/ld-ifunc/ifunc.exp +--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2020-07-28 15:59:15.867927119 +0100 ++++ binutils-2.35/ld/testsuite/ld-ifunc/ifunc.exp 2020-07-28 16:05:49.751327625 +0100 +@@ -534,6 +534,7 @@ if { ![check_ifunc_attribute_available] + return + } + if { [istarget "s390*-*-*"] ++ || [istarget "powerpc*-*-*"] + || [istarget "ppc*-*-*"] } { + return + } else { diff --git a/binutils-readelf-other-sym-info.patch b/binutils-readelf-other-sym-info.patch new file mode 100644 index 0000000..72913ba --- /dev/null +++ b/binutils-readelf-other-sym-info.patch @@ -0,0 +1,35 @@ +--- binutils.orig/binutils/readelf.c 2020-07-24 15:08:30.317597020 +0100 ++++ binutils-2.35/binutils/readelf.c 2020-07-24 15:09:39.029155552 +0100 +@@ -12069,11 +12069,13 @@ print_dynamic_symbol (Filedata *filedata + unsigned int vis = ELF_ST_VISIBILITY (psym->st_other); + + printf (" %-7s", get_symbol_visibility (vis)); ++#if 0 + /* Check to see if any other bits in the st_other field are set. + Note - displaying this information disrupts the layout of the + table being generated, but for the moment this case is very rare. */ + if (psym->st_other ^ vis) + printf (" [%s] ", get_symbol_other (filedata, psym->st_other ^ vis)); ++#endif + } + printf (" %4s ", get_symbol_index_type (filedata, psym->st_shndx)); + +@@ -12112,7 +12114,17 @@ print_dynamic_symbol (Filedata *filedata + version_string); + } + +- putchar ('\n'); ++#if 1 ++ { ++ unsigned int vis = ELF_ST_VISIBILITY (psym->st_other); ++ ++ /* Check to see if any other bits in the st_other field are set. */ ++ if (psym->st_other ^ vis) ++ printf (" \t[%s]", get_symbol_other (filedata, psym->st_other ^ vis)); ++ } ++#endif ++ ++ putchar ('\n'); + + if (ELF_ST_BIND (psym->st_info) == STB_LOCAL + && section != NULL diff --git a/binutils-s390-build.patch b/binutils-s390-build.patch new file mode 100644 index 0000000..cdb6a5d --- /dev/null +++ b/binutils-s390-build.patch @@ -0,0 +1,772 @@ +diff -rup binutils.orig/libctf/ctf-create.c binutils-2.34.0/libctf/ctf-create.c +--- binutils.orig/libctf/ctf-create.c 2020-06-16 12:06:28.466468753 +0100 ++++ binutils-2.34.0/libctf/ctf-create.c 2020-06-16 12:16:19.744482839 +0100 +@@ -871,7 +871,8 @@ ctf_add_encoded (ctf_file_t *fp, uint32_ + + if ((type = ctf_add_generic (fp, flag, name, kind, &dtd)) == CTF_ERR) + return CTF_ERR; /* errno is set for us. */ +- ++ if (dtd == NULL) ++ return CTF_ERR; + dtd->dtd_data.ctt_info = CTF_TYPE_INFO (kind, flag, 0); + dtd->dtd_data.ctt_size = clp2 (P2ROUNDUP (ep->cte_bits, CHAR_BIT) + / CHAR_BIT); +@@ -896,6 +897,8 @@ ctf_add_reftype (ctf_file_t *fp, uint32_ + + if ((type = ctf_add_generic (fp, flag, NULL, kind, &dtd)) == CTF_ERR) + return CTF_ERR; /* errno is set for us. */ ++ if (dtd == NULL) ++ return CTF_ERR; + + dtd->dtd_data.ctt_info = CTF_TYPE_INFO (kind, flag, 0); + dtd->dtd_data.ctt_type = (uint32_t) ref; +@@ -958,6 +961,8 @@ ctf_add_slice (ctf_file_t *fp, uint32_t + + if ((type = ctf_add_generic (fp, flag, NULL, CTF_K_SLICE, &dtd)) == CTF_ERR) + return CTF_ERR; /* errno is set for us. */ ++ if (dtd == NULL) ++ return CTF_ERR; + + dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_SLICE, flag, 0); + dtd->dtd_data.ctt_size = clp2 (P2ROUNDUP (ep->cte_bits, CHAR_BIT) +@@ -1008,6 +1013,8 @@ ctf_add_array (ctf_file_t *fp, uint32_t + + if ((type = ctf_add_generic (fp, flag, NULL, CTF_K_ARRAY, &dtd)) == CTF_ERR) + return CTF_ERR; /* errno is set for us. */ ++ if (dtd == NULL) ++ return CTF_ERR; + + dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_ARRAY, flag, 0); + dtd->dtd_data.ctt_size = 0; +@@ -1075,6 +1082,8 @@ ctf_add_function (ctf_file_t *fp, uint32 + free (vdat); + return CTF_ERR; /* errno is set for us. */ + } ++ if (dtd == NULL) ++ return CTF_ERR; + + dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_FUNCTION, flag, vlen); + dtd->dtd_data.ctt_type = (uint32_t) ctc->ctc_return; +@@ -1104,6 +1113,8 @@ ctf_add_struct_sized (ctf_file_t *fp, ui + else if ((type = ctf_add_generic (fp, flag, name, CTF_K_STRUCT, + &dtd)) == CTF_ERR) + return CTF_ERR; /* errno is set for us. */ ++ if (dtd == NULL) ++ return CTF_ERR; + + dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_STRUCT, flag, 0); + +@@ -1141,6 +1152,8 @@ ctf_add_union_sized (ctf_file_t *fp, uin + else if ((type = ctf_add_generic (fp, flag, name, CTF_K_UNION, + &dtd)) == CTF_ERR) + return CTF_ERR; /* errno is set for us */ ++ if (dtd == NULL) ++ return CTF_ERR; + + dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_UNION, flag, 0); + +@@ -1177,6 +1190,8 @@ ctf_add_enum (ctf_file_t *fp, uint32_t f + else if ((type = ctf_add_generic (fp, flag, name, CTF_K_ENUM, + &dtd)) == CTF_ERR) + return CTF_ERR; /* errno is set for us. */ ++ if (dtd == NULL) ++ return CTF_ERR; + + dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_ENUM, flag, 0); + dtd->dtd_data.ctt_size = fp->ctf_dmodel->ctd_int; +diff -rup binutils.orig/libctf/ctf-types.c binutils-2.34.0/libctf/ctf-types.c +--- binutils.orig/libctf/ctf-types.c 2020-06-16 12:06:28.466468753 +0100 ++++ binutils-2.34.0/libctf/ctf-types.c 2020-06-16 12:10:58.033563365 +0100 +@@ -748,7 +748,7 @@ ctf_type_encoding (ctf_file_t *fp, ctf_i + case CTF_K_SLICE: + { + const ctf_slice_t *slice; +- ctf_encoding_t underlying_en; ++ ctf_encoding_t underlying_en = {0}; + slice = &dtd->dtd_u.dtu_slice; + + data = ctf_type_encoding (fp, slice->cts_type, &underlying_en); +diff -rup binutils.orig/opcodes/s390-mkopc.c binutils-2.34.0/opcodes/s390-mkopc.c +--- binutils.orig/opcodes/s390-mkopc.c 2020-06-16 12:06:28.447468816 +0100 ++++ binutils-2.34.0/opcodes/s390-mkopc.c 2020-06-16 12:17:10.783311417 +0100 +@@ -168,7 +168,7 @@ insertExpandedMnemonic (char *opcode, ch + int mask_start, i = 0, tag_found = 0, reading_number = 0; + int number_p = 0, suffix_p = 0, prefix_p = 0; + const struct s390_cond_ext_format *ext_table; +- int ext_table_length; ++ int ext_table_length = 0; + + if (!(tag = strpbrk (mnemonic, "*$"))) + { +Only in binutils.orig/libctf: .#ctf-create.c +diff -rup binutils.orig/libctf/ctf-create.c binutils-2.34.0/libctf/ctf-create.c +--- binutils.orig/libctf/ctf-create.c 2020-06-16 14:49:06.080801319 +0100 ++++ binutils-2.34.0/libctf/ctf-create.c 2020-06-16 14:49:08.046794113 +0100 +@@ -798,6 +798,7 @@ ctf_add_generic (ctf_file_t *fp, uint32_ + { + ctf_dtdef_t *dtd; + ctf_id_t type; ++ *rp = NULL; + + if (flag != CTF_ADD_NONROOT && flag != CTF_ADD_ROOT) + return (ctf_set_errno (fp, EINVAL)); +diff -rup binutils.orig/opcodes/fr30-ibld.c binutils-2.34.0/opcodes/fr30-ibld.c +--- binutils.orig/opcodes/fr30-ibld.c 2020-06-16 14:49:06.074801341 +0100 ++++ binutils-2.34.0/opcodes/fr30-ibld.c 2020-06-16 16:43:31.428324833 +0100 +@@ -810,7 +810,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC + break; + case FR30_OPERAND_DIR10 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 8, 16, total_length, pc, & value); + value = ((value) << (2)); + fields->f_dir10 = value; +@@ -821,7 +821,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC + break; + case FR30_OPERAND_DIR9 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 8, 16, total_length, pc, & value); + value = ((value) << (1)); + fields->f_dir9 = value; +@@ -829,7 +829,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC + break; + case FR30_OPERAND_DISP10 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<f_disp10 = value; +@@ -840,7 +840,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC + break; + case FR30_OPERAND_DISP9 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<f_disp9 = value; +@@ -865,7 +865,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC + break; + case FR30_OPERAND_LABEL12 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<f_rel12 = value; +@@ -873,7 +873,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC + break; + case FR30_OPERAND_LABEL9 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<f_rel9 = value; +@@ -881,7 +881,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC + break; + case FR30_OPERAND_M4 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 16, total_length, pc, & value); + value = ((value) | (-16)); + fields->f_m4 = value; +@@ -911,7 +911,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC + break; + case FR30_OPERAND_U10 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 8, 16, total_length, pc, & value); + value = ((value) << (2)); + fields->f_u10 = value; +@@ -928,7 +928,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC + break; + case FR30_OPERAND_UDISP6 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 16, total_length, pc, & value); + value = ((value) << (2)); + fields->f_udisp6 = value; + +diff -rup binutils.orig/opcodes/fr30-ibld.c binutils-2.34.0/opcodes/fr30-ibld.c +--- binutils.orig/opcodes/fr30-ibld.c 2020-06-16 17:10:22.540563440 +0100 ++++ binutils-2.34.0/opcodes/fr30-ibld.c 2020-06-16 17:10:48.966468906 +0100 +@@ -903,7 +903,7 @@ fr30_cgen_extract_operand (CGEN_CPU_DESC + break; + case FR30_OPERAND_S10 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<f_s10 = value; +Only in binutils-2.34.0/opcodes: fr30-ibld.c~ +--- binutils.orig/opcodes/m32c-ibld.c 2020-06-16 17:10:22.531563472 +0100 ++++ binutils-2.34.0/opcodes/m32c-ibld.c 2020-06-16 17:25:48.612258094 +0100 +@@ -1805,7 +1805,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_BIT32RNPREFIXED : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 2, 32, total_length, pc, & value); + value = (((((~ (((USI) (value) >> (1))))) & (1))) | (((((value) << (1))) & (2)))); + fields->f_dst32_rn_prefixed_QI = value; +@@ -1813,7 +1813,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_BIT32RNUNPREFIXED : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 2, 32, total_length, pc, & value); + value = (((((~ (((USI) (value) >> (1))))) & (1))) | (((((value) << (1))) & (2)))); + fields->f_dst32_rn_unprefixed_QI = value; +@@ -1824,7 +1824,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_BITBASE16_16_U16 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_16_u16 = value; +@@ -1860,7 +1860,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + length = extract_normal (cd, ex_info, insn_value, 0, 0, 13, 3, 32, total_length, pc, & fields->f_bitno32_unprefixed); + if (length <= 0) break; + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<> (8))) & (255))) | (((((value) & (255))) << (8))))))); + fields->f_dsp_16_s16 = value; +@@ -1887,7 +1887,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + length = extract_normal (cd, ex_info, insn_value, 0, 0, 13, 3, 32, total_length, pc, & fields->f_bitno32_unprefixed); + if (length <= 0) break; + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_16_u16 = value; +@@ -1903,7 +1903,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + length = extract_normal (cd, ex_info, insn_value, 0, 0, 13, 3, 32, total_length, pc, & fields->f_bitno32_unprefixed); + if (length <= 0) break; + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_16_u16 = value; +@@ -1971,7 +1971,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 8, 32, total_length, pc, & fields->f_dsp_24_u8); + if (length <= 0) break; + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_32_u16 = value; +@@ -1996,7 +1996,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_16_S16 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<> (8))) & (255))) | (((((value) & (255))) << (8))))))); + fields->f_dsp_16_s16 = value; +@@ -2007,7 +2007,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_16_U16 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_16_u16 = value; +@@ -2016,7 +2016,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + case M32C_OPERAND_DSP_16_U20 : + { + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_16_u16 = value; +@@ -2032,7 +2032,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + case M32C_OPERAND_DSP_16_U24 : + { + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_16_u16 = value; +@@ -2078,7 +2078,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 8, 32, total_length, pc, & fields->f_dsp_24_u8); + if (length <= 0) break; + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_32_u16 = value; +@@ -2094,7 +2094,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 8, 32, total_length, pc, & fields->f_dsp_24_u8); + if (length <= 0) break; + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_32_u16 = value; +@@ -2110,7 +2110,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_32_S16 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<> (8))) & (255))) | (((((value) & (255))) << (8))))))); + fields->f_dsp_32_s16 = value; +@@ -2121,7 +2121,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_32_U16 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_32_u16 = value; +@@ -2129,7 +2129,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_32_U20 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 24, 32, total_length, pc, & value); + value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) << (16))) & (16711680)))); + fields->f_dsp_32_u24 = value; +@@ -2137,7 +2137,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_32_U24 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 24, 32, total_length, pc, & value); + value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) << (16))) & (16711680)))); + fields->f_dsp_32_u24 = value; +@@ -2148,7 +2148,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_40_S16 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<> (8))) & (255))) | (((((value) & (255))) << (8))))))); + fields->f_dsp_40_s16 = value; +@@ -2159,7 +2159,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_40_U16 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 8, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_40_u16 = value; +@@ -2167,7 +2167,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_40_U20 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 8, 20, 32, total_length, pc, & value); + value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) << (16))) & (983040)))); + fields->f_dsp_40_u20 = value; +@@ -2175,7 +2175,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_40_U24 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 8, 24, 32, total_length, pc, & value); + value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) << (16))) & (16711680)))); + fields->f_dsp_40_u24 = value; +@@ -2186,7 +2186,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_48_S16 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<> (8))) & (255))) | (((((value) & (255))) << (8))))))); + fields->f_dsp_48_s16 = value; +@@ -2197,7 +2197,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_48_U16 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_48_u16 = value; +@@ -2206,7 +2206,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + case M32C_OPERAND_DSP_48_U20 : + { + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_48_u16 = value; +@@ -2222,7 +2222,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + case M32C_OPERAND_DSP_48_U24 : + { + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_48_u16 = value; +@@ -2240,7 +2240,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_8_S24 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<> (16))) & (255))) | (((value) & (65280))))) | (((((value) & (255))) << (16))))) ^ (8388608))) - (8388608)); + fields->f_dsp_8_s24 = value; +@@ -2251,7 +2251,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_8_U16 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_8_u16 = value; +@@ -2259,7 +2259,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DSP_8_U24 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 24, 32, total_length, pc, & value); + value = ((((((USI) (value) >> (16))) | (((value) & (65280))))) | (((((value) & (255))) << (16)))); + fields->f_dsp_8_u24 = value; +@@ -2343,7 +2343,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DST32RNPREFIXEDHI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 2, 32, total_length, pc, & value); + value = ((((value) + (2))) % (4)); + fields->f_dst32_rn_prefixed_HI = value; +@@ -2351,7 +2351,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DST32RNPREFIXEDQI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 2, 32, total_length, pc, & value); + value = (((((~ (((USI) (value) >> (1))))) & (1))) | (((((value) << (1))) & (2)))); + fields->f_dst32_rn_prefixed_QI = value; +@@ -2359,7 +2359,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DST32RNPREFIXEDSI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 2, 32, total_length, pc, & value); + value = ((value) - (2)); + fields->f_dst32_rn_prefixed_SI = value; +@@ -2367,7 +2367,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DST32RNUNPREFIXEDHI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 2, 32, total_length, pc, & value); + value = ((((value) + (2))) % (4)); + fields->f_dst32_rn_unprefixed_HI = value; +@@ -2375,7 +2375,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DST32RNUNPREFIXEDQI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 2, 32, total_length, pc, & value); + value = (((((~ (((USI) (value) >> (1))))) & (1))) | (((((value) << (1))) & (2)))); + fields->f_dst32_rn_unprefixed_QI = value; +@@ -2383,7 +2383,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_DST32RNUNPREFIXEDSI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 2, 32, total_length, pc, & value); + value = ((value) - (2)); + fields->f_dst32_rn_unprefixed_SI = value; +@@ -2402,7 +2402,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_IMM_16_HI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<> (8))) & (255))) | (((((value) & (255))) << (8))))))); + fields->f_dsp_16_s16 = value; +@@ -2414,14 +2414,14 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + case M32C_OPERAND_IMM_16_SI : + { + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_16_u16 = value; + } + if (length <= 0) break; + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_32_u16 = value; +@@ -2454,7 +2454,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 8, 32, total_length, pc, & fields->f_dsp_24_u8); + if (length <= 0) break; + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 0, 24, 32, total_length, pc, & value); + value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) << (16))) & (16711680)))); + fields->f_dsp_32_u24 = value; +@@ -2467,7 +2467,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_IMM_32_HI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<> (8))) & (255))) | (((((value) & (255))) << (8))))))); + fields->f_dsp_32_s16 = value; +@@ -2486,7 +2486,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_IMM_40_HI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<> (8))) & (255))) | (((((value) & (255))) << (8))))))); + fields->f_dsp_40_s16 = value; +@@ -2498,7 +2498,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + case M32C_OPERAND_IMM_40_SI : + { + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 8, 24, 32, total_length, pc, & value); + value = ((((((((USI) (value) >> (16))) & (255))) | (((value) & (65280))))) | (((((value) << (16))) & (16711680)))); + fields->f_dsp_40_u24 = value; +@@ -2513,7 +2513,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_IMM_48_HI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<> (8))) & (255))) | (((((value) & (255))) << (8))))))); + fields->f_dsp_48_s16 = value; +@@ -2525,14 +2525,14 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + case M32C_OPERAND_IMM_48_SI : + { + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 32, 16, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_48_u16 = value; + } + if (length <= 0) break; + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 64, 0, 16, 32, total_length, pc, & value); + value = ((((((UHI) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))); + fields->f_dsp_64_u16 = value; +@@ -2567,7 +2567,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_IMM_8_HI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<> (8))) & (255))) | (((((value) & (255))) << (8))))))); + fields->f_dsp_8_s16 = value; +@@ -2593,7 +2593,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_IMM1_S : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 2, 1, 32, total_length, pc, & value); + value = ((value) + (1)); + fields->f_imm1_S = value; +@@ -2612,7 +2612,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_LAB_16_8 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<f_lab_16_8 = value; +@@ -2620,7 +2620,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_LAB_24_8 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<f_lab_24_8 = value; +@@ -2628,7 +2628,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_LAB_32_8 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<f_lab_32_8 = value; +@@ -2636,7 +2636,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_LAB_40_8 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<f_lab_40_8 = value; +@@ -2644,7 +2644,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_LAB_5_3 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<f_lab_5_3 = value; +@@ -2652,7 +2652,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_LAB_8_16 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<> (8))) | (((((value) & (255))) << (8))))) ^ (32768))) - (32768))) + (((pc) + (1)))); + fields->f_lab_8_16 = value; +@@ -2660,7 +2660,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_LAB_8_24 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<> (16))) | (((value) & (65280))))) | (((((value) & (255))) << (16)))); + fields->f_lab_8_24 = value; +@@ -2668,7 +2668,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_LAB_8_8 : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0|(1<f_lab_8_8 = value; +@@ -2757,7 +2757,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_SRC32RNPREFIXEDHI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 18, 2, 32, total_length, pc, & value); + value = ((((value) + (2))) % (4)); + fields->f_src32_rn_prefixed_HI = value; +@@ -2765,7 +2765,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_SRC32RNPREFIXEDQI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 18, 2, 32, total_length, pc, & value); + value = (((((~ (((USI) (value) >> (1))))) & (1))) | (((((value) << (1))) & (2)))); + fields->f_src32_rn_prefixed_QI = value; +@@ -2773,7 +2773,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_SRC32RNPREFIXEDSI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 18, 2, 32, total_length, pc, & value); + value = ((value) - (2)); + fields->f_src32_rn_prefixed_SI = value; +@@ -2781,7 +2781,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_SRC32RNUNPREFIXEDHI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 10, 2, 32, total_length, pc, & value); + value = ((((value) + (2))) % (4)); + fields->f_src32_rn_unprefixed_HI = value; +@@ -2789,7 +2789,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_SRC32RNUNPREFIXEDQI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 10, 2, 32, total_length, pc, & value); + value = (((((~ (((USI) (value) >> (1))))) & (1))) | (((((value) << (1))) & (2)))); + fields->f_src32_rn_unprefixed_QI = value; +@@ -2797,7 +2797,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC + break; + case M32C_OPERAND_SRC32RNUNPREFIXEDSI : + { +- long value; ++ long value = 0; + length = extract_normal (cd, ex_info, insn_value, 0, 0, 10, 2, 32, total_length, pc, & value); + value = ((value) - (2)); + fields->f_src32_rn_unprefixed_SI = value; +--- binutils.orig/binutils/srconv.c 2020-06-16 17:10:22.251564474 +0100 ++++ binutils-2.34.0/binutils/srconv.c 2020-06-16 20:07:51.670025912 +0100 +@@ -492,6 +492,8 @@ wr_rl (struct coff_ofile *ptr ATTRIBUTE_ + rl.addr = r->offset; + rl.bitloc = 0; + rl.flen = 32; /* SH Specific. */ ++ rl.dunno = 0; ++ rl.symn = 0; + + /* What sort of reloc ? Look in the section to find out. */ + ref = r->symbol; +--- binutils.orig/libctf/ctf-create.c 2020-07-24 15:33:26.100996335 +0100 ++++ binutils-2.35/libctf/ctf-create.c 2020-07-24 15:33:29.042977475 +0100 +@@ -1257,6 +1257,8 @@ ctf_add_forward (ctf_file_t *fp, uint32_ + + if ((type = ctf_add_generic (fp, flag, name, kind, &dtd)) == CTF_ERR) + return CTF_ERR; /* errno is set for us. */ ++ if (dtd == NULL) ++ return CTF_ERR; + + dtd->dtd_data.ctt_info = CTF_TYPE_INFO (CTF_K_FORWARD, flag, 0); + dtd->dtd_data.ctt_type = kind; diff --git a/binutils-s390-ld-testsuite-fixes.patch b/binutils-s390-ld-testsuite-fixes.patch new file mode 100644 index 0000000..ecc32be --- /dev/null +++ b/binutils-s390-ld-testsuite-fixes.patch @@ -0,0 +1,120 @@ +--- binutils.orig/ld/testsuite/ld-elf/indirect.exp 2020-07-28 13:07:26.371506355 +0100 ++++ binutils-2.35/ld/testsuite/ld-elf/indirect.exp 2020-07-28 13:19:16.109480917 +0100 +@@ -151,12 +151,6 @@ set run_tests { + {"Run with libindirect4c.so 4" + "-Wl,--no-as-needed tmpdir/libindirect4c.so tmpdir/indirect4b.o tmpdir/indirect4a.o" "" + {dummy.c} "indirect4d" "indirect4.out"} +- {"Run indirect5 1" +- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" "" +- {indirect5a.c} "indirect5a" "indirect5.out" "$NOPIE_CFLAGS"} +- {"Run indirect5 2" +- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" "" +- {dummy.c} "indirect5b" "indirect5.out" "$NOPIE_CFLAGS"} + {"Run indirect6 1" + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" "" + {indirect6a.c} "indirect6a" "indirect5.out" "$NOPIE_CFLAGS"} +@@ -208,7 +202,7 @@ proc check_dynamic_syms { test } { + return 1 + } + +-foreach t [list indirect5a indirect5b indirect6a indirect6b] { ++foreach t [list indirect6a indirect6b] { + set testname [concat $t "dynsym"] + if { [check_dynamic_syms tmpdir/$t] } { + pass $testname +@@ -225,12 +219,6 @@ if { ! [string match "" $exec_output] } + } + + set pie_tests { +- {"Run indirect5 3" +- "-pie -Wl,--no-as-needed tmpdir/libindirect5.so" "" +- {indirect5a.c} "indirect5c" "indirect5.out" "-fPIE"} +- {"Run indirect5 4" +- "-pie -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" "" +- {dummy.c} "indirect5d" "indirect5.out" "-fPIE"} + {"Run indirect6 3" + "-pie -Wl,--no-as-needed tmpdir/libindirect5.so" "" + {indirect6a.c} "indirect6c" "indirect5.out" "-fPIE"} +diff -rup binutils.orig/ld/testsuite/ld-elf/shared.exp binutils-2.35/ld/testsuite/ld-elf/shared.exp +--- binutils.orig/ld/testsuite/ld-elf/shared.exp 2020-07-28 14:15:41.646811416 +0100 ++++ binutils-2.35/ld/testsuite/ld-elf/shared.exp 2020-07-28 14:19:13.606963162 +0100 +@@ -1380,18 +1380,6 @@ if { [istarget *-*-linux*] + "pr22393-2-static" \ + "pass.out" \ + ] \ +- [list \ +- "Run pr21964-4" \ +- "" \ +- "" \ +- {pr21964-4.c} \ +- "pr21964-4" \ +- "pass.out" \ +- "" \ +- "" \ +- "" \ +- "-ldl" \ +- ] \ + ] + } + +diff -rup binutils.orig/ld/testsuite/ld-elf/tls.exp binutils-2.35/ld/testsuite/ld-elf/tls.exp +--- binutils.orig/ld/testsuite/ld-elf/tls.exp 2020-07-28 14:15:41.635811460 +0100 ++++ binutils-2.35/ld/testsuite/ld-elf/tls.exp 2020-07-28 14:21:04.086521032 +0100 +@@ -49,5 +49,6 @@ run_ld_link_tests [list \ + {{readelf -r pr22263-1.rd}} \ + "pr22263-1" \ + "-fPIE -O2 $NOSANTIZE_CFLAGS" \ +- ] \ ++ ] \ ++ { s390*-*-* } \ + ] +diff -rup binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp binutils-2.35/ld/testsuite/ld-ifunc/ifunc.exp +--- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2020-07-28 14:15:41.532811873 +0100 ++++ binutils-2.35/ld/testsuite/ld-ifunc/ifunc.exp 2020-07-28 14:22:37.768146123 +0100 +@@ -531,7 +531,9 @@ run_ld_link_exec_tests [list \ + if { ![check_ifunc_attribute_available] } { + return + } +- ++if { [istarget "s390*-*-*"] } { ++ return ++} else { + run_cc_link_tests [list \ + [list \ + "Build pr18808a.o" \ +@@ -668,6 +670,7 @@ run_cc_link_tests [list \ + "pr23169f" \ + ] \ + ] ++} + + run_ld_link_exec_tests [list \ + [list \ +--- binutils.orig/ld/testsuite/ld-elf/tls.exp 2020-07-28 15:07:51.733384431 +0100 ++++ binutils-2.35/ld/testsuite/ld-elf/tls.exp 2020-07-28 15:10:08.096835851 +0100 +@@ -50,5 +50,5 @@ run_ld_link_tests [list \ + "pr22263-1" \ + "-fPIE -O2 $NOSANTIZE_CFLAGS" \ + ] \ +- { s390*-*-* } \ ++ [list "s390*-*-*"] \ + ] +--- binutils.orig/ld/testsuite/ld-elf/tls.exp 2020-07-28 15:59:15.964926725 +0100 ++++ binutils-2.35/ld/testsuite/ld-elf/tls.exp 2020-07-28 15:59:55.898764564 +0100 +@@ -39,6 +39,9 @@ if [istarget "sparc*-*-*"] { + append AFLAGS_PIC " -K PIC" + } + ++if [istarget "s390*-*-*"] { ++ return ++} else { + run_ld_link_tests [list \ + [list \ + "Build pr22263-1" \ +@@ -50,5 +53,5 @@ run_ld_link_tests [list \ + "pr22263-1" \ + "-fPIE -O2 $NOSANTIZE_CFLAGS" \ + ] \ +- [list "s390*-*-*"] \ + ] ++} diff --git a/binutils-secondary-relocs-speed.patch b/binutils-secondary-relocs-speed.patch new file mode 100644 index 0000000..3da4ba7 --- /dev/null +++ b/binutils-secondary-relocs-speed.patch @@ -0,0 +1,62 @@ +diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.35/bfd/elf-bfd.h +--- binutils.orig/bfd/elf-bfd.h 2021-06-23 15:00:33.913477324 +0100 ++++ binutils-2.35/bfd/elf-bfd.h 2021-06-23 15:03:42.300235019 +0100 +@@ -1748,6 +1748,11 @@ struct bfd_elf_section_data + /* Link from a text section to its .eh_frame_entry section. */ + asection *eh_frame_entry; + ++ /* TRUE if the section has secondary reloc sections associated with it. ++ FIXME: In the future it might be better to change this into a list ++ of secondary reloc sections, making lookup easier and faster. */ ++ bfd_boolean has_secondary_relocs; ++ + /* A pointer used for various section optimizations. */ + void *sec_info; + }; +diff -rup binutils.orig/bfd/elf.c binutils-2.35/bfd/elf.c +--- binutils.orig/bfd/elf.c 2021-06-23 15:00:33.902477396 +0100 ++++ binutils-2.35/bfd/elf.c 2021-06-23 15:02:36.269672347 +0100 +@@ -12672,6 +12672,7 @@ _bfd_elf_copy_special_section_fields (co + { + asection * isec; + asection * osec; ++ struct bfd_elf_section_data * esd; + + if (isection == NULL) + return FALSE; +@@ -12687,8 +12688,9 @@ _bfd_elf_copy_special_section_fields (co + if (osec == NULL) + return FALSE; + +- BFD_ASSERT (elf_section_data (osec)->sec_info == NULL); +- elf_section_data (osec)->sec_info = elf_section_data (isec)->sec_info; ++ esd = elf_section_data (osec); ++ BFD_ASSERT (esd->sec_info == NULL); ++ esd->sec_info = elf_section_data (isec)->sec_info; + osection->sh_type = SHT_RELA; + osection->sh_link = elf_onesymtab (obfd); + if (osection->sh_link == 0) +@@ -12731,6 +12733,10 @@ _bfd_elf_copy_special_section_fields (co + osection->sh_info = + elf_section_data (isection->bfd_section->output_section)->this_idx; + ++ esd = elf_section_data (isection->bfd_section->output_section); ++ BFD_ASSERT (esd != NULL); ++ osection->sh_info = esd->this_idx; ++ esd->has_secondary_relocs = TRUE; + #if DEBUG_SECONDARY_RELOCS + fprintf (stderr, "update header of %s, sh_link = %u, sh_info = %u\n", + osec->name, osection->sh_link, osection->sh_info); +diff -rup binutils.orig/bfd/elfcode.h binutils-2.35/bfd/elfcode.h +--- binutils.orig/bfd/elfcode.h 2021-06-23 15:00:33.910477344 +0100 ++++ binutils-2.35/bfd/elfcode.h 2021-06-23 15:04:32.506902070 +0100 +@@ -987,7 +987,8 @@ elf_write_relocs (bfd *abfd, asection *s + (*swap_out) (abfd, &src_rela, dst_rela); + } + +- if (!bed->write_secondary_relocs (abfd, sec)) ++ if (elf_section_data (sec)->has_secondary_relocs ++ && !bed->write_secondary_relocs (abfd, sec)) + { + *failedp = TRUE; + return; diff --git a/binutils-special-sections-in-groups.patch b/binutils-special-sections-in-groups.patch new file mode 100644 index 0000000..7de5a93 --- /dev/null +++ b/binutils-special-sections-in-groups.patch @@ -0,0 +1,27 @@ +--- binutils.orig/bfd/elf.c 2018-10-19 11:42:10.107277490 +0100 ++++ binutils-2.31.1/bfd/elf.c 2018-10-19 11:44:33.607105801 +0100 +@@ -830,7 +830,13 @@ setup_group (bfd *abfd, Elf_Internal_Shd + } + } + +- if (elf_group_name (newsect) == NULL) ++ if (elf_group_name (newsect) == NULL ++ /* OS specific sections might be in a group (eg ARM's ARM_EXIDX section) ++ but they will not have been added to the group because they do not ++ have contents that the ELF code in the BFD library knows how to ++ process. This is OK though - we rely upon the target backends to ++ handle these sections for us. */ ++ && hdr->sh_type < SHT_LOOS) + { + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: no group info for section '%pA'"), +@@ -936,7 +942,8 @@ _bfd_elf_setup_sections (bfd *abfd) + else if (idx->shdr->bfd_section) + elf_sec_group (idx->shdr->bfd_section) = shdr->bfd_section; + else if (idx->shdr->sh_type != SHT_RELA +- && idx->shdr->sh_type != SHT_REL) ++ && idx->shdr->sh_type != SHT_REL ++ && idx->shdr->sh_type < SHT_LOOS) + { + /* There are some unknown sections in the group. */ + _bfd_error_handler diff --git a/binutils-warnings.patch b/binutils-warnings.patch new file mode 100644 index 0000000..6f3d32d --- /dev/null +++ b/binutils-warnings.patch @@ -0,0 +1,158 @@ +diff --git a/binutils/dwarf.c b/binutils/dwarf.c +index 6ecfab5d..f8698213 100644 +--- a/binutils/dwarf.c ++++ b/binutils/dwarf.c +@@ -4914,7 +4914,7 @@ display_debug_lines_decoded (struct dwarf_section * section, + else + { + newFileName = (char *) xmalloc (fileNameLength + 1); +- strncpy (newFileName, fileName, fileNameLength + 1); ++ strcpy (newFileName, fileName); + } + + if (!do_wide || (fileNameLength <= MAX_FILENAME_LENGTH)) +diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c +index 3639bfbf..ed080a1a 100644 +--- a/libiberty/cp-demangle.c ++++ b/libiberty/cp-demangle.c +@@ -185,20 +185,6 @@ static void d_init_info (const char *, int, size_t, struct d_info *); + #define CP_STATIC_IF_GLIBCPP_V3 + #endif /* ! defined(IN_GLIBCPP_V3) */ + +-/* See if the compiler supports dynamic arrays. */ +- +-#ifdef __GNUC__ +-#define CP_DYNAMIC_ARRAYS +-#else +-#ifdef __STDC__ +-#ifdef __STDC_VERSION__ +-#if __STDC_VERSION__ >= 199901L && !__STDC_NO_VLA__ +-#define CP_DYNAMIC_ARRAYS +-#endif /* __STDC_VERSION__ >= 199901L && !__STDC_NO_VLA__ */ +-#endif /* defined (__STDC_VERSION__) */ +-#endif /* defined (__STDC__) */ +-#endif /* ! defined (__GNUC__) */ +- + /* We avoid pulling in the ctype tables, to prevent pulling in + additional unresolved symbols when this code is used in a library. + FIXME: Is this really a valid reason? This comes from the original +@@ -4343,29 +4329,21 @@ cplus_demangle_print_callback (int options, + d_print_init (&dpi, callback, opaque, dc); + + { +-#ifdef CP_DYNAMIC_ARRAYS +- /* Avoid zero-length VLAs, which are prohibited by the C99 standard +- and flagged as errors by Address Sanitizer. */ +- __extension__ struct d_saved_scope scopes[(dpi.num_saved_scopes > 0) +- ? dpi.num_saved_scopes : 1]; +- __extension__ struct d_print_template temps[(dpi.num_copy_templates > 0) +- ? dpi.num_copy_templates : 1]; +- +- dpi.saved_scopes = scopes; +- dpi.copy_templates = temps; +-#else +- dpi.saved_scopes = alloca (dpi.num_saved_scopes +- * sizeof (*dpi.saved_scopes)); +- dpi.copy_templates = alloca (dpi.num_copy_templates +- * sizeof (*dpi.copy_templates)); +-#endif +- ++ dpi.saved_scopes ++ = (struct d_saved_scope *) xmalloc (dpi.num_saved_scopes ++ * sizeof (*dpi.saved_scopes)); ++ dpi.copy_templates ++ = (struct d_print_template *) xmalloc (dpi.num_copy_templates ++ * sizeof (*dpi.copy_templates)); + d_print_comp (&dpi, options, dc); + } + + d_print_flush (&dpi); + +- return ! d_print_saw_error (&dpi); ++ int retval = ! d_print_saw_error (&dpi); ++ free (dpi.saved_scopes); ++ free (dpi.copy_templates); ++ return retval; + } + + /* Turn components into a human readable string. OPTIONS is the +@@ -6307,16 +6285,12 @@ d_demangle_callback (const char *mangled, int options, + } + + { +-#ifdef CP_DYNAMIC_ARRAYS +- __extension__ struct demangle_component comps[di.num_comps]; +- __extension__ struct demangle_component *subs[di.num_subs]; +- +- di.comps = comps; +- di.subs = subs; +-#else +- di.comps = alloca (di.num_comps * sizeof (*di.comps)); +- di.subs = alloca (di.num_subs * sizeof (*di.subs)); +-#endif ++ di.comps ++ = (struct demangle_component *) xmalloc (di.num_comps ++ * sizeof (*di.comps)); ++ di.subs ++ = (struct demangle_component **) xmalloc (di.num_subs ++ * sizeof (*di.subs)); + + switch (type) + { +@@ -6357,6 +6331,8 @@ d_demangle_callback (const char *mangled, int options, + : 0; + } + ++ free (di.comps); ++ free (di.subs); + return status; + } + +@@ -6588,16 +6564,12 @@ is_ctor_or_dtor (const char *mangled, + cplus_demangle_init_info (mangled, DMGL_GNU_V3, strlen (mangled), &di); + + { +-#ifdef CP_DYNAMIC_ARRAYS +- __extension__ struct demangle_component comps[di.num_comps]; +- __extension__ struct demangle_component *subs[di.num_subs]; +- +- di.comps = comps; +- di.subs = subs; +-#else +- di.comps = alloca (di.num_comps * sizeof (*di.comps)); +- di.subs = alloca (di.num_subs * sizeof (*di.subs)); +-#endif ++ di.comps ++ = (struct demangle_component *) xmalloc (di.num_comps ++ * sizeof (*di.comps)); ++ di.subs ++ = (struct demangle_component **) xmalloc (di.num_subs ++ * sizeof (*di.subs)); + + dc = cplus_demangle_mangled_name (&di, 1); + +@@ -6640,6 +6612,8 @@ is_ctor_or_dtor (const char *mangled, + } + } + ++ free (di.comps); ++ free (di.subs); + return ret; + } + +diff --git a/libiberty/make-relative-prefix.c b/libiberty/make-relative-prefix.c +index e3f9f920..5dbe6f89 100644 +--- a/libiberty/make-relative-prefix.c ++++ b/libiberty/make-relative-prefix.c +@@ -259,10 +259,7 @@ make_relative_prefix_1 (const char *progname, const char *bin_prefix, + #ifdef HAVE_HOST_EXECUTABLE_SUFFIX + len += strlen (HOST_EXECUTABLE_SUFFIX); + #endif +- if (len < MAX_ALLOCA_SIZE) +- nstore = (char *) alloca (len); +- else +- alloc_ptr = nstore = (char *) malloc (len); ++ alloc_ptr = nstore = (char *) malloc (len); + + startp = endp = temp; + while (1) diff --git a/binutils.spec b/binutils.spec new file mode 100644 index 0000000..977cd62 --- /dev/null +++ b/binutils.spec @@ -0,0 +1,3393 @@ + +%define __python /opt/rh/gcc-toolset-9/root/usr/bin/python3 +%{?scl:%{?scl_package:%scl_package binutils}} + +Summary: A GNU collection of binary utilities +Name: %{?scl_prefix}%{?cross}binutils%{?_with_debug:-debug} +Version: 2.35 +Release: 11%{?dist} +License: GPLv3+ +URL: https://sourceware.org/binutils + +# Binutils SPEC file. Can be invoked with the following parameters: + +# --define "binutils_target arm-linux-gnu" to create arm-linux-gnu-binutils. +# +# --with bootstrap: Build with minimal dependencies. +# --with debug: Build without optimizations and without splitting the debuginfo. +# --without docs: Skip building documentation. +# --without testsuite: Do not run the testsuite. Default is to run it. +# --with testsuite: Run the testsuite. Default when --with=debug is not to run it. +# --without gold Disable building of the GOLD linker. +# --with clang To force building with the CLANG. +# --with debuginfod Enable support for debuginfod. + +#---Start of Configure Options----------------------------------------------- + +# Do not create deterministic archives by default (cf: BZ 1195883) +%define enable_deterministic_archives 0 + +# Enable support for GCC LTO compilation. +%define enable_lto 1 + +# Disable the default generation of compressed debug sections. +%define default_compress_debug 0 + +# Default to read-only-relocations (relro) in shared binaries. +%define default_relro 1 + +# Disable the default generation of GNU Build notes by the assembler. +# This has turned out to be problematic for the i686 architecture. +# although the exact reason has not been determined. (See BZ 1572485) +# It also breaks building EFI binaries on AArch64, as these cannot have +# relocations against absolute symbols. +%define default_generate_notes 0 + +# Enable thread support in the GOLD linker. This is particularly +# important if plugins to the linker intend to use threads themselves. +# See BZ 1636479 for more details. This option is made configurable +# in case there is ever a need to disable thread support. +%define enable_threading 1 + +#----End of Configure Options------------------------------------------------ + +# Note - in the future the gold linker may become deprecated. +%bcond_without gold +# Default: Not bootstrapping. +%bcond_with bootstrap +# Default: Not debug +%bcond_with debug +# Default: Always build documentation. +%bcond_without docs +# Default: Always run the testsuite. +%bcond_without testsuite +# Use clang as the build time compiler. Default: gcc +%bcond_with clang +# Default: do not support debuginfod. +%bcond_with debuginfod + + +%if %{with bootstrap} +%undefine with_docs +%undefine with_testsuite +%endif + +%if %{with debug} +%undefine with_testsuite +%endif + +%if 0%{!?binutils_target:1} +%define binutils_target %{_target_platform} +%define isnative 1 +%define enable_shared 1 +%else +%define cross %{binutils_target}- +%define isnative 0 +%define enable_shared 0 +%endif + +#---------------------------------------------------------------------------- + +# Note - the Linux Kernel binutils releases are too unstable and contain +# too many controversial patches so we stick with the official FSF version +# instead. + +Source: https://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz + +Source2: binutils-2.19.50.0.1-output-format.sed + +%if %{with docs} +# Strictly speaking this next file is not part of the binutils distribution. +# But the emacs info system expects it to be present on any system where +# emacs is installed, and old binutils distributions used to include it by +# mistake. Since there is no suitable documentation files component to +# current RHEL releases, it is included here instead. In order to save time +# and complexity it is stored as a pre-built, compressed, info file. +# The upstream version of the original source file can be found here: +# http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=doc/standards.texi;hb=HEAD +# For more information see: https://bugzilla.redhat.com/show_bug.cgi?id=1467390 +Source3: standards.info.gz +%endif + +#---------------------------------------------------------------------------- + +# Purpose: Use /lib64 and /usr/lib64 instead of /lib and /usr/lib in the +# default library search path of 64-bit targets. +# Lifetime: Permanent, but it should not be. This is a bug in the libtool +# sources used in both binutils and gcc, (specifically the +# libtool.m4 file). These are based on a version released in 2009 +# (2.2.6?) rather than the latest version. (Definitely fixed in +# libtool version 2.4.6). +Patch01: binutils-2.20.51.0.2-libtool-lib64.patch + +# Purpose: Appends a RHEL or Fedora release string to the generic binutils +# version string. +# Lifetime: Permanent. This is a RHEL/Fedora specific patch. +Patch02: binutils-2.25-version.patch + +# Purpose: Exports the demangle.h header file (associated with the libiberty +# sources) with the binutils-devel rpm. +# Lifetime: Permanent. This is a RHEL/Fedora specific patch. +Patch03: binutils-export-demangle.h.patch + +# Purpose: Disables the check in the BFD library's bfd.h header file that +# config.h has been included before the bfd.h header. See BZ +# #845084 for more details. +# Lifetime: Permanent - but it should not be. The bfd.h header defines +# various types that are dependent upon configuration options, so +# the order of inclusion is important. +# FIXME: It would be better if the packages using the bfd.h header were +# fixed so that they do include the header files in the correct +# order. +Patch04: binutils-2.22.52.0.4-no-config-h-check.patch + +# Purpose: Include the filename concerned in readelf error messages. This +# makes readelf's output more helpful when it is run on multiple +# input files. +# Lifetime: Permanent. This patch changes the format of readelf's output, +# making it better (IMHO) but also potentially breaking tools that +# depend upon readelf's current format. Hence it remains a local +# patch. +Patch05: binutils-2.29-filename-in-error-messages.patch + +# Purpose: Disable an x86/x86_64 optimization that moves functions from the +# PLT into the GOTPLT for faster access. This optimization is +# problematic for tools that want to intercept PLT entries, such +# as ltrace and LD_AUDIT. See BZs 1452111 and 1333481. +# Lifetime: Permanent. But it should not be. +# FIXME: Replace with a configure time option. +Patch06: binutils-2.29-revert-PLT-elision.patch + +# Purpose: Use the "unsigned long long" type for pointers on hosts where +# long is a 32-bit type but pointers are a 64-bit type. Necessary +# because the rpmdiff tester insists that if both the i686 and +# x86_64 versions of binutils-devel are installed on the same +# machine, then they will have identical versions of the bfd.h +# header file. +# Lifetime: Permanent. +Patch07: binutils-2.25-set-long-long.patch + +# Purpose: Changes readelf so that when it displays extra information about +# a symbol, this information is placed at the end of the line. +# Lifetime: Permanent. +# FIXME: The proper fix would be to update the scripts that are expecting +# a fixed output from readelf. But it seems that some of them are +# no longer being maintained. +Patch08: binutils-readelf-other-sym-info.patch + +# Purpose: Do not create PLT entries for AARCH64 IFUNC symbols referenced in +# debug sections. +# Lifetime: Permanent. +# FIXME: Find related bug. Decide on permanency. +Patch09: binutils-2.27-aarch64-ifunc.patch + +# Purpose: Ignore duplicate indirect symbols generated by GOLD. +# Lifetime: Permanent. +# FIXME: This problem needs to be resolved in the FSF sources, but the +# GOLD maintainers seem to be reluctant to address the issue. +Patch10: binutils-2.28-ignore-gold-duplicates.patch + +# Purpose: Stop the binutils from statically linking with libstdc++. +# Lifetime: Permanent. +Patch11: binutils-do-not-link-with-static-libstdc++.patch + +# Purpose: Add a .attach_to_group pseudo-op to the assembler for +# use by the annobin gcc plugin. +# Lifetime: Permanent. +Patch12: binutils-attach-to-group.patch + +# Purpose: Allow OS specific sections in section groups. +# Lifetime: Fixed in 2.36 (maybe) +Patch13: binutils-special-sections-in-groups.patch + +# Purpose: Have the GOLD linker generate PT_NOTE segments with 8-byte alignment. +# Lifetime: Maybe fixed in 2.33. +Patch14: binutils-gold-8-byte-note-segments.patch + +# Purpose: Stop gold from aborting when input sections with the same name +# have different flags. +# Lifetime: Fixed in 2.36 (maybe) +Patch15: binutils-gold-mismatched-section-flags.patch + +# Purpose: Remove the builder id comment from bfd-stdint.h. It causes +# conflicts when both the i686 and x86_64 binutils devel rpms +# are installed, as the comments makes the file compare as +# being different. +# Lifetime: Permanent. +Patch16: binutils-no-builder-comment-in-bfd-stdint.patch + +# Purpose: Correct licence strings rejected by PELC review. +# Lifetime: Permanent. +Patch17: binutils-PELC-licence-corrections.patch + +# Purpose: Ignore duplicate FDE entries found in some AArch64 libraries. +# Lifetime: Permanent. +Patch18: binutils-ignore-duplicate-FDE-entries.patch + +# Purpose: Fixes build warnings when compiling for s390 usibng gcc-10 +# Lifetime: Should be fixed in 2.36 +Patch19: binutils-s390-build.patch + +# Purpose: Fix LTO problems running config mini-builds. +# Lifetime: Should be fixed in 2.36. +Patch20: binutils-config.patch + +# Purpose: Fix compile time warning messages building with gcc-10. +# Lifetime: Should be fixed in 2.36. +Patch21: binutils-warnings.patch + +# Purpose: Fix compile time warning messages building with gcc-10. (part 2). +# Lifetime: Should be fixed in 2.36. +Patch22: binutils-gcc-10-fixes.patch + +# Purpose: Fix problems with the linker tests. +# Lifetime: Should be fixed in 2.36. +Patch23: binutils-fix-testsuite-failures.patch +Patch24: binutils-fix-ld-failures.patch +Patch25: binutils-aarch64-ld-testsuite-fixes.patch +Patch26: binutils-s390-ld-testsuite-fixes.patch +Patch27: binutils-i686-ld-testsuite-fixes.patch +Patch28: binutils-ppc-ld-testsuite-fixes.patch + +# Purpose: Add a check to the GOLD linker for a corrupt input file +# with a fuzzed section offset. +# Lifetime: Fixed in 2.36 (maybe) +Patch29: binutils-CVE-2019-1010204.patch + +# Purpose: Default to DWARF level 3 in the assembler. +# Lifetime: Fixed in 2.36. +Patch30: binutils-gas-dwarf-level-4.patch + +# Purpose: Set the sh_entsize of the AArch64's PLT section to 0. +# Lifetime: Fixed in 2.36. +Patch31: binutils-aarch64-plt-sh_entsize.patch + +# Purpose: Fixes for linking LTO objects. +# Lifetime: Fixed in 2.36 +Patch32: binutils-add-sym-cache-to-elf-link-hash.patch +Patch33: binutils-elf-add-objects.patch + +# Purpose: Remove a vulnerability in the smart_rename function. +# Lifetime: Fixed in 2.36 +Patch34: binutils-CVE-2021-20197.patch + +# Purpose: Remove a quadratic performance penalty processing files. +# Lifetime: Fixed in 2.35.2 +Patch35: binutils-secondary-relocs-speed.patch + +# Purpose: Remove a quadratic performance penalty processing files. +# Lifetime: Fixed in 2.35.2 +Patch36: binutils-gas-speedups.patch + +# Purpose: Add options to control the display of multibyte characters. CVE 2021-42574 +# Lifetime: Fixed in 2.38 (maybe) +Patch37: binutils.unicode.patch + +# Purpose: Fix the assembly of the three-operand variant of the DCBT insn. +# Lifetime: Fixed in 2.36.1 +Patch38: binutils-PPC-dcbt.patch + +# Purpose: Fix the assembly of the three-operand variant of the DCBT insn (again). +# Lifetime: Fixed in 2.36.1 +Patch39: binutils-ppc-hash-insert.patch + +#---------------------------------------------------------------------------- + +Provides: bundled(libiberty) + +%if %{with gold} + +%define gold_arches %{ix86} x86_64 %{arm} aarch64 %{power64} s390x + +%if %{with bootstrap} +%define build_gold no +%else +%ifarch %gold_arches +%define build_gold both +%else +%define build_gold no +%endif +%endif + +%else +%define build_gold no +%endif + +%define alternatives_cmd %{!?scl:%{_sbindir}}%{?scl:%{_root_sbindir}}/alternatives +%define alternatives_cmdline %{alternatives_cmd}%{?scl: --altdir %{_sysconfdir}/alternatives --admindir %{_scl_root}/var/lib/alternatives} + +%if %{with debug} +# Define this if you want to skip the strip step and preserve debug info. +# Useful for testing. +%define __debug_install_post : > %{_builddir}/%{?buildsubdir}/debugfiles.list +%define debug_package %{nil} +%endif + +Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) + +# Perl, sed and touch are all used in the %%prep section of this spec file. +BuildRequires: gcc, perl, sed, coreutils, autoconf + +# Gold needs bison in order to build gold/yyscript.c. +# Bison needs m4. +%if "%{build_gold}" == "both" +BuildRequires: bison, m4, gcc-c++ +%endif + +%if %{with clang} +BuildRequires: clang compiler-rt +%else +BuildRequires: gcc +%endif + +%if %{without bootstrap} +BuildRequires: gettext, flex, zlib-devel +%endif + +%if %{with docs} +BuildRequires: texinfo >= 4.0 +# BZ 920545: We need pod2man in order to build the manual pages. +BuildRequires: /usr/bin/pod2man +Requires(post): /sbin/install-info +Requires(preun): /sbin/install-info +%else +BuildRequires: findutils +%endif + +# Required for: ld-bootstrap/bootstrap.exp bootstrap with --static +# It should not be required for: ld-elf/elf.exp static {preinit,init,fini} array +%if %{with testsuite} +# relro_test.sh uses dc which is part of the bc rpm, hence its inclusion here. +BuildRequires: dejagnu, zlib-static, glibc-static, sharutils, bc +%if "%{build_gold}" == "both" +# The GOLD testsuite needs a static libc++ +BuildRequires: libstdc++-static +%endif +%endif + +Conflicts: gcc-c++ < 4.0.0 + +%{?scl:Requires:%scl_runtime} + +# The higher of these two numbers determines the default ld. +%{!?ld_bfd_priority: %global ld_bfd_priority 50} +%{!?ld_gold_priority:%global ld_gold_priority 30} + +%if "%{build_gold}" == "both" +Requires(post): coreutils +Requires(post): %{alternatives_cmd} +Requires(preun): %{alternatives_cmd} +%endif + +# On ARM EABI systems, we do want -gnueabi to be part of the +# target triple. +%ifnarch %{arm} +%define _gnu %{nil} +%endif + +%if %{with debuginfod} +BuildRequires: elfutils-debuginfod-client-devel +BuildRequires: elfutils-debuginfod-client +Requires: elfutils-debuginfod-client +%endif + +#---------------------------------------------------------------------------- + +%description +Binutils is a collection of binary utilities, including ar (for +creating, modifying and extracting from archives), as (a family of GNU +assemblers), gprof (for displaying call graph profile data), ld (the +GNU linker), nm (for listing symbols from object files), objcopy (for +copying and translating object files), objdump (for displaying +information from object files), ranlib (for generating an index for +the contents of an archive), readelf (for displaying detailed +information about binary files), size (for listing the section sizes +of an object or archive file), strings (for listing printable strings +from files), strip (for discarding symbols), and addr2line (for +converting addresses to file and line). + +#---------------------------------------------------------------------------- + +%package devel +Summary: BFD and opcodes static and dynamic libraries and header files +Provides: binutils-static = %{version}-%{release} +Requires: zlib-devel +Requires: %{?scl_prefix}binutils = %{version}-%{release} +# BZ 1215242: We need touch... +Requires: coreutils + +%description devel +This package contains BFD and opcodes static and dynamic libraries. + +The dynamic libraries are in this package, rather than a separate +base package because they are actually linker scripts that force +the use of the static libraries. This is because the API of the +BFD library is too unstable to be used dynamically. + +The static libraries are here because they are now needed by the +dynamic libraries. + +Developers starting new projects are strongly encouraged to consider +using libelf instead of BFD. + +#---------------------------------------------------------------------------- + +%if %{with gold} + +%package gold +Summary: The GOLD linker, a faster alternative to the BFD linker +Provides: gold = %{version}-%{release} +Requires: binutils >= %{version} + +%description gold +This package provides the GOLD linker, which can be used as an alternative to +the default binutils linker (ld.bfd). The GOLD is generally faster than the +BFD linker, and it supports features such as Identical Code Folding and +Incremental linking. Unfortunately it is not as well maintained as the BFD +linker, and it may become deprecated in the future. + +# Gold needs bison in order to build gold/yyscript.c. +BuildRequires: bison, m4, gcc-c++ +# The GOLD testsuite needs a static libc++ +BuildRequires: libstdc++-static + +%if ! %{with clang} +BuildRequires: gcc-c++ +Conflicts: gcc-c++ < 4.0.0 +%endif + +# The higher of these two numbers determines the default ld. +%{!?ld_gold_priority:%global ld_gold_priority 30} + +%endif + +%{!?ld_bfd_priority: %global ld_bfd_priority 50} + +#---------------------------------------------------------------------------- + +%prep +%autosetup -p1 -n binutils-%{version} + +# We cannot run autotools as there is an exact requirement of autoconf-2.59. +# FIXME - this is no longer true. Maybe try reinstating autotool use ? + +# On ppc64 and aarch64, we might use 64KiB pages +sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*ppc.c +sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*aarch64.c +sed -i -e '/common_pagesize/s/4 /64 /' gold/powerpc.cc +sed -i -e '/pagesize/s/0x1000,/0x10000,/' gold/aarch64.cc +# LTP sucks +perl -pi -e 's/i\[3-7\]86/i[34567]86/g' */conf* +sed -i -e 's/%''{release}/%{release}/g' bfd/Makefile{.am,.in} +sed -i -e '/^libopcodes_la_\(DEPENDENCIES\|LIBADD\)/s,$, ../bfd/libbfd.la,' opcodes/Makefile.{am,in} +# Build libbfd.so and libopcodes.so with -Bsymbolic-functions if possible. +if gcc %{optflags} -v --help 2>&1 | grep -q -- -Bsymbolic-functions; then +sed -i -e 's/^libbfd_la_LDFLAGS = /&-Wl,-Bsymbolic-functions /' bfd/Makefile.{am,in} +sed -i -e 's/^libopcodes_la_LDFLAGS = /&-Wl,-Bsymbolic-functions /' opcodes/Makefile.{am,in} +fi +# $PACKAGE is used for the gettext catalog name. +sed -i -e 's/^ PACKAGE=/ PACKAGE=%{?cross}/' */configure +# Undo the name change to run the testsuite. +for tool in binutils gas ld +do + sed -i -e "2aDEJATOOL = $tool" $tool/Makefile.am + sed -i -e "s/^DEJATOOL = .*/DEJATOOL = $tool/" $tool/Makefile.in +done +touch */configure +# Touch the .info files so that they are newer then the .texi files and +# hence do not need to be rebuilt. This eliminates the need for makeinfo. +# The -print is there just to confirm that the command is working. +%if %{without docs} + find . -name *.info -print -exec touch {} \; +%endif + +# Not sure how this should be done. The file is created by +# patch44. +chmod +x gold/testsuite/gnu_property_test.sh + +%ifarch %{power64} +%define _target_platform %{_arch}-%{_vendor}-%{_host_os} +%endif + +#---------------------------------------------------------------------------- + +%build +echo target is %{binutils_target} + +# Dependencies are not set up to rebuild the configure files +# in the subdirectories. So we just rebuild the ones we care +# about after applying the configure patches +pushd libiberty +autoconf +popd +pushd intl +autoconf +popd + +%ifarch %{power64} +export CFLAGS="$RPM_OPT_FLAGS -Wno-error" +%else +export CFLAGS="$RPM_OPT_FLAGS" +%endif + +CARGS= + +%if %{with debuginfod} +CARGS="$CARGS --with-debuginfod" +%endif + +case %{binutils_target} in i?86*|sparc*|ppc*|s390*|sh*|arm*|aarch64*) + CARGS="$CARGS --enable-64-bit-bfd" + ;; +esac + +case %{binutils_target} in ia64*) + CARGS="$CARGS --enable-targets=i386-linux" + ;; +esac + +case %{binutils_target} in ppc*|ppc64*) + CARGS="$CARGS --enable-targets=spu" + ;; +esac + +case %{binutils_target} in ppc64-*) + CARGS="$CARGS --enable-targets=powerpc64le-linux" + ;; +esac + +case %{binutils_target} in ppc64le*) + CARGS="$CARGS --enable-targets=powerpc-linux" + ;; +esac + +case %{binutils_target} in x86_64*|i?86*|arm*|aarch64*) + CARGS="$CARGS --enable-targets=x86_64-pep" + ;; +esac + +%if %{default_relro} + CARGS="$CARGS --enable-relro=yes" +%else + CARGS="$CARGS --enable-relro=no" +%endif + +%if %{with debug} +export CFLAGS="$CFLAGS -O0 -ggdb2 -Wno-error -D_FORTIFY_SOURCE=0" +%define enable_shared 0 +%endif + +# BZ 1541027 - include the linker flags from redhat-rpm-config as well. +export LDFLAGS=$RPM_LD_FLAGS + +%if %{with clang} +%define _with_cc_clang 1 +%endif + +# We could optimize the cross builds size by --enable-shared but the produced +# binaries may be less convenient in the embedded environment. +%configure \ + --quiet \ + --build=%{_target_platform} --host=%{_target_platform} \ + --target=%{binutils_target} \ +%if %{with gold} +%ifarch %gold_arches +%if "%{build_gold}" == "both" + --enable-gold=default \ +%else + --enable-gold \ +%endif +%endif +%endif + --enable-ld \ +%if %{isnative} + --with-sysroot=/ \ +%else + --enable-targets=%{_host} \ + --with-sysroot=%{_prefix}/%{binutils_target}/sys-root \ + --program-prefix=%{cross} \ +%endif +%if %{enable_shared} + --enable-shared \ +%else + --disable-shared \ +%endif +%if %{enable_deterministic_archives} + --enable-deterministic-archives \ +%else + --enable-deterministic-archives=no \ +%endif +%if %{enable_lto} + --enable-lto \ +%endif +%if %{default_compress_debug} + --enable-compressed-debug-sections=all \ +%else + --enable-compressed-debug-sections=none \ +%endif +%if %{default_generate_notes} + --enable-generate-build-notes=yes \ +%else + --enable-generate-build-notes=no \ +%endif +%if %{enable_threading} + --enable-threads=yes \ +%else + --enable-threads=no \ +%endif + $CARGS \ + --enable-plugins \ + --with-bugurl=http://bugzilla.redhat.com/bugzilla/ \ + || cat config.log + +%if %{with docs} +%make_build %{_smp_mflags} tooldir=%{_prefix} all +%make_build %{_smp_mflags} tooldir=%{_prefix} info +%else +%make_build %{_smp_mflags} tooldir=%{_prefix} MAKEINFO=true all +%endif + +# Do not use %%check as it is run after %%install where libbfd.so is rebuilt +# with -fvisibility=hidden no longer being usable in its shared form. +%if %{without testsuite} +echo ====================TESTSUITE DISABLED========================= +%else +make -k check < /dev/null || : +echo ====================TESTING========================= +cat {gas/testsuite/gas,ld/ld,binutils/binutils}.sum +%if "%{build_gold}" == "both" +if [ -f gold/test-suite.log ]; then + cat gold/test-suite.log +fi +if [ -f gold/testsuite/test-suite.log ]; then + cat gold/testsuite/*.log +fi +%endif +echo ====================TESTING END===================== +for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log} +do + ln $file binutils-%{_target_platform}-$(basename $file) || : +done +tar cjf binutils-%{_target_platform}.tar.xz binutils-%{_target_platform}-*.{sum,log} +uuencode binutils-%{_target_platform}.tar.xz binutils-%{_target_platform}.tar.xz +rm -f binutils-%{_target_platform}.tar.xz binutils-%{_target_platform}-*.{sum,log} +%if "%{build_gold}" == "both" +if [ -f gold/testsuite/test-suite.log ]; then + tar cjf binutils-%{_target_platform}-gold.log.tar.xz gold/testsuite/*.log + uuencode binutils-%{_target_platform}-gold.log.tar.xz binutils-%{_target_platform}-gold.log.tar.xz + rm -f binutils-%{_target_platform}-gold.log.tar.xz +fi +%endif +%endif + +#---------------------------------------------------------------------------- + +%install +%if %{with docs} +%make_install DESTDIR=%{buildroot} +%else +%make_install DESTDIR=%{buildroot} MAKEINFO=true +%endif + +%if %{isnative} +%if %{with docs} +make prefix=%{buildroot}%{_prefix} infodir=%{buildroot}%{_infodir} install-info +cp %{SOURCE3} %{buildroot}%{_infodir} +%endif + +# Rebuild libiberty.a with -fPIC. +# Future: Remove it together with its header file, projects should bundle it. +%make_build -C libiberty clean +%set_build_flags +%make_build CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libiberty + +# Rebuild libbfd.a with -fPIC. +# Without the hidden visibility the 3rd party shared libraries would export +# the bfd non-stable ABI. +%make_build -C bfd clean +%set_build_flags +%make_build CFLAGS="-g -fPIC $RPM_OPT_FLAGS -fvisibility=hidden" -C bfd + +# Rebuild libopcodes.a with -fPIC. +%make_build -C opcodes clean +%set_build_flags +%make_build CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C opcodes + +install -m 644 bfd/libbfd.a %{buildroot}%{_libdir} +install -m 644 libiberty/libiberty.a %{buildroot}%{_libdir} +install -m 644 include/libiberty.h %{buildroot}%{_prefix}/include +install -m 644 opcodes/libopcodes.a %{buildroot}%{_libdir} +# Remove Windows/Novell only man pages +rm -f %{buildroot}%{_mandir}/man1/{dlltool,nlmconv,windres,windmc}* +%if %{without docs} +rm -f %{buildroot}%{_mandir}/man1/{addr2line,ar,as,c++filt,elfedit,gprof,ld,nm,objcopy,objdump,ranlib,readelf,size,strings,strip}* +rm -f %{buildroot}%{_infodir}/{as,bfd,binutils,gprof,ld}* +%endif + +%if %{enable_shared} +chmod +x %{buildroot}%{_libdir}/lib*.so* +%endif + +# Prevent programs from linking against libbfd and libopcodes +# dynamically, as they are changed far too often. +rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.so + +# Remove libtool files, which reference the .so libs +rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.la + +# Sanity check --enable-64-bit-bfd really works. +grep '^#define BFD_ARCH_SIZE 64$' %{buildroot}%{_prefix}/include/bfd.h +# Fix multilib conflicts of generated values by __WORDSIZE-based expressions. +%ifarch %{ix86} x86_64 ppc %{power64} s390 s390x sh3 sh4 sparc sparc64 arm +sed -i -e '/^#include "ansidecl.h"/{p;s~^.*$~#include ~;}' \ + -e 's/^#define BFD_DEFAULT_TARGET_SIZE \(32\|64\) *$/#define BFD_DEFAULT_TARGET_SIZE __WORDSIZE/' \ + -e 's/^#define BFD_HOST_64BIT_LONG [01] *$/#define BFD_HOST_64BIT_LONG (__WORDSIZE == 64)/' \ + -e 's/^#define BFD_HOST_64_BIT \(long \)\?long *$/#if __WORDSIZE == 32\ +#define BFD_HOST_64_BIT long long\ +#else\ +#define BFD_HOST_64_BIT long\ +#endif/' \ + -e 's/^#define BFD_HOST_U_64_BIT unsigned \(long \)\?long *$/#define BFD_HOST_U_64_BIT unsigned BFD_HOST_64_BIT/' \ + %{buildroot}%{_prefix}/include/bfd.h +%endif +touch -r bfd/bfd-in2.h %{buildroot}%{_prefix}/include/bfd.h + +# Generate .so linker scripts for dependencies; imported from glibc/Makerules: + +# This fragment of linker script gives the OUTPUT_FORMAT statement +# for the configuration we are building. +OUTPUT_FORMAT="\ +/* Ensure this .so library will not be used by a link for a different format + on a multi-architecture system. */ +$(gcc $CFLAGS $LDFLAGS -shared -x c /dev/null -o /dev/null -Wl,--verbose -v 2>&1 | sed -n -f "%{SOURCE2}")" + +tee %{buildroot}%{_libdir}/libbfd.so <> %{?cross}binutils.lang +cat %{?cross}bfd.lang >> %{?cross}binutils.lang +cat %{?cross}gas.lang >> %{?cross}binutils.lang +cat %{?cross}gprof.lang >> %{?cross}binutils.lang + +if [ -x ld/ld-new ]; then + %find_lang %{?cross}ld + cat %{?cross}ld.lang >> %{?cross}binutils.lang +fi +if [ -x gold/ld-new ]; then + %find_lang %{?cross}gold + cat %{?cross}gold.lang >> %{?cross}binutils.lang +fi + +#---------------------------------------------------------------------------- + +%post +%if "%{build_gold}" == "both" +%__rm -f %{_bindir}/%{?cross}ld +%{alternatives_cmdline} --install %{_bindir}/%{?cross}ld %{?cross}ld \ + %{_bindir}/%{?cross}ld.bfd %{ld_bfd_priority} +%{alternatives_cmdline} --install %{_bindir}/%{?cross}ld %{?cross}ld \ + %{_bindir}/%{?cross}ld.gold %{ld_gold_priority} +%endif + +%if %{isnative} +%ldconfig_post +%if %{with docs} + /sbin/install-info --info-dir=%{_infodir} %{_infodir}/as.info.gz + /sbin/install-info --info-dir=%{_infodir} %{_infodir}/binutils.info.gz + /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gprof.info.gz + /sbin/install-info --info-dir=%{_infodir} %{_infodir}/ld.info.gz + /sbin/install-info --info-dir=%{_infodir} %{_infodir}/standards.info.gz +%endif +%endif + +exit 0 + +#---------------------------------------------------------------------------- + +%preun +%if "%{build_gold}" == "both" +if [ $1 = 0 ]; then + %{alternatives_cmdline} --remove %{?cross}ld %{_bindir}/%{?cross}ld.bfd + %{alternatives_cmdline} --remove %{?cross}ld %{_bindir}/%{?cross}ld.gold +fi +%endif + +%if %{isnative} +if [ $1 = 0 ]; then + if [ -e %{_infodir}/binutils.info.gz ] + then + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/as.info.gz + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info.gz + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info.gz + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz + /sbin/install-info --quiet --delete --info-dir=%{_infodir} %{_infodir}/standards.info.gz + fi +fi +%endif + +exit 0 + +#---------------------------------------------------------------------------- + +%if %{isnative} +%postun +%ldconfig_postun + if [ -e %{_infodir}/binutils.info.gz ] + then + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/as.info.gz + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info.gz + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info.gz + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz + /sbin/install-info --quiet --delete --info-dir=%{_infodir} %{_infodir}/standards.info.gz + fi +%endif + +#---------------------------------------------------------------------------- + +%files -f %{?cross}binutils.lang +%license COPYING COPYING3 COPYING3.LIB COPYING.LIB +%doc README +%{_bindir}/%{?cross}[!l]* + +%if "%{build_gold}" == "both" +%{_bindir}/%{?cross}ld.* +%ghost %{_bindir}/%{?cross}ld +%else +%{_bindir}/%{?cross}ld* +%endif + +%if %{with docs} +%{_mandir}/man1/* +%{_infodir}/as.info.* +%{_infodir}/binutils.info.* +%{_infodir}/gprof.info.* +%{_infodir}/ld.info.* +%{_infodir}/bfd.info.* +%{_infodir}/standards.info.* +%endif + +%if %{enable_shared} +%{_libdir}/lib*.so +%{_libdir}/libctf* +%exclude %{_libdir}/libbfd.so +%exclude %{_libdir}/libopcodes.so +%endif + +%if %{isnative} + +%if %{with docs} +%{_infodir}/[^b]*info* +%{_infodir}/binutils*info* +%endif + +%files devel +%{_prefix}/include/* +%{_libdir}/lib*.a +%{_libdir}/libbfd.so +%{_libdir}/libopcodes.so + +%if %{with docs} +%{_infodir}/bfd*info* +%endif + +%endif + +#---------------------------------------------------------------------------- +%changelog +* Thu Feb 03 2022 Nick Clifton - 2.35-11 +- Fix the assembly of the three-operand variant of the DCBT insn. (#2044523) + +* Tue Jan 25 2022 Nick Clifton - 2.35-10 +- Fix the assembly of the three-operand variant of the DCBT insn. (#2044523) + +* Mon Nov 29 2021 Nick Clifton - 2.35-9 +- Add ability to control the display of unicode characters. (#2009178) +- Backport some more speed up patches. (#1978174) +- Remove a quadratic performance penalty processing files. (#1978174) +- Extend vulnerability fix again. (#1925779) + +* Mon Feb 08 2021 Nick Clifton - 2.35-8 +- Extend vulnerability fix again. (#1925779) + +* Mon Feb 01 2021 Nick Clifton - 2.35-7 +- Fix a vulnerability in the smart_rename function used by some binutils tools. (#1920641) + +* Fri Jan 15 2021 Nick Clifton - 2.35-6 +- NVR bump to allow rebuild with new tag. + +* Tue Aug 11 2020 Nick Clifton - 2.35-5 +- Fix building with LTO enabled. +- Set the sh_entsize field of the AArch64's PLT section to 0. (PR 26312) + +* Tue Jul 28 2020 Nick Clifton - 2.35-4 +- Fix testsuite failures. + +* Sun Jul 26 2020 Nick Clifton - 2.35-3 +- Do not enable debuginfod support by default. +- Add run-time dependency on libdebuginfod library when debuginfod support is enabled. + +* Sun Jul 26 2020 Nick Clifton - 2.35-2 +- Remove unnecessary dependency upon binutils-gold. + +* Fri Jul 24 2020 Nick Clifton - 2.35-1 +- REBASE TO GNU BINUTILS 2.35 + +* Wed May 27 2020 Nick Clifton - 2.32-19 +- Initial import into GTS-10-RHEL-8.3 branch. (#1817170) + +* Wed May 13 2020 Nick Clifton - 2.32-18.1 +- Fix a potential illegal memory access parsing corrupt ELF files. (#1835184) + +* Mon Mar 02 2020 Nick Clifton - 2.32-18 +- Fix failures in linker testuite due to compiling test code without -D_FORTIFY_SOURCE specified. (#1809101) + +* Sun Dec 08 2019 Nick Clifton - 2.32-17 +- Fix a potential seg-fault in the BFD library when parsing pathalogical debug_info sections. (#1779255) +- Fix a potential memory exhaustion in the BFD library when parsing corrupt DWARF debug information. +- Backport H.J.Lu's patch to add a workaround for the JCC Errata to the assembler. (#1779417) +- Fix potential integer overflow in readelf. (#1740470) +- Fix potential integer overflow in GOLD. (#1739491) + +* Tue Aug 06 2019 Nick Clifton - 2.32-15 +- Stop strip from complaining if the first build note is not a version note. (#1736114) + +* Mon Aug 05 2019 Nick Clifton - 2.32-14 +- Remove debugging print statement in objcopy sources. (#1733868) + +* Fri Jul 05 2019 Nick Clifton - 2.32-13 +- Define scl before Name. + +* Tue Jul 02 2019 Nick Clifton - 2.32-12 +- Add support for AArch64 function calls that use a variant PCS. + +* Mon Jul 01 2019 Nick Clifton - 2.32-11 +- Stop gas from triggering a seg-fault when creating relocs for build notes. (PR 24748) + +* Tue Jun 25 2019 Nick Clifton - 2.32-10 +- Ignore duplicate FDE entries in AArch64 libraries. (#1709827) + +* Tue Jun 25 2019 Nick Clifton - 2.32-9 +- Correct licences rejected by PELC review. + +* Mon Jun 24 2019 Nick Clifton - 2.32-8 +- Remove the builder command from bfd-stdint.h. + +* Mon Jun 24 2019 Nick Clifton - 2.32-7 +- Stop gold from aborting when it encounters input sections with the same name and different flags. (#1722715) + +* Tue Jun 18 2019 Nick Clifton - 2.32-6 +- Add descriptions to the new s390x arch13 instructions. (#1690457) + +* Wed Jun 12 2019 Nick Clifton - 2.32-5 +- Import patch to fix alignment of note segments created by GOLD. (#1614908) + +* Tue Jun 11 2019 Nick Clifton - 2.32-4 +- Release bump to allow a rebuild. + +* Fri Jun 07 2019 Nick Clifton - 2.32-3 +- Add scl macros to spec file. +- Add gating.yaml file. + +* Wed Jun 05 2019 Nick Clifton - 2.32-2 +- Fix linker testsuite failures. + +* Wed Jun 05 2019 Nick Clifton - 2.32-1 +- IMPORT FROM FEDORA RAWHIDE. +- Improve s390x Hardware support in toolchain. (#1690983) + +* Tue May 21 2019 Nick Clifton - 2.32-14 +- Import fix for PR 23870 in order to help building Go binaries. + +* Mon Apr 29 2019 Nick Clifton - 2.32-13 +- Do not include ld.gold in the base binutils package. (#1703714) + +* Wed Apr 24 2019 Björn Esser - 2.32-12 +- Remove hardcoded gzip suffix from GNU info pages + +* Wed Apr 10 2019 Nick Clifton - 2.32-11 +- Fix a stack exhaustion problem in libiberty's name demangling code. (#1680658) + +* Mon Mar 18 2019 David Abdurachmanov - 2.32-10 +- Disable ld.gold on RISC-V and fix file installation issues. + +* Wed Mar 06 2019 Nick Clifton - 2.32-9 +- Stop potential illegal memory access when disassembling an EFI binary. (#1685727) + +* Wed Feb 27 2019 Nick Clifton - 2.32-8 +- Fix requirements and use of the alternatives mechanism. (#1683408, #1683466) + +* Tue Feb 26 2019 Nick Clifton - 2.32-7 +- Move GOLD into a sub-package of BINUTILS. + +* Tue Feb 26 2019 Nick Clifton - 2.32-6 +- Stop potential illegal memory access when parsing a corrupt MIPS binary. (#1680676) + +* Tue Feb 26 2019 Nick Clifton - 2.32-5 +- Stop potential illegal memory access when parsing corrupt archives. (#1680670) + +* Mon Feb 25 2019 Nick Clifton - 2.32-4 +- Stop potential illegal memory access when parsing corrupt PE files. (#1680682) + +* Mon Feb 25 2019 Nick Clifton - 2.32-3 +- Improve objdump's handling of corrupt input files. (#1680663) + +* Wed Feb 20 2019 Nick Clifton - 2.32-2 +- Fix some bfd linker testsuite failures. + +* Wed Feb 20 2019 Nick Clifton - 2.32-1 +- Rebase to GNU Binutils 2.32 +- Retire: binutils-s390-partial-relro.patch +- Retire: binutils-note-merge-improvements.patch +- Retire: Retire: binutils-merge-attribute-sections.patch +- Retire: binutils-gold-discard-version-info.patch +- Retire: binutils-gas-input-matches-output.patch +- Retire: binutils-fix-testsuite-failures.patch +- Retire: binutils-do-not-provide-shared-section-symbols.patch +- Retire: binutils-disable-readelf-gap-reports.patch +- Retire: binutils-detect-corrupt-sym-version-info.patch +- Retire: binutils-delay-ld-script-constant-eval.patch +- Retire: binutils-clear-version-info.patch +- Retire: binutils-CVE-2018-20002.patch +- Retire: binutils-CVE-2018-17358.patch +- Retire: binutils-2.31-export-demangle.h.patch +- Retire: binutils-2.28-ignore-gold-duplicates.patch +- Retire: binutils-2.26-lto.patch + +* Mon Feb 18 2019 Nick Clifton - 2.31.1-23 +- Ensure that decompressed sections have the correct alignment. (#1678204) + +* Thu Feb 14 2019 Nick Clifton - 2.31.1-22 +- Rework the post uninstall stage to avoid mysterious error from ldconfig. (#1673912) + +* Thu Jan 31 2019 Fedora Release Engineering - 2.31.1-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Wed Jan 30 2019 Nick Clifton - 2.31.1-20 +- Fix the assembler's check that the output file is not also one of the input files. (#1660279) + +* Thu Jan 03 2019 Nick Clifton - 2.31.1-19 +- Fix a memory leak reading minisymbols. (#1661535) + +* Wed Jan 02 2019 Nick Clifton - 2.31.1-18 +- Ensure that GOLD is linked with pthread library. (#1636479) + +* Wed Nov 28 2018 Nick Clifton - 2.31.1-17 +- Stop gold from warning about discard version information unless explicitly requested. (#1654153) + +* Thu Nov 15 2018 Nick Clifton - 2.31.1-16 +- Remove debugging fprintf statement accidentally left in patch. (#1645828) + +* Fri Oct 12 2018 Nick Clifton - 2.31.1-15 +- Allow OS specific sections in section groups. (#1639485) + +* Fri Sep 28 2018 Nick Clifton - 2.31.1-14 +- Fix a potential buffer overrun when parsing a corrupt ELF file. (#1632912) +- Add a .attach_to_group pseuo-op to assembler (for use by annobin). (#1630574) +- Stop the binutils from statically linking with libstdc++. (#1630550) +- Include gold testsuite results in test logs. +- Disable readelf's reporting of gaps in build notes. (#1623556) + +* Tue Sep 04 2018 Nick Clifton - 2.31.1-13 +- Delay the evaluation of linker script constants until after the configuration options have been set. (#1624751) + +* Tue Aug 28 2018 Nick Clifton - 2.31.1-12 +- Detect and report corrupt symbol version information. (#1599521) + +* Tue Aug 14 2018 Nick Clifton - 2.31.1-11 +- Remove the version information from a dynamic symbol that is being overridden. (#1614920) + +* Mon Aug 06 2018 Nick Clifton - 2.31.1-10 +- Improve objcopy's --merge-notes option. (#1608390) + +* Tue Jul 31 2018 Florian Weimer - 2.31.1-9 +- Rebuild with fixed binutils + +* Mon Jul 30 2018 Nick Clifton - 2.31.1-8 +- Move the .gnu.build.attributes section to after the .comment section. + +* Fri Jul 27 2018 Nick Clifton - 2.31.1-7 +- Fix a thinko in the merge patch. + +* Fri Jul 27 2018 Nick Clifton - 2.31.1-6 +- Fix a typo in the merge patch. + +* Thu Jul 26 2018 Nick Clifton - 2.31.1-5 +- Merge .gnu.build.attribute sections together. (#1608390) + +* Tue Jul 24 2018 Nick Clifton - 2.31.1-3 +- Extend gold linker patch to cover subsections of .gnu.build.attributes. (#1607054) + +* Thu Jul 19 2018 Nick Clifton - 2.31.1-2 +- Improve partial relro support for the s/390. + +* Thu Jul 19 2018 Nick Clifton - 2.31.1-1 +- Rebase to official 2.31.1 GNU Binutils release. +- Retire: binutils-2.22.52.0.1-export-demangle.h.patch +- Retire: binutils-2.30-allow_R_AARCH64-symbols.patch +- Retire: binutils-CVE-2018-10372.patch +- Retire: binutils-CVE-2018-10373.patch +- Retire: binutils-CVE-2018-10534.patch +- Retire: binutils-CVE-2018-10535.patch +- Retire: binutils-CVE-2018-6323.patch +- Retire: binutils-CVE-2018-6759.patch +- Retire: binutils-CVE-2018-7208.patch +- Retire: binutils-CVE-2018-7568.patch +- Retire: binutils-CVE-2018-7569.patch +- Retire: binutils-CVE-2018-7570.patch +- Retire: binutils-CVE-2018-7642.patch +- Retire: binutils-CVE-2018-7643.patch +- Retire: binutils-CVE-2018-8945.patch +- Retire: binutils-PowerPC-IEEE-long-double-warnings.patch +- Retire: binutils-debug-section-marking.patch +- Retire: binutils-gas-build-notes.patch +- Retire: binutils-gold-llvm-plugin.patch +- Retire: binutils-ifunc-relocs-in-notes.patch +- Retire: binutils-linkonce-notes.patch +- Retire: binutils-missing-notes.patch +- Retire: binutils-page-to-segment-assignment.patch +- Retire: binutils-revert-PowerPC-speculation-barriers.patch +- Retire: binutils-skip-dwo-search-if-not-needed.patch +- Retire: binutils-speed-up-objdump.patch +- Retire: binutils-strip-unknown-relocs.patch +- Retire: binutils-x86-local-relocs.patch +- Retire: binutils-x86-local-version.patch + +* Thu Jul 12 2018 Fedora Release Engineering - 2.30.90-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Thu Jul 12 2018 Nick Clifton 2.30.90-3 +- Stop gold from complaining about annobin note relocs against symbols in sections which have been discarded. (#1600431) + +* Tue Jul 10 2018 Nick Clifton 2.30.90-2 +- Revert fix for PR 23161 which was placing unversioned section symbols (_edata, _end, __bss_start) into shared libraries. (#1599521) + +* Mon Jul 9 2018 Nick Clifton 2.30.90-1 +- Rebase to a snapshot of the soon-to-be-created 2.31 FSF release. + +* Fri Jul 6 2018 Peter Robinson 2.30-26 +- Fix the generation of relocations for assembler created notes. (#1598551) + +* Wed Jul 4 2018 Peter Robinson 2.30-25 +- Minor spec cleanups and fixes. + +* Mon Jun 18 2018 Nick Clifton 2.30-24 +- When installing both ld.bfd and ld.gold, do not reset the current alternative if upgrading. (#1592069) + +* Tue Jun 12 2018 Nick Clifton 2.30-23 +- Correct warning messages about incompatible PowerPC IEEE long double settings. + +* Fri Jun 01 2018 Nick Clifton 2.30-22 +- Fix handling of local versioned symbols by the x86 linker. (PR 23194) +- Fix linker testsuite failures. + +* Thu May 17 2018 Nick Clifton 2.30-21 +- Fix a seg-fault parsing PE format binaries. (#1560829) + +* Mon May 14 2018 Nick Clifton 2.30-20 +- Have the x86 linker resolve relocations against the _end, _edata and __bss_start symbols locally. (#1576735) +- Do not generate GNU build notes for linkonce sections. (#1576362) + +* Thu May 10 2018 Nick Clifton 2.30-19 +- Fix a seg-fault running objcopy on a corrupt PE format file. (#1574702) +- Fix a seg-fault running objcopy on a corrupt ELF format file. (#1574705) + +* Tue May 01 2018 Nick Clifton 2.30-18 +- Fix a seg-fault parsing corrupt DWARF information. (#1573360) +- Fix another seg-fault parsing corrupt DWARF information. (#1573367) +- Fix a seg-fault copying a corrupt ELF file. (#1551788) +- Fix a seg-fault parsing a large ELF files on a 32-bit host. (#1539891) +- Fix a seg-fault running nm on a corrupt ELF file. (#15343247) +- Fix a seg-fault running nm on a file containing corrupt DWARF information. (#1551781) +- Fix another seg-fault running nm on a file containing corrupt DWARF information. (#1551763) + +* Fri Apr 27 2018 Nick Clifton 2.30-17 +- Disable the automatic generation of annobin notes. (#1572485) + +* Fri Apr 27 2018 Nick Clifton 2.30-16 +- Fix for PR 22887 - crashing objdump by passing it a corrupt AOUT binary. (#1553115) +- Fix for PR 22905 - crashing objdump by passing it a corrupt DWARF file. (#1553122) +- Fix for PR 22741 - crashing objdump by passing it a corrupt COFF file. (#1571918) + +* Thu Apr 26 2018 Nick Clifton 2.30-15 +- Enhance the assembler to automatically generate annobin notes if none are present in the input. + +* Thu Mar 22 2018 Nick Clifton 2.30-14 +- Fix the GOLD linker's processing of protected symbols created by the LLVM plugin. (#1559234 and PR 22868) + +* Wed Mar 14 2018 Nick Clifton 2.30-13 +- Do not discard debugobj files created by GCC v8 LTO wrapper. (#1543912 and RHBZ 84847 and PR 20882) + +* Fri Mar 09 2018 Nick Clifton 2.30-12 +- Treat relocs against s390x IFUNC symbols in note sections as relocs against the FUNC symbol instead. +- Combined previous patches into one which covers all ifunc supporting architectures. (#1553705) +- Retire binutils-s390-ifunc-relocs-in-notes.patch +- Retire binutils-x86_64-ifunc-relocs-in-notes.patch + +* Fri Mar 09 2018 Nick Clifton 2.30-11 +- Treat relocs against s390x IFUNC symbols in note sections as relocs against the FUNC symbol instead. (#1553705) + +* Wed Mar 07 2018 Nick Clifton 2.30-10 +- Ignore duplicate symbols generated by GOLD. (#1458003) + +* Wed Mar 07 2018 Nick Clifton 2.30-9 +- Stop strip from replacing unknown relocs with null relocs. (#1545386) + +* Wed Mar 07 2018 Nick Clifton 2.30-8 +- Ignore duplicate symbols generated by GOLD. (#1458003) + +* Mon Mar 05 2018 Nick Clifton 2.30-7 +- Speed up objdump. (#1551540) + +* Thu Feb 22 2018 Patrick Uiterwijk - 2.30-6 +- Fix R_AARCH64 symbols (PR 22764) (#1547781) + +* Wed Feb 21 2018 Nick Clifton 2.30-5 +- Fix assignment of pages to segments. (PR 22758) +- Inject RPM_LD_FLAGS into the build. (#1541027) +- Fix slowdown in readelf when examining files with lots of debug information. (PR 22802) +- Remove support for PowerPC speculation barrier insertion. +- Rebase on 2.30 +- Retire binutils-2.22.52.0.1-relro-on-by-default.patch +- Retire binutils-2.28-dynamic-section-warning.patch +- Retire binutils-2.29-skip-rp14918-test-for-arm.patch +- Retire binutils-2.29.1-gold-start-stop.patch +- Retire binutils-2.29.1-readelf-use-dynamic.patch +- Retire binutils-aarch64-pie.patch +- Retire binutils-coverity.patch +- Retire binutils-ppc64-stub-creation.patch +- Retire binutils-strip-delete-relocs.patch +- Retire binutils-support-v3-build-notes.patch +- Retire binutils-z-undefs.patch + +* Mon Feb 12 2018 Nick Clifton 2.29.1-19 +- Remove comment that explained how to disable annobin. (#1541027) + +* Thu Feb 08 2018 Nick Clifton 2.29.1-18 +- Inject RPM_LD_FLAGS into the build. (#1541027) + +* Wed Feb 07 2018 Fedora Release Engineering - 2.29.1-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Feb 01 2018 Nick Clifton 2.29.1-16 +- Use make_build and make_install macros. (#1541027) + +* Thu Jan 25 2018 Nick Clifton 2.29.1-15 +- Reenable binary annotations. + +* Thu Jan 25 2018 Nick Clifton 2.29.1-14 +- Fix creation of PowerPC64 function call stubs. (#1523457) +- Disable -z defs during build. +- Disable binary annotations. (temporary ?) + +* Mon Jan 22 2018 Nick Clifton 2.29.1-13 +- Fix bugs in AArch64 static PIE support. (#1536645) + +* Tue Jan 16 2018 Nick Clifton 2.29.1-12 +- Add "-z undefs" option to the linker. + +* Thu Jan 11 2018 Nick Clifton 2.29.1-11 +- *Do* enable relro by default for the PowerPC64 architecture. (#1523946) + +* Wed Jan 03 2018 Nick Clifton 2.29.1-10 +- Update readelf and objcopy to support v3 build notes. + +* Tue Dec 12 2017 Nick Clifton 2.29.1-9 +- Have readelf display extra symbol information at the end of the line. (#1479302) + +* Mon Dec 11 2017 Nick Clifton 2.29.1-8 +- Do not enable relro by default for the PowerPC64 architecture. (#1523946) + +* Thu Dec 07 2017 Nick Clifton 2.29.1-7 +- Stop strip from crashing when deleteing relocs in a file with annobin notes. (#1520805) + +* Wed Dec 06 2017 Nick Clifton 2.29.1-6 +- Have readelf return an exit failure status when attempting to process an empty file. (#1522732) + +* Tue Nov 28 2017 Nick Clifton 2.29.1-5 +- Disable PLT elision for x86/x86_64. (#1452111 and #1333481) + +* Wed Nov 01 2017 Nick Clifton 2.29.1-4 +- Have readelf suggest the use of --use-dynamic when there are dynamic relocs that could have been displayed. (#1507694) + +* Wed Oct 18 2017 Nick Clifton 2.29.1-3 +- Fix the GOLD linker's generation of relocations for start and stop symbols. (#1500898) + +* Thu Sep 28 2017 Nick Clifton 2.29.1-2 +- Enable GOLD for PPC64 and s390x. (#1173780) +- Retire: binutils-2.20.51.0.10-sec-merge-emit.patch. + (It has been redundant for a long time now...) + +* Tue Sep 26 2017 Nick Clifton 2.29.1-1 +- Rebase on FSF binutils 2.29.1 release. +- Retire: binutils-2.29-ppc64-plt-localentry0-disable.patch +- Retire: binutils-2.29-non-elf-orphan-skip.patch + +* Thu Sep 14 2017 Nick Clifton 2.29-10 +- Extend fix for PR 21884. + (#1491023) + +* Thu Sep 14 2017 Nick Clifton 2.29-8 +- Import fix for PR 21884 which stops a seg-fault in the linker when changing output format to binary during a final link. + (#1491023) + +* Sun Sep 10 2017 Nick Clifton - 2.29-7 +- Annotate patches with reason and lifetime expectances. +- Retire: binutils-2.24-ldforcele.patch +- Retire: binutils-2.25-set-long-long.patch +- Retire: binutils-2.25.1-cleansweep.patch +- Retire: binutils-2.26-fix-compile-warnings.patch +- Retire: binutils-2.28-ignore-gold-duplicates.patch + +* Wed Aug 02 2017 Fedora Release Engineering - 2.29-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Mon Jul 31 2017 Nick Clifton 2.29-5 +- Update ppc64 localentry0 patch with changes made by Alan Modra to the FSF binutils sources. + (#1475636) + +* Sun Jul 30 2017 Florian Weimer - 2.29-4 +- Rebuild with binutils fix for ppc64le, bootstrapping (#1475636) + +* Fri Jul 28 2017 Nick Clifton 2.29-3 +- Do not enable the PPC64 plt-localentry0 linker optimization by default. + (#1475636) + +* Wed Jul 26 2017 Fedora Release Engineering - 2.29-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Mon Jul 24 2017 Nick Clifton 2.29-1 +- Rebase on FSF binutils 2.29. +- Retire: binutils-2.20.51.0.10-ppc64-pie.patch +- Retire: binutils-2.27-ld-buffer-overflow.patch +- Retire: binutils-2.28-libiberty-bugfixes.patch +- Retire: binutils-gnu-build-notes.patch +- Retire: binutils-2.28-gas-comp_dir.patch +- Retire: binutils-2.28-ppc-dynamic-relocs.patch +- Retire: binutils-2.28-dynamic-section-warning.patch +- Retire: binutils-2.28-aarch64-copy-relocs.patch +- Retire: binutils-2.28-DW_AT_export_symbols.patch + +* Thu Jul 20 2017 Nick Clifton 2.28-14 +- Remove -flto compile time option accidentally added to CFLAGS. + +* Thu Jul 20 2017 Nick Clifton 2.28-13 +- Add support for displaying new DWARF5 tags. + (#1472966) + +* Wed Jul 19 2017 Nick Clifton 2.28-12 +- Correct snafu in previous delta that broke building s390 binaries. + (#1472486) + +* Mon Jul 17 2017 Nick Clifton 2.28-11 +- Fix s390 assembler so that it remove fake local symbols from its output. + (#1460254) + +* Wed Jun 28 2017 Nick Clifton 2.28-10 +- Update support for GNU Build Attribute notes to include version 2 notes. + +* Thu Jun 15 2017 Nick Clifton 2.28-9 +- Update patch to fix AArch64 copy reloc generation. + (#1452170) + +* Fri Jun 09 2017 Nick Clifton 2.28-8 +- Ignore duplicate indirect symbols generated by the GOLD linker. + (#1458003) + +* Thu Jun 08 2017 Nick Clifton 2.28-7 +- Eliminate the generation of incorrect dynamic copy relocations on AArch64. + (#1452170) + +* Mon May 15 2017 Fedora Release Engineering - 2.28-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild + +* Mon Mar 20 2017 Nick Clifton 2.28-5 +- Update GNU BUILD NOTES patch. +- Import FSF binutils patch to fix running readelf on debug info binaries. + (#1434050) + +* Wed Mar 08 2017 Nick Clifton 2.28-4 +- Update GNU BUILD NOTES patch. +- Import FSF binutils patch to fix an abort with PowerPC dynamic relocs. + +* Mon Mar 06 2017 Mark Wielaard 2.28-3 +- Backport patch to add support for putting name, comp_dir and + producer strings into the .debug_str section. + (#1429389) + +* Fri Mar 03 2017 Nick Clifton 2.28-2 +- Add support for GNU BUILD NOTEs. + +* Thu Mar 02 2017 Nick Clifton 2.28-1 +- Rebase on FSF binutils v2.28. +- Retire: binutils-2.23.52.0.1-addr2line-dynsymtab.patch +- Retire: binutils-2.27-local-dynsym-count.patch +- Retire: binutils-2.27-monotonic-section-offsets.patch +- Retire: binutils-2.27-arm-aarch64-default-relro.patch +- Retire: binutils-2.28-gold.patch +- Retire: binutils-2.27-objdump-improvements.patch +- Retire: binutils-2.27-dwarf-parse-speedup.patch +- Retire: binutils-2.27-objdump-improvements.2.patch +- Retire: binutils-2.27-arm-binary-objects.patch +- Retire: binutils-2.27-ppc-fp-attributes.patch +- Add patch to sync libiberty with FSF GCC mainline. + (#1428310) + +* Fri Feb 17 2017 Nick Clifton 2.27-19 +- Add support for PowerPC FP attributes. + (#1422461) + +* Wed Feb 15 2017 Nick Clifton 2.27-18 +- Fix running the ARM port of the linker on BINARY objects. + (#1422577) + +* Fri Feb 10 2017 Fedora Release Engineering - 2.27-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Thu Feb 02 2017 Stephen Gallagher 2.27-16 +- Install COPYING[*] files using the % license macro. + (#1418430) + +* Tue Jan 31 2017 Nick Clifton 2.27-15 +- Fix buffer overflows when printing translated messages. + (#1417411) + +* Mon Jan 16 2017 Nick Clifton 2.27-14 +- Include the filename concerned in readelf error messages. + (#1412348) + +* Mon Jan 09 2017 Nick Clifton 2.27-13 +- Another speed up for objdump when displaying source code alognside disassembly. + (#1397113) + +* Tue Nov 22 2016 Nick Clifton 2.27-12 +- Speed up objdump when displaying source code alognside disassembly. + (#1397113) + +* Tue Nov 08 2016 Nick Clifton 2.27-11 +- Fix objdumps disassembly of dynamic executables. + (#1370275) + +* Fri Nov 04 2016 Nick Clifton 2.27-10 +- Fix GOLD for ARM and AARCH64 + (#1386126) + +* Mon Sep 26 2016 Mark Pryor 2.27-9 +- Fix invocation of /sbin/ldconfig when reinstalling binutils + in order to prevent warnings from rpm. + (#1379030) + (#1379117) + +* Thu Sep 22 2016 Mark Pryor 2.27-8 +- Add i386pep emulation for all EFI capable CPU types. + (#1376870) + +* Wed Sep 21 2016 Nick Clifton 2.27-7 +- Use --with-sysroot=/ for native targets. This prevents the default + sysroot of /usr/local//sys-root from being used, which breaks + locating needed shared libaries, but still allows the --sysroot + linker command line option to be effective. + (#1374889) + (#1377803) + (#1377949) + +* Tue Sep 20 2016 Nick Clifton 2.27-6 +- Omit building GOLD when bootstrapping. +- Add a generic build requirement on gcc. +- Move bison and m4 build requirements to be conditional upon building GOLD. +- Add --with-sysroot configure option when building native targets. +- Skip PR14918 linker test for ARM native targets. + (#1374889) + +* Fri Sep 16 2016 Nick Clifton 2.27-5 +- Add support for building the rpm with "--with bootstrap" enabled. +- Retire: binutils-2.20.51.0.2-ia64-lib64.patch + +* Thu Sep 01 2016 Nick Clifton 2.27-4 +- Properly disable the default generation of compressed debug sections. + (#1366182) + +* Fri Aug 19 2016 Nick Clifton 2.27-3 +- Put sections in a monotonically increasing order of file offset. +- Allow ARM and AArch64 targets to have relro on by default. + +* Mon Aug 15 2016 Nick Clifton 2.27-2 +- Fix computation of sh_info field in the header of .dynsym sections. + +* Wed Aug 03 2016 Nick Clifton 2.27-1 +- Rebase on FSF binutils 2.27 release. +- Retire: binutils-2.26-formatting.patch +- Retire: binutils-2.26-Bsymbolic_PIE.patch +- Retire: binutils-rh1312151.patch +- Retire: binutils-2.26-fix-GOT-offset-calculation.patch +- Retire: binutils-2.26-common-definitions.patch +- Retire: binutils-2.26-x86-PIE-relocations.patch + +* Mon Jun 13 2016 Nick Clifton 2.26-23 +- Enable support for GCC's LTO. + (#1342618) + +* Thu Jun 02 2016 Nick Clifton 2.26-22 +- Retire the copy-osabi patch. + (#1252066) + +* Mon May 09 2016 Nick Clifton 2.26-21 +- Fix another compile time warning, this time in tc-arm.c. + (#1333695) + +* Fri Apr 22 2016 Nick Clifton 2.26-20 +- Housekeeping: Delete retired patches. Renumber patches. +- Increase version number past F24 because F24 update is blocked by a version number comparison. + +* Fri Mar 18 2016 Nick Clifton 2.26-16 +- Import patch to fix generation of x86 relocs in PIE mode. (PR 19827) + +* Mon Mar 14 2016 Nick Clifton 2.26-15 +- Import patch to have common symbols in an executable override definitions in shared objects (PR 19579) + (#1312507) + +* Mon Feb 29 2016 Nick Clifton 2.26-14 +- Import patch to fix x86 GOT offset calculation in 2.26 sources (PR 19601) + (#1312489) + +* Fri Feb 26 2016 Nick Clifton 2.26-13 +- Import patch to fix symbol versioning bug in 2.26 sources (PR 19698) + (#1312151) + +* Fri Feb 19 2016 Nick Clifton 2.26-12 +- Import H.J.Lu's kernel LTO patch. + (#1302071) + +* Tue Feb 16 2016 poma 2.26-11 +- Enable -Bsymbolic and -Bsymbolic-functions to PIE. Needed by Syslinux + (#1308296) + +* Wed Feb 10 2016 Nick Clifton 2.26-10 +- Retire: binutils-2.23.2-aarch64-em.patch + (#1305179) + +* Tue Feb 09 2016 Nick Clifton 2.26-9 +- Fix indentation in bfd/elf64-s390.c, gas/config/tc-ia64.c + and bfd/pe-mips.c to avoid compile time warnings. + +* Thu Feb 04 2016 Nick Clifton 2.26-8 +- Fix indentation in bfd/coff-[i386|x86_64].c to avoid compile time warning. +- Suppress GOLD's dir_caches destructor. +- Suppress GOLD's Reloc_stub::Key::name function. +- Suppress unused ARM architecture variations in GAS. + +* Wed Feb 03 2016 Fedora Release Engineering - 2.26-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jan 27 2016 Nick Clifton 2.26-4 +- Drop the kernel patch entirely... +- Retire: binutils-2.25-kernel-ld-r.patch +- Retire: binutils-2.25.1-plugin-format-checking.patch + +* Tue Jan 26 2016 Nick Clifton 2.26-3 +- Fix kernel patch for AVR targets. + +* Mon Jan 25 2016 Nick Clifton 2.26-2 +- Fix kernel patch for PPC32 targets. + +* Mon Jan 25 2016 Nick Clifton 2.26-1 +- Rebase on FSF binutils 2.26 release. +- Retire: binutils-2.25.1-ihex-parsing.patch +- Retire: binutils-2.25.1-dynamic_list.patch +- Retire: binutils-2.25.1-aarch64-pr18668.patch +- Retire: binutils-rh1247126.patch + (#1271387) + +* Thu Nov 05 2015 Nick Clifton 2.25.1-9 +- Prevent an infinite recursion when a plugin tries to claim a file in an unrecognised format. + (#1174065) + +* Wed Oct 28 2015 Nick Clifton 2.25.1-8 +- Enable little endian support when configuring for 64-bit PowerPC. + (#1275709) + +* Thu Sep 24 2015 Nick Clifton 2.25.1-7 +- Fix incorrectly generated binaries and DSOs on PPC platforms. + (#1247126) + +* Fri Sep 11 2015 Nick Clifton 2.25.1-6 +- Fix handling of AArch64 local GOT relocs. (#1262091) + +* Thu Sep 10 2015 Nick Clifton 2.25.1-5 +- Do not enable deterministic archives by default (#1195883) + +* Thu Aug 06 2015 Rex Dieter 2.25.1-4 +- Qt linked with gold crash on startup (#1193044) + +* Tue Aug 04 2015 Nick Clifton - 2.25.1-3 +- Fix the parsing of corrupt iHex files. +- Resovles: 1250141 + +* Tue Aug 04 2015 Nick Clifton - 2.25.1-2 +- Retire: binutils-2.25-aarch64-fPIC-error.patch +- Resovles: 1249969 + +* Thu Jul 23 2015 Nick Clifton - 2.25.1-1 +- Rebase on FSF binutils 2.25.1 release. +- Retire: binutils-2.25-x86_64-pie-relocs.patch + +* Thu Jul 02 2015 Nick Clifton - 2.25-12 +- For AArch64 issue an error message when attempting to resolve a + PC-relative dynamic reloc in a non-PIC object file. +- Related: 1232499 + +* Wed Jun 17 2015 Fedora Release Engineering - 2.25-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Wed Jun 10 2015 Nick Clifton - 2.25-10 +- Make the AArch64 GOLD port use 64K pages. +- Resolves: BZ #1225156 and BZ #1215546 + +* Mon Apr 27 2015 Nick Clifton - 2.25-8 +- Require the coreutils so that touch is available. +- Resolves: BZ #1215242 + +* Tue Apr 21 2015 Nick Clifton - 2.25-7 +- Enable building GOLD for the AArch64. +- Resolves: BZ #1203057 + +* Thu Mar 19 2015 Nick Clifton - 2.25-6 +- Remove the windmc manual page, so that it is not installed. +- Resolves: BZ #1203606 + +* Sat Feb 21 2015 Till Maas - 2.25-6 +- Rebuilt for Fedora 23 Change + https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code + +* Mon Feb 02 2015 Nick Clifton - 2.25-5 +- Fix scanning for object symbols in binutils-2.25-kernel-ld-r.patch +- Resolves: BZ #1149660 + +* Tue Jan 20 2015 Nick Clifton - 2.25-4 +- Import the fix for PR ld/17827 from FSF mainline. +- Resolves: BZ #1182511 + +* Mon Jan 12 2015 Nick Clifton - 2.25-3 +- Suppress building of GOLD for PPC, for now... +- Resolves: BZ #1173780 + +* Sat Dec 27 2014 Ralf Corsépius - 2.25-2 +- Reflect configure.info/standards.info having been dropped (RHBZ#1177359). + +* Wed Dec 24 2014 Nick Clifton - 2.25-1 +- Rebase on FSF binutils 2.25 release. +- Retire: binutils-2.24-s390-mkopc.patch +- Retire: binutils-2.24-elfnn-aarch64.patch +- Retire: binutils-2.24-DW_FORM_ref_addr.patch +- Retire: binutils-2.24-set-section-macros.patch +- Retire: binutils-2.24-fake-zlib-sections.patch +- Retire: binutils-2.24-arm-static-tls.patch +- Retire: binutils-2.24-fat-lto-objects.patch +- Retire: binutils-2.24-symbol-warning.patch +- Retire: binutils-2.24-aarch64-ld-shared-non-PIC-xfail.patch +- Retire: binutils-2.24-weak-sym-merge.patch +- Retire: binutils-2.24-indirect-chain.patch +- Retire: binutils-2.24-aarch64-fix-final_link_relocate.patch +- Retire: binutils-2.24-aarch64-fix-gotplt-offset-ifunc.patch +- Retire: binutils-2.24-aarch64-fix-static-ifunc.patch +- Retire: binutils-2.24-aarch64-fix-ie-relax.patch +- Retire: binutils-HEAD-change-ld-notice-interface.patch +- Retire: binutils-2.24-corrupt-binaries.patch +- Retire: binutils-2.24-strings-default-all.patch +- Retire: binutils-2.24-corrupt-ar.patch + +* Thu Nov 13 2014 Nick Clifton - 2.24-29 +- Fix problems with the ar program reported in FSF PR 17533. (1162666, 1162655) + +* Fri Oct 31 2014 Nick Clifton - 2.24-28 +- Fix buffer overrun in ihex parser. +- Fix memory corruption in previous patch. +- Consoldiate corrupt handling patches into just one patch. +- Default strings command to using -a. + +* Wed Oct 29 2014 Nick Clifton - 2.24-27 +- Fix memory corruption bug introduced by the previous patch. + +* Tue Oct 28 2014 Nick Clifton - 2.24-26 +- Import patches for PR/17510 and PR/17512 to fix reading corrupt ELF binaries. (1157276, 1157277) + +* Mon Oct 27 2014 Nick Clifton - 2.24-25 +- Import patch from mainline to fix seg-fault when reading corrupt group headers. (1157276) + +* Fri Oct 24 2014 Nick Clifton - 2.24-24 +- Import patch from mainline to fix seg-fault when reading corrupt srec fields. (1156272) + +* Mon Aug 25 2014 Kyle McMartin - 2.24-23 +- aarch64: increase common page size to 64KB +- binutils-HEAD-change-ld-notice-interface.patch: backport fix from HEAD + that fixes LTO + ifunc when using ld.bfd instead of gold. +- binutils-2.24-aarch64-fix-gotplt-offset-ifunc.patch + binutils-2.24-aarch64-fix-static-ifunc.patch, split elfnn-aarch64 patches + into upstream git commits, to make it easier to figure out what's + backported already +- binutils-2.24-aarch64-fix-ie-relax.patch: add fix for gd to ie relaxation + when target register is >16 (pretty unlikely, but...) + +* Thu Aug 21 2014 Kyle McMartin - 2.24-22 +- bfd/elfnn-aarch64.c: use correct offsets in final_link_relocate + Resolves: BZ #1126199 + +* Thu Aug 21 2014 Nick Clifton - 2.24-21 +- Import patch from mainline to fix indirect symbol resolution. + Resolves: BZ #1123714 + +* Tue Aug 19 2014 Nick Clifton - 2.24-20 +- Enable deterministic archives by default. + Resolves: BZ #1124342 + +* Fri Aug 15 2014 Fedora Release Engineering - 2.24-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Fri Aug 15 2014 Nick Clifton - 2.24-18 +- Correct elf_merge_st_other arguments for weak symbols. + Resolves: #1126436 + +* Tue Aug 12 2014 Jeff Law - 2.24-17 +- Enable gold for PPC. + +* Tue Jun 24 2014 Kyle McMartin - 2.24-16 +- Backport a couple LTO testsuite fixes from HEAD. + Default to -ffat-lto-objects for some ld tests, which was the default in + gcc 4.8, but changed in 4.9, and resulted in some failures. +- Add STATIC_TLS flag on ARM when IE relocs are emitted in a shared + library. Also fix up offsets in the testsuite resulting from the + addition of the flags. +- XFail some ld tests on AArch64 to cut some of the spurious testsuite + failures down. + +* Sat Jun 07 2014 Fedora Release Engineering - 2.24-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Fri May 09 2014 Nick Clifton - 2.24-14 +- Fix detection of little endian PPC64 binaries. (#1095885) + +* Mon Apr 28 2014 Nick Clifton - 2.24-13 +- Fix detection of uncompressed .debug_str sections. (#1082370) + +* Tue Apr 22 2014 Nick Clifton - 2.24-12 +- Fix compiling using gcc 4.9 (#1087374) + +* Thu Mar 27 2014 Nick Clifton - 2.24-11 +- Use {version} in Source string. Delete unused patches. + +* Tue Jan 28 2014 Nick Clifton - 2.24-10 +- Fix decoding of abbrevs using a DW_FORM_ref_addr attribute. (#1056797) + +* Tue Dec 17 2013 Nick Clifton - 2.24-9 +- Import fixes on 2.24 branch that affect AArch64 IFUNC and PLT handling. + +* Thu Dec 05 2013 Nick Clifton - 2.24-8 +- Fix building opcodes library with -Werror=format-security. (#1037026) + +* Wed Dec 04 2013 Jeff Law - 2.24-7 +- Update to official binutils 2.24 release. + +* Thu Nov 21 2013 Nick Clifton - 2.24-6 +- Update binutils 2.24 snapshot. + +* Mon Nov 11 2013 Nick Clifton - 2.24-5 +- Update binutils 2.24 snapshot. +- Switch to using GIT instead of CVS to access the FSF repository. +- Retire binutils-2.24-nm-dynsym.patch + +* Fri Oct 25 2013 Nick Clifton - 2.24-4 +- Update binutils 2.24 snapshot. +- Stop NM from halting if it encounters a file with no symbols when displaying dynamic symbols in multiple files. (#1022845) + +* Fri Oct 18 2013 Nick Clifton - 2.24-3 +- Update binutils 2.24 snapshot. + +* Fri Oct 11 2013 Nick Clifton - 2.24-2 +- Update binutils 2.24 snapshot. + +* Fri Oct 04 2013 Nick Clifton - 2.24-1 +- Rebase on binutils 2.24 snapshot. +- Retire: binutils-2.23.52.0.1-64-bit-thin-archives.patch, +- binutils-2.23.52.0.1-as-doc-texinfo-fixes.patch, +- binutils-2.23.52.0.1-check-regular-ifunc-refs.patch, +- binutils-2.23.2-ld-texinfo-fixes.patch, +- binutils-2.23.2-bfd-texinfo-fixes.patch, +- binutils-2.23.2-dwz-alt-debuginfo.patch +- binutils-2.23.2-s390-gas-machinemode.patch +- binutils-2.23.2-xtensa.memset.patch +- binutils-2.23.2-s390-zEC12.patch +- binutils-2.23.2-arm-add-float-abi-to-e_flags.patch +- binutils-2.23.51.0.1-readelf-flush-stdout.patch + +* Mon Sep 09 2013 Nick Clifton - 2.23.88.0.1-14 +- Make readelf flush stdout before emitting an error or warning message. (#1005182) + +* Fri Aug 30 2013 Kyle McMartin 2.23.88.0.1-13 +- Add the hard-float/soft-float ABI flag as appropriate for + ET_DYN/ET_EXEC in EABI_VER5. +- Fix last changelog entry, it was release 12, not 14. + +* Wed Aug 14 2013 Nick Clifton 2.23.88.0.1-12 +- Add support for the s/390 zEC12 architecture to gas. (#996395) + +* Mon Aug 12 2013 Nick Clifton 2.23.88.0.1-11 +- Fix typos in invocations of memset in elf32-xtensa.c + +* Wed Aug 07 2013 Karsten Hopp 2.23.88.0.1-10 +- disable -Werror on ppc64p7 for #918189 + +* Sat Aug 03 2013 Fedora Release Engineering - 2.23.88.0.1-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Fri Jul 19 2013 Nick Clifton - 2.23.88.0.1-8 +- Add support for the S/390 .machinemode pseudo-op to GAS. (#986031) + +* Fri Jul 05 2013 Nick Clifton - 2.23.88.0.1-7 +- Add a requirement for libstdc++-static when running the GOLD testsuite. + +* Wed Jun 05 2013 Nick Clifton - 2.23.88.0.1-6 +- Fix building of aarch64 targets after applying the patch for kernel ld -r modules. +- Fix building when "--with debug" is specified. + +* Wed May 29 2013 Nick Clifton - 2.23.88.0.1-5 +- Add support for the alternative debuging files generated by the DWZ program. (#965255) + +* Fri May 17 2013 Nick Clifton - 2.23.88.0.1-4 +- Import H.J.'s patch to add support for kernel ld -r modules. +- Fix errors reported by version 5.0 of texinfo when parsing bfd documentation. + +* Fri Apr 26 2013 Nick Clifton - 2.23.88.0.1-3 +- Fix errors reported by version 5.0 of texinfo when parsing assembler documentation. + +* Thu Apr 25 2013 Nick Clifton - 2.23.88.0.1-2 +- Fix errors reported by version 5.0 of texinfo when parsing linker documentation. + +* Wed Apr 24 2013 Nick Clifton - 2.23.88.0.1-1 +- Switch over to basing sources on the official FSF binutils releases. +- Retire binutils-2.23.52.0.1-revert-pr15149.patch. +- Update binutils-2.22.52.0.1-relro-on-by-default.patch and binutils-2.23.52.0.1-as-doc-texinfo-fixes.patch. + +* Wed Apr 17 2013 Nick Clifton - 2.23.52.0.1-10 +- Import patch for FSF mainline PR 15371 to fix ifunc references in shared libraries. (#927818) + +* Thu Mar 14 2013 Nick Clifton - 2.23.52.0.1-9 +- Enhance opncls.c:find_separate_debug_file() to look in Fedora specific locations. +- Enhance dwarf2.c:find_line() to work with shared libraries. (#920542) + +* Wed Mar 13 2013 Nick Clifton - 2.23.52.0.1-8 +- Fix addr2line to use dynamic symbols if it failed to canonicalize ordinary symbols. (#920542) + +* Wed Mar 13 2013 Nick Clifton - 2.23.52.0.1-7 +- Change requirement to explicitly depend upon /usr/bin/pod2man. (#920545) + +* Wed Mar 13 2013 Nick Clifton - 2.23.52.0.1-6 +- Require perl for pod2man for building man pages. (#920545) + +* Fri Mar 08 2013 Nick Clifton - 2.23.52.0.1-5 +- Reverts patch for PR15149 - prevents report weak DT_NEEDED symbols. (#918003) + +* Wed Mar 06 2013 Nick Clifton - 2.23.52.0.1-4 +- Enable building of GOLD for the ARM. (#908966) + +* Mon Mar 04 2013 Nick Clifton - 2.23.52.0.1-3 +- Fix errors reported by version 5.0 of texinfo when parsing assembler documentaion. + +* Fri Mar 01 2013 Nick Clifton - 2.23.52.0.1-2 +- Fix the creation of index tables in 64-bit thin archives. (#915411) + +* Thu Feb 28 2013 Nick Clifton - 2.23.52.0.1-1 +- Rebase on 2.23.51.0.1 release. (#916516) + +* Fri Feb 08 2013 Nick Clifton - 2.23.51.0.9-2 +- Enable 64-bit BFD for aarch64. (#908904) + +* Mon Feb 04 2013 Nick Clifton - 2.23.51.0.9-1 +- Rebase on 2.23.51.0.9 release. (#907089) +- Retire binutils-2.23.51.0.8-arm-whitespace.patch. + +* Mon Jan 21 2013 Nick Clifton - 2.23.51.0.8-4 +- Allow more whitespace in ARM instructions. (#892261) + +* Tue Jan 15 2013 Patsy Franklin - 2.23.51.0.8-3 +- Add bc to BuildRequires when running the testsuite. (#895321) + +* Wed Jan 02 2013 Nick Clifton - 2.23.51.0.8-2 +- Add runtime link with libdl. (#889134) + +* Wed Jan 02 2013 Nick Clifton - 2.23.51.0.8-1 +- Rebase on 2.23.51.0.8 release. (#890382) + +* Fri Dec 21 2012 Nick Clifton - 2.23.51.0.7-1 +- Rebase on 2.23.51.0.7 release. (#889432) + +* Tue Nov 27 2012 Nick Clifton - 2.23.51.0.6-1 +- Rebase on 2.23.51.0.6 release. (#880508) + +* Tue Nov 13 2012 Nick Clifton - 2.23.51.0.5-1 +- Rebase on 2.23.51.0.5 release. (#876141) +- Retire binutils-2.23.51.0.3-arm-ldralt.patch + +* Tue Oct 23 2012 Nick Clifton - 2.23.51.0.3-3 +- Rename ARM LDRALT instruction to LDALT. (#869025) PR/14575 + +* Mon Oct 15 2012 Jon Ciesla - 2.23.51.0.3-2 +- Provides: bundled(libiberty) + +* Tue Oct 02 2012 Nick Clifton - 2.23.51.0.3-1 +- Rebase on 2.23.51.0.3 release. (#858560) + +* Tue Sep 11 2012 Nick Clifton - 2.23.51.0.2-1 +- Rebase on 2.23.51.0.2 release. (#856119) +- Retire binutils-2.23.51.0.1-gold-keep.patch and binutils-rh805974.patch. + +* Tue Sep 4 2012 Jeff Law 2.23.51.0.1-4 +- Correctly handle PLTOFF relocs for s390 IFUNCs. + +* Tue Aug 14 2012 Karsten Hopp 2.23.51.0.1-3 +- apply F17 commit cd2fda5 to honour {powerpc64} macro (#834651) + +* Tue Aug 14 2012 Nick Clifton - 2.23.51.0.1-2 +- Make GOLD honour KEEP directives in linker scripts (#8333355) + +* Wed Aug 08 2012 Nick Clifton - 2.23.51.0.1-1 +- Rebase on 2.23.51.0.1 release. (#846433) +- Retire binutils-2.22.52.0.4-dwz.patch, binutils-2.22.52.0.4-ar-4Gb.patch, binutils-2.22.52.0.4-arm-plt-refcount.patch, binutils-2.22.52.0.4-s390-64bit-archive.patch. + +* Thu Aug 02 2012 Nick Clifton - 2.22.52.0.4-8 +- Make the binutils-devel package depend upon the binutils package. (#845082) + +* Thu Aug 02 2012 Nick Clifton - 2.22.52.0.4-7 +- Disable checks that config.h is included before system headers. (#845084) + +* Tue Jul 17 2012 Nick Clifton - 2.22.52.0.4-6 +- Use 64bit indicies in archives for s390 binaries. (#835957) + +* Thu Jul 05 2012 Nick Clifton - 2.22.52.0.4-5 +- Catch attempts to create a broken symbol index with archives > 4Gb in size. (#835957) + +* Fri Jun 29 2012 Nick Clifton - 2.22.52.0.4-4 +- Import fix for ld/14189. (#829311) + +* Fri Jun 29 2012 Nick Clifton - 2.22.52.0.4-3 +- Fix handling of archives > 4Gb in size by importing patch for PR binutils/14302. (#835957) + +* Tue Jun 19 2012 Jakub Jelinek - 2.22.52.0.4-2 +- Add minimal dwz -m support. + +* Wed Jun 06 2012 Nick Clifton - 2.22.52.0.4-1 +- Rebase on 2.22.52.0.4 release. (#829027) + +* Tue May 08 2012 Nick Clifton - 2.22.52.0.3-1 +- Rebase on 2.22.52.0.3 release. (#819823) + +* Mon Apr 30 2012 Nick Clifton - 2.22.52.0.2-1 +- Rebase on 2.22.52.0.2 release. (#816514) +- Retire binutils-2.22.52.0.1-weakdef.patch, binutils-2.22.52.0.1-ld-13621.patch, binutils-rh797752.patch, binutils-2.22.52.0.1-x86_64-hidden-ifunc.patch, binutils-2.22.52.0.1-tsx.patch and binutils-2.22.52.0.1-hidden-ifunc.patch. +- Update binutils-2.22.52.0.1-reloc-on-by-default.patch. + +* Fri Apr 27 2012 Nick Clifton - 2.22.52.0.1-12 +- Include demangle.h in the devel rpm. + +* Tue Apr 03 2012 Nick Clifton - 2.22.52.0.1-11 +- Enable -zrelro by default for RHEL 7+. (#807831) + +* Fri Mar 16 2012 Jakub Jelinek - 2.22.52.0.1-10 +- Fix up handling of hidden ifunc relocs on i?86 + +* Wed Mar 14 2012 Jeff Law - 2.22.52.0.1-9 +- Fix c++filt docs (2nd instance) (#797752) + +* Wed Mar 07 2012 Jakub Jelinek - 2.22.52.0.1-8 +- Fix up handling of hidden ifunc relocs on x86_64 +- Add Intel TSX support + +* Tue Mar 06 2012 Nick Clifton - 2.22.52.0.1-7 +- Enable -zrelro by default. (#621983 #807831) + +* Mon Feb 27 2012 Jeff Law - 2.22.52.0.1-6 +- Fix c++filt docs (#797752) + +* Wed Feb 15 2012 Mark Wielaard - 2.22.52.0.1-5 +- Add upstream ld/13621 'dangling global hidden symbol in symtab' patch. + +* Wed Feb 08 2012 Adam Williamson - 2.22.52.0.1-4 +- Actually apply the patch + +* Wed Feb 08 2012 Adam Williamson - 2.22.52.0.1-3 +- Add upstream weakdef.patch to fix RH #788107 + +* Wed Feb 01 2012 Nick Clifton - 2.22.52.0.1-2 +- Drat - forgot to upload the new tarball. Now done. + +* Wed Feb 01 2012 Nick Clifton - 2.22.52.0.1-1 +- Rebase on 2.22.52 release. +- Remove build-id.patch and gold-casts.patch as they are included in the 2.22.52 sources. + +* Fri Jan 13 2012 Nick Clifton - 2.22-4 +- Fix bug in GOLD sources parsing signed integers in command line options. + +* Fri Jan 13 2012 Nick Clifton - 2.22-3 +- Add casts for building gold with 4.7 version of gcc. + +* Thu Jan 12 2012 Fedora Release Engineering - 2.22-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Nov 22 2011 Nick Clifton - 2.22-1 +- Rebase on 2.22 release. + +* Fri Sep 30 2011 Ricky Zhou - 2.21.53.0.2-2 +- Rebuild libopcodes.a with -fPIC. + +* Tue Aug 09 2011 Nick Clifton - 2.21.53.0.2-1 +- Rebase on 2.21.53.0.2 tarball. Delete unneeded patches. (BZ 728677) + +* Tue Aug 02 2011 Nick Clifton - 2.21.53.0.1-3 +- Update libiberty demangling. (BZ 727453) + +* Wed Jul 27 2011 Nick Clifton - 2.21.53.0.1-2 +- Import Jakub Jelinek's patch to add support for displaying the contents of .debug_macro sections. + +* Tue Jul 19 2011 Nick Clifton - 2.21.53.0.1-1 +- Rebase on 2.21.53.0.1 tarball. Delete unneeded patches. (BZ 712668) + +* Fri Jun 24 2011 Nick Clifton - 2.21.52.0.1-5 +- Import fix for PR ld/12921. + +* Fri Jun 24 2011 Nick Clifton - 2.21.52.0.1-4 +- Run "alternatives --auto" to restore ld symbolic link if it was manually configured. (BZ 661247) + +* Thu Jun 16 2011 Nick Clifton - 2.21.52.0.1-3 +- Fix seg-fault attempting to find a function name without a symbol table. (BZ 713471) + +* Fri Jun 10 2011 Nick Clifton - 2.21.52.0.1-2 +- Import fix for PR ld/12851 (BZ 711268) + +* Thu Jun 09 2011 Nick Clifton - 2.21.52.0.1-1 +- Rebase on 2.21.52.0.1 tarball. (BZ 712025) + +* Tue May 17 2011 Nick Clifton - 2.21.51.0.9-1 +- Rebase on 2.21.51.0.9 tarball. (BZ 703105) + +* Mon May 2 2011 Peter Robinson - 2.21.51.0.8-3 +- Add ARM to BFD checks + +* Mon Apr 11 2011 Nick Clifton - 2.21.51.0.8-2 +- Delete plugins patch - enable plugins via configure option. + +* Mon Apr 11 2011 Nick Clifton - 2.21.51.0.8-1 +- Rebase on 2.21.51.0.8 tarball. + +* Thu Mar 17 2011 Nick Clifton - 2.21.51.0.7-1 +- Rebase on 2.21.51.0.7 tarball. + +* Tue Mar 08 2011 Nick Clifton - 2.21.51.0.6-2 +- Enable gold plugins. (BZ 682852) + +* Thu Feb 10 2011 Nick Clifton - 2.21.51.0.6-1 +- Rebase on 2.21.51.0.6 tarball. + +* Mon Feb 07 2011 Fedora Release Engineering - 2.21.51.0.5-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Fri Jan 28 2011 Jakub Jelinek - 2.21.51.0.5-3 +- Readd --build-id fix patch. (PR ld/12451) + +* Thu Jan 6 2011 Dan Horák - 2.21.51.0.5-2 +- fix build on non-gold arches like s390(x) where both ld and ld.bfd is installed + +* Wed Jan 5 2011 Nick Clifton - 2.21.51.0.5-1 +- Rebase on 2.21.51.0.5 tarball. +- Delete redundant patches. +- Fix gold+ld configure command line option. + +* Fri Nov 5 2010 Dan Horák - 2.20.51.0.12-2 +- "no" is not valid option for --enable-gold + +* Thu Oct 28 2010 Nick Clifton - 2.20.51.0.12-1 +- Rebase on 2.20.51.0.12 tarball. (BZ 582160) + +* Fri Sep 10 2010 Nick Clifton - 2.20.51.0.11-1 +- Rebase on 2.20.51.0.11 tarball. (BZ 631771) + +* Fri Aug 20 2010 Nick Clifton - 2.20.51.0.10-3 +- Allow ^ and ! characters in linker script wildcard patterns. (BZ 621742) + +* Fri Aug 20 2010 Nick Clifton - 2.20.51.0.10-2 +- Fix seg fault in sec_merge_emit(). (BZ 623687) + +* Tue Aug 10 2010 Nick Clifton - 2.20.51.0.10-1 +- Rebase on 2.20.51.0.10 tarball. +- Import GOLD sources from binutils mainline as of 10 Aug 2010. + +* Wed Jun 30 2010 Nick Clifton - 2.20.51.0.7-5 +- Rename the binutils-static package to binutils-devel in line with the Fedora packaging guidelines. + +* Wed Jun 9 2010 Nick Clifton - 2.20.51.0.7-4 +- Allow GOLD linker to parse "-l" directives inside INPUT statements in linker scripts. (BZ 600553) + +* Tue May 4 2010 Nick Clifton - 2.20.51.0.7-3 +- Allow unique symbols in archive maps. + +* Tue Apr 20 2010 Nick Clifton - 2.20.51.0.7-2 +- Merge binutils-devel package into binutils-static package. (BZ 576300) + +* Thu Apr 8 2010 Nick Clifton - 2.20.51.0.7-1 +- Rebase on 2.20.51.0.7 tarball. +- Delete redundant patches: + binutils-2.20.51.0.2-add-needed.patch, + binutils-2.20.51.0.2-do-not-set-ifunc.patch, + binutils-2.20.51.0.2-enable-gold.patch, + binutils-2.20.51.0.2-gas-expr.patch, + binutils-2.20.51.0.2-ifunc-ld-s.patch, + binutils-2.20.51.0.2-lwp.patch, + binutils-2.20.51.0.2-ppc-hidden-plt-relocs.patch, + binutils-2.20.51.0.2-x86-hash-table.patch, +- Do not allow unique symbols to be bound locally. (PR ld/11434) +- Add support for DWARF4 debug information. + +* Thu Mar 4 2010 Nick Clifton - 2.20.51.0.2-17 +- Do not set ELFOSABI_LINUX on binaries which just link to IFUNC using DSOs. (BZ 568941) + +* Tue Mar 2 2010 Nick Clifton - 2.20.51.0.2-16 +- Copy the OSABI field in ELF headers, if set. (BZ 568921) + +* Fri Feb 12 2010 Nick Clifton - 2.20.51.0.2-15 +- Create separate static and devel sub-packages. (BZ 556040) + +* Tue Feb 2 2010 Nick Clifton - 2.20.51.0.2-14 +- Fix seg-fault when linking mixed x86 and x86_64 binaries. (BZ 487472) + +* Fri Jan 22 2010 Nick Clifton - 2.20.51.0.2-13 +- Add a requirement for the coreutils. (BZ 557006) + +* Wed Jan 20 2010 Nick Clifton - 2.20.51.0.2-12 +- Fix --no-copy-dt-needed so that it will not complain about weak references. + +* Fri Dec 18 2009 Nick Clifton - 2.20.51.0.2-11 +- Add missing part of PR 11088 patch. + +* Thu Dec 17 2009 Nick Clifton - 2.20.51.0.2-10 +- Apply patch for PR 11088. (BZ 544149) + +* Wed Dec 9 2009 Nick Clifton - 2.20.51.0.2-9 +- Apply patch for PR 10856. (BZ 544358) + +* Tue Dec 1 2009 Roland McGrath - 2.20.51.0.2-8 +- Build gold only for x86 flavors until others are tested. + +* Tue Nov 24 2009 Roland McGrath - 2.20.51.0.2-7 +- Add support for building gold. + +* Mon Nov 9 2009 Jakub Jelinek 2.20.51.0.2-5 +- Fix up --copy-dt-needed-entries default. (Nick Clifton) + +* Mon Nov 9 2009 Jakub Jelinek 2.20.51.0.2-4 +- Fix ld -s with IRELATIVE relocations. (BZ 533321, PR ld/10911) +- Add AMD Orochi LWP support, fix FMA4 support. + +* Thu Nov 05 2009 Nick CLifton 2.20.51.0.2-3 +- Rename --add-needed to --copy-dt-needed-entries and improve error message about unresolved symbols in DT_NEEDED DSOs. + +* Tue Oct 27 2009 Jan Kratochvil 2.20.51.0.2-2 +- Fix rpm --excludedocs (BZ 515922). +- Fix spurious scriplet errors by `exit 0'. (BZ 517979, Nick Clifton) + +* Mon Oct 12 2009 Nick Clifton 2.20.51.0.2-1 +- Rebase on 2.20 tarball. +- Remove redundant moxie patch. +- Remove redundant unique is global patch. +- Remove redundant cxxfilt java doc patch. + +* Tue Sep 29 2009 Jan Kratochvil 2.19.51.0.14-32 +- Remove spurious description of nonexistent --java switch for cxxfilt. + +* Thu Aug 6 2009 Jakub Jelinek 2.19.51.0.14-31 +- Fix strip on objects with STB_GNU_UNIQUE symbols. (BZ 515700, PR binutils/10492) + +* Fri Jul 24 2009 Fedora Release Engineering - 2.19.51.0.14-30 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Jul 22 2009 Nick Clifton 2.19.51.0.11-28 +- Rebase sources on 2.19.51.0.14 tarball. Gain fixes for PRs 10429 and 10433. + +* Wed Jul 22 2009 Nick Clifton 2.19.51.0.11-28 +- Rebase sources on 2.19.51.0.13 tarball. Remove redundant orphan section placement patch. (BZ 512937) + +* Tue Jul 14 2009 Nick Clifton 2.19.51.0.11-27 +- Add patch to allow moxie target to build, and hence --enable-targets=all to work. + +* Tue Jul 14 2009 Nick Clifton 2.19.51.0.11-26 +- Import orphan section placement patch from mainline. (BZ 510384) + +* Tue Jul 14 2009 Nick Clifton 2.19.51.0.11-25 +- Fix build-id patch to avoid memory corruption. (BZ 501582) + +* Sat Jul 11 2009 Jan Kratochvil 2.19.51.0.11-24 +- Provide uuencode output of the testsuite results. + +* Tue Jun 30 2009 Nick Clifton 2.19.51.0.11-23 +- Rebase sources on the 2.19.51.0.11 tarball. + +* Mon Jun 22 2009 Nick Clifton 2.19.51.0.10-22 +- Rebase sources on the 2.19.51.0.10 tarball. + +* Thu Jun 11 2009 Nick Clifton 2.19.51.0.2-21 +- Do not attempt to set execute permission on non-regular files. (BZ 503426) + +* Tue Jun 9 2009 Jakub Jelinek 2.19.51.0.2-20 +- Fix .cfi_* skip over >= 64KB of code. (PR gas/10255) + +* Wed May 27 2009 Nick Clifton 2.19.51.0.2-19 +- Import fix for binutils PR #9938. (BZ 500295) + +* Wed Apr 15 2009 Nick Clifton 2.19.51.0.2-18 +- Update IBM Power 7 support patch to fix tlbilx opcode. (BZ 494718) + +* Tue Mar 17 2009 Nick Clifton 2.19.51.0.2-17 +- Add glibc-static to BuildRequires when running the testsuite. + +* Thu Mar 05 2009 Nick Clifton 2.19.51.0.2-16 +- Add IBM Power7 support. (BZ 487887) + +* Mon Mar 02 2009 Nick Clifton 2.19.51.0.2-15 +- Add IFUNC support. (BZ 465302) + +* Mon Feb 23 2009 Fedora Release Engineering - 2.19.51.0.2-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Feb 23 2009 Jan Kratochvil 2.19.50.0.2-13 +- Rediff the symbolic-envvar-revert patch to comply with rpm patch --fuzz=0. + +* Thu Feb 5 2009 Nick Clifton 2.19.51.0.2-12 +- Rebase sources on 2.19.51.0.2 tarball. Remove linkonce-r-discard and + gcc-expect-table patches. + +* Mon Feb 2 2009 Jan Kratochvil 2.19.50.0.1-11 +- Fix .eh_frame_hdr build also for .gcc_except_table LSDA refs (BZ 461675). + +* Fri Jan 23 2009 Nick Clifton 2.19.50.0.1-10 +- Only require dejagnu if the testsuites are going to be run. (BZ 481169) + +* Sat Nov 29 2008 Nick Clifton 2.19.50.0.1-8 +- Add build-id patch to ensure that section contents are incorporated + into a build id. (BZ 472152) + +* Fri Nov 21 2008 Nick Clifton 2.19.50.0.1 +- Rebase sources on 2.19.50.0.1 tarball. Update all patches, trimming + those that are no longer needed. + +* Thu Oct 30 2008 Jan Kratochvil 2.18.50.0.9-7 +- Fix %%{_prefix}/include/bfd.h on 32-bit hosts due the 64-bit BFD target + support from 2.18.50.0.8-2 (BZ 468495). + +* Thu Oct 30 2008 Jan Kratochvil 2.18.50.0.9-6 +- binutils-devel now requires zlib-devel (BZ 463101 comment 5). +- Fix complains on .gnu.linkonce.r relocations to their discarded + .gnu.linkonce.t counterparts. + +* Mon Sep 22 2008 Jan Kratochvil 2.18.50.0.9-5 +- Remove %%makeinstall to comply with the spu-binutils review (BZ 452211). + +* Mon Sep 22 2008 Jan Kratochvil 2.18.50.0.9-4 +- Fix *.so scripts for multilib linking (BZ 463101, suggested by Jakub Jelinek). + +* Sun Sep 21 2008 Jan Kratochvil 2.18.50.0.9-3 +- Provide libbfd.so and libopcodes.so for automatic dependencies (BZ 463101). +- Fix .eh_frame_hdr build on C++ files with discarded common groups (BZ 458950). +- Provide --build and --host to fix `rpmbuild --target' biarch builds. +- Include %%{binutils_target}- filename prefix for binaries for cross builds. +- Fix multilib conflict on %%{_prefix}/include/bfd.h's BFD_HOST_64BIT_LONG_LONG. + +* Mon Sep 15 2008 Jan Kratochvil 2.18.50.0.9-2 +- Package review, analysed by Jon Ciesla and Patrice Dumas (BZ 225615). + - build back in the sourcedir without problems as gasp is no longer included. + - Fix the install-info requirement. + - Drop the needless gzipping of the info files. + - Provide Obsoletes versions. + - Use the %%configure macro. + +* Sat Aug 30 2008 Jan Kratochvil 2.18.50.0.9-1 +- Update to 2.18.50.0.9. + - Drop the ppc-only spu target pre-build stage (BZ 455242). + - Drop parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457189). +- New .spec BuildRequires zlib-devel (/-static) for compressed sections. +- Update .spec Buildroot to be more unique. + +* Fri Aug 1 2008 Jan Kratochvil 2.18.50.0.8-2 +- Fix parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457189). +- Turn on 64-bit BFD support for i386, globally enable AC_SYS_LARGEFILE. +- `--with debug' builds now with --disable-shared. +- Removed a forgotten unused ld/eelf32_spu.c workaround from 2.18.50.0.8-1. + +* Thu Jul 31 2008 Jan Kratochvil 2.18.50.0.8-1 +- Update to 2.18.50.0.8. + - Drop the .clmul -> .pclmul renaming backport. +- Add %%{binutils_target} macro to support building cross-binutils. + (David Woodhouse) +- Support `--without testsuite' to suppress the testsuite run. +- Support `--with debug' to build without optimizations. +- Refresh the patchset with fuzz 0 (for new rpmbuild). +- Enable the spu target on ppc/ppc64 (BZ 455242). + +* Wed Jul 16 2008 Jan Kratochvil 2.18.50.0.6-4 +- include the `dist' tag in the Release number +- libbfd.a symbols visibility is now hidden (for #447426, suggested by Jakub) + +* Wed Jul 16 2008 Jan Kratochvil 2.18.50.0.6-3 +- rebuild libbfd.a with -fPIC for inclusion into shared libraries (#447426) + +* Tue Apr 8 2008 Jakub Jelinek 2.18.50.0.6-2 +- backport .clmul -> .pclmul renaming + +* Fri Apr 4 2008 Jakub Jelinek 2.18.50.0.6-1 +- update to 2.18.50.0.6 + - Intel AES, CLMUL, AVX/FMA support + +* Mon Mar 3 2008 Jakub Jelinek 2.18.50.0.4-2 +- revert aranges optimization (Alan Modra, BZ#5303, BZ#5755) +- fix ld-shared testcase for GCC 4.3 (H.J. Lu) + +* Fri Feb 29 2008 Jakub Jelinek 2.18.50.0.4-1 +- update to 2.18.50.0.4 + +* Tue Feb 19 2008 Fedora Release Engineering 2.18.50.0.3-2 +- Autorebuild for GCC 4.3 + +* Wed Dec 12 2007 Jakub Jelinek 2.18.50.0.3-1 +- update to 2.18.50.0.3 + - fix build with recent makeinfo (#415271) + +* Thu Aug 16 2007 Jakub Jelinek 2.17.50.0.18-1 +- update to 2.17.50.0.18 + - GPLv3+ + - preserve .note.gnu.build-id in objcopy --only-keep-debug (#251935) + - fix sparc64/alpha broken by --build-id patch (#252936) +- update License tag +- fix ld crash with --build-id and non-ELF output format (Alan Modra, BZ#4923) + +* Tue Jul 31 2007 Jakub Jelinek 2.17.50.0.17-7 +- fix ppc32 secure PLT detection (Alan Modra) + +* Wed Jul 25 2007 Jakub Jelinek 2.17.50.0.17-6 +- rebuilt to make sure even libbfd.so and libopcodes.so aren't + broken by #249435 + +* Tue Jul 24 2007 Jakub Jelinek 2.17.50.0.17-5 +- add .note.gnu.build-id into default linker script (#249435) + +* Tue Jul 24 2007 Jakub Jelinek 2.17.50.0.17-4 +- don't kill the %%{_gnu} part of target name on arm + (Lennert Buytenhek, #243516) +- create just one PT_NOTE segment header for all consecutive SHT_NOTE + sections + +* Wed Jul 18 2007 Roland McGrath 2.17.50.0.17-3 +- fix for ld --build-id + +* Sun Jul 15 2007 Roland McGrath 2.17.50.0.17-2 +- ld --build-id support + +* Wed Jun 27 2007 Jakub Jelinek 2.17.50.0.17-1 +- update to 2.17.50.0.17 + +* Tue Jun 12 2007 Jakub Jelinek 2.17.50.0.16-1 +- update to 2.17.50.0.16 + +* Sat Apr 14 2007 Jakub Jelinek 2.17.50.0.12-4 +- fix linking non-ELF input objects into ELF output (#235747) + +* Wed Mar 14 2007 Jakub Jelinek 2.17.50.0.12-3 +- don't require matching ELF_OSABI for target vecs with ELFOSABI_NONE, + only prefer specific osabi target vecs over the generic ones + (H.J.Lu, #230964, BZ#3826) +- build libbfd.so and libopcodes.so with -Bsymbolic-functions + +* Fri Mar 2 2007 Jakub Jelinek 2.17.50.0.12-2 +- ignore install-info errors from scriptlets (#223678) + +* Thu Mar 1 2007 Jakub Jelinek 2.17.50.0.12-1 +- update to 2.17.50.0.12 +- revert the misdesigned LD_SYMBOLIC{,_FUNCTIONS} env var support, + only support -Bsymbolic/-Bsymbolic-functions/--dynamic-list* + +* Mon Jan 8 2007 Jakub Jelinek 2.17.50.0.9-1 +- update to 2.17.50.0.9 +- fix tekhex reader + +* Sat Dec 23 2006 Jakub Jelinek 2.17.50.0.8-2 +- fix --as-needed on ppc64 (#219629) + +* Sun Dec 3 2006 Jakub Jelinek 2.17.50.0.8-1 +- update to 2.17.50.0.8 +- initialize frch_cfi_data (BZ#3607) + +* Fri Dec 1 2006 Jakub Jelinek 2.17.50.0.7-1 +- update to 2.17.50.0.7 + - .cfi_personality and .cfi_lsda directives, per subsection .cfi_* + directives, better .eh_frame CIE merging + +* Thu Nov 9 2006 Jakub Jelinek 2.17.50.0.6-3 +- fix popcnt instruction assembly and disassembly on amd64 (#214767) + +* Mon Oct 23 2006 Jakub Jelinek 2.17.50.0.6-2 +- update to 2.17.50.0.6 + - fix for section relative linker script defined symbols in + empty sections (#207598, BZ#3267) + - fix handling of DW_CFA_set_loc in .eh_frame optimizations + - fix R_PPC_{PLT,GOT{,_TLSGD,_TLSLD,_TPREL,_DTPREL}}16_HA relocation + handling with weak undefined symbols (Alan Modra, #211094) + +* Tue Sep 12 2006 Jakub Jelinek 2.17.50.0.3-6 +- fix multilib conflict in %%{_prefix}/include/bfd.h + +* Tue Sep 12 2006 Jakub Jelinek 2.17.50.0.3-5 +- fix efi-app-ia64 magic number (#206002, BZ#3171) + +* Tue Sep 5 2006 Jakub Jelinek 2.17.50.0.3-4 +- link libopcodes*.so against libbfd*.so (#202327) +- split *.a and header files into binutils-devel + +* Fri Aug 18 2006 Jakub Jelinek 2.17.50.0.3-3 +- on ppc and ppc64 increase default -z commonpagesize to 64K (#203001) + +* Fri Jul 28 2006 Alexandre Oliva 2.17.50.0.3-2 +- do not infer x86 arch implicitly based on instruction in the input + (#200330) + +* Mon Jul 17 2006 Jakub Jelinek 2.17.50.0.3-1 +- update to 2.17.50.0.3 + +* Fri Jul 14 2006 Jakub Jelinek 2.17.50.0.2-8 +- add support for new AMDFAM10 instructions (#198281, IT#97662) +- add -march=/-mtune= gas support on x86/x86-64 +- x86/x86-64 nop insn improvements +- fix DT_GNU_HASH shift count value computation + +* Tue Jul 11 2006 Jakub Jelinek 2.17.50.0.2-7 +- add DT_GNU_HASH support (--hash-style=gnu and --hash-style=both + ld options) + +* Thu Jun 29 2006 Jakub Jelinek 2.17.50.0.2-4 +- fix i?86 TLS GD->IE transition in executables (#196157, BZ#2513) + +* Mon Jun 19 2006 Jakub Jelinek 2.17.50.0.2-3 +- fix two places in ld that misbehaved with MALLOC_PERTURB_=N +- fix .tls_common handling in relocatable linking + +* Mon Jun 5 2006 Jakub Jelinek 2.17.50.0.2-2 +- fix --as-needed (Alan Modra, #193689, BZ#2721) + +* Thu Jun 1 2006 Jakub Jelinek 2.17.50.0.2-1 +- update to 2.17.50.0.2 +- update from CVS to 20060601 +- speed up the ELF linker by caching the result of kept section check + (H.J. Lu) + +* Tue May 9 2006 Jakub Jelinek 2.17.50.0.1-1 +- update to 2.17.50.0.1 + +* Fri Mar 31 2006 Jakub Jelinek 2.16.91.0.6-6 +- fix ld error message formatting, so that collect2 parser can + parse it again for g++ -frepo (#187142) + +* Thu Mar 9 2006 Alexandre Oliva 2.16.91.0.6-4 +- fix relaxation of TLS GD to LE on PPC (#184590) + +* Fri Mar 3 2006 Jakub Jelinek 2.16.91.0.6-3 +- support DW_CFA_val_{offset,offset_sf,expression} in readelf/objdump + +* Tue Feb 28 2006 Jakub Jelinek 2.16.91.0.6-2 +- add MNI support on i?86/x86_64 (#183080) +- support S signal frame augmentation flag in .eh_frame, + add .cfi_signal_frame support (#175951, PR other/26208, BZ#300) + +* Tue Feb 14 2006 Jakub Jelinek 2.16.91.0.6-1 +- update to 2.16.91.0.6 + - fix ppc64 --gc-sections + - disassembler fixes for x86_64 cr/debug regs + - fix linker search order for DT_NEEDED libs + +* Mon Jan 02 2006 Jakub Jelinek 2.16.91.0.5-1 +- update to 2.16.91.0.5 +- don't error about .toc1 references to discarded sectiosn on ppc64 + (#175944) + +* Wed Dec 14 2005 Jakub Jelinek 2.16.91.0.3-2 +- put .gnu.linkonce.d.rel.ro.* sections into relro region + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Fri Nov 11 2005 Jakub Jelinek 2.16.91.0.3-1 +- update to 2.16.91.0.3 +- add .weakref support (Alexandre Oliva, #115157, #165728) + +* Thu Aug 18 2005 Jakub Jelinek 2.16.91.0.2-4 +- install-info also configure.info +- update standards.texi from gnulib (#165530) + +* Tue Aug 16 2005 Jakub Jelinek 2.16.91.0.2-3 +- update to 20050816 CVS +- better fix for ld-cdtest +- fix symbol version script parsing + +* Fri Jul 29 2005 Jakub Jelinek 2.16.91.0.2-2 +- don't complain about relocs to discarded sections in ppc32 + .got2 sections (Alan Modra, PR target/17828) + +* Fri Jul 22 2005 Jakub Jelinek 2.16.91.0.2-1 +- update to 2.16.91.0.2 + +* Thu Jul 21 2005 Jakub Jelinek 2.16.91.0.1-3 +- fix buffer overflow in readelf ia64 unwind printing code +- use vsnprintf rather than vsprintf in gas diagnostics (Tavis Ormandy) +- fix ld-cdtest when CFLAGS contains -fexceptions + +* Wed Jul 20 2005 Jakub Jelinek 2.16.91.0.1-2 +- update to 20050720 CVS + +* Mon Jul 11 2005 Jakub Jelinek 2.16.91.0.1-1 +- update to 2.16.91.0.1 plus 20050708 CVS + +* Wed Jun 15 2005 Jakub Jelinek 2.16.90.0.3-1 +- update to 2.16.90.0.3 +- update to 20050615 CVS + - ppc32 secure PLT support (Alan Modra) +- further bfd/readelf robustification + +* Sat Jun 11 2005 Jakub Jelinek 2.15.94.0.2.2-4 +- further bfd robustification (CAN-2005-1704, #158680) + +* Fri Jun 10 2005 Jakub Jelinek 2.15.94.0.2.2-3 +- further objdump and readelf robustification (CAN-2005-1704, #158680) + +* Wed May 25 2005 Jakub Jelinek 2.15.94.0.2.2-2 +- bfd and readelf robustification (CAN-2005-1704, #158680) + +* Tue Mar 29 2005 Jakub Jelinek 2.15.94.0.2.2-1 +- update to 2.15.94.0.2.2 +- speed up walk_wild_section (Robert O'Callahan) + +* Mon Mar 7 2005 Jakub Jelinek 2.15.94.0.2-4 +- rebuilt with GCC 4 + +* Mon Feb 28 2005 Jakub Jelinek 2.15.94.0.2-3 +- fix buffer overflows in readelf (#149506) +- move c++filt to binutils from gcc-c++, conflict with gcc-c++ < 4.0 (#86333) + +* Thu Feb 10 2005 Jakub Jelinek 2.15.94.0.2-1 +- update to 2.15.94.0.2 +- fix .note.GNU-stack/PT_GNU_STACK computation in linker on ppc64 (#147296) +- fix stripping of binaries/libraries that have empty sections right before + .dynamic section (with the same starting address; #144038) +- handle AS_NEEDED (...) in linker script INPUT/GROUP + +* Tue Dec 14 2004 Jakub Jelinek 2.15.92.0.2-11 +- fix a longstanding -z relro bug + +* Mon Dec 13 2004 Jakub Jelinek 2.15.92.0.2-10 +- avoid unnecessary gap with -z relro showing on i686 libc.so +- ppc64 --emit-relocs fix (Alan Modra) +- don't crash if STT_SECTION symbol has incorrect st_shndx (e.g. SHN_ABS, + as created by nasm; #142181) +- don't try to make absptr LSDAs relative if they don't have relocations + against them (Alan Modra, #141162) + +* Wed Oct 27 2004 Jakub Jelinek 2.15.92.0.2-5.EL4 +- fix ar xo (#104344) + +* Wed Oct 20 2004 Jakub Jelinek 2.15.92.0.2-5 +- fix --just-symbols on ppc64 (Alan Modra, #135498) + +* Fri Oct 15 2004 Jakub Jelinek 2.15.92.0.2-4 +- fix code detecting matching linkonce and single member comdat + group sections (#133078) + +* Mon Oct 11 2004 Jakub Jelinek 2.15.92.0.2-3 +- revert Sep 09 change to make ppc L second argument e.g. for tlbie + non-optional +- fix stripping of prelinked binaries and libraries (#133734) +- allow strings(1) on 32-bit arches to be used again with > 2GB + files (#133555) + +* Mon Oct 4 2004 Jakub Jelinek 2.15.92.0.2-2 +- update to 2.15.92.0.2 +- change ld's ld.so.conf parser to match ldconfig's (#129340) + +* Mon Sep 20 2004 Jakub Jelinek 2.15.91.0.2-9 +- avoid almost 1MB (sparse) gaps in the middle of -z relro + libraries on x86-64 (Andreas Schwab) +- fix -z relro to make sure end of PT_GNU_RELRO segment is always + COMMONPAGESIZE aligned + +* Wed Aug 18 2004 Jakub Jelinek 2.15.91.0.2-8 +- fix linker segfaults on input objects with SHF_LINK_ORDER with + incorrect sh_link (H.J.Lu, Nick Clifton, #130198, BZ #290) + +* Wed Aug 18 2004 Jakub Jelinek 2.15.91.0.2-7 +- resolve all undefined ppc64 .* syms to the function bodies through + .opd, not just those used in brach instructions (Alan Modra) + +* Tue Aug 17 2004 Jakub Jelinek 2.15.91.0.2-6 +- fix ppc64 ld --dotsyms (Alan Modra) + +* Tue Aug 17 2004 Jakub Jelinek 2.15.91.0.2-5 +- various ppc64 make check fixes when using non-dot-syms gcc (Alan Modra) +- fix --gc-sections +- on ia64 create empty .gnu.linkonce.ia64unw*.* sections for + .gnu.linkonce.t.* function doesn't need unwind info + +* Mon Aug 16 2004 Jakub Jelinek 2.15.91.0.2-4 +- kill ppc64 dot symbols (Alan Modra) +- objdump -d support for objects without dot symbols +- support for overlapping ppc64 .opd entries + +* Mon Aug 9 2004 Jakub Jelinek 2.15.91.0.2-3 +- fix a newly introduced linker crash on x86-64 + +* Sun Aug 8 2004 Alan Cox 2.15.91.0.2-2 +- BuildRequire bison and macroise buildroot - from Steve Grubb + +* Fri Jul 30 2004 Jakub Jelinek 2.15.91.0.2-1 +- update to 2.15.91.0.2 +- BuildRequire flex (#117763) + +* Wed May 19 2004 Jakub Jelinek 2.15.90.0.3-7 +- use lib64 instead of lib directories on ia64 if %%{_lib} is + set to lib64 by rpm + +* Sat May 15 2004 Jakub Jelinek 2.15.90.0.3-6 +- fix a bug introduced in the ++/-- rejection patch + from 2.15.90.0.3 (Alan Modra) + +* Tue May 4 2004 Jakub Jelinek 2.15.90.0.3-5 +- fix s390{,x} .{,b,p2}align handling +- ppc/ppc64 testsuite fix + +* Mon May 3 2004 Jakub Jelinek 2.15.90.0.3-4 +- -z relro ppc/ppc64/ia64 fixes +- change x86-64 .plt symbol st_size handling to match ia32 +- prettify objdump -d output + +* Tue Apr 20 2004 Jakub Jelinek 2.15.90.0.3-3 +- several SPARC fixes + +* Sun Apr 18 2004 Jakub Jelinek 2.15.90.0.3-2 +- yet another fix for .tbss handling + +* Fri Apr 16 2004 Jakub Jelinek 2.15.90.0.3-1 +- update to 2.15.90.0.3 + +* Fri Mar 26 2004 Jakub Jelinek 2.15.90.0.1.1-2 +- update to 20040326 CVS + - fix ppc64 weak .opd symbol handling (Alan Modra, #119086) +- fix .tbss handling bug introduced + +* Fri Mar 26 2004 Jakub Jelinek 2.15.90.0.1.1-1 +- update to 2.15.90.0.1.1 + +* Sat Feb 21 2004 Jakub Jelinek 2.14.90.0.8-8 +- with -z now without --enable-new-dtags create DT_BIND_NOW + dynamic entry in addition to DT_FLAGS_1 with DF_1_NOW bit set + +* Fri Feb 20 2004 Jakub Jelinek 2.14.90.0.8-7 +- fix -pie on ppc32 + +* Fri Feb 20 2004 Jakub Jelinek 2.14.90.0.8-6 +- clear .plt sh_entsize on sparc32 +- put whole .got into relro area with -z now -z relro + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Thu Jan 22 2004 Jakub Jelinek 2.14.90.0.8-4 +- fix -pie on IA64 + +* Mon Jan 19 2004 Jakub Jelinek 2.14.90.0.8-3 +- fix testcases on s390 and s390x + +* Fri Jan 16 2004 Jakub Jelinek 2.14.90.0.8-2 +- fix testcases on AMD64 +- fix .got's sh_entsize on IA32/AMD64 +- set COMMONPAGESIZE on s390/s390x +- set COMMONPAGESIZE on ppc32 (Alan Modra) + +* Fri Jan 16 2004 Jakub Jelinek 2.14.90.0.8-1 +- update to 2.14.90.0.8 + +* Tue Jan 13 2004 Jakub Jelinek 2.14.90.0.7-4 +- fix -z relro on 64-bit arches + +* Mon Jan 12 2004 Jakub Jelinek 2.14.90.0.7-3 +- fix some bugs in -z relro support + +* Fri Jan 9 2004 Jakub Jelinek 2.14.90.0.7-2 +- -z relro support, reordering of RW sections + +* Fri Jan 9 2004 Jakub Jelinek 2.14.90.0.7-1 +- update to 2.14.90.0.7 + +* Mon Nov 24 2003 Jakub Jelinek 2.14.90.0.6-4 +- fix assembly parsing of foo=(.-bar)/4 (Alan Modra) +- fix IA-64 assembly parsing of (p7) hint @pause + +* Tue Sep 30 2003 Jakub Jelinek 2.14.90.0.6-3 +- don't abort on some linker warnings/errors on IA-64 + +* Sat Sep 20 2003 Jakub Jelinek 2.14.90.0.6-2 +- fix up merge2.s to use .p2align instead of .align + +* Sat Sep 20 2003 Jakub Jelinek 2.14.90.0.6-1 +- update to 2.14.90.0.6 +- speed up string merging (Lars Knoll, Michael Matz, Alan Modra) +- speed up IA-64 local symbol handling during linking + +* Fri Sep 5 2003 Jakub Jelinek 2.14.90.0.5-7 +- avoid ld -s segfaults introduced in 2.14.90.0.5-5 (Dmitry V. Levin, + #103180) + +* Fri Aug 29 2003 Jakub Jelinek 2.14.90.0.5-6 +- build old demangler into libiberty.a (#102268) +- SPARC .cfi* support + +* Tue Aug 5 2003 Jakub Jelinek 2.14.90.0.5-5 +- fix orphan section placement + +* Tue Jul 29 2003 Jakub Jelinek 2.14.90.0.5-4 +- fix ppc64 elfvsb linker tests +- some more 64-bit cleanliness fixes, give ppc64 fdesc symbols + type and size (Alan Modra) + +* Tue Jul 29 2003 Jakub Jelinek 2.14.90.0.5-3 +- fix 64-bit unclean code in ppc-opc.c + +* Mon Jul 28 2003 Jakub Jelinek 2.14.90.0.5-2 +- fix 64-bit unclean code in tc-ppc.c + +* Mon Jul 28 2003 Jakub Jelinek 2.14.90.0.5-1 +- update to 2.14.90.0.5 +- fix ld -r on ppc64 (Alan Modra) + +* Fri Jul 18 2003 Jakub Jelinek 2.14.90.0.4-23 +- rebuilt + +* Thu Jul 17 2003 Jakub Jelinek 2.14.90.0.4-22 +- fix elfNN_ia64_dynamic_symbol_p (Richard Henderson, #86661) +- don't access memory beyond what was allocated in readelf + (Richard Henderson) + +* Thu Jul 10 2003 Jakub Jelinek 2.14.90.0.4-21 +- add .cfi_* support on ppc{,64} and s390{,x} + +* Tue Jul 8 2003 Jakub Jelinek 2.14.90.0.4-20 +- remove lib{bfd,opcodes}.la (#98190) + +* Mon Jul 7 2003 Jakub Jelinek 2.14.90.0.4-19 +- fix -pie support on amd64, s390, s390x and ppc64 +- issue relocation overflow errors for s390/s390x -fpic code when + accessing .got slots above 4096 bytes from .got start + +* Thu Jul 3 2003 Jakub Jelinek 2.14.90.0.4-18 +- rebuilt + +* Thu Jul 3 2003 Jakub Jelinek 2.14.90.0.4-17 +- fix ia64 -pie support +- require no undefined non-weak symbols in PIEs like required for normal + binaries + +* Wed Jul 2 2003 Jakub Jelinek 2.14.90.0.4-16 +- fix readelf -d on IA-64 +- build libiberty.a with -fPIC, so that it can be lined into shared + libraries + +* Wed Jun 25 2003 Jakub Jelinek 2.14.90.0.4-15 +- rebuilt + +* Wed Jun 25 2003 Jakub Jelinek 2.14.90.0.4-14 +- added support for Intel Prescott instructions +- fix hint@pause for ia64 +- add workaround for LTP sillyness (#97934) + +* Wed Jun 18 2003 Jakub Jelinek 2.14.90.0.4-13 +- update CFI stuff to 2003-06-18 +- make sure .eh_frame is aligned to 8 bytes on 64-bit arches, + remove padding within one .eh_frame section + +* Tue Jun 17 2003 Jakub Jelinek 2.14.90.0.4-12 +- rebuilt + +* Tue Jun 17 2003 Jakub Jelinek 2.14.90.0.4-11 +- one more fix for the same patch + +* Tue Jun 17 2003 Jakub Jelinek 2.14.90.0.4-10 +- fix previous patch + +* Mon Jun 16 2003 Jakub Jelinek 2.14.90.0.4-9 +- ensure R_PPC64_{RELATIVE,ADDR64} have *r_offset == r_addend + and the other relocs have *r_offset == 0 + +* Tue Jun 10 2003 Jakub Jelinek 2.14.90.0.4-8 +- remove some unnecessary provides in ppc64 linker script + which were causing e.g. empty .ctors/.dtors section creation + +* Fri Jun 6 2003 Jakub Jelinek 2.14.90.0.4-7 +- some CFI updates/fixes +- don't create dynamic relocations against symbols defined in PIE + exported from its .dynsym + +* Wed Jun 4 2003 Jakub Jelinek 2.14.90.0.4-6 +- update gas to 20030604 +- PT_GNU_STACK support + +* Mon Jun 2 2003 Jakub Jelinek 2.14.90.0.4-5 +- buildrequire gettext (#91838) + +* Sat May 31 2003 Jakub Jelinek 2.14.90.0.4-4 +- fix shared libraries with >= 8192 .plt slots on ppc32 + +* Thu May 29 2003 Jakub Jelinek 2.14.90.0.4-3 +- rebuilt + +* Thu May 29 2003 Jakub Jelinek 2.14.90.0.4-2 +- rename ld --dynamic option to --pic-executable or --pie +- fix ld --help output +- document --pie/--pic-executable in ld.info and ld.1 + +* Wed May 28 2003 Jakub Jelinek 2.14.90.0.4-1 +- update to 2.14.90.0.4-1 +- gas CFI updates (Richard Henderson) +- dynamic executables (Ulrich Drepper) + +* Tue May 20 2003 Jakub Jelinek 2.14.90.0.2-2 +- fix ELF visibility handling +- tidy plt entries on IA-32, ppc and ppc64 + +* Mon May 19 2003 Jakub Jelinek 2.14.90.0.2-1 +- update to 2.14.90.0.2-1 + +* Tue May 13 2003 Jakub Jelinek 2.13.90.0.20-8 +- fix bfd_elf_hash on 64-bit arches (Andrew Haley) + +* Wed Apr 30 2003 Jakub Jelinek 2.13.90.0.20-7 +- rebuilt + +* Mon Apr 14 2003 Jakub Jelinek 2.13.90.0.20-6 +- optimize DW_CFA_advance_loc4 in gas even if there is 'z' augmentation + with size 0 in FDE + +* Fri Apr 11 2003 Jakub Jelinek 2.13.90.0.20-5 +- fix SPARC build + +* Thu Apr 3 2003 Jakub Jelinek 2.13.90.0.20-4 +- fix ppc32 plt reference counting +- don't include %%{_prefix}/%%{_lib}/debug in the non-debuginfo package + (#87729) + +* Mon Mar 31 2003 Jakub Jelinek 2.13.90.0.20-3 +- make elf64ppc target native extra on ppc and elf32ppc native extra + on ppc64. + +* Fri Mar 28 2003 Jakub Jelinek 2.13.90.0.20-2 +- fix TLS on IA-64 with ld relaxation + +* Sat Mar 22 2003 Jakub Jelinek 2.13.90.0.20-1 +- update to 2.13.90.0.20 + +* Mon Feb 24 2003 Jakub Jelinek 2.13.90.0.18-9 +- rebuilt + +* Mon Feb 24 2003 Jakub Jelinek 2.13.90.0.18-8 +- don't strip binaries in %%install, so that there is non-empty + debuginfo + +* Mon Feb 24 2003 Jakub Jelinek 2.13.90.0.18-7 +- don't optimize .eh_frame during ld -r + +* Thu Feb 13 2003 Jakub Jelinek 2.13.90.0.18-6 +- don't clear elf_link_hash_flags in the .symver patch +- only use TC_FORCE_RELOCATION in s390's TC_FORCE_RELOCATION_SUB_SAME + (Alan Modra) + +* Mon Feb 10 2003 Jakub Jelinek 2.13.90.0.18-5 +- fix the previous .symver change +- remove libbfd.so and libopcodes.so symlinks, so that other packages + link statically, not dynamically against libbfd and libopcodes + whose ABI is everything but stable + +* Mon Feb 10 2003 Jakub Jelinek 2.13.90.0.18-4 +- do .symver x, x@FOO handling earlier +- support .file and .loc on s390* + +* Mon Feb 10 2003 Jakub Jelinek 2.13.90.0.18-3 +- handle .symver x, x@FOO in ld such that relocs against x become + dynamic relocations against x@FOO (#83325) +- two PPC64 TLS patches (Alan Modra) + +* Sun Feb 09 2003 Jakub Jelinek 2.13.90.0.18-2 +- fix SEARCH_DIR on x86_64/s390x +- fix Alpha --relax +- create DT_RELA{,SZ,ENT} on s390 even if there is just .rela.plt + and no .rela.dyn section +- support IA-32 on IA-64 (#83752) +- .eh_frame_hdr fix (Andreas Schwab) + +* Thu Feb 06 2003 Jakub Jelinek 2.13.90.0.18-1 +- update to 2.13.90.0.18 + 20030121->20030206 CVS diff + +* Tue Feb 04 2003 Jakub Jelinek 2.13.90.0.16-8 +- alpha TLS fixes +- use .debug_line directory table to make the section tiny bit smaller +- libtool fix from Jens Petersen + +* Sun Feb 02 2003 Jakub Jelinek 2.13.90.0.16-7 +- sparc32 TLS + +* Fri Jan 24 2003 Jakub Jelinek 2.13.90.0.16-6 +- s390{,x} TLS and two other mainframe patches + +* Fri Jan 17 2003 Jakub Jelinek 2.13.90.0.16-5 +- fix IA-64 TLS IE in shared libs +- .{preinit,init,fini}_array compat hack from Alexandre Oliva + +* Thu Jan 16 2003 Jakub Jelinek 2.13.90.0.16-4 +- IA-64 TLS fixes +- fix .plt sh_entsize on Alpha +- build with %%_smp_mflags + +* Sat Nov 30 2002 Jakub Jelinek 2.13.90.0.16-3 +- fix strip on TLS binaries and libraries + +* Fri Nov 29 2002 Jakub Jelinek 2.13.90.0.16-2 +- fix IA-64 ld bootstrap + +* Thu Nov 28 2002 Jakub Jelinek 2.13.90.0.16-1 +- update to 2.13.90.0.16 +- STT_TLS SHN_UNDEF fix + +* Wed Nov 27 2002 Jakub Jelinek 2.13.90.0.10-4 +- pad .rodata.cstNN sections at the end if they aren't sized to multiple + of sh_entsize +- temporary patch to make .eh_frame and .gcc_except_table sections + readonly if possible (should be removed when AUTO_PLACE is implemented) +- fix .PPC.EMB.apuinfo section flags + +* Wed Oct 23 2002 Jakub Jelinek 2.13.90.0.10-3 +- fix names and content of alpha non-alloced .rela.* sections (#76583) +- delete unpackaged files from the buildroot + +* Tue Oct 15 2002 Jakub Jelinek 2.13.90.0.10-2 +- enable s390x resp. s390 emulation in linker too + +* Mon Oct 14 2002 Jakub Jelinek 2.13.90.0.10-1 +- update to 2.13.90.0.10 +- add a bi-arch patch for sparc/s390/x86_64 +- add --enable-64-bit-bfd on sparc, s390 and ppc + +* Thu Oct 10 2002 Jakub Jelinek 2.13.90.0.4-3 +- fix combreloc testcase + +* Thu Oct 10 2002 Jakub Jelinek 2.13.90.0.4-2 +- fix orphan .rel and .rela section placement with -z combreloc (Alan Modra) +- skip incompatible linker scripts when searching for libraries + +* Tue Oct 1 2002 Jakub Jelinek 2.13.90.0.4-1 +- update to 2.13.90.0.4 +- x86-64 TLS support +- some IA-32 TLS fixes +- some backported patches from trunk +- include opcodes, ld, gas and bfd l10n too + +* Thu Sep 19 2002 Jakub Jelinek 2.13.90.0.2-3 +- allow addends for IA-32 TLS @tpoff, @ntpoff and @dtpoff +- clear memory at *r_offset of dynamic relocs on PPC +- avoid ld crash if accessing non-local symbols through LE relocs +- new IA-32 TLS relocs, bugfixes and testcases +- use brl insn on IA-64 (Richard Henderson) +- fix R_IA64_PCREL21{M,F} handling (Richard Henderson) +- build in separate builddir, so that gasp tests don't fail +- include localization + +* Thu Aug 8 2002 Jakub Jelinek 2.13.90.0.2-2 +- fix R_386_TPOFF32 addends (#70824) + +* Sat Aug 3 2002 Jakub Jelinek 2.13.90.0.2-1 +- update to 2.13.90.0.2 + - fix ld TLS assertion failure (#70084) + - fix readelf --debug-dump= handling to match man page and --help + (#68997) +- fix _GLOBAL_OFFSET_TABLE gas handling (#70241) + +* Wed Jul 24 2002 Jakub Jelinek 2.12.90.0.15-1 +- update to 2.12.90.0.15 +- TLS .tbss fix +- don't use rpm %%configure macro, it is broken too often (#69366) + +* Thu May 30 2002 Jakub Jelinek 2.12.90.0.9-1 +- update to 2.12.90.0.9 + - TLS support +- remove gasp.info from %%post/%%preun (#65400) + +* Mon Apr 29 2002 Jakub Jelinek 2.12.90.0.7-1 +- update to 2.12.90.0.7 +- run make check + +* Mon Apr 29 2002 Jakub Jelinek 2.11.93.0.2-12 +- fix .hidden handling on SPARC (Richard Henderson) +- don't crash when linking -shared non-pic code with SHF_MERGE +- fix .eh_frame_hdr for DW_EH_PE_aligned +- correctly adjust DW_EH_PE_pcrel encoded personalities in CIEs + +* Fri Apr 5 2002 Jakub Jelinek 2.11.93.0.2-11 +- don't emit dynamic R_SPARC_DISP* relocs against STV_HIDDEN symbols + into shared libraries + +* Thu Mar 21 2002 Jakub Jelinek 2.11.93.0.2-10 +- don't merge IA-64 unwind info sections together during ld -r + +* Mon Mar 11 2002 Jakub Jelinek 2.11.93.0.2-9 +- fix DATA_SEGMENT_ALIGN on ia64/alpha/sparc/sparc64 + +* Fri Mar 8 2002 Jakub Jelinek 2.11.93.0.2-8 +- don't crash on SHN_UNDEF local dynsyms (Andrew MacLeod) + +* Thu Mar 7 2002 Jakub Jelinek 2.11.93.0.2-7 +- fix bfd configury bug (Alan Modra) + +* Tue Mar 5 2002 Jakub Jelinek 2.11.93.0.2-6 +- don't copy visibility when equating symbols +- fix alpha .text/.data with .previous directive bug + +* Tue Mar 5 2002 Jakub Jelinek 2.11.93.0.2-5 +- fix SHF_MERGE crash with --gc-sections (#60369) +- C++ symbol versioning patch + +* Fri Feb 22 2002 Jakub Jelinek 2.11.93.0.2-4 +- add DW_EH_PE_absptr -> DW_EH_PE_pcrel optimization for shared libs, + if DW_EH_PE_absptr cannot be converted that way, don't build the + .eh_frame_hdr search table + +* Fri Feb 15 2002 Jakub Jelinek 2.11.93.0.2-3 +- fix ld -N broken by last patch + +* Tue Feb 12 2002 Jakub Jelinek 2.11.93.0.2-2 +- trade one saved runtime page for data segment (=almost always not shared) + for up to one page of disk space where possible + +* Fri Feb 8 2002 Jakub Jelinek 2.11.93.0.2-1 +- update to 2.11.93.0.2 +- use %%{ix86} instead of i386 for -z combreloc default (#59086) + +* Thu Jan 31 2002 Jakub Jelinek 2.11.92.0.12-10 +- don't create SHN_UNDEF STB_WEAK symbols unless there are any relocations + against them + +* Wed Jan 30 2002 Bill Nottingham 2.11.92.0.12-9.1 +- rebuild (fix ia64 miscompilation) + +* Wed Jan 09 2002 Tim Powers +- automated rebuild + +* Fri Dec 28 2001 Jakub Jelinek 2.11.92.0.12-8 +- two further .eh_frame patch fixes + +* Wed Dec 19 2001 Jakub Jelinek 2.11.92.0.12-7 +- as ld is currently not able to shrink input sections to zero size + during discard_info, build a fake minimal CIE in that case +- update elf-strtab patch to what was commited + +* Mon Dec 17 2001 Jakub Jelinek 2.11.92.0.12-6 +- one more .eh_frame patch fix +- fix alpha .eh_frame handling +- optimize elf-strtab finalize + +* Sat Dec 15 2001 Jakub Jelinek 2.11.92.0.12-5 +- yet another fix for the .eh_frame patch + +* Fri Dec 14 2001 Jakub Jelinek 2.11.92.0.12-4 +- Alan Modra's patch to avoid crash if there is no dynobj + +* Thu Dec 13 2001 Jakub Jelinek 2.11.92.0.12-3 +- H.J.'s patch to avoid crash if input files are not ELF +- don't crash if a SHF_MERGE for some reason could not be merged +- fix objcopy/strip to preserve SHF_MERGE sh_entsize +- optimize .eh_frame sections, add PT_GNU_EH_FRAME support +- support anonymous version tags in version script + +* Tue Nov 27 2001 Jakub Jelinek 2.11.92.0.12-2 +- fix IA-64 SHF_MERGE handling + +* Tue Nov 27 2001 Jakub Jelinek 2.11.92.0.12-1 +- update to 2.11.92.0.12 + - optimize .dynstr and .shstrtab sections (#55524) + - fix ld.1 glitch (#55459) +- turn relocs against SHF_MERGE local symbols with zero addend + into STT_SECTION + addend +- remove man pages for programs not included (nlmconv, windres, dlltool; + #55456, #55461) +- add BuildRequires for texinfo + +* Thu Oct 25 2001 Jakub Jelinek 2.11.92.0.7-2 +- duh, fix strings on bfd objects (#55084) + +* Sat Oct 20 2001 Jakub Jelinek 2.11.92.0.7-1 +- update to 2.11.92.0.7 +- remove .rel{,a}.dyn from output if it is empty + +* Thu Oct 11 2001 Jakub Jelinek 2.11.92.0.5-2 +- fix strings patch +- use getc_unlocked in strings to speed it up by 50% on large files + +* Wed Oct 10 2001 Jakub Jelinek 2.11.92.0.5-1 +- update to 2.11.92.0.5 + - binutils localization (#45148) + - fix typo in REPORT_BUGS_TO (#54325) +- support files bigger than 2GB in strings (#54406) + +* Wed Sep 26 2001 Jakub Jelinek 2.11.90.0.8-12 +- on IA-64, don't mix R_IA64_IPLTLSB relocs with non-PLT relocs in + .rela.dyn section. + +* Tue Sep 25 2001 Jakub Jelinek 2.11.90.0.8-11 +- add iplt support for IA-64 (Richard Henderson) +- switch to new section flags for SHF_MERGE and SHF_STRINGS, put + in compatibility code +- "s" section flag for small data sections on IA-64 and Alpha + (Richard Henderson) +- fix sparc64 .plt[32768+] handling +- don't emit .rela.stab on sparc + +* Mon Sep 10 2001 Jakub Jelinek 2.11.90.0.8-10 +- fix SHF_MERGE on Sparc + +* Fri Aug 31 2001 Jakub Jelinek 2.11.90.0.8-9 +- on Alpha, copy *r_offset to R_ALPHA_RELATIVE's r_addend + +* Thu Aug 30 2001 Jakub Jelinek 2.11.90.0.8-8 +- on IA-64, put crtend{,S}.o's .IA_64.unwind section last in + .IA_64.unwind output section (for compatibility with 7.1 eh) + +* Fri Aug 24 2001 Jakub Jelinek 2.11.90.0.8-7 +- put RELATIVE relocs first, not last +- enable -z combreloc by default on IA-{32,64}, Alpha, Sparc* + +* Thu Aug 23 2001 Jakub Jelinek 2.11.90.0.8-6 +- support for -z combreloc +- remove .dynamic patch, -z combreloc patch does this better +- set STT_FUNC default symbol sizes in .endp directive on IA-64 + +* Mon Jul 16 2001 Jakub Jelinek 2.11.90.0.8-5 +- fix last patch (H.J.Lu) + +* Fri Jul 13 2001 Jakub Jelinek 2.11.90.0.8-4 +- fix placing of orphan sections + +* Sat Jun 23 2001 Jakub Jelinek +- fix SHF_MERGE support on Alpha + +* Fri Jun 8 2001 Jakub Jelinek +- 2.11.90.0.8 + - some SHF_MERGE suport fixes +- don't build with tooldir /usrusr instead of /usr (#40937) +- reserve few .dynamic entries for prelinking + +* Mon Apr 16 2001 Jakub Jelinek +- 2.11.90.0.5 + - SHF_MERGE support + +* Tue Apr 3 2001 Jakub Jelinek +- 2.11.90.0.4 + - fix uleb128 support, so that CVS gcc bootstraps + - some ia64 fixes + +* Mon Mar 19 2001 Jakub Jelinek +- add -Bgroup support from Ulrich Drepper + +* Fri Mar 9 2001 Jakub Jelinek +- hack - add elf_i386_glibc21 emulation + +* Fri Feb 16 2001 Jakub Jelinek +- 2.10.91.0.2 + +* Fri Feb 9 2001 Jakub Jelinek +- 2.10.1.0.7 +- remove ExcludeArch ia64 +- back out the -oformat, -omagic and -output change for now + +* Fri Dec 15 2000 Jakub Jelinek +- Prereq /sbin/install-info + +* Tue Nov 21 2000 Jakub Jelinek +- 2.10.1.0.2 + +* Tue Nov 21 2000 Jakub Jelinek +- add one more alpha patch + +* Wed Nov 15 2000 Jakub Jelinek +- fix alpha visibility as problem +- add support for Ultra-III + +* Fri Sep 15 2000 Jakub Jelinek +- and one more alpha patch + +* Fri Sep 15 2000 Jakub Jelinek +- two sparc patches + +* Mon Jul 24 2000 Jakub Jelinek +- 2.10.0.18 + +* Mon Jul 10 2000 Jakub Jelinek +- 2.10.0.12 + +* Mon Jun 26 2000 Jakub Jelinek +- 2.10.0.9 + +* Thu Jun 15 2000 Jakub Jelinek +- fix ld -r + +* Mon Jun 5 2000 Jakub Jelinek +- 2.9.5.0.46 +- use _mandir/_infodir/_lib + +* Mon May 8 2000 Bernhard Rosenkraenzer +- 2.9.5.0.41 + +* Wed Apr 12 2000 Bernhard Rosenkraenzer +- 2.9.5.0.34 + +* Wed Mar 22 2000 Bernhard Rosenkraenzer +- 2.9.5.0.31 + +* Fri Feb 04 2000 Cristian Gafton +- man pages are compressed +- apply kingdon's patch from #5031 + +* Wed Jan 19 2000 Jeff Johnson +- Permit package to be built with a prefix other than /usr. + +* Thu Jan 13 2000 Cristian Gafton +- add pacth from hjl to fix the versioning problems in ld + +* Tue Jan 11 2000 Bernhard Rosenkraenzer +- Add sparc patches from Jakub Jelinek +- Add URL: + +* Tue Dec 14 1999 Bernhard Rosenkraenzer +- 2.9.5.0.22 + +* Wed Nov 24 1999 Bernhard Rosenkraenzer +- 2.9.5.0.19 + +* Sun Oct 24 1999 Bernhard Rosenkraenzer +- 2.9.5.0.16 + +* Mon Sep 06 1999 Jakub Jelinek +- make shared non-pic libraries work on sparc with glibc 2.1. + +* Fri Aug 27 1999 Jim Kingdon +- No source/spec changes, just rebuilding with egcs-1.1.2-18 because + the older egcs was miscompling gprof. + +* Mon Apr 26 1999 Cristian Gafton +- back out very *stupid* sparc patch done by HJLu. People, keep out of + things you don't understand. +- add alpha relax patch from rth + +* Mon Apr 05 1999 Cristian Gafton +- version 2.9.1.0.23 +- patch to make texinfo documentation compile +- auto rebuild in the new build environment (release 2) + +* Tue Feb 23 1999 Cristian Gafton +- updated to 2.9.1.0.21 +- merged with UltraPenguin + +* Mon Jan 04 1999 Cristian Gafton +- added ARM patch from philb +- version 2.9.1.0.19a +- added a patch to allow arm* arch to be identified as an ARM + +* Thu Oct 01 1998 Cristian Gafton +- updated to 2.9.1.0.14. + +* Sat Sep 19 1998 Jeff Johnson +- updated to 2.9.1.0.13. + +* Wed Sep 09 1998 Cristian Gafton +- updated to 2.9.1.0.12 + +* Thu Jul 2 1998 Jeff Johnson +- updated to 2.9.1.0.7. + +* Wed Jun 03 1998 Jeff Johnson +- updated to 2.9.1.0.6. + +* Tue Jun 02 1998 Erik Troan +- added patch from rth to get right offsets for sections in relocateable + objects on sparc32 + +* Thu May 07 1998 Prospector System +- translations modified for de, fr, tr + +* Tue May 05 1998 Cristian Gafton +- version 2.9.1.0.4 is out; even more, it is public ! + +* Tue May 05 1998 Jeff Johnson +- updated to 2.9.1.0.3. + +* Mon Apr 20 1998 Cristian Gafton +- updated to 2.9.0.3 + +* Tue Apr 14 1998 Cristian Gafton +- upgraded to 2.9.0.2 + +* Sun Apr 05 1998 Cristian Gafton +- updated to 2.8.1.0.29 (HJ warned me that this thing is a moving target... + :-) +- "fixed" the damn make install command so that all tools get installed + +* Thu Apr 02 1998 Cristian Gafton +- upgraded again to 2.8.1.0.28 (at least on alpha now egcs will compile) +- added info packages handling + +* Tue Mar 10 1998 Cristian Gafton +- upgraded to 2.8.1.0.23 + +* Mon Mar 02 1998 Cristian Gafton +- updated to 2.8.1.0.15 (required to compile the newer glibc) +- all patches are obsoleted now + +* Wed Oct 22 1997 Erik Troan +- added 2.8.1.0.1 patch from hj +- added patch for alpha palcode form rth diff --git a/binutils.unicode.patch b/binutils.unicode.patch new file mode 100644 index 0000000..4974303 --- /dev/null +++ b/binutils.unicode.patch @@ -0,0 +1,1775 @@ +diff -rup binutils.orig/binutils/NEWS binutils-2.35/binutils/NEWS +--- binutils.orig/binutils/NEWS 2021-10-21 15:15:57.838969981 +0100 ++++ binutils-2.35/binutils/NEWS 2021-10-21 15:39:14.475071663 +0100 +@@ -122,6 +122,15 @@ Changes in 2.32: + + Changes in 2.31: + ++* Tools which display names or strings (readelf, strings, nm, objdump) ++ have a new command line option which controls how unicode characters are ++ handled. By default they are treated as normal for the tool. Using ++ --unicode=locale will display them according to the current locale. ++ Using --unicode=hex will display them as hex byte values, whilst ++ --unicode=escape will display them as escape sequences. In addition ++ using --unicode=highlight will display them as unicode escape sequences ++ highlighted in red (if supported by the output device). ++ + * Add support for disassembling netronome Flow Processor (NFP) firmware files. + + * The AArch64 port now supports showing disassembly notes which are emitted +diff -rup binutils.orig/binutils/doc/binutils.texi binutils-2.35/binutils/doc/binutils.texi +--- binutils.orig/binutils/doc/binutils.texi 2021-10-21 15:15:57.839969974 +0100 ++++ binutils-2.35/binutils/doc/binutils.texi 2021-10-21 15:39:14.476071657 +0100 +@@ -787,6 +787,7 @@ nm [@option{-A}|@option{-o}|@option{--pr + [@option{-D}|@option{--dynamic}] [@option{-f}@var{format}|@option{--format=}@var{format}] + [@option{-g}|@option{--extern-only}] [@option{-h}|@option{--help}] + [@option{-l}|@option{--line-numbers}] [@option{--inlines}] ++ [@option{-U} @var{method}] [@option{--unicode=}@var{method}] + [@option{-n}|@option{-v}|@option{--numeric-sort}] + [@option{-P}|@option{--portability}] [@option{-p}|@option{--no-sort}] + [@option{-r}|@option{--reverse-sort}] [@option{-S}|@option{--print-size}] +@@ -1075,6 +1076,21 @@ Use @var{radix} as the radix for printin + @cindex undefined symbols + Display only undefined symbols (those external to each object file). + ++@item -U @var{[d|i|l|e|x|h]} ++@itemx --unicode=@var{[default|invalid|locale|escape|hex|highlight]} ++Controls the display of UTF-8 encoded mulibyte characters in strings. ++The default (@option{--unicode=default}) is to give them no special ++treatment. The @option{--unicode=locale} option displays the sequence ++in the current locale, which may or may not support them. The options ++@option{--unicode=hex} and @option{--unicode=invalid} display them as ++hex byte sequences enclosed by either angle brackets or curly braces. ++ ++The @option{--unicode=escape} option displays them as escape sequences ++(@var{\uxxxx}) and the @option{--unicode=highlight} option displays ++them as escape sequences highlighted in red (if supported by the ++output device). The colouring is intended to draw attention to the ++presence of unicode sequences where they might not be expected. ++ + @item -V + @itemx --version + Show the version number of @command{nm} and exit. +@@ -2176,6 +2192,7 @@ objdump [@option{-a}|@option{--archive-h + [@option{--prefix-strip=}@var{level}] + [@option{--insn-width=}@var{width}] + [@option{--visualize-jumps[=color|=extended-color|=off]} ++ [@option{-U} @var{method}] [@option{--unicode=}@var{method}] + [@option{-V}|@option{--version}] + [@option{-H}|@option{--help}] + @var{objfile}@dots{} +@@ -2843,6 +2860,21 @@ When displaying symbols include those wh + special in some way and which would not normally be of interest to the + user. + ++@item -U @var{[d|i|l|e|x|h]} ++@itemx --unicode=@var{[default|invalid|locale|escape|hex|highlight]} ++Controls the display of UTF-8 encoded mulibyte characters in strings. ++The default (@option{--unicode=default}) is to give them no special ++treatment. The @option{--unicode=locale} option displays the sequence ++in the current locale, which may or may not support them. The options ++@option{--unicode=hex} and @option{--unicode=invalid} display them as ++hex byte sequences enclosed by either angle brackets or curly braces. ++ ++The @option{--unicode=escape} option displays them as escape sequences ++(@var{\uxxxx}) and the @option{--unicode=highlight} option displays ++them as escape sequences highlighted in red (if supported by the ++output device). The colouring is intended to draw attention to the ++presence of unicode sequences where they might not be expected. ++ + @item -V + @itemx --version + Print the version number of @command{objdump} and exit. +@@ -3119,6 +3151,7 @@ strings [@option{-afovV}] [@option{-}@va + [@option{-n} @var{min-len}] [@option{--bytes=}@var{min-len}] + [@option{-t} @var{radix}] [@option{--radix=}@var{radix}] + [@option{-e} @var{encoding}] [@option{--encoding=}@var{encoding}] ++ [@option{-U} @var{method}] [@option{--unicode=}@var{method}] + [@option{-}] [@option{--all}] [@option{--print-file-name}] + [@option{-T} @var{bfdname}] [@option{--target=}@var{bfdname}] + [@option{-w}] [@option{--include-all-whitespace}] +@@ -3210,6 +3243,28 @@ single-8-bit-byte characters, @samp{b} = + littleendian. Useful for finding wide character strings. (@samp{l} + and @samp{b} apply to, for example, Unicode UTF-16/UCS-2 encodings). + ++@item -U @var{[d|i|l|e|x|h]} ++@itemx --unicode=@var{[default|invalid|locale|escape|hex|highlight]} ++Controls the display of UTF-8 encoded mulibyte characters in strings. ++The default (@option{--unicode=default}) is to give them no special ++treatment, and instead rely upon the setting of the ++@option{--encoding} option. The other values for this option ++automatically enable @option{--encoding=S}. ++ ++The @option{--unicode=invalid} option treats them as non-graphic ++characters and hence not part of a valid string. All the remaining ++options treat them as valid string characters. ++ ++The @option{--unicode=locale} option displays them in the current ++locale, which may or may not support UTF-8 encoding. The ++@option{--unicode=hex} option displays them as hex byte sequences ++enclosed between @var{<>} characters. The @option{--unicode=escape} ++option displays them as escape sequences (@var{\uxxxx}) and the ++@option{--unicode=highlight} option displays them as escape sequences ++highlighted in red (if supported by the output device). The colouring ++is intended to draw attention to the presence of unicode sequences ++where they might not be expected. ++ + @item -T @var{bfdname} + @itemx --target=@var{bfdname} + @cindex object code format +@@ -4728,6 +4783,7 @@ readelf [@option{-a}|@option{--all}] + [@option{-W}|@option{--wide}] + [@option{-T}|@option{--silent-truncation}] + [@option{-H}|@option{--help}] ++ [@option{-U} @var{method}|@option{--unicode=}@var{method}] + @var{elffile}@dots{} + @c man end + @end smallexample +@@ -4817,6 +4873,28 @@ Displays the entries in dynamic symbol t + has one. The output format is the same as the format used by the + @option{--syms} option. + ++@item -U @var{[d|i|l|e|x|h]} ++@itemx --unicode=[default|invalid|locale|escape|hex|highlight] ++Controls the display of non-ASCII characters in identifier names. ++The default (@option{--unicode=locale} or @option{--unicode=default}) is ++to treat them as multibyte characters and display them in the current ++locale. All other versions of this option treat the bytes as UTF-8 ++encoded values and attempt to interpret them. If they cannot be ++interpreted or if the @option{--unicode=invalid} option is used then ++they are displayed as a sequence of hex bytes, encloses in curly ++parethesis characters. ++ ++Using the @option{--unicode=escape} option will display the characters ++as as unicode escape sequences (@var{\uxxxx}). Using the ++@option{--unicode=hex} will display the characters as hex byte ++sequences enclosed between angle brackets. ++ ++Using the @option{--unicode=highlight} will display the characters as ++unicode escape sequences but it will also highlighted them in red, ++assuming that colouring is supported by the output device. The ++colouring is intended to draw attention to the presence of unicode ++sequences when they might not be expected. ++ + @item -e + @itemx --headers + Display all the headers in the file. Equivalent to @option{-h -l -S}. +diff -rup binutils.orig/binutils/nm.c binutils-2.35/binutils/nm.c +--- binutils.orig/binutils/nm.c 2021-10-21 15:15:57.835970002 +0100 ++++ binutils-2.35/binutils/nm.c 2021-10-21 15:39:14.476071657 +0100 +@@ -38,6 +38,11 @@ + #include "bucomm.h" + #include "plugin-api.h" + #include "plugin.h" ++#include "safe-ctype.h" ++ ++#ifndef streq ++#define streq(a,b) (strcmp ((a),(b)) == 0) ++#endif + + /* When sorting by size, we use this structure to hold the size and a + pointer to the minisymbol. */ +@@ -186,6 +191,18 @@ static const char *plugin_target = NULL; + static bfd *lineno_cache_bfd; + static bfd *lineno_cache_rel_bfd; + ++typedef enum unicode_display_type ++{ ++ unicode_default = 0, ++ unicode_locale, ++ unicode_escape, ++ unicode_hex, ++ unicode_highlight, ++ unicode_invalid ++} unicode_display_type; ++ ++static unicode_display_type unicode_display = unicode_default; ++ + enum long_option_values + { + OPTION_TARGET = 200, +@@ -225,6 +242,7 @@ static struct option long_options[] = + {"target", required_argument, 0, OPTION_TARGET}, + {"defined-only", no_argument, &defined_only, 1}, + {"undefined-only", no_argument, &undefined_only, 1}, ++ {"unicode", required_argument, NULL, 'U'}, + {"version", no_argument, &show_version, 1}, + {"with-symbol-versions", no_argument, &with_symbol_versions, 1}, + {0, no_argument, 0, 0} +@@ -274,6 +292,8 @@ usage (FILE *stream, int status) + -t, --radix=RADIX Use RADIX for printing symbol values\n\ + --target=BFDNAME Specify the target object format as BFDNAME\n\ + -u, --undefined-only Display only undefined symbols\n\ ++ -U {d|s|i|x|e|h} Specify how to treat UTF-8 encoded unicode characters\n\ ++ --unicode={default|show|invalid|hex|escape|highlight}\n\ + --with-symbol-versions Display version strings after symbol names\n\ + -X 32_64 (ignored)\n\ + @FILE Read options from FILE\n\ +@@ -389,6 +409,189 @@ get_coff_symbol_type (const struct inter + return bufp; + } + ++/* Convert a potential UTF-8 encoded sequence in IN into characters in OUT. ++ The conversion format is controlled by the unicode_display variable. ++ Returns the number of characters added to OUT. ++ Returns the number of bytes consumed from IN in CONSUMED. ++ Always consumes at least one byte and displays at least one character. */ ++ ++static unsigned int ++display_utf8 (const unsigned char * in, char * out, unsigned int * consumed) ++{ ++ char * orig_out = out; ++ unsigned int nchars = 0; ++ ++ if (unicode_display == unicode_default) ++ goto invalid; ++ ++ if (in[0] < 0xc0) ++ goto invalid; ++ ++ if ((in[1] & 0xc0) != 0x80) ++ goto invalid; ++ ++ if ((in[0] & 0x20) == 0) ++ { ++ nchars = 2; ++ goto valid; ++ } ++ ++ if ((in[2] & 0xc0) != 0x80) ++ goto invalid; ++ ++ if ((in[0] & 0x10) == 0) ++ { ++ nchars = 3; ++ goto valid; ++ } ++ ++ if ((in[3] & 0xc0) != 0x80) ++ goto invalid; ++ ++ nchars = 4; ++ ++ valid: ++ switch (unicode_display) ++ { ++ case unicode_locale: ++ /* Copy the bytes into the output buffer as is. */ ++ memcpy (out, in, nchars); ++ out += nchars; ++ break; ++ ++ case unicode_invalid: ++ case unicode_hex: ++ { ++ unsigned int j; ++ ++ out += sprintf (out, "%c", unicode_display == unicode_hex ? '<' : '{'); ++ for (j = 0; j < nchars; j++) ++ out += sprintf (out, "%02x", in [j]); ++ out += sprintf (out, "%c", unicode_display == unicode_hex ? '>' : '}'); ++ } ++ break; ++ ++ case unicode_highlight: ++ if (isatty (1)) ++ out += sprintf (out, "\x1B[31;47m"); /* Red. */ ++ /* Fall through. */ ++ case unicode_escape: ++ switch (nchars) ++ { ++ case 2: ++ out += sprintf (out, "\\u%02x%02x", ++ ((in[0] & 0x1c) >> 2), ++ ((in[0] & 0x03) << 6) | (in[1] & 0x3f)); ++ break; ++ ++ case 3: ++ out += sprintf (out, "\\u%02x%02x", ++ ((in[0] & 0x0f) << 4) | ((in[1] & 0x3c) >> 2), ++ ((in[1] & 0x03) << 6) | ((in[2] & 0x3f))); ++ break; ++ ++ case 4: ++ out += sprintf (out, "\\u%02x%02x%02x", ++ ((in[0] & 0x07) << 6) | ((in[1] & 0x3c) >> 2), ++ ((in[1] & 0x03) << 6) | ((in[2] & 0x3c) >> 2), ++ ((in[2] & 0x03) << 6) | ((in[3] & 0x3f))); ++ break; ++ default: ++ /* URG. */ ++ break; ++ } ++ ++ if (unicode_display == unicode_highlight && isatty (1)) ++ out += sprintf (out, "\033[0m"); /* Default colour. */ ++ break; ++ ++ default: ++ /* URG */ ++ break; ++ } ++ ++ * consumed = nchars; ++ return out - orig_out; ++ ++ invalid: ++ /* Not a valid UTF-8 sequence. */ ++ *out = *in; ++ * consumed = 1; ++ return 1; ++} ++ ++/* Convert any UTF-8 encoded characters in NAME into the form specified by ++ unicode_display. Also converts control characters. Returns a static ++ buffer if conversion was necessary. ++ Code stolen from objdump.c:sanitize_string(). */ ++ ++static const char * ++convert_utf8 (const char * in) ++{ ++ static char * buffer = NULL; ++ static size_t buffer_len = 0; ++ const char * original = in; ++ char * out; ++ ++ /* Paranoia. */ ++ if (in == NULL) ++ return ""; ++ ++ /* See if any conversion is necessary. ++ In the majority of cases it will not be needed. */ ++ do ++ { ++ unsigned char c = *in++; ++ ++ if (c == 0) ++ return original; ++ ++ if (ISCNTRL (c)) ++ break; ++ ++ if (unicode_display != unicode_default && c >= 0xc0) ++ break; ++ } ++ while (1); ++ ++ /* Copy the input, translating as needed. */ ++ in = original; ++ if (buffer_len < (strlen (in) * 9)) ++ { ++ free ((void *) buffer); ++ buffer_len = strlen (in) * 9; ++ buffer = xmalloc (buffer_len + 1); ++ } ++ ++ out = buffer; ++ do ++ { ++ unsigned char c = *in++; ++ ++ if (c == 0) ++ break; ++ ++ if (ISCNTRL (c)) ++ { ++ *out++ = '^'; ++ *out++ = c + 0x40; ++ } ++ else if (unicode_display != unicode_default && c >= 0xc0) ++ { ++ unsigned int num_consumed; ++ ++ out += display_utf8 ((const unsigned char *)(in - 1), out, & num_consumed); ++ in += num_consumed - 1; ++ } ++ else ++ *out++ = c; ++ } ++ while (1); ++ ++ *out = 0; ++ return buffer; ++} ++ + /* Print symbol name NAME, read from ABFD, with printf format FORM, + demangling it if requested. */ + +@@ -410,6 +613,9 @@ print_symname (const char *form, struct + } + } + ++ if (unicode_display != unicode_default) ++ name = convert_utf8 (name); ++ + printf (form, name); + if (info != NULL && info->elfinfo) + { +@@ -1726,7 +1932,7 @@ main (int argc, char **argv) + fatal (_("fatal error: libbfd ABI mismatch")); + set_default_bfd_target (); + +- while ((c = getopt_long (argc, argv, "aABCDef:gHhlnopPrSst:uvVvX:", ++ while ((c = getopt_long (argc, argv, "aABCDef:gHhlnopPrSst:uU:vVvX:", + long_options, (int *) 0)) != EOF) + { + switch (c) +@@ -1813,6 +2019,24 @@ main (int argc, char **argv) + case 'u': + undefined_only = 1; + break; ++ ++ case 'U': ++ if (streq (optarg, "default") || streq (optarg, "d")) ++ unicode_display = unicode_default; ++ else if (streq (optarg, "locale") || streq (optarg, "l")) ++ unicode_display = unicode_locale; ++ else if (streq (optarg, "escape") || streq (optarg, "e")) ++ unicode_display = unicode_escape; ++ else if (streq (optarg, "invalid") || streq (optarg, "i")) ++ unicode_display = unicode_invalid; ++ else if (streq (optarg, "hex") || streq (optarg, "x")) ++ unicode_display = unicode_hex; ++ else if (streq (optarg, "highlight") || streq (optarg, "h")) ++ unicode_display = unicode_highlight; ++ else ++ fatal (_("invalid argument to -U/--unicode: %s"), optarg); ++ break; ++ + case 'V': + show_version = 1; + break; +diff -rup binutils.orig/binutils/objdump.c binutils-2.35/binutils/objdump.c +--- binutils.orig/binutils/objdump.c 2021-10-21 15:15:57.836969995 +0100 ++++ binutils-2.35/binutils/objdump.c 2021-10-21 15:40:27.689549518 +0100 +@@ -205,6 +205,18 @@ static const struct objdump_private_desc + + /* The list of detected jumps inside a function. */ + static struct jump_info *detected_jumps = NULL; ++ ++typedef enum unicode_display_type ++{ ++ unicode_default = 0, ++ unicode_locale, ++ unicode_escape, ++ unicode_hex, ++ unicode_highlight, ++ unicode_invalid ++} unicode_display_type; ++ ++static unicode_display_type unicode_display = unicode_default; + + static void usage (FILE *, int) ATTRIBUTE_NORETURN; + static void +@@ -247,6 +259,9 @@ usage (FILE *stream, int status) + -r, --reloc Display the relocation entries in the file\n\ + -R, --dynamic-reloc Display the dynamic relocation entries in the file\n\ + @ Read options from \n\ ++ -U[d|l|i|x|e|h] Controls the display of UTF-8 unicode characters\n\ ++ --unicode=[default|locale|invalid|hex|escape|highlight]\n")); ++ fprintf (stream, _("\ + -v, --version Display this program's version number\n\ + -i, --info List object formats and architectures supported\n\ + -H, --help Display this information\n\ +@@ -395,6 +410,7 @@ static struct option long_options[]= + {"stop-address", required_argument, NULL, OPTION_STOP_ADDRESS}, + {"syms", no_argument, NULL, 't'}, + {"target", required_argument, NULL, 'b'}, ++ {"unicode", required_argument, NULL, 'U'}, + {"version", no_argument, NULL, 'V'}, + {"wide", no_argument, NULL, 'w'}, + {"prefix", required_argument, NULL, OPTION_PREFIX}, +@@ -414,10 +430,124 @@ nonfatal (const char *msg) + bfd_nonfatal (msg); + exit_status = 1; + } ++ ++/* Convert a potential UTF-8 encoded sequence in IN into characters in OUT. ++ The conversion format is controlled by the unicode_display variable. ++ Returns the number of characters added to OUT. ++ Returns the number of bytes consumed from IN in CONSUMED. ++ Always consumes at least one byte and displays at least one character. */ ++ ++static unsigned int ++display_utf8 (const unsigned char * in, char * out, unsigned int * consumed) ++{ ++ char * orig_out = out; ++ unsigned int nchars = 0; ++ ++ if (unicode_display == unicode_default) ++ goto invalid; ++ ++ if (in[0] < 0xc0) ++ goto invalid; ++ ++ if ((in[1] & 0xc0) != 0x80) ++ goto invalid; ++ ++ if ((in[0] & 0x20) == 0) ++ { ++ nchars = 2; ++ goto valid; ++ } ++ ++ if ((in[2] & 0xc0) != 0x80) ++ goto invalid; ++ ++ if ((in[0] & 0x10) == 0) ++ { ++ nchars = 3; ++ goto valid; ++ } ++ ++ if ((in[3] & 0xc0) != 0x80) ++ goto invalid; ++ ++ nchars = 4; ++ ++ valid: ++ switch (unicode_display) ++ { ++ case unicode_locale: ++ /* Copy the bytes into the output buffer as is. */ ++ memcpy (out, in, nchars); ++ out += nchars; ++ break; ++ ++ case unicode_invalid: ++ case unicode_hex: ++ { ++ unsigned int j; ++ ++ out += sprintf (out, "%c", unicode_display == unicode_hex ? '<' : '{'); ++ for (j = 0; j < nchars; j++) ++ out += sprintf (out, "%02x", in [j]); ++ out += sprintf (out, "%c", unicode_display == unicode_hex ? '>' : '}'); ++ } ++ break; ++ ++ case unicode_highlight: ++ if (isatty (1)) ++ out += sprintf (out, "\x1B[31;47m"); /* Red. */ ++ /* Fall through. */ ++ case unicode_escape: ++ switch (nchars) ++ { ++ case 2: ++ out += sprintf (out, "\\u%02x%02x", ++ ((in[0] & 0x1c) >> 2), ++ ((in[0] & 0x03) << 6) | (in[1] & 0x3f)); ++ break; ++ ++ case 3: ++ out += sprintf (out, "\\u%02x%02x", ++ ((in[0] & 0x0f) << 4) | ((in[1] & 0x3c) >> 2), ++ ((in[1] & 0x03) << 6) | ((in[2] & 0x3f))); ++ break; ++ ++ case 4: ++ out += sprintf (out, "\\u%02x%02x%02x", ++ ((in[0] & 0x07) << 6) | ((in[1] & 0x3c) >> 2), ++ ((in[1] & 0x03) << 6) | ((in[2] & 0x3c) >> 2), ++ ((in[2] & 0x03) << 6) | ((in[3] & 0x3f))); ++ break; ++ default: ++ /* URG. */ ++ break; ++ } ++ ++ if (unicode_display == unicode_highlight && isatty (1)) ++ out += sprintf (out, "\033[0m"); /* Default colour. */ ++ break; ++ ++ default: ++ /* URG */ ++ break; ++ } ++ ++ * consumed = nchars; ++ return out - orig_out; ++ ++ invalid: ++ /* Not a valid UTF-8 sequence. */ ++ *out = *in; ++ * consumed = 1; ++ return 1; ++} + + /* Returns a version of IN with any control characters + replaced by escape sequences. Uses a static buffer +- if necessary. */ ++ if necessary. ++ ++ If unicode display is enabled, then also handles the ++ conversion of unicode characters. */ + + static const char * + sanitize_string (const char * in) +@@ -435,40 +565,50 @@ sanitize_string (const char * in) + of cases it will not be needed. */ + do + { +- char c = *in++; ++ unsigned char c = *in++; + + if (c == 0) + return original; + + if (ISCNTRL (c)) + break; ++ ++ if (unicode_display != unicode_default && c >= 0xc0) ++ break; + } + while (1); + + /* Copy the input, translating as needed. */ + in = original; +- if (buffer_len < (strlen (in) * 2)) ++ if (buffer_len < (strlen (in) * 9)) + { + free ((void *) buffer); +- buffer_len = strlen (in) * 2; ++ buffer_len = strlen (in) * 9; + buffer = xmalloc (buffer_len + 1); + } + + out = buffer; + do + { +- char c = *in++; ++ unsigned char c = *in++; + + if (c == 0) + break; + +- if (!ISCNTRL (c)) +- *out++ = c; +- else ++ if (ISCNTRL (c)) + { + *out++ = '^'; + *out++ = c + 0x40; + } ++ else if (unicode_display != unicode_default && c >= 0xc0) ++ { ++ unsigned int num_consumed; ++ ++ out += display_utf8 ((const unsigned char *)(in - 1), out, & num_consumed); ++ in += num_consumed - 1; ++ } ++ else ++ *out++ = c; + } + while (1); + +@@ -476,7 +616,6 @@ sanitize_string (const char * in) + return buffer; + } + +- + /* Returns TRUE if the specified section should be dumped. */ + + static bfd_boolean +@@ -1055,6 +1194,8 @@ objdump_print_symname (bfd *abfd, struct + + name = sanitize_string (name); + ++ name = sanitize_string (name); ++ + if (inf != NULL) + { + (*inf->fprintf_func) (inf->stream, "%s", name); +@@ -3136,7 +3277,7 @@ disassemble_section (bfd *abfd, asection + if (!bfd_malloc_and_get_section (abfd, section, &data)) + { + non_fatal (_("Reading section %s failed because: %s"), +- section->name, bfd_errmsg (bfd_get_error ())); ++ sanitize_string (section->name), bfd_errmsg (bfd_get_error ())); + return; + } + +@@ -4307,7 +4448,7 @@ dump_section (bfd *abfd, asection *secti + if (!bfd_get_full_section_contents (abfd, section, &data)) + { + non_fatal (_("Reading section %s failed because: %s"), +- section->name, bfd_errmsg (bfd_get_error ())); ++ sanitize_string (section->name), bfd_errmsg (bfd_get_error ())); + return; + } + +@@ -4447,6 +4588,24 @@ dump_symbols (bfd *abfd ATTRIBUTE_UNUSED + free (alloc); + } + } ++ else if (unicode_display != unicode_default ++ && name != NULL && *name != '\0') ++ { ++ const char * sanitized_name; ++ ++ /* If we want to sanitize the name, we do it here, and ++ temporarily clobber it while calling bfd_print_symbol. ++ FIXME: This is a gross hack. */ ++ sanitized_name = sanitize_string (name); ++ if (sanitized_name != name) ++ (*current)->name = sanitized_name; ++ else ++ sanitized_name = NULL; ++ bfd_print_symbol (cur_bfd, stdout, *current, ++ bfd_print_symbol_all); ++ if (sanitized_name != NULL) ++ (*current)->name = name; ++ } + else + bfd_print_symbol (cur_bfd, stdout, *current, + bfd_print_symbol_all); +@@ -5128,7 +5287,7 @@ main (int argc, char **argv) + set_default_bfd_target (); + + while ((c = getopt_long (argc, argv, +- "pP:ib:m:M:VvCdDlfFaHhrRtTxsSI:j:wE:zgeGW::", ++ "pP:ib:m:M:VvCdDlfFaHhrRtTxsSI:j:wE:zgeGW::U:", + long_options, (int *) 0)) + != EOF) + { +@@ -5407,6 +5566,23 @@ main (int argc, char **argv) + seenflag = TRUE; + break; + ++ case 'U': ++ if (streq (optarg, "default") || streq (optarg, "d")) ++ unicode_display = unicode_default; ++ else if (streq (optarg, "locale") || streq (optarg, "l")) ++ unicode_display = unicode_locale; ++ else if (streq (optarg, "escape") || streq (optarg, "e")) ++ unicode_display = unicode_escape; ++ else if (streq (optarg, "invalid") || streq (optarg, "i")) ++ unicode_display = unicode_invalid; ++ else if (streq (optarg, "hex") || streq (optarg, "x")) ++ unicode_display = unicode_hex; ++ else if (streq (optarg, "highlight") || streq (optarg, "h")) ++ unicode_display = unicode_highlight; ++ else ++ fatal (_("invalid argument to -U/--unicode: %s"), optarg); ++ break; ++ + case 'H': + usage (stdout, 0); + /* No need to set seenflag or to break - usage() does not return. */ +diff -rup binutils.orig/binutils/readelf.c binutils-2.35/binutils/readelf.c +--- binutils.orig/binutils/readelf.c 2021-10-21 15:15:57.835970002 +0100 ++++ binutils-2.35/binutils/readelf.c 2021-10-21 15:39:14.479071635 +0100 +@@ -317,6 +317,18 @@ typedef enum print_mode + } + print_mode; + ++typedef enum unicode_display_type ++{ ++ unicode_locale, ++ unicode_escape, ++ unicode_hex, ++ unicode_highlight, ++ unicode_invalid ++} unicode_display_type; ++ ++static unicode_display_type unicode_display = unicode_locale; ++ ++ + /* Versioned symbol info. */ + enum versioned_symbol_info + { +@@ -592,11 +604,18 @@ print_symbol (signed int width, const ch + if (c == 0) + break; + +- /* Do not print control characters directly as they can affect terminal +- settings. Such characters usually appear in the names generated +- by the assembler for local labels. */ +- if (ISCNTRL (c)) ++ if (ISPRINT (c)) ++ { ++ putchar (c); ++ width_remaining --; ++ num_printed ++; ++ } ++ else if (ISCNTRL (c)) + { ++ /* Do not print control characters directly as they can affect terminal ++ settings. Such characters usually appear in the names generated ++ by the assembler for local labels. */ ++ + if (width_remaining < 2) + break; + +@@ -604,11 +623,135 @@ print_symbol (signed int width, const ch + width_remaining -= 2; + num_printed += 2; + } +- else if (ISPRINT (c)) ++ else if (c == 0x7f) + { +- putchar (c); +- width_remaining --; +- num_printed ++; ++ if (width_remaining < 5) ++ break; ++ printf (""); ++ width_remaining -= 5; ++ num_printed += 5; ++ } ++ else if (unicode_display != unicode_locale) ++ { ++ /* Display unicode characters as something else. */ ++ unsigned char bytes[4]; ++ bfd_boolean is_utf8; ++ unsigned int nbytes; ++ ++ bytes[0] = c; ++ ++ if (bytes[0] < 0xc0) ++ { ++ nbytes = 1; ++ is_utf8 = FALSE; ++ } ++ else ++ { ++ bytes[1] = *symbol++; ++ ++ if ((bytes[1] & 0xc0) != 0x80) ++ { ++ is_utf8 = FALSE; ++ /* Do not consume this character. It may only ++ be the first byte in the sequence that was ++ corrupt. */ ++ --symbol; ++ nbytes = 1; ++ } ++ else if ((bytes[0] & 0x20) == 0) ++ { ++ is_utf8 = TRUE; ++ nbytes = 2; ++ } ++ else ++ { ++ bytes[2] = *symbol++; ++ ++ if ((bytes[2] & 0xc0) != 0x80) ++ { ++ is_utf8 = FALSE; ++ symbol -= 2; ++ nbytes = 1; ++ } ++ else if ((bytes[0] & 0x10) == 0) ++ { ++ is_utf8 = TRUE; ++ nbytes = 3; ++ } ++ else ++ { ++ bytes[3] = *symbol++; ++ ++ nbytes = 4; ++ ++ if ((bytes[3] & 0xc0) != 0x80) ++ { ++ is_utf8 = FALSE; ++ symbol -= 3; ++ nbytes = 1; ++ } ++ else ++ is_utf8 = TRUE; ++ } ++ } ++ } ++ ++ if (unicode_display == unicode_invalid) ++ is_utf8 = FALSE; ++ ++ if (unicode_display == unicode_hex || ! is_utf8) ++ { ++ unsigned int i; ++ ++ if (width_remaining < (nbytes * 2) + 2) ++ break; ++ ++ putchar (is_utf8 ? '<' : '{'); ++ for (i = 0; i < nbytes; i++) ++ printf ("%02x", bytes[i]); ++ putchar (is_utf8 ? '>' : '}'); ++ } ++ else ++ { ++ if (unicode_display == unicode_highlight && isatty (1)) ++ printf ("\x1B[31;47m"); /* Red. */ ++ ++ switch (nbytes) ++ { ++ case 2: ++ if (width_remaining < 6) ++ break; ++ printf ("\\u%02x%02x", ++ (bytes[0] & 0x1c) >> 2, ++ ((bytes[0] & 0x03) << 6) | (bytes[1] & 0x3f)); ++ break; ++ case 3: ++ if (width_remaining < 6) ++ break; ++ printf ("\\u%02x%02x", ++ ((bytes[0] & 0x0f) << 4) | ((bytes[1] & 0x3c) >> 2), ++ ((bytes[1] & 0x03) << 6) | (bytes[2] & 0x3f)); ++ break; ++ case 4: ++ if (width_remaining < 8) ++ break; ++ printf ("\\u%02x%02x%02x", ++ ((bytes[0] & 0x07) << 6) | ((bytes[1] & 0x3c) >> 2), ++ ((bytes[1] & 0x03) << 6) | ((bytes[2] & 0x3c) >> 2), ++ ((bytes[2] & 0x03) << 6) | (bytes[3] & 0x3f)); ++ ++ break; ++ default: ++ /* URG. */ ++ break; ++ } ++ ++ if (unicode_display == unicode_highlight && isatty (1)) ++ printf ("\033[0m"); /* Default colour. */ ++ } ++ ++ if (bytes[nbytes - 1] == 0) ++ break; + } + else + { +@@ -4528,6 +4671,7 @@ static struct option options[] = + {"ctf-parent", required_argument, 0, OPTION_CTF_PARENT}, + #endif + ++ {"unicode", required_argument, 0, 'U'}, + {"version", no_argument, 0, 'v'}, + {"wide", no_argument, 0, 'W'}, + {"silent-truncation",no_argument, 0, 'T'}, +@@ -4597,6 +4741,11 @@ usage (FILE * stream) + #endif + fprintf (stream, _("\ + -I --histogram Display histogram of bucket list lengths\n\ ++ -U --unicode=[locale|escape|hex|highlight|invalid]\n\ ++ Display unicode characters as determined by the current locale\n\ ++ (default), escape sequences, \"\", highlighted\n\ ++ escape sequences, or treat them as invalid and display as\n\ ++ \"{hex sequences}\"\n\ + -W --wide Allow output width to exceed 80 characters\n\ + -T --silent-truncation If a symbol name is truncated, do not add a suffix [...]\n\ + @ Read options from \n\ +@@ -4693,7 +4842,7 @@ parse_args (struct dump_data *dumpdata, + usage (stderr); + + while ((c = getopt_long +- (argc, argv, "ADHILNR:STVWacdeghi:lnp:rstuvw::x:z", options, NULL)) != EOF) ++ (argc, argv, "ADHILNR:STU:VWacdeghi:lnp:rstuvw::x:z", options, NULL)) != EOF) + { + switch (c) + { +@@ -4843,6 +4992,25 @@ parse_args (struct dump_data *dumpdata, + request_dump (dumpdata, DISASS_DUMP); + break; + #endif ++ case 'U': ++ if (optarg == NULL) ++ error (_("Missing arg to -U/--unicode")); /* Can this happen ? */ ++ else if (streq (optarg, "default") || streq (optarg, "d")) ++ unicode_display = unicode_locale; ++ else if (streq (optarg, "locale") || streq (optarg, "l")) ++ unicode_display = unicode_locale; ++ else if (streq (optarg, "escape") || streq (optarg, "e")) ++ unicode_display = unicode_escape; ++ else if (streq (optarg, "invalid") || streq (optarg, "i")) ++ unicode_display = unicode_invalid; ++ else if (streq (optarg, "hex") || streq (optarg, "x")) ++ unicode_display = unicode_hex; ++ else if (streq (optarg, "highlight") || streq (optarg, "h")) ++ unicode_display = unicode_highlight; ++ else ++ error (_("unknown argument to -U/--unicode: %s"), optarg); ++ break; ++ + case 'v': + print_version (program_name); + break; +diff -rup binutils.orig/binutils/strings.c binutils-2.35/binutils/strings.c +--- binutils.orig/binutils/strings.c 2021-10-21 15:15:57.837969988 +0100 ++++ binutils-2.35/binutils/strings.c 2021-10-21 15:39:14.479071635 +0100 +@@ -55,6 +55,19 @@ + -T {bfdname} + Specify a non-default object file format. + ++ --unicode={default|locale|invalid|hex|escape|highlight} ++ -U {d|l|i|x|e|h} ++ Determine how to handle UTF-8 unicode characters. The default ++ is no special treatment. All other versions of this option ++ only apply if the encoding is valid and enabling the option ++ implies --encoding=S. ++ The 'locale' option displays the characters according to the ++ current locale. The 'invalid' option treats them as ++ non-string characters. The 'hex' option displays them as hex ++ byte sequences. The 'escape' option displays them as escape ++ sequences and the 'highlight' option displays them as ++ coloured escape sequences. ++ + --output-separator=sep_string + -s sep_string String used to separate parsed strings in output. + Default is newline. +@@ -76,6 +89,22 @@ + #include "safe-ctype.h" + #include "bucomm.h" + ++#ifndef streq ++#define streq(a,b) (strcmp ((a),(b)) == 0) ++#endif ++ ++typedef enum unicode_display_type ++{ ++ unicode_default = 0, ++ unicode_locale, ++ unicode_escape, ++ unicode_hex, ++ unicode_highlight, ++ unicode_invalid ++} unicode_display_type; ++ ++static unicode_display_type unicode_display = unicode_default; ++ + #define STRING_ISGRAPHIC(c) \ + ( (c) >= 0 \ + && (c) <= 255 \ +@@ -94,7 +123,7 @@ extern int errno; + static int address_radix; + + /* Minimum length of sequence of graphic chars to trigger output. */ +-static int string_min; ++static uint string_min; + + /* Whether or not we include all whitespace as a graphic char. */ + static bfd_boolean include_all_whitespace; +@@ -130,6 +159,7 @@ static struct option long_options[] = + {"target", required_argument, NULL, 'T'}, + {"output-separator", required_argument, NULL, 's'}, + {"help", no_argument, NULL, 'h'}, ++ {"unicode", required_argument, NULL, 'U'}, + {"version", no_argument, NULL, 'v'}, + {NULL, 0, NULL, 0} + }; +@@ -173,7 +203,7 @@ main (int argc, char **argv) + encoding = 's'; + output_separator = NULL; + +- while ((optc = getopt_long (argc, argv, "adfhHn:wot:e:T:s:Vv0123456789", ++ while ((optc = getopt_long (argc, argv, "adfhHn:wot:e:T:s:U:Vv0123456789", + long_options, (int *) 0)) != EOF) + { + switch (optc) +@@ -246,6 +276,23 @@ main (int argc, char **argv) + output_separator = optarg; + break; + ++ case 'U': ++ if (streq (optarg, "default") || streq (optarg, "d")) ++ unicode_display = unicode_default; ++ else if (streq (optarg, "locale") || streq (optarg, "l")) ++ unicode_display = unicode_locale; ++ else if (streq (optarg, "escape") || streq (optarg, "e")) ++ unicode_display = unicode_escape; ++ else if (streq (optarg, "invalid") || streq (optarg, "i")) ++ unicode_display = unicode_invalid; ++ else if (streq (optarg, "hex") || streq (optarg, "x")) ++ unicode_display = unicode_hex; ++ else if (streq (optarg, "highlight") || streq (optarg, "h")) ++ unicode_display = unicode_highlight; ++ else ++ fatal (_("invalid argument to -U/--unicode: %s"), optarg); ++ break; ++ + case 'V': + case 'v': + print_version ("strings"); +@@ -260,6 +307,9 @@ main (int argc, char **argv) + } + } + ++ if (unicode_display != unicode_default) ++ encoding = 'S'; ++ + if (numeric_opt != 0) + { + string_min = (int) strtoul (argv[numeric_opt - 1] + 1, &s, 0); +@@ -553,11 +603,629 @@ unget_part_char (long c, file_ptr *addre + } + } + } ++ ++static void ++print_filename_and_address (const char * filename, file_ptr address) ++{ ++ if (print_filenames) ++ printf ("%s: ", filename); ++ ++ if (! print_addresses) ++ return; ++ ++ switch (address_radix) ++ { ++ case 8: ++ if (sizeof (address) > sizeof (long)) ++ { ++#ifndef __MSVCRT__ ++ printf ("%7llo ", (unsigned long long) address); ++#else ++ printf ("%7I64o ", (unsigned long long) address); ++#endif ++ } ++ else ++ printf ("%7lo ", (unsigned long) address); ++ break; ++ ++ case 10: ++ if (sizeof (address) > sizeof (long)) ++ { ++#ifndef __MSVCRT__ ++ printf ("%7llu ", (unsigned long long) address); ++#else ++ printf ("%7I64d ", (unsigned long long) address); ++#endif ++ } ++ else ++ printf ("%7ld ", (long) address); ++ break; ++ ++ case 16: ++ if (sizeof (address) > sizeof (long)) ++ { ++#ifndef __MSVCRT__ ++ printf ("%7llx ", (unsigned long long) address); ++#else ++ printf ("%7I64x ", (unsigned long long) address); ++#endif ++ } ++ else ++ printf ("%7lx ", (unsigned long) address); ++ break; ++ } ++} ++ ++/* Return non-zero if the bytes starting at BUFFER form a valid UTF-8 encoding. ++ If the encoding is valid then returns the number of bytes it uses. */ ++ ++static unsigned int ++is_valid_utf8 (const unsigned char * buffer, unsigned long buflen) ++{ ++ if (buffer[0] < 0xc0) ++ return 0; ++ ++ if (buflen < 2) ++ return 0; ++ ++ if ((buffer[1] & 0xc0) != 0x80) ++ return 0; ++ ++ if ((buffer[0] & 0x20) == 0) ++ return 2; ++ ++ if (buflen < 3) ++ return 0; ++ ++ if ((buffer[2] & 0xc0) != 0x80) ++ return 0; ++ ++ if ((buffer[0] & 0x10) == 0) ++ return 3; ++ ++ if (buflen < 4) ++ return 0; ++ ++ if ((buffer[3] & 0xc0) != 0x80) ++ return 0; ++ ++ return 4; ++} ++ ++/* Display a UTF-8 encoded character in BUFFER according to the setting ++ of unicode_display. The character is known to be valid. ++ Returns the number of bytes consumed. */ ++ ++static unsigned int ++display_utf8_char (const unsigned char * buffer) ++{ ++ unsigned int j; ++ unsigned int utf8_len; ++ ++ switch (buffer[0] & 0x30) ++ { ++ case 0x00: ++ case 0x10: ++ utf8_len = 2; ++ break; ++ case 0x20: ++ utf8_len = 3; ++ break; ++ default: ++ utf8_len = 4; ++ } ++ ++ switch (unicode_display) ++ { ++ default: ++ fprintf (stderr, "ICE: unexpected unicode display type\n"); ++ break; ++ ++ case unicode_escape: ++ case unicode_highlight: ++ if (unicode_display == unicode_highlight && isatty (1)) ++ printf ("\x1B[31;47m"); /* Red. */ ++ ++ switch (utf8_len) ++ { ++ case 2: ++ printf ("\\u%02x%02x", ++ ((buffer[0] & 0x1c) >> 2), ++ ((buffer[0] & 0x03) << 6) | (buffer[1] & 0x3f)); ++ break; ++ ++ case 3: ++ printf ("\\u%02x%02x", ++ ((buffer[0] & 0x0f) << 4) | ((buffer[1] & 0x3c) >> 2), ++ ((buffer[1] & 0x03) << 6) | ((buffer[2] & 0x3f))); ++ break; ++ ++ case 4: ++ printf ("\\u%02x%02x%02x", ++ ((buffer[0] & 0x07) << 6) | ((buffer[1] & 0x3c) >> 2), ++ ((buffer[1] & 0x03) << 6) | ((buffer[2] & 0x3c) >> 2), ++ ((buffer[2] & 0x03) << 6) | ((buffer[3] & 0x3f))); ++ break; ++ default: ++ /* URG. */ ++ break; ++ } ++ ++ if (unicode_display == unicode_highlight && isatty (1)) ++ printf ("\033[0m"); /* Default colour. */ ++ break; ++ ++ case unicode_hex: ++ putchar ('<'); ++ for (j = 0; j < utf8_len; j++) ++ printf ("%02x", buffer [j]); ++ putchar ('>'); ++ break; ++ ++ case unicode_locale: ++ printf ("%.1s", buffer); ++ break; ++ } ++ ++ return utf8_len; ++} ++ ++/* Display strings in BUFFER. Treat any UTF-8 encoded characters encountered ++ according to the setting of the unicode_display variable. The buffer ++ contains BUFLEN bytes. ++ ++ Display the characters as if they started at ADDRESS and are contained in ++ FILENAME. */ ++ ++static void ++print_unicode_buffer (const char * filename, ++ file_ptr address, ++ const unsigned char * buffer, ++ unsigned long buflen) ++{ ++ /* Paranoia checks... */ ++ if (filename == NULL ++ || buffer == NULL ++ || unicode_display == unicode_default ++ || encoding != 'S' ++ || encoding_bytes != 1) ++ { ++ fprintf (stderr, "ICE: bad arguments to print_unicode_buffer\n"); ++ return; ++ } ++ ++ if (buflen == 0) ++ return; ++ ++ /* We must only display strings that are at least string_min *characters* ++ long. So we scan the buffer in two stages. First we locate the start ++ of a potential string. Then we walk along it until we have found ++ string_min characters. Then we go back to the start point and start ++ displaying characters according to the unicode_display setting. */ ++ ++ unsigned long start_point = 0; ++ unsigned long i = 0; ++ unsigned int char_len = 1; ++ unsigned int num_found = 0; ++ ++ for (i = 0; i < buflen; i += char_len) ++ { ++ int c = buffer[i]; ++ ++ char_len = 1; ++ ++ /* Find the first potential character of a string. */ ++ if (! STRING_ISGRAPHIC (c)) ++ { ++ num_found = 0; ++ continue; ++ } ++ ++ if (c > 126) ++ { ++ if (c < 0xc0) ++ { ++ num_found = 0; ++ continue; ++ } ++ ++ if ((char_len = is_valid_utf8 (buffer + i, buflen - i)) == 0) ++ { ++ char_len = 1; ++ num_found = 0; ++ continue; ++ } ++ ++ if (unicode_display == unicode_invalid) ++ { ++ /* We have found a valid UTF-8 character, but we treat it as non-graphic. */ ++ num_found = 0; ++ continue; ++ } ++ } ++ ++ if (num_found == 0) ++ /* We have found a potential starting point for a string. */ ++ start_point = i; ++ ++ ++ num_found; ++ ++ if (num_found >= string_min) ++ break; ++ } ++ ++ if (num_found < string_min) ++ return; ++ ++ print_filename_and_address (filename, address + start_point); ++ ++ /* We have found string_min characters. Display them and any ++ more that follow. */ ++ for (i = start_point; i < buflen; i += char_len) ++ { ++ int c = buffer[i]; ++ ++ char_len = 1; ++ ++ if (! STRING_ISGRAPHIC (c)) ++ break; ++ else if (c < 127) ++ putchar (c); ++ else if (! is_valid_utf8 (buffer + i, buflen - i)) ++ break; ++ else if (unicode_display == unicode_invalid) ++ break; ++ else ++ char_len = display_utf8_char (buffer + i); ++ } ++ ++ if (output_separator) ++ fputs (output_separator, stdout); ++ else ++ putchar ('\n'); ++ ++ /* FIXME: Using tail recursion here is lazy programming... */ ++ print_unicode_buffer (filename, address + i, buffer + i, buflen - i); ++} ++ ++static int ++get_unicode_byte (FILE * stream, ++ unsigned char * putback, ++ unsigned int * num_putback, ++ unsigned int * num_read) ++{ ++ if (* num_putback > 0) ++ { ++ * num_putback = * num_putback - 1; ++ return putback [* num_putback]; ++ } ++ ++ * num_read = * num_read + 1; ++ ++#if defined(HAVE_GETC_UNLOCKED) && HAVE_DECL_GETC_UNLOCKED ++ return getc_unlocked (stream); ++#else ++ return getc (stream); ++#endif ++} ++ ++/* Helper function for print_unicode_stream. */ ++ ++static void ++print_unicode_stream_body (const char * filename, ++ file_ptr address, ++ FILE * stream, ++ unsigned char * putback_buf, ++ unsigned int num_putback, ++ unsigned char * print_buf) ++{ ++ /* It would be nice if we could just read the stream into a buffer ++ and then process if with print_unicode_buffer. But the input ++ might be huge or it might time-locked (eg stdin). So instead ++ we go one byte at a time... */ ++ ++ file_ptr start_point = 0; ++ unsigned int num_read = 0; ++ unsigned int num_chars = 0; ++ unsigned int num_print = 0; ++ int c; ++ ++ /* Find a series of string_min characters. Put them into print_buf. */ ++ do ++ { ++ if (num_chars >= string_min) ++ break; ++ ++ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read); ++ if (c == EOF) ++ break; ++ ++ if (! STRING_ISGRAPHIC (c)) ++ { ++ num_chars = num_print = 0; ++ continue; ++ } ++ ++ if (num_chars == 0) ++ start_point = num_read - 1; ++ ++ if (c < 127) ++ { ++ print_buf[num_print] = c; ++ num_chars ++; ++ num_print ++; ++ continue; ++ } ++ ++ if (c < 0xc0) ++ { ++ num_chars = num_print = 0; ++ continue; ++ } ++ ++ /* We *might* have a UTF-8 sequence. Time to start peeking. */ ++ char utf8[4]; ++ ++ utf8[0] = c; ++ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read); ++ if (c == EOF) ++ break; ++ utf8[1] = c; ++ ++ if ((utf8[1] & 0xc0) != 0x80) ++ { ++ /* Invalid UTF-8. */ ++ putback_buf[num_putback++] = utf8[1]; ++ num_chars = num_print = 0; ++ continue; ++ } ++ else if ((utf8[0] & 0x20) == 0) ++ { ++ /* A valid 2-byte UTF-8 encoding. */ ++ if (unicode_display == unicode_invalid) ++ { ++ putback_buf[num_putback++] = utf8[1]; ++ num_chars = num_print = 0; ++ } ++ else ++ { ++ print_buf[num_print ++] = utf8[0]; ++ print_buf[num_print ++] = utf8[1]; ++ num_chars ++; ++ } ++ continue; ++ } ++ ++ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read); ++ if (c == EOF) ++ break; ++ utf8[2] = c; ++ ++ if ((utf8[2] & 0xc0) != 0x80) ++ { ++ /* Invalid UTF-8. */ ++ putback_buf[num_putback++] = utf8[2]; ++ putback_buf[num_putback++] = utf8[1]; ++ num_chars = num_print = 0; ++ continue; ++ } ++ else if ((utf8[0] & 0x10) == 0) ++ { ++ /* A valid 3-byte UTF-8 encoding. */ ++ if (unicode_display == unicode_invalid) ++ { ++ putback_buf[num_putback++] = utf8[2]; ++ putback_buf[num_putback++] = utf8[1]; ++ num_chars = num_print = 0; ++ } ++ else ++ { ++ print_buf[num_print ++] = utf8[0]; ++ print_buf[num_print ++] = utf8[1]; ++ print_buf[num_print ++] = utf8[2]; ++ num_chars ++; ++ } ++ continue; ++ } ++ ++ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read); ++ if (c == EOF) ++ break; ++ utf8[3] = c; ++ ++ if ((utf8[3] & 0xc0) != 0x80) ++ { ++ /* Invalid UTF-8. */ ++ putback_buf[num_putback++] = utf8[3]; ++ putback_buf[num_putback++] = utf8[2]; ++ putback_buf[num_putback++] = utf8[1]; ++ num_chars = num_print = 0; ++ } ++ /* We have a valid 4-byte UTF-8 encoding. */ ++ else if (unicode_display == unicode_invalid) ++ { ++ putback_buf[num_putback++] = utf8[3]; ++ putback_buf[num_putback++] = utf8[1]; ++ putback_buf[num_putback++] = utf8[2]; ++ num_chars = num_print = 0; ++ } ++ else ++ { ++ print_buf[num_print ++] = utf8[0]; ++ print_buf[num_print ++] = utf8[1]; ++ print_buf[num_print ++] = utf8[2]; ++ print_buf[num_print ++] = utf8[3]; ++ num_chars ++; ++ } ++ } ++ while (1); ++ ++ if (num_chars >= string_min) ++ { ++ /* We know that we have string_min valid characters in print_buf, ++ and there may be more to come in the stream. Start displaying ++ them. */ ++ ++ print_filename_and_address (filename, address + start_point); ++ ++ unsigned int i; ++ for (i = 0; i < num_print;) ++ { ++ if (print_buf[i] < 127) ++ putchar (print_buf[i++]); ++ else ++ i += display_utf8_char (print_buf + i); ++ } ++ ++ /* OK so now we have to start read unchecked bytes. */ ++ ++ /* Find a series of string_min characters. Put them into print_buf. */ ++ do ++ { ++ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read); ++ if (c == EOF) ++ break; ++ ++ if (! STRING_ISGRAPHIC (c)) ++ break; ++ ++ if (c < 127) ++ { ++ putchar (c); ++ continue; ++ } ++ ++ if (c < 0xc0) ++ break; ++ ++ /* We *might* have a UTF-8 sequence. Time to start peeking. */ ++ unsigned char utf8[4]; ++ ++ utf8[0] = c; ++ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read); ++ if (c == EOF) ++ break; ++ utf8[1] = c; ++ ++ if ((utf8[1] & 0xc0) != 0x80) ++ { ++ /* Invalid UTF-8. */ ++ putback_buf[num_putback++] = utf8[1]; ++ break; ++ } ++ else if ((utf8[0] & 0x20) == 0) ++ { ++ /* Valid 2-byte UTF-8. */ ++ if (unicode_display == unicode_invalid) ++ { ++ putback_buf[num_putback++] = utf8[1]; ++ break; ++ } ++ else ++ { ++ (void) display_utf8_char (utf8); ++ continue; ++ } ++ } ++ ++ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read); ++ if (c == EOF) ++ break; ++ utf8[2] = c; ++ ++ if ((utf8[2] & 0xc0) != 0x80) ++ { ++ /* Invalid UTF-8. */ ++ putback_buf[num_putback++] = utf8[2]; ++ putback_buf[num_putback++] = utf8[1]; ++ break; ++ } ++ else if ((utf8[0] & 0x10) == 0) ++ { ++ /* Valid 3-byte UTF-8. */ ++ if (unicode_display == unicode_invalid) ++ { ++ putback_buf[num_putback++] = utf8[2]; ++ putback_buf[num_putback++] = utf8[1]; ++ break; ++ } ++ else ++ { ++ (void) display_utf8_char (utf8); ++ continue; ++ } ++ } ++ ++ c = get_unicode_byte (stream, putback_buf, & num_putback, & num_read); ++ if (c == EOF) ++ break; ++ utf8[3] = c; ++ ++ if ((utf8[3] & 0xc0) != 0x80) ++ { ++ /* Invalid UTF-8. */ ++ putback_buf[num_putback++] = utf8[3]; ++ putback_buf[num_putback++] = utf8[2]; ++ putback_buf[num_putback++] = utf8[1]; ++ break; ++ } ++ else if (unicode_display == unicode_invalid) ++ { ++ putback_buf[num_putback++] = utf8[3]; ++ putback_buf[num_putback++] = utf8[2]; ++ putback_buf[num_putback++] = utf8[1]; ++ break; ++ } ++ else ++ /* A valid 4-byte UTF-8 encoding. */ ++ (void) display_utf8_char (utf8); ++ } ++ while (1); ++ ++ if (output_separator) ++ fputs (output_separator, stdout); ++ else ++ putchar ('\n'); ++ } ++ ++ if (c != EOF) ++ /* FIXME: Using tail recursion here is lazy, but it works. */ ++ print_unicode_stream_body (filename, address + num_read, stream, putback_buf, num_putback, print_buf); ++} ++ ++/* Display strings read in from STREAM. Treat any UTF-8 encoded characters ++ encountered according to the setting of the unicode_display variable. ++ The stream is positioned at ADDRESS and is attached to FILENAME. */ ++ ++static void ++print_unicode_stream (const char * filename, ++ file_ptr address, ++ FILE * stream) ++{ ++ /* Paranoia checks... */ ++ if (filename == NULL ++ || stream == NULL ++ || unicode_display == unicode_default ++ || encoding != 'S' ++ || encoding_bytes != 1) ++ { ++ fprintf (stderr, "ICE: bad arguments to print_unicode_stream\n"); ++ return; ++ } ++ ++ /* Allocate space for string_min 4-byte utf-8 characters. */ ++ unsigned char * print_buf = xmalloc ((4 * string_min) + 1); ++ /* We should never have to put back more than 4 bytes. */ ++ unsigned char putback_buf[5]; ++ unsigned int num_putback = 0; ++ ++ print_unicode_stream_body (filename, address, stream, putback_buf, num_putback, print_buf); ++ free (print_buf); ++} + + /* Find the strings in file FILENAME, read from STREAM. + Assume that STREAM is positioned so that the next byte read + is at address ADDRESS in the file. +- Stop reading at address STOP_POINT in the file, if nonzero. + + If STREAM is NULL, do not read from it. + The caller can supply a buffer of characters +@@ -570,18 +1238,27 @@ static void + print_strings (const char *filename, FILE *stream, file_ptr address, + int stop_point, int magiccount, char *magic) + { ++ if (unicode_display != unicode_default) ++ { ++ if (magic != NULL) ++ print_unicode_buffer (filename, address, ++ (const unsigned char *) magic, magiccount); ++ ++ if (stream != NULL) ++ print_unicode_stream (filename, address, stream); ++ return; ++ } ++ + char *buf = (char *) xmalloc (sizeof (char) * (string_min + 1)); + + while (1) + { + file_ptr start; +- int i; ++ unsigned int i; + long c; + + /* See if the next `string_min' chars are all graphic chars. */ + tryline: +- if (stop_point && address >= stop_point) +- break; + start = address; + for (i = 0; i < string_min; i++) + { +@@ -718,6 +1395,8 @@ usage (FILE *stream, int status) + -T --target= Specify the binary file format\n\ + -e --encoding={s,S,b,l,B,L} Select character size and endianness:\n\ + s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n\ ++ --unicode={default|show|invalid|hex|escape|highlight}\n\ ++ -U {d|s|i|x|e|h} Specify how to treat UTF-8 encoded unicode characters\n\ + -s --output-separator= String used to separate strings in output.\n\ + @ Read options from \n\ + -h --help Display this information\n\ diff --git a/sources b/sources new file mode 100644 index 0000000..91c8b35 --- /dev/null +++ b/sources @@ -0,0 +1,2 @@ +SHA512 (binutils-2.35.tar.xz) = 9f222e4ab6720036402d03904fb11b73ab87714b85cd84997f7d357f405c7e10581d70202f9165a1ee0c70538632db27ecc9dfe627dddb1e6bc7edb1537cf786 +SHA512 (standards.info.gz) = 52452ec58c9b0045abeb1f7fb29d56a62cd4042edbb5e1685dad5f6932731ace2bf05ec238b2e8d3d851114a2718b511dfc721c996bee8721a873314de7c7358