From 0c89c8266890c36bd66f8bd975bf353340b2bb41 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 04 2021 06:31:53 +0000 Subject: import mingw-binutils-2.37-1.el9 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d853d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/binutils-2.37.tar.xz diff --git a/.mingw-binutils.metadata b/.mingw-binutils.metadata new file mode 100644 index 0000000..b766ae0 --- /dev/null +++ b/.mingw-binutils.metadata @@ -0,0 +1 @@ +e9cf391b000010d6c752771974b394c9c743c928 SOURCES/binutils-2.37.tar.xz diff --git a/SOURCES/binutils-2.27-aarch64-ifunc.patch b/SOURCES/binutils-2.27-aarch64-ifunc.patch new file mode 100644 index 0000000..17eb80d --- /dev/null +++ b/SOURCES/binutils-2.27-aarch64-ifunc.patch @@ -0,0 +1,11 @@ +diff -rupN --no-dereference binutils-2.37/bfd/elfnn-aarch64.c binutils-2.37-new/bfd/elfnn-aarch64.c +--- binutils-2.37/bfd/elfnn-aarch64.c 2021-07-08 13:37:19.000000000 +0200 ++++ binutils-2.37-new/bfd/elfnn-aarch64.c 2021-07-24 21:59:12.398868364 +0200 +@@ -5473,6 +5473,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/SOURCES/binutils-CVE-2019-1010204.patch b/SOURCES/binutils-CVE-2019-1010204.patch new file mode 100644 index 0000000..e3a7c80 --- /dev/null +++ b/SOURCES/binutils-CVE-2019-1010204.patch @@ -0,0 +1,16 @@ +diff -rupN --no-dereference binutils-2.37/gold/fileread.cc binutils-2.37-new/gold/fileread.cc +--- binutils-2.37/gold/fileread.cc 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/gold/fileread.cc 2021-07-24 21:59:22.937765719 +0200 +@@ -385,6 +385,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/SOURCES/binutils-do-not-link-with-static-libstdc++.patch b/SOURCES/binutils-do-not-link-with-static-libstdc++.patch new file mode 100644 index 0000000..354992a --- /dev/null +++ b/SOURCES/binutils-do-not-link-with-static-libstdc++.patch @@ -0,0 +1,83 @@ +diff -rupN --no-dereference binutils-2.37/configure binutils-2.37-new/configure +--- binutils-2.37/configure 2021-07-18 18:36:27.000000000 +0200 ++++ binutils-2.37-new/configure 2021-07-24 21:59:14.582847093 +0200 +@@ -5257,49 +5257,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 -rupN --no-dereference binutils-2.37/configure.ac binutils-2.37-new/configure.ac +--- binutils-2.37/configure.ac 2021-07-18 18:48:58.000000000 +0200 ++++ binutils-2.37-new/configure.ac 2021-07-24 21:59:14.583847083 +0200 +@@ -1300,26 +1300,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/SOURCES/binutils-export-demangle.h.patch b/SOURCES/binutils-export-demangle.h.patch new file mode 100644 index 0000000..ee635cb --- /dev/null +++ b/SOURCES/binutils-export-demangle.h.patch @@ -0,0 +1,33 @@ +diff -rupN --no-dereference binutils-2.37/bfd/Makefile.am binutils-2.37-new/bfd/Makefile.am +--- binutils-2.37/bfd/Makefile.am 2021-07-24 21:59:01.980969825 +0200 ++++ binutils-2.37-new/bfd/Makefile.am 2021-07-24 21:59:01.986969767 +0200 +@@ -33,7 +33,7 @@ bfdlibdir = @bfdlibdir@ + bfdincludedir = @bfdincludedir@ + bfdlib_LTLIBRARIES = libbfd.la + bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ +- $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.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 -rupN --no-dereference binutils-2.37/bfd/Makefile.in binutils-2.37-new/bfd/Makefile.in +--- binutils-2.37/bfd/Makefile.in 2021-07-24 21:59:01.980969825 +0200 ++++ binutils-2.37-new/bfd/Makefile.in 2021-07-24 21:59:01.987969757 +0200 +@@ -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 \ +- $(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 +@@ -469,7 +469,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@ $(INCDIR)/diagnostics.h \ ++@INSTALL_LIBBFD_TRUE@ $(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/SOURCES/binutils-filename-in-error-messages.patch b/SOURCES/binutils-filename-in-error-messages.patch new file mode 100644 index 0000000..a06480b --- /dev/null +++ b/SOURCES/binutils-filename-in-error-messages.patch @@ -0,0 +1,124 @@ +diff -rupN --no-dereference binutils-2.37/binutils/readelf.c binutils-2.37-new/binutils/readelf.c +--- binutils-2.37/binutils/readelf.c 2021-07-08 13:37:19.000000000 +0200 ++++ binutils-2.37-new/binutils/readelf.c 2021-07-24 21:59:05.781932809 +0200 +@@ -21873,45 +21873,52 @@ process_file (char * file_name) + struct stat statbuf; + char armag[SARMAG]; + bool ret = true; ++ 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); +- fclose (filedata->handle); +- free (filedata); +- return false; ++ error (_("Failed to read file's magic number\n")); ++ goto done; + } + + filedata->file_size = (bfd_size_type) statbuf.st_size; +@@ -21919,33 +21926,39 @@ process_file (char * file_name) + + 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) ++ { ++ if (filedata->handle != NULL) ++ 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/SOURCES/binutils-fix-testsuite-failures.patch b/SOURCES/binutils-fix-testsuite-failures.patch new file mode 100644 index 0000000..af32305 --- /dev/null +++ b/SOURCES/binutils-fix-testsuite-failures.patch @@ -0,0 +1,304 @@ +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-elfvers/vers24.rd binutils-2.37-new/ld/testsuite/ld-elfvers/vers24.rd +--- binutils-2.37/ld/testsuite/ld-elfvers/vers24.rd 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-elfvers/vers24.rd 2021-07-24 21:59:18.647807502 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-10.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-10.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-10.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-10.d 2021-07-24 21:59:18.648807492 +0200 +@@ -32,7 +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 ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-11.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-11.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-11.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-11.d 2021-07-24 21:59:18.648807492 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-13.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-13.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-13.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-13.d 2021-07-24 21:59:18.648807492 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-14.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-14.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-14.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-14.d 2021-07-24 21:59:18.649807482 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-15.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-15.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-15.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-15.d 2021-07-24 21:59:18.649807482 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-16.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-16.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-16.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-16.d 2021-07-24 21:59:18.649807482 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-17.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-17.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-17.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-17.d 2021-07-24 21:59:18.649807482 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-18.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-18.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-18.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-18.d 2021-07-24 21:59:18.650807473 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-19.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-19.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-19.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-19.d 2021-07-24 21:59:18.650807473 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-20.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-20.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-20.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-20.d 2021-07-24 21:59:18.650807473 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-21.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-21.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-21.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-21.d 2021-07-24 21:59:18.650807473 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-22.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-22.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-22.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-22.d 2021-07-24 21:59:18.650807473 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-23.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-23.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-23.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-23.d 2021-07-24 21:59:18.651807463 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-24.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-24.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-24.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-24.d 2021-07-24 21:59:18.651807463 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-25.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-25.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-25.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-25.d 2021-07-24 21:59:18.651807463 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-28.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-28.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-28.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-28.d 2021-07-24 21:59:18.651807463 +0200 +@@ -1 +1,2 @@ + .*: error: Error ++#... +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-29.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-29.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-29.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-29.d 2021-07-24 21:59:18.652807453 +0200 +@@ -1 +1,2 @@ + .*: warning: Warning ++#... +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-30.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-30.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-30.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-30.d 2021-07-24 21:59:18.652807453 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-6.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-6.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-6.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-6.d 2021-07-24 21:59:18.652807453 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-7.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-7.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-7.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-7.d 2021-07-24 21:59:18.652807453 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-8.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-8.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-8.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-8.d 2021-07-24 21:59:18.653807444 +0200 +@@ -30,9 +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 ++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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-9.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-9.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-9.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-9.d 2021-07-24 21:59:18.653807444 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin.exp binutils-2.37-new/ld/testsuite/ld-plugin/plugin.exp +--- binutils-2.37/ld/testsuite/ld-plugin/plugin.exp 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin.exp 2021-07-24 21:59:18.653807444 +0200 +@@ -117,6 +117,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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/pr20070.d binutils-2.37-new/ld/testsuite/ld-plugin/pr20070.d +--- binutils-2.37/ld/testsuite/ld-plugin/pr20070.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/pr20070.d 2021-07-24 21:59:18.653807444 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-srec/srec.exp binutils-2.37-new/ld/testsuite/ld-srec/srec.exp +--- binutils-2.37/ld/testsuite/ld-srec/srec.exp 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-srec/srec.exp 2021-07-24 21:59:18.654807434 +0200 +@@ -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 --git a/SOURCES/binutils-gold-i386-gnu-property-notes.patch b/SOURCES/binutils-gold-i386-gnu-property-notes.patch new file mode 100644 index 0000000..88955b4 --- /dev/null +++ b/SOURCES/binutils-gold-i386-gnu-property-notes.patch @@ -0,0 +1,192 @@ +diff -rupN --no-dereference binutils-2.37/gold/i386.cc binutils-2.37-new/gold/i386.cc +--- binutils-2.37/gold/i386.cc 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/gold/i386.cc 2021-07-24 21:59:31.051686692 +0200 +@@ -360,7 +360,11 @@ class Target_i386 : public Sized_target< + got_(NULL), plt_(NULL), got_plt_(NULL), got_irelative_(NULL), + got_tlsdesc_(NULL), global_offset_table_(NULL), rel_dyn_(NULL), + rel_irelative_(NULL), copy_relocs_(elfcpp::R_386_COPY), +- got_mod_index_offset_(-1U), tls_base_symbol_defined_(false) ++ got_mod_index_offset_(-1U), tls_base_symbol_defined_(false), ++ isa_1_used_(0), isa_1_needed_(0), ++ feature_1_(0), feature_2_used_(0), feature_2_needed_(0), ++ object_isa_1_used_(0), object_feature_1_(0), ++ object_feature_2_used_(0), seen_first_object_(false) + { } + + // Process the relocations to determine unreferenced sections for +@@ -859,6 +863,21 @@ class Target_i386 : public Sized_target< + this->rel_dyn_section(layout)); + } + ++ // Record a target-specific program property in the .note.gnu.property ++ // section. ++ void ++ record_gnu_property(unsigned int, unsigned int, size_t, ++ const unsigned char*, const Object*); ++ ++ // Merge the target-specific program properties from the current object. ++ void ++ merge_gnu_properties(const Object*); ++ ++ // Finalize the target-specific program properties and add them back to ++ // the layout. ++ void ++ do_finalize_gnu_properties(Layout*) const; ++ + // Information about this specific target which we pass to the + // general Target structure. + static const Target::Target_info i386_info; +@@ -898,6 +917,26 @@ class Target_i386 : public Sized_target< + unsigned int got_mod_index_offset_; + // True if the _TLS_MODULE_BASE_ symbol has been defined. + bool tls_base_symbol_defined_; ++ ++ // Target-specific program properties, from .note.gnu.property section. ++ // Each bit represents a specific feature. ++ uint32_t isa_1_used_; ++ uint32_t isa_1_needed_; ++ uint32_t feature_1_; ++ uint32_t feature_2_used_; ++ uint32_t feature_2_needed_; ++ // Target-specific properties from the current object. ++ // These bits get ORed into ISA_1_USED_ after all properties for the object ++ // have been processed. But if either is all zeroes (as when the property ++ // is absent from an object), the result should be all zeroes. ++ // (See PR ld/23486.) ++ uint32_t object_isa_1_used_; ++ // These bits get ANDed into FEATURE_1_ after all properties for the object ++ // have been processed. ++ uint32_t object_feature_1_; ++ uint32_t object_feature_2_used_; ++ // Whether we have seen our first object, for use in initializing FEATURE_1_. ++ bool seen_first_object_; + }; + + const Target::Target_info Target_i386::i386_info = +@@ -1042,6 +1081,126 @@ Target_i386::rel_irelative_section(Layou + return this->rel_irelative_; + } + ++// Record a target-specific program property from the .note.gnu.property ++// section. ++void ++Target_i386::record_gnu_property( ++ unsigned int, unsigned int pr_type, ++ size_t pr_datasz, const unsigned char* pr_data, ++ const Object* object) ++{ ++ uint32_t val = 0; ++ ++ switch (pr_type) ++ { ++ case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_USED: ++ case elfcpp::GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED: ++ case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED: ++ case elfcpp::GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED: ++ case elfcpp::GNU_PROPERTY_X86_ISA_1_USED: ++ case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED: ++ case elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND: ++ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED: ++ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED: ++ if (pr_datasz != 4) ++ { ++ gold_warning(_("%s: corrupt .note.gnu.property section " ++ "(pr_datasz for property %d is not 4)"), ++ object->name().c_str(), pr_type); ++ return; ++ } ++ val = elfcpp::Swap<32, false>::readval(pr_data); ++ break; ++ default: ++ gold_warning(_("%s: unknown program property type 0x%x " ++ "in .note.gnu.property section"), ++ object->name().c_str(), pr_type); ++ break; ++ } ++ ++ switch (pr_type) ++ { ++ case elfcpp::GNU_PROPERTY_X86_ISA_1_USED: ++ this->object_isa_1_used_ |= val; ++ break; ++ case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED: ++ this->isa_1_needed_ |= val; ++ break; ++ case elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND: ++ // If we see multiple feature props in one object, OR them together. ++ this->object_feature_1_ |= val; ++ break; ++ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED: ++ this->object_feature_2_used_ |= val; ++ break; ++ case elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED: ++ this->feature_2_needed_ |= val; ++ break; ++ } ++} ++ ++// Merge the target-specific program properties from the current object. ++void ++Target_i386::merge_gnu_properties(const Object*) ++{ ++ if (this->seen_first_object_) ++ { ++ // If any object is missing the ISA_1_USED property, we must omit ++ // it from the output file. ++ if (this->object_isa_1_used_ == 0) ++ this->isa_1_used_ = 0; ++ else if (this->isa_1_used_ != 0) ++ this->isa_1_used_ |= this->object_isa_1_used_; ++ this->feature_1_ &= this->object_feature_1_; ++ // If any object is missing the FEATURE_2_USED property, we must ++ // omit it from the output file. ++ if (this->object_feature_2_used_ == 0) ++ this->feature_2_used_ = 0; ++ else if (this->feature_2_used_ != 0) ++ this->feature_2_used_ |= this->object_feature_2_used_; ++ } ++ else ++ { ++ this->isa_1_used_ = this->object_isa_1_used_; ++ this->feature_1_ = this->object_feature_1_; ++ this->feature_2_used_ = this->object_feature_2_used_; ++ this->seen_first_object_ = true; ++ } ++ this->object_isa_1_used_ = 0; ++ this->object_feature_1_ = 0; ++ this->object_feature_2_used_ = 0; ++} ++ ++static inline void ++add_property(Layout* layout, unsigned int pr_type, uint32_t val) ++{ ++ unsigned char buf[4]; ++ elfcpp::Swap<32, false>::writeval(buf, val); ++ layout->add_gnu_property(elfcpp::NT_GNU_PROPERTY_TYPE_0, pr_type, 4, buf); ++} ++ ++// Finalize the target-specific program properties and add them back to ++// the layout. ++void ++Target_i386::do_finalize_gnu_properties(Layout* layout) const ++{ ++ if (this->isa_1_used_ != 0) ++ add_property(layout, elfcpp::GNU_PROPERTY_X86_ISA_1_USED, ++ this->isa_1_used_); ++ if (this->isa_1_needed_ != 0) ++ add_property(layout, elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED, ++ this->isa_1_needed_); ++ if (this->feature_1_ != 0) ++ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND, ++ this->feature_1_); ++ if (this->feature_2_used_ != 0) ++ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_USED, ++ this->feature_2_used_); ++ if (this->feature_2_needed_ != 0) ++ add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_2_NEEDED, ++ this->feature_2_needed_); ++} ++ + // Write the first three reserved words of the .got.plt section. + // The remainder of the section is written while writing the PLT + // in Output_data_plt_i386::do_write. diff --git a/SOURCES/binutils-gold-mismatched-section-flags.patch b/SOURCES/binutils-gold-mismatched-section-flags.patch new file mode 100644 index 0000000..b61a90d --- /dev/null +++ b/SOURCES/binutils-gold-mismatched-section-flags.patch @@ -0,0 +1,19 @@ +diff -rupN --no-dereference binutils-2.37/gold/layout.cc binutils-2.37-new/gold/layout.cc +--- binutils-2.37/gold/layout.cc 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/gold/layout.cc 2021-07-24 21:59:20.710787409 +0200 +@@ -869,6 +869,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; +@@ -879,6 +880,7 @@ Layout::get_output_section(const char* n + if (p != this->section_name_map_.end()) + os = p->second; + } ++#endif + } + + if (os == NULL) diff --git a/SOURCES/binutils-gold-warn-unsupported.patch b/SOURCES/binutils-gold-warn-unsupported.patch new file mode 100644 index 0000000..e5e4d9e --- /dev/null +++ b/SOURCES/binutils-gold-warn-unsupported.patch @@ -0,0 +1,67 @@ +diff -rupN --no-dereference binutils-2.37/bfd/config.bfd binutils-2.37-new/bfd/config.bfd +--- binutils-2.37/bfd/config.bfd 2021-07-08 13:37:19.000000000 +0200 ++++ binutils-2.37-new/bfd/config.bfd 2021-07-24 21:59:24.914746464 +0200 +@@ -465,7 +465,7 @@ case "${targ}" in + ;; + + #ifdef BFD64 +- bpf-*-none) ++ bpf-*-none | bpf-*) + targ_defvec=bpf_elf64_le_vec + targ_selvecs=bpf_elf64_be_vec + targ_underscore=yes +@@ -1421,7 +1421,7 @@ case "${targ}" in + ;; + + *) +- echo 1>&2 "*** BFD does not support target ${targ}." ++ echo 1>&2 "*** BFD does not support target '${targ}'. Honest." + echo 1>&2 "*** Look in bfd/config.bfd for supported targets." + exit 1 + ;; +diff -rupN --no-dereference binutils-2.37/gold/configure binutils-2.37-new/gold/configure +--- binutils-2.37/gold/configure 2021-07-18 18:40:53.000000000 +0200 ++++ binutils-2.37-new/gold/configure 2021-07-24 21:59:24.917746435 +0200 +@@ -5184,7 +5184,8 @@ for targ in $target $canon_targets; do + . ${srcdir}/configure.tgt + + if test "$targ_obj" = "UNKNOWN"; then +- as_fn_error $? "\"unsupported target $targ\"" "$LINENO" 5 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"unsupported target $targ\"" >&5 ++$as_echo "$as_me: WARNING: \"unsupported target $targ\"" >&2;} + else + targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)" + if test "$targ_extra_obj" != ""; then +diff -rupN --no-dereference binutils-2.37/gold/configure.ac binutils-2.37-new/gold/configure.ac +--- binutils-2.37/gold/configure.ac 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/gold/configure.ac 2021-07-24 21:59:24.918746425 +0200 +@@ -181,7 +181,7 @@ for targ in $target $canon_targets; do + . ${srcdir}/configure.tgt + + if test "$targ_obj" = "UNKNOWN"; then +- AC_MSG_ERROR("unsupported target $targ") ++ AC_MSG_WARN("unsupported target $targ") + else + targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)" + if test "$targ_extra_obj" != ""; then +diff -rupN --no-dereference binutils-2.37/ld/configure.tgt binutils-2.37-new/ld/configure.tgt +--- binutils-2.37/ld/configure.tgt 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/configure.tgt 2021-07-24 21:59:24.919746416 +0200 +@@ -215,7 +215,7 @@ bfin-*-linux-uclibc*) targ_emul=elf32bfi + targ_extra_emuls="elf32bfin" + targ_extra_libpath=$targ_extra_emuls + ;; +-bpf-*-*) targ_emul=elf64bpf ++bpf-* | bpf-*-*) targ_emul=elf64bpf + ;; + cr16-*-elf*) targ_emul=elf32cr16 + ;; +@@ -1025,7 +1025,7 @@ z8k-*-coff) targ_emul=z8002 + targ_extra_ofiles= + ;; + *) +- echo 2>&1 "*** ld does not support target ${targ}" ++ echo 2>&1 "*** ld does not support target '${targ}' NO REALLY" + echo 2>&1 "*** see ld/configure.tgt for supported targets" + exit 1 + diff --git a/SOURCES/binutils-no-config-h-check.patch b/SOURCES/binutils-no-config-h-check.patch new file mode 100644 index 0000000..9a7bf1e --- /dev/null +++ b/SOURCES/binutils-no-config-h-check.patch @@ -0,0 +1,30 @@ +diff -rupN --no-dereference binutils-2.37/bfd/bfd-in2.h binutils-2.37-new/bfd/bfd-in2.h +--- binutils-2.37/bfd/bfd-in2.h 2021-07-08 13:37:19.000000000 +0200 ++++ binutils-2.37-new/bfd/bfd-in2.h 2021-07-24 21:59:03.850951615 +0200 +@@ -30,11 +30,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 -rupN --no-dereference binutils-2.37/bfd/bfd-in.h binutils-2.37-new/bfd/bfd-in.h +--- binutils-2.37/bfd/bfd-in.h 2021-07-08 13:37:19.000000000 +0200 ++++ binutils-2.37-new/bfd/bfd-in.h 2021-07-24 21:59:03.851951606 +0200 +@@ -23,11 +23,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/SOURCES/binutils-readelf-other-sym-info.patch b/SOURCES/binutils-readelf-other-sym-info.patch new file mode 100644 index 0000000..df2e324 --- /dev/null +++ b/SOURCES/binutils-readelf-other-sym-info.patch @@ -0,0 +1,36 @@ +diff -rupN --no-dereference binutils-2.37/binutils/readelf.c binutils-2.37-new/binutils/readelf.c +--- binutils-2.37/binutils/readelf.c 2021-07-24 21:59:08.033910876 +0200 ++++ binutils-2.37-new/binutils/readelf.c 2021-07-24 21:59:10.159890170 +0200 +@@ -12616,11 +12616,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)); + +@@ -12670,7 +12672,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/SOURCES/binutils-revert-PLT-elision.patch b/SOURCES/binutils-revert-PLT-elision.patch new file mode 100644 index 0000000..b6d62e2 --- /dev/null +++ b/SOURCES/binutils-revert-PLT-elision.patch @@ -0,0 +1,245 @@ +diff -rupN --no-dereference binutils-2.37/bfd/elfxx-x86.c binutils-2.37-new/bfd/elfxx-x86.c +--- binutils-2.37/bfd/elfxx-x86.c 2021-07-08 13:37:19.000000000 +0200 ++++ binutils-2.37-new/bfd/elfxx-x86.c 2021-07-24 21:59:08.085910370 +0200 +@@ -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 +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-i386/pltgot-1.d binutils-2.37-new/ld/testsuite/ld-i386/pltgot-1.d +--- binutils-2.37/ld/testsuite/ld-i386/pltgot-1.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-i386/pltgot-1.d 2021-07-24 21:59:08.086910360 +0200 +@@ -2,6 +2,7 @@ + #readelf: -S --wide + #as: --32 + ++#pass + #... + +\[ *[0-9]+\] \.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+10 +.* + #... +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-i386/pltgot-2.d binutils-2.37-new/ld/testsuite/ld-i386/pltgot-2.d +--- binutils-2.37/ld/testsuite/ld-i386/pltgot-2.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-i386/pltgot-2.d 2021-07-24 21:59:08.086910360 +0200 +@@ -3,7 +3,6 @@ + #readelf: -d --wide + #as: --32 + +-#failif + #... + +0x[0-9a-f]+ +\(PLTREL.* + #... +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-i386/pr19636-2d.d binutils-2.37-new/ld/testsuite/ld-i386/pr19636-2d.d +--- binutils-2.37/ld/testsuite/ld-i386/pr19636-2d.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-i386/pr19636-2d.d 2021-07-24 21:59:08.086910360 +0200 +@@ -8,7 +8,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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-i386/pr19636-2e.d binutils-2.37-new/ld/testsuite/ld-i386/pr19636-2e.d +--- binutils-2.37/ld/testsuite/ld-i386/pr19636-2e.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-i386/pr19636-2e.d 2021-07-24 21:59:08.086910360 +0200 +@@ -8,7 +8,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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-i386/pr20830.d binutils-2.37-new/ld/testsuite/ld-i386/pr20830.d +--- binutils-2.37/ld/testsuite/ld-i386/pr20830.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-i386/pr20830.d 2021-07-24 21:59:08.087910350 +0200 +@@ -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 +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/pltgot-1.d binutils-2.37-new/ld/testsuite/ld-x86-64/pltgot-1.d +--- binutils-2.37/ld/testsuite/ld-x86-64/pltgot-1.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/pltgot-1.d 2021-07-24 21:59:08.087910350 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/pltgot-2.d binutils-2.37-new/ld/testsuite/ld-x86-64/pltgot-2.d +--- binutils-2.37/ld/testsuite/ld-x86-64/pltgot-2.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/pltgot-2.d 2021-07-24 21:59:08.087910350 +0200 +@@ -3,7 +3,6 @@ + #readelf: -d --wide + #as: --64 + +-#failif + #... + +0x[0-9a-f]+ +\(PLTREL.* + #... +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/plt-main.rd binutils-2.37-new/ld/testsuite/ld-x86-64/plt-main.rd +--- binutils-2.37/ld/testsuite/ld-x86-64/plt-main.rd 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/plt-main.rd 2021-07-24 21:59:08.087910350 +0200 +@@ -1,4 +1,3 @@ +-#failif + #... + [0-9a-f ]+R_X86_64_JUMP_SLOT +0+ +bar \+ 0 + #... +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/pr20830a.d binutils-2.37-new/ld/testsuite/ld-x86-64/pr20830a.d +--- binutils-2.37/ld/testsuite/ld-x86-64/pr20830a.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/pr20830a.d 2021-07-24 21:59:08.088910340 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/pr20830a-now.d binutils-2.37-new/ld/testsuite/ld-x86-64/pr20830a-now.d +--- binutils-2.37/ld/testsuite/ld-x86-64/pr20830a-now.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/pr20830a-now.d 2021-07-24 21:59:08.088910340 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/pr20830b.d binutils-2.37-new/ld/testsuite/ld-x86-64/pr20830b.d +--- binutils-2.37/ld/testsuite/ld-x86-64/pr20830b.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/pr20830b.d 2021-07-24 21:59:08.088910340 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/pr20830b-now.d binutils-2.37-new/ld/testsuite/ld-x86-64/pr20830b-now.d +--- binutils-2.37/ld/testsuite/ld-x86-64/pr20830b-now.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/pr20830b-now.d 2021-07-24 21:59:08.088910340 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/pr21038a.d binutils-2.37-new/ld/testsuite/ld-x86-64/pr21038a.d +--- binutils-2.37/ld/testsuite/ld-x86-64/pr21038a.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/pr21038a.d 2021-07-24 21:59:08.089910331 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/pr21038a-now.d binutils-2.37-new/ld/testsuite/ld-x86-64/pr21038a-now.d +--- binutils-2.37/ld/testsuite/ld-x86-64/pr21038a-now.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/pr21038a-now.d 2021-07-24 21:59:08.089910331 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/pr21038b.d binutils-2.37-new/ld/testsuite/ld-x86-64/pr21038b.d +--- binutils-2.37/ld/testsuite/ld-x86-64/pr21038b.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/pr21038b.d 2021-07-24 21:59:08.089910331 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/pr21038b-now.d binutils-2.37-new/ld/testsuite/ld-x86-64/pr21038b-now.d +--- binutils-2.37/ld/testsuite/ld-x86-64/pr21038b-now.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/pr21038b-now.d 2021-07-24 21:59:08.089910331 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/pr21038c.d binutils-2.37-new/ld/testsuite/ld-x86-64/pr21038c.d +--- binutils-2.37/ld/testsuite/ld-x86-64/pr21038c.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/pr21038c.d 2021-07-24 21:59:08.089910331 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/pr21038c-now.d binutils-2.37-new/ld/testsuite/ld-x86-64/pr21038c-now.d +--- binutils-2.37/ld/testsuite/ld-x86-64/pr21038c-now.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/pr21038c-now.d 2021-07-24 21:59:08.090910321 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/tlspic2.rd binutils-2.37-new/ld/testsuite/ld-x86-64/tlspic2.rd +--- binutils-2.37/ld/testsuite/ld-x86-64/tlspic2.rd 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/tlspic2.rd 2021-07-24 21:59:08.090910321 +0200 +@@ -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 diff --git a/SOURCES/binutils-special-sections-in-groups.patch b/SOURCES/binutils-special-sections-in-groups.patch new file mode 100644 index 0000000..9ecb455 --- /dev/null +++ b/SOURCES/binutils-special-sections-in-groups.patch @@ -0,0 +1,28 @@ +diff -rupN --no-dereference binutils-2.37/bfd/elf.c binutils-2.37-new/bfd/elf.c +--- binutils-2.37/bfd/elf.c 2021-07-08 13:37:19.000000000 +0200 ++++ binutils-2.37-new/bfd/elf.c 2021-07-24 21:59:16.679826669 +0200 +@@ -824,7 +824,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'"), +@@ -927,7 +933,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/SOURCES/binutils-testsuite-fixes.patch b/SOURCES/binutils-testsuite-fixes.patch new file mode 100644 index 0000000..15cb2c7 --- /dev/null +++ b/SOURCES/binutils-testsuite-fixes.patch @@ -0,0 +1,865 @@ +diff -rupN --no-dereference binutils-2.37/gold/main.cc binutils-2.37-new/gold/main.cc +--- binutils-2.37/gold/main.cc 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/gold/main.cc 2021-07-24 21:59:28.964707019 +0200 +@@ -290,16 +290,6 @@ main(int argc, char** argv) + elapsed.sys / 1000, (elapsed.sys % 1000) * 1000, + elapsed.wall / 1000, (elapsed.wall % 1000) * 1000); + +-#if defined(HAVE_MALLINFO2) +- struct mallinfo2 m = mallinfo2(); +- fprintf(stderr, _("%s: total space allocated by malloc: %lld bytes\n"), +- program_name, static_cast(m.arena)); +-#elif defined(HAVE_MALLINFO) +- struct mallinfo m = mallinfo(); +- fprintf(stderr, _("%s: total space allocated by malloc: %lld bytes\n"), +- program_name, static_cast(m.arena)); +-#endif +- + File_read::print_stats(); + Archive::print_stats(); + Lib_group::print_stats(); +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d binutils-2.37-new/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d +--- binutils-2.37/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-now.d 2021-07-24 21:59:28.964707019 +0200 +@@ -11,7 +11,7 @@ + 0x.+ \(PLTRELSZ\) \s+.+ \(bytes\) + 0x.+ \(PLTREL\) \s+RELA + 0x.+ \(JMPREL\) \s+0x.+ +- 0x.+ \(BIND_NOW\) \s+ ++ 0x.+ \(FLAGS\) \s+BIND_NOW + 0x.+ \(FLAGS_1\) \s+ Flags: NOW + 0x.+ \(NULL\) \s+ 0x0 + +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-aarch64/variant_pcs-now.d binutils-2.37-new/ld/testsuite/ld-aarch64/variant_pcs-now.d +--- binutils-2.37/ld/testsuite/ld-aarch64/variant_pcs-now.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-aarch64/variant_pcs-now.d 2021-07-24 21:59:28.965707009 +0200 +@@ -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[ ]+UND f_spec_global_default_undef[ ]+\[VARIANT_PCS\] ++ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT[ ]+1 f_spec_global_default_ifunc[ ]+\[VARIANT_PCS\] + 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[ ]+1 f_spec_global_default_def[ ]+\[VARIANT_PCS\] + 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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-aarch64/variant_pcs-r.d binutils-2.37-new/ld/testsuite/ld-aarch64/variant_pcs-r.d +--- binutils-2.37/ld/testsuite/ld-aarch64/variant_pcs-r.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-aarch64/variant_pcs-r.d 2021-07-24 21:59:28.965707009 +0200 +@@ -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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-aarch64/variant_pcs-shared.d binutils-2.37-new/ld/testsuite/ld-aarch64/variant_pcs-shared.d +--- binutils-2.37/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2021-07-24 21:59:28.978706882 +0200 +@@ -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[ ]+UND f_spec_global_default_undef[ ]+\[VARIANT_PCS\] ++ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT[ ]+1 f_spec_global_default_ifunc[ ]+\[VARIANT_PCS\] + 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[ ]+1 f_spec_global_default_def[ ]+\[VARIANT_PCS\] + 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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-elf/compress.exp binutils-2.37-new/ld/testsuite/ld-elf/compress.exp +--- binutils-2.37/ld/testsuite/ld-elf/compress.exp 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-elf/compress.exp 2021-07-24 21:59:28.978706882 +0200 +@@ -167,8 +167,8 @@ if { [regexp_diff tmpdir/$test.out $srcd + + set test_name "Link with zlib compressed debug output 1" + set test normal +-send_log "$READELF -w tmpdir/$test > tmpdir/$test.out\n" +-set got [remote_exec host [concat sh -c [list "$READELF -w tmpdir/$test > tmpdir/$test.out"]] "" "/dev/null"] ++send_log "$READELF -wi tmpdir/$test > tmpdir/$test.out\n" ++set got [remote_exec host [concat sh -c [list "$READELF -wi tmpdir/$test > tmpdir/$test.out"]] "" "/dev/null"] + if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { + send_log "$got\n" + fail "$test_name" +@@ -176,8 +176,8 @@ if { [lindex $got 0] != 0 || ![string ma + + set test_name "Link with zlib compressed debug output 2" + set test zlibnormal +-send_log "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out\n" +-set got [remote_exec host [concat sh -c [list "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out"]] "" "/dev/null"] ++send_log "$READELF -wi tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out\n" ++set got [remote_exec host [concat sh -c [list "$READELF -wi tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out"]] "" "/dev/null"] + if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { + send_log "$got\n" + fail "$test_name" +@@ -203,8 +203,8 @@ if { [regexp_diff tmpdir/$test.out $srcd + + set test_name "Link with zlib-gnu compressed debug output 1" + set test gnunormal +-send_log "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out\n" +-set got [remote_exec host [concat sh -c [list "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out"]] "" "/dev/null"] ++send_log "$READELF -wi tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out\n" ++set got [remote_exec host [concat sh -c [list "$READELF -wi tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out"]] "" "/dev/null"] + if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { + send_log "$got\n" + fail "$test_name" +@@ -230,8 +230,8 @@ if { [regexp_diff tmpdir/$test.out $srcd + + set test gabinormal + set test_name "Link with zlib-gabi compressed debug output 1" +-send_log "$READELF -w tmpdir/$test > tmpdir/$test.out\n" +-set got [remote_exec host [concat sh -c [list "$READELF -w tmpdir/$test > tmpdir/$test.out"]] "" "/dev/null"] ++send_log "$READELF -wi tmpdir/$test > tmpdir/$test.out\n" ++set got [remote_exec host [concat sh -c [list "$READELF -wi tmpdir/$test > tmpdir/$test.out"]] "" "/dev/null"] + if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { + send_log "$got\n" + fail "$test_name" +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-elf/pr26580-3.out binutils-2.37-new/ld/testsuite/ld-elf/pr26580-3.out +--- binutils-2.37/ld/testsuite/ld-elf/pr26580-3.out 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-elf/pr26580-3.out 2021-07-24 21:59:28.979706873 +0200 +@@ -1,2 +1,2 @@ + library not loaded +-alignment 1 ++alignment . +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-elf/shared.exp binutils-2.37-new/ld/testsuite/ld-elf/shared.exp +--- binutils-2.37/ld/testsuite/ld-elf/shared.exp 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-elf/shared.exp 2021-07-24 21:59:28.979706873 +0200 +@@ -1536,18 +1536,6 @@ if { [istarget *-*-linux*] + "pr22393-2-static" \ + "pass.out" \ + ] \ +- [list \ +- "Run pr21964-4" \ +- "" \ +- "" \ +- {pr21964-4.c} \ +- "pr21964-4" \ +- "pass.out" \ +- "" \ +- "" \ +- "" \ +- "-ldl" \ +- ] \ + ] + } + +@@ -1629,6 +1617,7 @@ if [istarget "sparc*-*-*"] { + if { ([istarget "*-*-linux*"] + || [istarget "*-*-nacl*"] + || [istarget "*-*-gnu*"]) ++ && ![istarget "aarch64*-*-*"] && ![istarget "arm*-*-*"] + && ![istarget "mips*-*-*"] } { + run_ld_link_tests [list \ + [list \ +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-elf/tls.exp binutils-2.37-new/ld/testsuite/ld-elf/tls.exp +--- binutils-2.37/ld/testsuite/ld-elf/tls.exp 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-elf/tls.exp 2021-07-24 21:59:28.979706873 +0200 +@@ -32,6 +32,9 @@ if { !([istarget *-*-linux*] + if { ![check_compiler_available] } { + return + } ++if { [istarget s390x*-*-*] } { ++ return ++} + + # This target requires extra GAS options when building PIC/PIE code. + set AFLAGS_PIC "" +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-elfvsb/elfvsb.exp binutils-2.37-new/ld/testsuite/ld-elfvsb/elfvsb.exp +--- binutils-2.37/ld/testsuite/ld-elfvsb/elfvsb.exp 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-elfvsb/elfvsb.exp 2021-07-24 21:59:28.980706863 +0200 +@@ -94,6 +94,10 @@ if { [istarget *-*-linux*] + } + } + ++if { [istarget i686*-*-*] } { ++ set support_protected "no" ++} ++ + # The test procedure. + proc visibility_test { visibility progname testname main sh1 sh2 dat args } { + global CC +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-gc/pr13683.d binutils-2.37-new/ld/testsuite/ld-gc/pr13683.d +--- binutils-2.37/ld/testsuite/ld-gc/pr13683.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-gc/pr13683.d 2021-07-24 21:59:28.980706863 +0200 +@@ -2,7 +2,7 @@ + #source: dummy.s + #ld: --gc-sections -e main --defsym foo=foo2 tmpdir/pr13683.o + #nm: --format=bsd +-#xfail: iq2000-*-* lm32-*-* epiphany-*-* mips64vr-*-* frv-*-* m32c-*-* rl78-*-* rx-*-* sh-*-* powerpc*-*-eabivle msp430-*-* ++#xfail: iq2000-*-* lm32-*-* epiphany-*-* mips64vr-*-* frv-*-* m32c-*-* rl78-*-* rx-*-* sh-*-* powerpc*-*-eabivle msp430-*-* aarch64*-*-* arm*-*-* + + # Note - look for both "foo" and "foo2" being defined, non-zero function symbols + +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-gc/pr19161.d binutils-2.37-new/ld/testsuite/ld-gc/pr19161.d +--- binutils-2.37/ld/testsuite/ld-gc/pr19161.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-gc/pr19161.d 2021-07-24 21:59:28.980706863 +0200 +@@ -2,7 +2,7 @@ + #source: dummy.s + #ld: --gc-sections -e main tmpdir/pr19161-1.o tmpdir/pr19161-2.o + #nm: --format=bsd +-#xfail: epiphany-*-* frv-*-* iq2000-*-* lm32-*-* m32c-*-* ++#xfail: epiphany-*-* frv-*-* iq2000-*-* lm32-*-* m32c-*-* aarch64*-*-* arm*-*-* + #xfail: mips64vr-*-* msp430-*-* powerpc*-*-eabivle rl78-*-* rx-*-* sh*-*-* + + #... +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-i386/i386.exp binutils-2.37-new/ld/testsuite/ld-i386/i386.exp +--- binutils-2.37/ld/testsuite/ld-i386/i386.exp 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-i386/i386.exp 2021-07-24 21:59:28.981706853 +0200 +@@ -1057,15 +1057,6 @@ if { [isnative] + "pr18900.out" \ + ] \ + [list \ +- "Run pr19031" \ +- "$NOPIE_LDFLAGS tmpdir/pr19031.so" \ +- "-Wa,-mx86-used-note=yes" \ +- { pr19031b.S pr19031c.c } \ +- "pr19031" \ +- "pr19031.out" \ +- "$NOPIE_CFLAGS" \ +- ] \ +- [list \ + "Run got1" \ + "$NOPIE_LDFLAGS tmpdir/got1d.so" \ + "-Wa,-mx86-used-note=yes" \ +@@ -1117,7 +1108,9 @@ if { [isnative] + ] \ + ] + +- undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" ++ if { ! [istarget i686*-*-*] } { ++ undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" ++ } + undefined_weak "-fPIE" "$NOPIE_LDFLAGS" + undefined_weak "-fPIE" "-pie" + undefined_weak "-fPIE" "-z nodynamic-undefined-weak $NOPIE_LDFLAGS" +@@ -1181,7 +1174,7 @@ if { [isnative] + ] \ + ] + +- if { [istarget "i?86-*-linux*"] } { ++ if { [istarget "i?86-*-linux*"] && ! [istarget i686*-*-*] } { + run_cc_link_tests [list \ + [list \ + "Build pr21168.so with -z ibtplt" \ +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-i386/plt-main.rd binutils-2.37-new/ld/testsuite/ld-i386/plt-main.rd +--- binutils-2.37/ld/testsuite/ld-i386/plt-main.rd 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-i386/plt-main.rd 2021-07-24 21:59:28.981706853 +0200 +@@ -1,4 +1 @@ +-#failif +-#... +-[0-9a-f ]+R_386_JUMP_SLOT +0+ +bar + #... +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-i386/plt-pie-ibt.dd binutils-2.37-new/ld/testsuite/ld-i386/plt-pie-ibt.dd +--- binutils-2.37/ld/testsuite/ld-i386/plt-pie-ibt.dd 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-i386/plt-pie-ibt.dd 2021-07-24 21:59:28.981706853 +0200 +@@ -1,7 +1,2 @@ + #... +-Disassembly of section .plt.got: +- +-[a-f0-9]+ <[_a-z]+@plt>: +-[ ]*[a-f0-9]+: f3 0f 1e fb endbr32 +-[ ]*[a-f0-9]+: ff a3 .. .. .. .. jmp +\*\-0x[a-f0-9]+\(%ebx\) + #pass +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-ifunc/ifunc.exp binutils-2.37-new/ld/testsuite/ld-ifunc/ifunc.exp +--- binutils-2.37/ld/testsuite/ld-ifunc/ifunc.exp 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-ifunc/ifunc.exp 2021-07-24 21:59:28.981706853 +0200 +@@ -39,6 +39,8 @@ if { ![is_elf_format] || ![supports_gnu_ + || [istarget nds32*-*-*] + || [istarget nios2-*-*] + || [istarget or1k-*-*] ++ || [istarget powerpc*-*-*] ++ || [istarget ppc*-*-*] + || [istarget score*-*-*] + || [istarget sh*-*-*] + || [istarget tic6x-*-*] +@@ -664,6 +666,11 @@ run_cc_link_tests [list \ + ] \ + ] + ++if { [isnative] ++ && !([istarget "powerpc-*-*"] ++ || [istarget "aarch64*-*-*"] || [istarget "arm*-*-*"] ++ || [istarget "sparc*-*-*"] ++ || [istarget "riscv*-*-*"]) } { + run_ld_link_exec_tests [list \ + [list \ + "Run pr18808" \ +@@ -714,6 +721,7 @@ run_ld_link_exec_tests [list \ + "pr18841.out" \ + ] \ + ] ++} + + # The pr23169 testcase is not valid. In general, you can't call ifunc + # resolvers in another binary unless you know what you're doing. In +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-10.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-10.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-10.d 2021-07-24 21:59:20.653787965 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-10.d 2021-07-24 21:59:28.982706843 +0200 +@@ -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_IRONLY ++Sym: '_?func' Resolution: LDPR_PREVAILING_DE.* + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY + #... + hook called: cleanup. +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-11.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-11.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-11.d 2021-07-24 21:59:20.653787965 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-11.d 2021-07-24 21:59:28.982706843 +0200 +@@ -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: '_?func' Resolution: LDPR_PREVAILING_DE.* + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY ++Sym: '_?text' Resolution: LDPR_PREVAILING_DE.* + #... + hook called: cleanup. + #... +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-12.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-12.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-12.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-12.d 2021-07-24 21:59:28.982706843 +0200 +@@ -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 `.*unc' definition: DEF, visibility: DEFAULT, resolution: PREVAILING_DE.* ++.*: symbol `.*unc1' definition: DEF, visibility: PROTECTED, resolution: PREVAILING_DEF_IRONLY ++.*: symbol `.*unc2' definition: DEF, visibility: INTERNAL, resolution: PREVAILING_DEF_IRONLY ++.*: symbol `.*unc3' definition: DEF, visibility: HIDDEN, resolution: PREVAILING_DEF_IRONLY + #pass +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-16.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-16.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-16.d 2021-07-24 21:59:20.654787955 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-16.d 2021-07-24 21:59:28.982706843 +0200 +@@ -30,7 +30,7 @@ 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: '_?func' Resolution: LDPR_PREVAILING_DE.* + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY + #... + hook called: cleanup. +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-17.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-17.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-17.d 2021-07-24 21:59:20.654787955 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-17.d 2021-07-24 21:59:28.983706834 +0200 +@@ -31,7 +31,7 @@ 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: '_?func' Resolution: LDPR_PREVAILING_DE.* + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY + #... + hook called: cleanup. +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-18.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-18.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-18.d 2021-07-24 21:59:20.654787955 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-18.d 2021-07-24 21:59:28.983706834 +0200 +@@ -32,7 +32,7 @@ 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: '_?func' Resolution: LDPR_PREVAILING_DE.* + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY + #... + hook called: cleanup. +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-19.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-19.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-19.d 2021-07-24 21:59:20.654787955 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-19.d 2021-07-24 21:59:28.983706834 +0200 +@@ -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: '_?func' Resolution: LDPR_PREVAILING_DE.* + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY ++Sym: '_?text' Resolution: LDPR_PREVAILING_DE.* + #... + hook called: cleanup. + #... +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-8.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-8.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-8.d 2021-07-24 21:59:20.657787926 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-8.d 2021-07-24 21:59:28.983706834 +0200 +@@ -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_IRONLY ++Sym: '_?func' Resolution: LDPR_PREVAILING_DE.* + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY + #... + hook called: cleanup. +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin-9.d binutils-2.37-new/ld/testsuite/ld-plugin/plugin-9.d +--- binutils-2.37/ld/testsuite/ld-plugin/plugin-9.d 2021-07-24 21:59:20.657787926 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin-9.d 2021-07-24 21:59:28.983706834 +0200 +@@ -31,7 +31,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_IRONLY ++Sym: '_?func' Resolution: LDPR_PREVAILING_DE.* + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY + #... + hook called: cleanup. +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-plugin/plugin.exp binutils-2.37-new/ld/testsuite/ld-plugin/plugin.exp +--- binutils-2.37/ld/testsuite/ld-plugin/plugin.exp 2021-07-24 21:59:20.657787926 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-plugin/plugin.exp 2021-07-24 21:59:28.984706824 +0200 +@@ -81,6 +81,7 @@ if { [istarget m681*-*-*] || [istarget m + # otherwise get FAILS due to _.frame + set CFLAGS "$CFLAGS -fomit-frame-pointer" + } ++ + # In order to define symbols in plugin options in the list of tests below, + # we need to know if the platform prepends an underscore to C symbols, + # which we find out by compiling the test objects now. If there is any +@@ -119,7 +120,7 @@ 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*] } { ++if { [istarget powerpc*-*-linux*] || [istarget x86_64*-*-linux*] || [istarget *-*-*] } { + set _ "" + } + +@@ -137,6 +138,9 @@ if [is_pecoff_format] { + #otherwise relocs overflow to symbols defined on the command line + append libs " --image-base=0x10000000" + } ++if { [istarget aarch64*-*-*] || [istarget arm*-*-*] } { ++ append libs " --defsym __aeabi_unwind_cpp_pr0=0" ++} + + set plugin_tests [list \ + [list "load plugin" "-plugin $plugin_path \ +@@ -304,6 +308,7 @@ if { !$can_compile || $failed_compile } + run_ld_link_tests $plugin_tests + + if { [is_elf_format] \ ++ && ! [istarget ppc64*-*-*] && ! [istarget powerpc*-*-*] + && [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 -rupN --no-dereference binutils-2.37/ld/testsuite/ld-powerpc/group1.sym binutils-2.37-new/ld/testsuite/ld-powerpc/group1.sym +--- binutils-2.37/ld/testsuite/ld-powerpc/group1.sym 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-powerpc/group1.sym 2021-07-24 21:59:28.984706824 +0200 +@@ -1,3 +1 @@ +-#... +-.* 8 FUNC +GLOBAL DEFAULT \[: 4\] +1 foo + #pass +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-powerpc/group3.sym binutils-2.37-new/ld/testsuite/ld-powerpc/group3.sym +--- binutils-2.37/ld/testsuite/ld-powerpc/group3.sym 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-powerpc/group3.sym 2021-07-24 21:59:28.984706824 +0200 +@@ -1,3 +1 @@ +-#... +-.* 4 FUNC +GLOBAL DEFAULT \[: 1\] +1 foo + #pass +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-powerpc/notoc3.d binutils-2.37-new/ld/testsuite/ld-powerpc/notoc3.d +--- binutils-2.37/ld/testsuite/ld-powerpc/notoc3.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-powerpc/notoc3.d 2021-07-24 21:59:28.984706824 +0200 +@@ -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 ++8000000000000004:.* + 8000000000000008: (00 00 00 60|60 00 00 00) nop + 800000000000000c: (20 00 80 4e|4e 80 00 20) blr +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-powerpc/pr23937.d binutils-2.37-new/ld/testsuite/ld-powerpc/pr23937.d +--- binutils-2.37/ld/testsuite/ld-powerpc/pr23937.d 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-powerpc/pr23937.d 2021-07-24 21:59:28.985706814 +0200 +@@ -5,6 +5,4 @@ + + #... + .* R_PPC64_IRELATIVE +10000180 +-#... +-.*: 0+10000180 +20 IFUNC +LOCAL +DEFAULT .* magic + #pass +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-powerpc/tlsexe32no.r binutils-2.37-new/ld/testsuite/ld-powerpc/tlsexe32no.r +--- binutils-2.37/ld/testsuite/ld-powerpc/tlsexe32no.r 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-powerpc/tlsexe32no.r 2021-07-24 21:59:28.985706814 +0200 +@@ -22,6 +22,7 @@ Section Headers: + +\[[ 0-9]+\] \.dynamic +DYNAMIC +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 08 +WA +4 +0 +4 + +\[[ 0-9]+\] \.got +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000038 04 +WA +0 +0 +4 + +\[[ 0-9]+\] \.plt +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000004 00 +WA +0 +0 +4 ++#pass + +\[[ 0-9]+\] \.symtab +SYMTAB +.* + +\[[ 0-9]+\] \.strtab +STRTAB +.* + +\[[ 0-9]+\] \.shstrtab +STRTAB +.* +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-powerpc/tlsexe32.r binutils-2.37-new/ld/testsuite/ld-powerpc/tlsexe32.r +--- binutils-2.37/ld/testsuite/ld-powerpc/tlsexe32.r 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-powerpc/tlsexe32.r 2021-07-24 21:59:28.986706805 +0200 +@@ -22,7 +22,8 @@ Section Headers: + +\[[ 0-9]+\] \.dynamic +DYNAMIC +[0-9a-f]+ [0-9a-f]+ [0-9a-f]+ 08 +WA +4 +0 +4 + +\[[ 0-9]+\] \.got +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000018 04 +WA +0 +0 +4 + +\[[ 0-9]+\] \.plt +PROGBITS +[0-9a-f]+ [0-9a-f]+ 000004 00 +WA +0 +0 +4 +- +\[[ 0-9]+\] \.symtab +SYMTAB +.* ++#pass +++\[[ 0-9]+\] \.symtab +SYMTAB +.* + +\[[ 0-9]+\] \.strtab +STRTAB +.* + +\[[ 0-9]+\] \.shstrtab +STRTAB +.* + #... +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-powerpc/tlsso32.r binutils-2.37-new/ld/testsuite/ld-powerpc/tlsso32.r +--- binutils-2.37/ld/testsuite/ld-powerpc/tlsso32.r 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-powerpc/tlsso32.r 2021-07-24 21:59:28.986706805 +0200 +@@ -20,6 +20,7 @@ Section Headers: + +\[[ 0-9]+\] \.dynamic +DYNAMIC .* 08 +WA +3 +0 +4 + +\[[ 0-9]+\] \.got +PROGBITS .* 0+40 04 +WA +0 +0 +4 + +\[[ 0-9]+\] \.plt +PROGBITS .* 0+4 00 +WA +0 +0 +4 ++#pass + +\[[ 0-9]+\] \.symtab +.* + +\[[ 0-9]+\] \.strtab +.* + +\[[ 0-9]+\] \.shstrtab +.* +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-scripts/crossref.exp binutils-2.37-new/ld/testsuite/ld-scripts/crossref.exp +--- binutils-2.37/ld/testsuite/ld-scripts/crossref.exp 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-scripts/crossref.exp 2021-07-24 21:59:28.986706805 +0200 +@@ -147,6 +147,8 @@ set exec_output [prune_warnings $exec_ou + + regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output + ++setup_xfail i686*-*-* ++ + if [string match "" $exec_output] then { + pass $test3 + } else { +@@ -187,6 +189,8 @@ set exec_output [prune_warnings $exec_ou + + regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output + ++setup_xfail i686*-*-* ++ + if [string match "" $exec_output] then { + pass $test6 + } else { +@@ -199,6 +203,8 @@ set exec_output [prune_warnings $exec_ou + + regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output + ++setup_xfail i686*-*-* ++ + if [string match "" $exec_output] then { + fail $test7 + } else { +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-shared/shared.exp binutils-2.37-new/ld/testsuite/ld-shared/shared.exp +--- binutils-2.37/ld/testsuite/ld-shared/shared.exp 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-shared/shared.exp 2021-07-24 21:59:28.987706795 +0200 +@@ -36,9 +36,6 @@ if { ![istarget hppa*64*-*-hpux*] \ + && ![istarget hppa*-*-linux*] \ + && ![istarget i?86-*-sysv4*] \ + && ![istarget i?86-*-unixware] \ +- && ![istarget i?86-*-elf*] \ +- && ![istarget i?86-*-linux*] \ +- && ![istarget i?86-*-gnu*] \ + && ![istarget *-*-nacl*] \ + && ![istarget ia64-*-elf*] \ + && ![istarget ia64-*-linux*] \ +diff -rupN --no-dereference binutils-2.37/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.37-new/ld/testsuite/ld-x86-64/x86-64.exp +--- binutils-2.37/ld/testsuite/ld-x86-64/x86-64.exp 2021-07-08 13:37:20.000000000 +0200 ++++ binutils-2.37-new/ld/testsuite/ld-x86-64/x86-64.exp 2021-07-24 21:59:28.987706795 +0200 +@@ -1466,22 +1466,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" \ +- ] \ +- [list \ + "Build lam-u48.so" \ + "-shared -Wl,-z,lam-u48" \ + "" \ +@@ -1813,49 +1797,6 @@ if { [isnative] && [check_compiler_avail + if { [istarget "x86_64-*-linux*"] \ + && ![istarget "x86_64-*-linux*-gnux32"]} { + +- run_cc_link_tests [list \ +- [list \ +- "Build plt-main with -z bndplt" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt \ +- -z noseparate-code -z max-page-size=0x200000" \ +- "-Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \ +- { plt-main5.c } \ +- {{objdump {-drw} plt-main-bnd.dd}} \ +- "plt-main-bnd" \ +- ] \ +- [list \ +- "Build plt-main with PIE and -z bndplt" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt -pie \ +- -z noseparate-code -z max-page-size=0x200000" \ +- "-fPIC -Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \ +- { plt-main5.c } \ +- {{objdump {-drw} plt-main-bnd.dd}} \ +- "plt-main-pie-bnd" \ +- ] \ +- [list \ +- "Build plt-main with -z bndplt -z now" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt -z now \ +- -z noseparate-code -z max-page-size=0x200000" \ +- "-Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \ +- { plt-main5.c } \ +- {{readelf {-SW} plt-main-bnd-now.rd} {objdump {-drw} plt-main-bnd.dd}} \ +- "plt-main-bnd-now" \ +- ] \ +- [list \ +- "Build plt-main with PIE and -z bndplt -z now" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z bndplt -z now -pie \ +- -z noseparate-code -z max-page-size=0x200000" \ +- "-fPIC -Wa,-mx86-used-note=yes $NOCF_PROTECTION_CFLAGS" \ +- { plt-main5.c } \ +- {{readelf {-SW} plt-main-bnd-now.rd} {objdump {-drw} plt-main-bnd.dd}} \ +- "plt-main-pie-bnd-now" \ +- ] \ +- ] +- + run_ld_link_exec_tests [list \ + [list \ + "Run plt-main with -z bndplt" \ +@@ -1940,66 +1881,6 @@ if { [isnative] && [check_compiler_avail + set pltdump {{objdump {-drw} plt-main-ibt.dd}} + set pltsecdump {{readelf {-SW} plt-main-ibt-now.rd} {objdump {-drw} plt-main-ibt.dd}} + } +- run_cc_link_tests [list \ +- [list \ +- "Build plt-main with -z ibtplt" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt \ +- -z noseparate-code -z max-page-size=0x200000" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- $pltdump \ +- "plt-main-ibt" \ +- ] \ +- [list \ +- "Build plt-main with PIE and -z ibtplt" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt -pie \ +- -z noseparate-code -z max-page-size=0x200000" \ +- "-fPIC -Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- $pltdump \ +- "plt-main-pie-ibt" \ +- ] \ +- [list \ +- "Build plt-main with -z ibtplt -z now" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt -z now \ +- -z noseparate-code -z max-page-size=0x200000" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- $pltsecdump \ +- "plt-main-ibt-now" \ +- ] \ +- [list \ +- "Build plt-main with PIE and -z ibtplt -z now" \ +- "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ +- tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt -z now -pie \ +- -z noseparate-code -z max-page-size=0x200000" \ +- "-fPIC -Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- $pltsecdump \ +- "plt-main-pie-ibt-now" \ +- ] \ +- [list \ +- "Build libibtplt-lib.so with -z ibtplt" \ +- "-shared -z ibtplt \ +- -z noseparate-code -z max-page-size=0x200000" \ +- "-fPIC -Wa,-mx86-used-note=yes" \ +- { plt-main1.c plt-main2.c plt-main3.c plt-main4.c} \ +- $pltdump \ +- "libibtplt-lib.so" \ +- ] \ +- [list \ +- "Build libibtplt--now-lib.so with -z ibtplt -z now" \ +- "-shared -z ibtplt -z now \ +- -z noseparate-code -z max-page-size=0x200000" \ +- "-fPIC -Wa,-mx86-used-note=yes" \ +- { plt-main1.c plt-main2.c plt-main3.c plt-main4.c} \ +- $pltdump \ +- "libibtplt-now-lib.so" \ +- ] \ +- ] + + run_ld_link_exec_tests [list \ + [list \ +@@ -2044,24 +1925,6 @@ if { [isnative] && [check_compiler_avail + "plt-main.out" \ + "-fPIC" \ + ] \ +- [list \ +- "Run plt-main with libibtplt-lib.so -z ibtplt" \ +- "-Wl,--no-as-needed,-z,ibtplt tmpdir/libibtplt-lib.so \ +- tmpdir/libplt-lib.so" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- "plt-main-ibt-lib" \ +- "plt-main.out" \ +- ] \ +- [list \ +- "Run plt-main with libibtplt-lib.so -z ibtplt -z now" \ +- "-Wl,--no-as-needed,-z,ibtplt,-z,now \ +- tmpdir/libibtplt-now-lib.so tmpdir/libplt-lib.so" \ +- "-Wa,-mx86-used-note=yes" \ +- { plt-main5.c } \ +- "plt-main-ibt-now-lib" \ +- "plt-main.out" \ +- ] \ + ] + + if { [check_ifunc_attribute_available] } { +@@ -2088,7 +1951,6 @@ if { [isnative] && [check_compiler_avail + } + } + +- undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" + undefined_weak "-fPIE" "" + undefined_weak "-fPIE" "-pie" + undefined_weak "-fPIE" "-Wl,-z,nodynamic-undefined-weak" diff --git a/SOURCES/binutils-use-long-long.patch b/SOURCES/binutils-use-long-long.patch new file mode 100644 index 0000000..8ac8f85 --- /dev/null +++ b/SOURCES/binutils-use-long-long.patch @@ -0,0 +1,38 @@ +diff -rupN --no-dereference binutils-2.37/bfd/configure binutils-2.37-new/bfd/configure +--- binutils-2.37/bfd/configure 2021-07-18 18:36:53.000000000 +0200 ++++ binutils-2.37-new/bfd/configure 2021-07-24 21:59:26.907727053 +0200 +@@ -12751,11 +12751,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 -rupN --no-dereference binutils-2.37/bfd/configure.ac binutils-2.37-new/bfd/configure.ac +--- binutils-2.37/bfd/configure.ac 2021-07-08 13:37:19.000000000 +0200 ++++ binutils-2.37-new/bfd/configure.ac 2021-07-24 21:59:26.908727043 +0200 +@@ -230,11 +230,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 --git a/SOURCES/binutils-version.patch b/SOURCES/binutils-version.patch new file mode 100644 index 0000000..5438e58 --- /dev/null +++ b/SOURCES/binutils-version.patch @@ -0,0 +1,46 @@ +diff -rupN --no-dereference binutils-2.37/bfd/Makefile.am binutils-2.37-new/bfd/Makefile.am +--- binutils-2.37/bfd/Makefile.am 2021-07-08 13:37:19.000000000 +0200 ++++ binutils-2.37-new/bfd/Makefile.am 2021-07-24 21:59:00.067988456 +0200 +@@ -942,8 +942,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 ;\ +@@ -954,7 +954,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 -rupN --no-dereference binutils-2.37/bfd/Makefile.in binutils-2.37-new/bfd/Makefile.in +--- binutils-2.37/bfd/Makefile.in 2021-07-18 18:36:53.000000000 +0200 ++++ binutils-2.37-new/bfd/Makefile.in 2021-07-24 21:59:00.069988437 +0200 +@@ -2053,8 +2053,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 ;\ +@@ -2065,7 +2065,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/SPECS/mingw-binutils.spec b/SPECS/mingw-binutils.spec new file mode 100644 index 0000000..4365381 --- /dev/null +++ b/SPECS/mingw-binutils.spec @@ -0,0 +1,621 @@ +%global run_testsuite 1 + +Name: mingw-binutils +Version: 2.37 +Release: 1%{?dist} +Summary: Cross-compiled version of binutils for Win32 and Win64 environments + +License: GPLv2+ and LGPLv2+ and GPLv3+ and LGPLv3+ + +URL: http://www.gnu.org/software/binutils/ +Source0: http://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz + +### Patches from native package +# 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). +# Not needed, mingw does not have lib64 +# Patch01: binutils-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-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-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-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-revert-PLT-elision.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. +Patch07: 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. +Patch08: binutils-2.27-aarch64-ifunc.patch + +# Purpose: Stop the binutils from statically linking with libstdc++. +# Lifetime: Permanent. +Patch09: binutils-do-not-link-with-static-libstdc++.patch + +# Purpose: Allow OS specific sections in section groups. +# Lifetime: Fixed in 2.38 (maybe) +Patch10: binutils-special-sections-in-groups.patch + +# Purpose: Fix linker testsuite failures. +# Lifetime: Fixed in 2.37 (maybe) +Patch11: binutils-fix-testsuite-failures.patch + +# Purpose: Stop gold from aborting when input sections with the same name +# have different flags. +# Lifetime: Fixed in 2.38 (maybe) +Patch12: binutils-gold-mismatched-section-flags.patch + +# Purpose: Add a check to the GOLD linker for a corrupt input file +# with a fuzzed section offset. +# Lifetime: Fixed in 2.38 (maybe) +Patch13: binutils-CVE-2019-1010204.patch + +# Purpose: Change the gold configuration script to only warn about +# unsupported targets. This allows the binutils to be built with +# BPF support enabled. +# Lifetime: Permanent. +Patch14: binutils-gold-warn-unsupported.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 users expect to be able to install both the i686- and +# x86_64 versions of binutils-devel on the same machine, so they +# need to identical versions of the bfd.h header file. +# Lifetime: Permanent. +Patch15: binutils-use-long-long.patch + + +# Purpose: Fix testsuite failures due to the patches applied here. +# Lifetime: Permanent, but varying with each new rebase. +Patch16: binutils-testsuite-fixes.patch + +# Purpose: Enable the creation of .note.gnu.property sections by the GOLD +# linker for x86 binaries. +# Lifetime: Fixed in 2.38 maybe +Patch17: binutils-gold-i386-gnu-property-notes.patch + + +BuildRequires: make +BuildRequires: gcc +BuildRequires: flex +BuildRequires: bison +BuildRequires: texinfo +BuildRequires: zlib-devel +BuildRequires: mingw32-filesystem >= 102 +BuildRequires: mingw64-filesystem >= 102 +%if %{run_testsuite} +BuildRequires: dejagnu +BuildRequires: sharutils +%endif +Provides: bundled(libiberty) + + +%description +Cross compiled binutils (utilities like 'strip', 'as', 'ld') which +understand Windows executables and DLLs. + +%package -n mingw-binutils-generic +Summary: Utilities which are needed for both the Win32 and Win64 toolchains + +%description -n mingw-binutils-generic +Utilities (like strip and objdump) which are needed for +both the Win32 and Win64 toolchains + +%package -n mingw32-binutils +Summary: Cross-compiled version of binutils for the Win32 environment +Requires: mingw-binutils-generic = %{version}-%{release} + +# NB: This must be left in. +Requires: mingw32-filesystem >= 95 + +%description -n mingw32-binutils +Cross compiled binutils (utilities like 'strip', 'as', 'ld') which +understand Windows executables and DLLs. + +%package -n mingw64-binutils +Summary: Cross-compiled version of binutils for the Win64 environment +Requires: mingw-binutils-generic = %{version}-%{release} + +# NB: This must be left in. +Requires: mingw64-filesystem >= 95 + +%description -n mingw64-binutils +Cross compiled binutils (utilities like 'strip', 'as', 'ld') which +understand Windows executables and DLLs. + + +%prep +%autosetup -p1 -n binutils-%{version} + +# See Patch02 +sed -i -e 's/%''{release}/%{release}/g' bfd/Makefile{.am,.in} + + +%build +# We call configure directly rather than via macros, thus if +# we are using LTO, we have to manually fix the broken configure +# scripts +[ %{_lto_cflags}x != x ] && %{_fix_broken_configure_for_lto} + + +mkdir build_win32 +pushd build_win32 +CFLAGS="%{optflags}" \ +../configure \ + --build=%_build --host=%_host \ + --target=%{mingw32_target} \ + --disable-nls \ + --with-sysroot=%{mingw32_sysroot} \ + --prefix=%{_prefix} \ + --bindir=%{_bindir} \ + --includedir=%{_includedir} \ + --libdir=%{_libdir} \ + --mandir=%{_mandir} \ + --infodir=%{_infodir} + +%make_build +popd + +mkdir build_win64 +pushd build_win64 +CFLAGS="%{optflags}" \ +../configure \ + --build=%_build --host=%_host \ + --target=%{mingw64_target} \ + --disable-nls \ + --with-sysroot=%{mingw64_sysroot} \ + --prefix=%{_prefix} \ + --bindir=%{_bindir} \ + --includedir=%{_includedir} \ + --libdir=%{_libdir} \ + --mandir=%{_mandir} \ + --infodir=%{_infodir} + +%make_build +popd + +# Create multilib versions for the tools strip, objdump nm, and objcopy +mkdir build_multilib +pushd build_multilib +CFLAGS="%{optflags}" \ +../configure \ + --build=%_build --host=%_host \ + --target=%{mingw64_target} \ + --enable-targets=%{mingw64_target},%{mingw32_target} \ + --disable-nls \ + --with-sysroot=%{mingw64_sysroot} \ + --prefix=%{_prefix} \ + --bindir=%{_bindir} \ + --includedir=%{_includedir} \ + --libdir=%{_libdir} \ + --mandir=%{_mandir} \ + --infodir=%{_infodir} + +%make_build +popd + + +%check +%if !%{run_testsuite} +echo ====================TESTSUITE DISABLED========================= +%else +pushd build_win32 + make -k check < /dev/null || : + echo ====================TESTING WIN32 ========================= + cat {gas/testsuite/gas,ld/ld,binutils/binutils}.sum + echo ====================TESTING WIN32 END===================== + for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log} + do + ln $file binutils-%{mingw32_target}-$(basename $file) || : + done + tar cjf binutils-%{mingw32_target}.tar.bz2 binutils-%{mingw32_target}-*.{sum,log} + uuencode binutils-%{mingw32_target}.tar.bz2 binutils-%{mingw32_target}.tar.bz2 + rm -f binutils-%{mingw32_target}.tar.bz2 binutils-%{mingw32_target}-*.{sum,log} +popd + +pushd build_win64 + make -k check < /dev/null || : + echo ====================TESTING WIN64 ========================= + cat {gas/testsuite/gas,ld/ld,binutils/binutils}.sum + echo ====================TESTING WIN64 END===================== + for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log} + do + ln $file binutils-%{mingw64_target}-$(basename $file) || : + done + tar cjf binutils-%{mingw64_target}.tar.bz2 binutils-%{mingw64_target}-*.{sum,log} + uuencode binutils-%{mingw64_target}.tar.bz2 binutils-%{mingw64_target}.tar.bz2 + rm -f binutils-%{mingw64_target}.tar.bz2 binutils-%{mingw64_target}-*.{sum,log} +popd +%endif + + +%install +%mingw_make_install +make -C build_multilib DESTDIR=%{buildroot}/multilib install + +# These files conflict with ordinary binutils. +rm -rf %{buildroot}%{_infodir} +rm -f %{buildroot}%{_libdir}/libiberty* +rm -f %{buildroot}%{_libdir}/bfd-plugins/libdep.so + +# Keep the multilib versions of the strip, objdump and objcopy commands +# We need these for the RPM integration as these tools must be able to +# both process win32 and win64 binaries +mv %{buildroot}/multilib%{_bindir}/%{mingw64_strip} %{buildroot}%{_bindir}/%{mingw_strip} +mv %{buildroot}/multilib%{_bindir}/%{mingw64_objdump} %{buildroot}%{_bindir}/%{mingw_objdump} +mv %{buildroot}/multilib%{_bindir}/%{mingw64_objcopy} %{buildroot}%{_bindir}/%{mingw_objcopy} +mv %{buildroot}/multilib%{_bindir}/%{mingw64_nm} %{buildroot}%{_bindir}/%{mingw_nm} +rm -rf %{buildroot}/multilib + + +%files -n mingw-binutils-generic +%license COPYING +%{_mandir}/man1/* +%{_bindir}/%{mingw_strip} +%{_bindir}/%{mingw_objdump} +%{_bindir}/%{mingw_objcopy} +%{_bindir}/%{mingw_nm} + +%files -n mingw32-binutils +%{_bindir}/%{mingw32_target}-addr2line +%{_bindir}/%{mingw32_target}-ar +%{_bindir}/%{mingw32_target}-as +%{_bindir}/%{mingw32_target}-c++filt +%{_bindir}/%{mingw32_target}-dlltool +%{_bindir}/%{mingw32_target}-dllwrap +%{_bindir}/%{mingw32_target}-elfedit +%{_bindir}/%{mingw32_target}-gprof +%{_bindir}/%{mingw32_target}-ld +%{_bindir}/%{mingw32_target}-ld.bfd +%{_bindir}/%{mingw32_target}-nm +%{_bindir}/%{mingw32_target}-objcopy +%{_bindir}/%{mingw32_target}-objdump +%{_bindir}/%{mingw32_target}-ranlib +%{_bindir}/%{mingw32_target}-readelf +%{_bindir}/%{mingw32_target}-size +%{_bindir}/%{mingw32_target}-strings +%{_bindir}/%{mingw32_target}-strip +%{_bindir}/%{mingw32_target}-windmc +%{_bindir}/%{mingw32_target}-windres +%{_prefix}/%{mingw32_target}/bin/ar +%{_prefix}/%{mingw32_target}/bin/as +%{_prefix}/%{mingw32_target}/bin/dlltool +%{_prefix}/%{mingw32_target}/bin/ld +%{_prefix}/%{mingw32_target}/bin/ld.bfd +%{_prefix}/%{mingw32_target}/bin/nm +%{_prefix}/%{mingw32_target}/bin/objcopy +%{_prefix}/%{mingw32_target}/bin/objdump +%{_prefix}/%{mingw32_target}/bin/ranlib +%{_prefix}/%{mingw32_target}/bin/readelf +%{_prefix}/%{mingw32_target}/bin/strip +%{_prefix}/%{mingw32_target}/lib/ldscripts + +%files -n mingw64-binutils +%{_bindir}/%{mingw64_target}-addr2line +%{_bindir}/%{mingw64_target}-ar +%{_bindir}/%{mingw64_target}-as +%{_bindir}/%{mingw64_target}-c++filt +%{_bindir}/%{mingw64_target}-dlltool +%{_bindir}/%{mingw64_target}-dllwrap +%{_bindir}/%{mingw64_target}-elfedit +%{_bindir}/%{mingw64_target}-gprof +%{_bindir}/%{mingw64_target}-ld +%{_bindir}/%{mingw64_target}-ld.bfd +%{_bindir}/%{mingw64_target}-nm +%{_bindir}/%{mingw64_target}-objcopy +%{_bindir}/%{mingw64_target}-objdump +%{_bindir}/%{mingw64_target}-ranlib +%{_bindir}/%{mingw64_target}-readelf +%{_bindir}/%{mingw64_target}-size +%{_bindir}/%{mingw64_target}-strings +%{_bindir}/%{mingw64_target}-strip +%{_bindir}/%{mingw64_target}-windmc +%{_bindir}/%{mingw64_target}-windres +%{_prefix}/%{mingw64_target}/bin/ar +%{_prefix}/%{mingw64_target}/bin/as +%{_prefix}/%{mingw64_target}/bin/dlltool +%{_prefix}/%{mingw64_target}/bin/ld +%{_prefix}/%{mingw64_target}/bin/ld.bfd +%{_prefix}/%{mingw64_target}/bin/nm +%{_prefix}/%{mingw64_target}/bin/objcopy +%{_prefix}/%{mingw64_target}/bin/objdump +%{_prefix}/%{mingw64_target}/bin/ranlib +%{_prefix}/%{mingw64_target}/bin/readelf +%{_prefix}/%{mingw64_target}/bin/strip +%{_prefix}/%{mingw64_target}/lib/ldscripts + + +%changelog +* Thu Aug 12 2021 Richard W.M. Jones - 2.37-1 +- Rebase to binutils 2.37 + resolves: rhbz#1953913 + +* Mon Aug 09 2021 Mohan Boddu - 2.34-10 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Mon Apr 26 2021 Richard W.M. Jones - 2.34-9 +- Add fix for broken CVE-2021-20197 fix + related: rhbz#1951278 + +* Fri Apr 16 2021 Mohan Boddu - 2.34-8 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Thu Jan 28 2021 Richard W.M. Jones - 2.34-7 +- Backport fixes for CVE-2021-20197. +- Bump and rebuild for s390. + +* Tue Jan 26 2021 Fedora Release Engineering - 2.34-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Fri Dec 18 2020 Sandro Mani - 2.34-4 +- Backport patches for CVE-2020-16592, CVE-2020-16598 + +* Wed Jul 29 2020 Sandro Mani - 2.34-3 +- Fix ld --version output + +* Tue Jul 28 2020 Fedora Release Engineering - 2.34-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jul 20 2020 Jeff Law - 2.34.0-2 +- Fix configure tests compromised by LTO + +* Fri Jun 19 2020 Sandro Mani - 2.34.0-1 +- Update to 2.34.0 +- Modernize spec + +* Wed Jan 29 2020 Fedora Release Engineering - 2.32-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Tue Nov 19 2019 Sandro Mani - 2.32-6 +- Add binutils_24267.patch +- Drop non-relevant patches from native binutils package + +* Tue Aug 13 2019 Fabiano FidĂȘncio - 3.32-5 +- Backport all patches from native binutils package, rhbz#1740709 + +* Wed Aug 07 2019 Sandro Mani - 2.32-4 +- Backport patch to fix "too many open files" when linking libLLVM.dll + +* Thu Jul 25 2019 Fedora Release Engineering - 2.32-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Tue May 07 2019 Sandro Mani - 2.32-1 +- Update to 2.32 + +* Fri Feb 01 2019 Fedora Release Engineering - 2.30-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Wed Aug 22 2018 Sandro Mani - 2.30-5 +- Refresh patch for binutils bug #23061 + +* Wed Aug 08 2018 Sandro Mani - 2.30-4 +- Backport patch for binutils bug #23061 + +* Fri Jul 13 2018 Fedora Release Engineering - 2.30-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Thu Jun 14 2018 Sandro Mani - 2.30-2 +- Backport patch for binutils bug #22762 + +* Thu Jun 14 2018 Sandro Mani - 2.30-1 +- Update to 2.30 + +* Thu Feb 08 2018 Fedora Release Engineering - 2.29.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sun Oct 08 2017 Kalev Lember - 2.29.1-1 +- Update to 2.29.1 + +* Tue Sep 19 2017 Sandro Mani - 2.29-4 +- Rebuild for mingw-filesystem (for %%mingw_nm macro) + +* Fri Aug 25 2017 Sandro Mani - 2.29-3 +- Also build multilib version of nm + +* Thu Aug 03 2017 Fedora Release Engineering - 2.29-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Kalev Lember - 2.29-1 +- Update to 2.29 + +* Mon Mar 06 2017 Kalev Lember - 2.28-1 +- Update to 2.28 + +* Fri Feb 10 2017 Fedora Release Engineering - 2.27-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Aug 10 2016 Kalev Lember - 2.27-1 +- Update to 2.27 + +* Tue May 10 2016 Kalev Lember - 2.26-1 +- Update to 2.26 + +* Thu Feb 04 2016 Fedora Release Engineering - 2.25-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering - 2.25-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Tue Dec 23 2014 Erik van Pienbroek - 2.25-1 +- Update to 2.25 + +* Tue Dec 23 2014 Erik van Pienbroek - 2.24-5 +- Fix CVE-2014-8501 (RHBZ #1162578 #1162583) +- Fix CVE-2014-8502 (RHBZ #1162602) +- Fix CVE-2014-8503 (RHBZ #1162612) +- Fix CVE-2014-8504 (RHBZ #1162626) +- Fix CVE-2014-8737 (RHBZ #1162660) +- Fix CVE-2014-8738 (RHBZ #1162673) + +* Sun Aug 17 2014 Fedora Release Engineering - 2.24-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 2.24-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Fri May 30 2014 Erik van Pienbroek - 2.24-2 +- Fix FTBFS against gcc 4.9 + +* Sat Jan 11 2014 Erik van Pienbroek - 2.24-1 +- Update to 2.24 + +* Sat Aug 03 2013 Fedora Release Engineering - 2.23.52.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Wed Apr 3 2013 Erik van Pienbroek - 2.23.52.0.1-1 +- Update to 2.23.52.0.1 +- Fixes FTBFS against latest texinfo +- Resolve build failure on PPC + +* Thu Feb 14 2013 Fedora Release Engineering - 2.23.51.0.5-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Tue Jan 22 2013 Erik van Pienbroek - 2.23.51.0.5-3 +- Backported patch to fix 'unexpected version string length' error in windres (RHBZ #902960) + +* Tue Nov 27 2012 Erik van Pienbroek - 2.23.51.0.5-2 +- Added BR: zlib-devel to enable support for compressed debug sections + +* Wed Nov 21 2012 Erik van Pienbroek - 2.23.51.0.5-1 +- Update to 2.23.51.0.5 release + +* Mon Oct 15 2012 Jon Ciesla - 2.22.52.0.4-2 +- Provides: bundled(libiberty) + +* Wed Jul 18 2012 Erik van Pienbroek - 2.22.52.0.4-1 +- Update to 2.22.52.0.4 release + +* Sat Jun 2 2012 Erik van Pienbroek - 2.22.52.0.3-1 +- Update to 2.22.52.0.3 release + +* Sun Apr 8 2012 Erik van Pienbroek - 2.22.52-4 +- Cleaned up unneeded %%global tags + +* Tue Mar 6 2012 Erik van Pienbroek - 2.22.52-3 +- Made the package compliant with the new MinGW packaging guidelines +- Added win64 support +- Added a mingw-binutils-generic package containing toolchain + utilities which can be used by both the win32 and win64 toolchains +- Enable the testsuite +- Package the license +- Fix source URL + +* Tue Mar 6 2012 Erik van Pienbroek - 2.22.52-2 +- Renamed the source package to mingw-binutils (RHBZ #673786) +- Use mingw macros without leading underscore + +* Sat Feb 25 2012 Erik van Pienbroek - 2.22.52-1 +- Update to 2.22.52 20120225 snapshot +- Bump the BR/R: mingw32-filesystem to >= 95 +- Rebuild using the i686-w64-mingw32 triplet +- Dropped some obsolete configure arguments +- Temporary provide mingw-strip, mingw-objdump and mingw-objcopy + in preparation for win32+win64 support + +* Tue Jan 10 2012 Erik van Pienbroek - 2.22-1 +- Update to 2.22 +- Dropped unneeded RPM tags +- Use parallel make + +* Tue May 10 2011 Kalev Lember - 2.21-2 +- Default to runtime pseudo reloc v2 now that mingw32-runtime 3.18 is in + +* Thu Mar 17 2011 Kalev Lember - 2.21-1 +- Update to 2.21 +- Added a patch to use runtime pseudo reloc v1 by default as the version of + mingw32-runtime we have does not support v2. +- Don't own the /usr/i686-pc-mingw32/bin/ directory + +* Tue Feb 08 2011 Fedora Release Engineering - 2.20.51.0.10-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Tue Sep 7 2010 Richard W.M. Jones - 2.20.51.0.10-1 +- Synchronize with Fedora native version (2.20.51.0.10). +- Note however that we are not using any Fedora patches. + +* Thu May 13 2010 Kalev Lember - 2.20.1-1 +- Update to 2.20.1 + +* Wed Sep 16 2009 Kalev Lember - 2.19.51.0.14-1 +- Update to 2.19.51.0.14 + +* Sat Jul 25 2009 Fedora Release Engineering - 2.19.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Tue Mar 10 2009 Richard W.M. Jones - 2.19.1-4 +- Switch to using upstream (GNU) binutils 2.19.1. It's exactly the + same as the MinGW version now. + +* Wed Feb 25 2009 Fedora Release Engineering - 2.19.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Fri Feb 20 2009 Richard W.M. Jones - 2.19.1-2 +- Rebuild for mingw32-gcc 4.4 + +* Tue Feb 10 2009 Richard W.M. Jones - 2.19.1-1 +- New upstream version 2.19.1. + +* Mon Dec 15 2008 Richard W.M. Jones - 2.19-1 +- New upstream version 2.19. + +* Sat Nov 29 2008 Richard W.M. Jones - 2.18.50_20080109_2-10 +- Must runtime-require mingw32-filesystem. + +* Fri Nov 21 2008 Levente Farkas - 2.18.50_20080109_2-9 +- BR mingw32-filesystem >= 38 + +* Wed Sep 24 2008 Richard W.M. Jones - 2.18.50_20080109_2-8 +- Rename mingw -> mingw32. +- BR mingw32-filesystem >= 26. + +* Thu Sep 4 2008 Richard W.M. Jones - 2.18.50_20080109_2-7 +- Use mingw-filesystem. + +* Mon Jul 7 2008 Richard W.M. Jones - 2.18.50_20080109_2-5 +- Initial RPM release, largely based on earlier work from several sources.