#1 Backport all patches from native binutils package
Merged 2 years ago by rjones. Opened 2 years ago by fidencio.
rpms/ fidencio/mingw-binutils wip/rhbz1740755  into  master

@@ -0,0 +1,236 @@ 

+ diff -rcp ../binutils-2.20.51.0.7.original/bfd/configure ./bfd/configure

+ --- a/bfd/configure	2010-04-08 14:53:48.000000000 +0100

+ +++ b/bfd/configure	2010-04-08 14:56:50.000000000 +0100

+ @@ -10762,10 +10762,34 @@

+    # before this can be enabled.

+    hardcode_into_libs=yes

+  

+ +  # find out which ABI we are using

+ +  libsuff=

+ +  case "$host_cpu" in

+ +  x86_64*|s390*|powerpc*|ppc*|sparc*)

+ +    echo 'int i;' > conftest.$ac_ext

+ +    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5

+ +  (eval $ac_compile) 2>&5

+ +  ac_status=$?

+ +  echo "$as_me:$LINENO: \$? = $ac_status" >&5

+ +  (exit $ac_status); }; then

+ +      case `/usr/bin/file conftest.$ac_objext` in

+ +      *64-bit*)

+ +        libsuff=64

+ +        if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then

+ +          sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"

+ +        fi

+ +        sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"

+ +        ;;

+ +      esac

+ +    fi

+ +    rm -rf conftest*

+ +    ;;

+ +  esac

+ +

+    # Append ld.so.conf contents to the search path

+    if test -f /etc/ld.so.conf; then

+      lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`

+ -    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"

+ +    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"

+    fi

+  

+    # We used to test for /lib/ld.so.1 and disable shared libraries on

+ diff -rcp ../binutils-2.20.51.0.7.original/binutils/configure ./binutils/configure

+ --- a/binutils/configure	2010-04-08 14:53:45.000000000 +0100

+ +++ b/binutils/configure	2010-04-08 14:56:21.000000000 +0100

+ @@ -10560,10 +10560,34 @@

+    # before this can be enabled.

+    hardcode_into_libs=yes

+  

+ +  # find out which ABI we are using

+ +  libsuff=

+ +  case "$host_cpu" in

+ +  x86_64*|s390*|powerpc*|ppc*|sparc*)

+ +    echo 'int i;' > conftest.$ac_ext

+ +    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5

+ +  (eval $ac_compile) 2>&5

+ +  ac_status=$?

+ +  echo "$as_me:$LINENO: \$? = $ac_status" >&5

+ +  (exit $ac_status); }; then

+ +      case `/usr/bin/file conftest.$ac_objext` in

+ +      *64-bit*)

+ +        libsuff=64

+ +        if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then

+ +          sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"

+ +        fi

+ +        sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"

+ +        ;;

+ +      esac

+ +    fi

+ +    rm -rf conftest*

+ +    ;;

+ +  esac

+ +

+    # Append ld.so.conf contents to the search path

+    if test -f /etc/ld.so.conf; then

+      lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`

+ -    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"

+ +    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"

+    fi

+  

+    # We used to test for /lib/ld.so.1 and disable shared libraries on

+ diff -rcp ../binutils-2.20.51.0.7.original/gas/configure ./gas/configure

+ --- a/gas/configure	2010-04-08 14:53:47.000000000 +0100

+ +++ b/gas/configure	2010-04-08 14:57:24.000000000 +0100

+ @@ -10547,10 +10547,34 @@

+    # before this can be enabled.

+    hardcode_into_libs=yes

+  

+ +  # find out which ABI we are using

+ +  libsuff=

+ +  case "$host_cpu" in

+ +  x86_64*|s390*|powerpc*|ppc*|sparc*)

+ +    echo 'int i;' > conftest.$ac_ext

+ +    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5

+ +  (eval $ac_compile) 2>&5

+ +  ac_status=$?

+ +  echo "$as_me:$LINENO: \$? = $ac_status" >&5

+ +  (exit $ac_status); }; then

+ +      case `/usr/bin/file conftest.$ac_objext` in

+ +      *64-bit*)

+ +        libsuff=64

+ +        if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then

+ +          sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"

+ +        fi

+ +        sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"

+ +        ;;

+ +      esac

+ +    fi

+ +    rm -rf conftest*

+ +    ;;

+ +  esac

+ +

+    # Append ld.so.conf contents to the search path

+    if test -f /etc/ld.so.conf; then

+      lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`

+ -    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"

+ +    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"

+    fi

+  

+    # We used to test for /lib/ld.so.1 and disable shared libraries on

+ diff -rcp ../binutils-2.20.51.0.7.original/gprof/configure ./gprof/configure

+ --- a/gprof/configure	2010-04-08 14:53:45.000000000 +0100

+ +++ b/gprof/configure	2010-04-08 14:57:50.000000000 +0100

+ @@ -10485,10 +10485,34 @@

+    # before this can be enabled.

+    hardcode_into_libs=yes

+  

+ +  # find out which ABI we are using

+ +  libsuff=

+ +  case "$host_cpu" in

+ +  x86_64*|s390*|powerpc*|ppc*|sparc*)

+ +    echo 'int i;' > conftest.$ac_ext

+ +    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5

+ +  (eval $ac_compile) 2>&5

+ +  ac_status=$?

+ +  echo "$as_me:$LINENO: \$? = $ac_status" >&5

+ +  (exit $ac_status); }; then

+ +      case `/usr/bin/file conftest.$ac_objext` in

+ +      *64-bit*)

+ +        libsuff=64

+ +        if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then

+ +          sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"

+ +        fi

+ +        sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"

+ +        ;;

+ +      esac

+ +    fi

+ +    rm -rf conftest*

+ +    ;;

+ +  esac

+ +

+    # Append ld.so.conf contents to the search path

+    if test -f /etc/ld.so.conf; then

+      lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`

+ -    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"

+ +    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"

+    fi

+  

+    # We used to test for /lib/ld.so.1 and disable shared libraries on

+ diff -rcp ../binutils-2.20.51.0.7.original/ld/configure ./ld/configure

+ --- a/ld/configure	2010-04-08 14:53:44.000000000 +0100

+ +++ b/ld/configure	2010-04-08 14:58:21.000000000 +0100

+ @@ -10966,10 +10966,34 @@

+    # before this can be enabled.

+    hardcode_into_libs=yes

+  

+ +  # find out which ABI we are using

+ +  libsuff=

+ +  case "$host_cpu" in

+ +  x86_64*|s390*|powerpc*|ppc*|sparc*)

+ +    echo 'int i;' > conftest.$ac_ext

+ +    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5

+ +  (eval $ac_compile) 2>&5

+ +  ac_status=$?

+ +  echo "$as_me:$LINENO: \$? = $ac_status" >&5

+ +  (exit $ac_status); }; then

+ +      case `/usr/bin/file conftest.$ac_objext` in

+ +      *64-bit*)

+ +        libsuff=64

+ +        if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then

+ +          sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"

+ +        fi

+ +        sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"

+ +        ;;

+ +      esac

+ +    fi

+ +    rm -rf conftest*

+ +    ;;

+ +  esac

+ +

+    # Append ld.so.conf contents to the search path

+    if test -f /etc/ld.so.conf; then

+      lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`

+ -    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"

+ +    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"

+    fi

+  

+    # We used to test for /lib/ld.so.1 and disable shared libraries on

+ Only in .: .#libtool.m4

+ Only in .: #libtool.m4#

+ diff -rcp ../binutils-2.20.51.0.7.original/opcodes/configure ./opcodes/configure

+ --- a/opcodes/configure	2010-04-08 14:53:45.000000000 +0100

+ +++ b/opcodes/configure	2010-04-08 14:59:10.000000000 +0100

+ @@ -10496,10 +10496,34 @@

+    # before this can be enabled.

+    hardcode_into_libs=yes

+  

+ +  # find out which ABI we are using

+ +  libsuff=

+ +  case "$host_cpu" in

+ +  x86_64*|s390*|powerpc*|ppc*|sparc*)

+ +    echo 'int i;' > conftest.$ac_ext

+ +    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5

+ +  (eval $ac_compile) 2>&5

+ +  ac_status=$?

+ +  echo "$as_me:$LINENO: \$? = $ac_status" >&5

+ +  (exit $ac_status); }; then

+ +      case `/usr/bin/file conftest.$ac_objext` in

+ +      *64-bit*)

+ +        libsuff=64

+ +        if test x"$sys_lib_search_path_spec" = x"/lib /usr/lib /usr/local/lib"; then

+ +          sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"

+ +        fi

+ +        sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}"

+ +        ;;

+ +      esac

+ +    fi

+ +    rm -rf conftest*

+ +    ;;

+ +  esac

+ +

+    # Append ld.so.conf contents to the search path

+    if test -f /etc/ld.so.conf; then

+      lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`

+ -    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"

+ +    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"

+    fi

+  

+    # We used to test for /lib/ld.so.1 and disable shared libraries on

@@ -0,0 +1,28 @@ 

+ --- a/bfd/bfd-in.h	2012-08-02 10:56:34.561769686 +0100

+ +++ b/bfd/bfd-in.h	2012-08-02 11:13:27.134797755 +0100

+ @@ -25,11 +25,6 @@

+  #ifndef __BFD_H_SEEN__

+  #define __BFD_H_SEEN__

+  

+ -/* PR 14072: Ensure that config.h is included first.  */

+ -#if !defined PACKAGE && !defined PACKAGE_VERSION

+ -#error config.h must be included before this header

+ -#endif

+ -

+  #ifdef __cplusplus

+  extern "C" {

+  #endif

+ --- a/bfd/bfd-in2.h	2012-08-02 10:56:34.349769680 +0100

+ +++ b/bfd/bfd-in2.h	2012-08-02 11:13:40.015798113 +0100

+ @@ -32,11 +32,6 @@

+  #ifndef __BFD_H_SEEN__

+  #define __BFD_H_SEEN__

+  

+ -/* PR 14072: Ensure that config.h is included first.  */

+ -#if !defined PACKAGE && !defined PACKAGE_VERSION

+ -#error config.h must be included before this header

+ -#endif

+ -

+  #ifdef __cplusplus

+  extern "C" {

+  #endif

@@ -0,0 +1,44 @@ 

+ --- binutils-2.26.orig/bfd/Makefile.am	2016-01-25 10:11:33.505289018 +0000

+ +++ binutils-2.26/bfd/Makefile.am	2016-01-25 10:13:23.489964145 +0000

+ @@ -1043,8 +1043,8 @@ DISTCLEANFILES = $(BUILD_CFILES) $(BUILD

+  bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in

+  	@echo "creating $@"

+  	@bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\

+ -	bfd_version_string="\"$(VERSION)\"" ;\

+ -	bfd_soversion="$(VERSION)" ;\

+ +	bfd_version_string="\"$(VERSION)-%{release}\"" ;\

+ +	bfd_soversion="$(VERSION)-%{release}" ;\

+  	bfd_version_package="\"$(PKGVERSION)\"" ;\

+  	report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\

+  	. $(srcdir)/development.sh ;\

+ @@ -1055,7 +1055,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/

+  	fi ;\

+  	$(SED) -e "s,@bfd_version@,$$bfd_version," \

+  	    -e "s,@bfd_version_string@,$$bfd_version_string," \

+ -	    -e "s,@bfd_version_package@,$$bfd_version_package," \

+ +	    -e "s,@bfd_version_package@,\"version \"," \

+  	    -e "s,@report_bugs_to@,$$report_bugs_to," \

+  	    < $(srcdir)/version.h > $@; \

+  	echo "$${bfd_soversion}" > libtool-soversion

+ --- binutils-2.26.orig/bfd/Makefile.in	2016-01-25 10:11:33.505289018 +0000

+ +++ binutils-2.26/bfd/Makefile.in	2016-01-25 10:14:17.818297941 +0000

+ @@ -2111,8 +2111,8 @@ stmp-lcoff-h: $(LIBCOFF_H_FILES)

+  bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in

+  	@echo "creating $@"

+  	@bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\

+ -	bfd_version_string="\"$(VERSION)\"" ;\

+ -	bfd_soversion="$(VERSION)" ;\

+ +	bfd_version_string="\"$(VERSION)-%{release}\"" ;\

+ +	bfd_soversion="$(VERSION)-%{release}" ;\

+  	bfd_version_package="\"$(PKGVERSION)\"" ;\

+  	report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\

+  	. $(srcdir)/development.sh ;\

+ @@ -2123,7 +2123,7 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/

+  	fi ;\

+  	$(SED) -e "s,@bfd_version@,$$bfd_version," \

+  	    -e "s,@bfd_version_string@,$$bfd_version_string," \

+ -	    -e "s,@bfd_version_package@,$$bfd_version_package," \

+ +	    -e "s,@bfd_version_package@,\"version \"," \

+  	    -e "s,@report_bugs_to@,$$report_bugs_to," \

+  	    < $(srcdir)/version.h > $@; \

+  	echo "$${bfd_soversion}" > libtool-soversion

@@ -0,0 +1,11 @@ 

+ diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.27/bfd/elfnn-aarch64.c

+ --- binutils.orig/bfd/elfnn-aarch64.c	2017-02-21 10:45:19.311956006 +0000

+ +++ binutils-2.27/bfd/elfnn-aarch64.c	2017-02-21 11:55:07.517922655 +0000

+ @@ -4947,6 +4947,7 @@ elfNN_aarch64_final_link_relocate (reloc

+       it here if it is defined in a non-shared object.  */

+    if (h != NULL

+        && h->type == STT_GNU_IFUNC

+ +      && (input_section->flags & SEC_ALLOC)

+        && h->def_regular)

+      {

+        asection *plt;

@@ -0,0 +1,124 @@ 

+ --- binutils.orig/binutils/readelf.c	2018-01-22 15:48:10.450701702 +0000

+ +++ binutils-2.30.0/binutils/readelf.c	2018-01-22 15:55:26.739588657 +0000

+ @@ -19019,75 +19019,85 @@ process_file (char * file_name)

+    Filedata * filedata = NULL;

+    struct stat statbuf;

+    char armag[SARMAG];

+ -  bfd_boolean ret = TRUE;

+ +  bfd_boolean ret = FALSE;

+ +  char * name;

+ +  char * saved_program_name;

+ +

+ +  /* Overload program_name to include file_name.  Doing this means

+ +     that warning/error messages will positively identify the file

+ +     concerned even when multiple instances of readelf are running.  */

+ +  name = xmalloc (strlen (program_name) + strlen (file_name) + 3);

+ +  sprintf (name, "%s: %s", program_name, file_name);

+ +  saved_program_name = program_name;

+ +  program_name = name;

+  

+    if (stat (file_name, &statbuf) < 0)

+      {

+        if (errno == ENOENT)

+ -	error (_("'%s': No such file\n"), file_name);

+ +	error (_("No such file\n"));

+        else

+ -	error (_("Could not locate '%s'.  System error message: %s\n"),

+ -	       file_name, strerror (errno));

+ -      return FALSE;

+ +	error (_("Could not locate file.  System error message: %s\n"),

+ +	       strerror (errno));

+ +      goto done;

+      }

+  

+    if (! S_ISREG (statbuf.st_mode))

+      {

+ -      error (_("'%s' is not an ordinary file\n"), file_name);

+ -      return FALSE;

+ +      error (_("Not an ordinary file\n"));

+ +      goto done;

+      }

+  

+    filedata = calloc (1, sizeof * filedata);

+    if (filedata == NULL)

+      {

+        error (_("Out of memory allocating file data structure\n"));

+ -      return FALSE;

+ +      goto done;

+      }

+  

+    filedata->file_name = file_name;

+    filedata->handle = fopen (file_name, "rb");

+    if (filedata->handle == NULL)

+      {

+ -      error (_("Input file '%s' is not readable.\n"), file_name);

+ -      free (filedata);

+ -      return FALSE;

+ +      error (_("Not readable\n"));

+ +      goto done;

+      }

+  

+    if (fread (armag, SARMAG, 1, filedata->handle) != 1)

+      {

+ -      error (_("%s: Failed to read file's magic number\n"), file_name);

+ -      fclose (filedata->handle);

+ -      free (filedata);

+ -      return FALSE;

+ -    }

+ -

+ -  filedata->file_size = (bfd_size_type) statbuf.st_size;

+ -

+ -  if (memcmp (armag, ARMAG, SARMAG) == 0)

+ -    {

+ -      if (! process_archive (filedata, FALSE))

+ -	ret = FALSE;

+ -    }

+ -  else if (memcmp (armag, ARMAGT, SARMAG) == 0)

+ -    {

+ -      if ( ! process_archive (filedata, TRUE))

+ -	ret = FALSE;

+ +      error (_("Failed to read file's magic number\n"));

+      }

+    else

+      {

+ -      if (do_archive_index)

+ -	error (_("File %s is not an archive so its index cannot be displayed.\n"),

+ -	       file_name);

+ +      filedata->file_size = (bfd_size_type) statbuf.st_size;

+  

+ -      rewind (filedata->handle);

+ -      archive_file_size = archive_file_offset = 0;

+ -

+ -      if (! process_object (filedata))

+ -	ret = FALSE;

+ +      if (memcmp (armag, ARMAG, SARMAG) == 0)

+ +	{

+ +	  if (process_archive (filedata, FALSE))

+ +	    ret = TRUE;

+ +	}

+ +      else if (memcmp (armag, ARMAGT, SARMAG) == 0)

+ +	{

+ +	  if (process_archive (filedata, TRUE))

+ +	    ret = TRUE;

+ +	}

+ +      else

+ +	{

+ +	  if (do_archive_index)

+ +	    error (_("Not an archive so its index cannot be displayed.\n"));

+ +

+ +	  rewind (filedata->handle);

+ +	  archive_file_size = archive_file_offset = 0;

+ +

+ +	  if (process_object (filedata))

+ +	    ret = TRUE;

+ +	}

+      }

+  

+    fclose (filedata->handle);

+ + done:

+    free (filedata);

+ +  free (program_name);

+ +  program_name = saved_program_name;

+  

+    return ret;

+  }

@@ -0,0 +1,266 @@ 

+ diff -rup binutils.orig/ld/testsuite/ld-i386/pltgot-1.d binutils-2.29.1/ld/testsuite/ld-i386/pltgot-1.d

+ --- binutils.orig/ld/testsuite/ld-i386/pltgot-1.d	2017-11-15 13:32:39.335065263 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-i386/pltgot-1.d	2017-11-15 15:03:55.649727195 +0000

+ @@ -2,6 +2,7 @@

+  #readelf: -S --wide

+  #as: --32

+  

+ +#pass

+  #...

+   +\[ *[0-9]+\] \.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+10 +.*

+  #...

+ diff -rup binutils.orig/ld/testsuite/ld-i386/pltgot-2.d binutils-2.29.1/ld/testsuite/ld-i386/pltgot-2.d

+ --- binutils.orig/ld/testsuite/ld-i386/pltgot-2.d	2017-11-15 13:32:39.329065335 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-i386/pltgot-2.d	2017-11-15 15:04:20.803430034 +0000

+ @@ -3,7 +3,6 @@

+  #readelf: -d --wide

+  #as: --32

+  

+ -#failif

+  #...

+   +0x[0-9a-f]+ +\(PLTREL.*

+  #...

+ diff -rup binutils.orig/ld/testsuite/ld-i386/pr19636-2d.d binutils-2.29.1/ld/testsuite/ld-i386/pr19636-2d.d

+ --- binutils.orig/ld/testsuite/ld-i386/pr19636-2d.d	2017-11-15 13:32:39.336065251 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-i386/pr19636-2d.d	2017-11-15 15:03:00.413379749 +0000

+ @@ -9,7 +9,7 @@ Relocation section '\.rel\.dyn' at offse

+  [0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +func

+  [0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func

+  [0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func

+ -

+ +#...

+  Symbol table '\.dynsym' contains [0-9]+ entries:

+   +Num: +Value +Size Type +Bind +Vis +Ndx Name

+  #...

+ diff -rup binutils.orig/ld/testsuite/ld-i386/pr19636-2e.d binutils-2.29.1/ld/testsuite/ld-i386/pr19636-2e.d

+ --- binutils.orig/ld/testsuite/ld-i386/pr19636-2e.d	2017-11-15 13:32:39.330065323 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-i386/pr19636-2e.d	2017-11-15 15:03:28.928042882 +0000

+ @@ -9,7 +9,7 @@ Relocation section '\.rel\.dyn' at offse

+  [0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +func

+  [0-9a-f]+ +[0-9a-f]+ +R_386_PC32 +0+ +func

+  [0-9a-f]+ +[0-9a-f]+ +R_386_GLOB_DAT +0+ +func

+ -

+ +#...

+  Symbol table '\.dynsym' contains [0-9]+ entries:

+   +Num: +Value +Size Type +Bind +Vis +Ndx Name

+  #...

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pltgot-1.d binutils-2.29.1/ld/testsuite/ld-x86-64/pltgot-1.d

+ --- binutils.orig/ld/testsuite/ld-x86-64/pltgot-1.d	2017-11-15 13:32:39.415064300 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/pltgot-1.d	2017-11-15 15:08:39.333375801 +0000

+ @@ -2,8 +2,4 @@

+  #readelf: -S --wide

+  #as: --64

+  

+ -#...

+ - +\[ *[0-9]+\] \.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+10 +.*

+ -#...

+ - +\[ *[0-9]+\] \.got\.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+18 +.*

+  #pass

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pltgot-2.d binutils-2.29.1/ld/testsuite/ld-x86-64/pltgot-2.d

+ --- binutils.orig/ld/testsuite/ld-x86-64/pltgot-2.d	2017-11-15 13:32:39.404064432 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/pltgot-2.d	2017-11-15 15:08:59.031143095 +0000

+ @@ -3,7 +3,6 @@

+  #readelf: -d --wide

+  #as: --64

+  

+ -#failif

+  #...

+   +0x[0-9a-f]+ +\(PLTREL.*

+  #...

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-bnd.dd

+ --- binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd	2017-11-15 13:32:39.405064420 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-bnd.dd	2017-11-15 15:06:53.694623801 +0000

+ @@ -1,7 +1,4 @@

+ -#...

+ -Disassembly of section .plt.got:

+  

+ -[a-f0-9]+ <[a-z_]+@plt>:

+ -[ 	]*[a-f0-9]+:	f2 ff 25 .. .. 20 00 	bnd jmpq \*0x20....\(%rip\)        # ...... <.*>

+ +#...

+  [ 	]*[a-f0-9]+:	90                   	nop

+  #pass

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-ibt.dd

+ --- binutils.orig/ld/testsuite/ld-x86-64/plt-main-ibt.dd	2017-11-15 13:32:39.412064336 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main-ibt.dd	2017-11-15 15:06:35.148842897 +0000

+ @@ -1,7 +1,3 @@

+  #...

+ -Disassembly of section .plt.got:

+ -

+ -[a-f0-9]+ <[_a-z]+@plt>:

+  [ 	]*[a-f0-9]+:	f3 0f 1e fa          	endbr64 

+ -[ 	]*[a-f0-9]+:	f2 ff 25 .. .. 20 00 	bnd jmpq \*0x20....\(%rip\)        # ...... <[_a-z]+>

+  #pass

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main.rd

+ --- binutils.orig/ld/testsuite/ld-x86-64/plt-main.rd	2017-11-15 13:32:39.407064397 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/plt-main.rd	2017-11-15 15:06:17.244054423 +0000

+ @@ -1,4 +1,3 @@

+ -#failif

+  #...

+  [0-9a-f ]+R_X86_64_JUMP_SLOT +0+ +bar \+ 0

+  #...

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830a.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830a.d

+ --- binutils.orig/ld/testsuite/ld-x86-64/pr20830a.d	2017-11-15 13:32:39.412064336 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830a.d	2017-11-15 15:15:09.918750288 +0000

+ @@ -20,6 +20,7 @@ Contents of the .eh_frame section:

+    DW_CFA_offset: r16 \(rip\) at cfa-8

+    DW_CFA_nop

+    DW_CFA_nop

+ +#pass

+  

+  0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4

+    DW_CFA_nop

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830a-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830a-now.d

+ --- binutils.orig/ld/testsuite/ld-x86-64/pr20830a-now.d	2017-11-15 13:32:39.413064324 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830a-now.d	2017-11-15 15:16:08.227055104 +0000

+ @@ -20,6 +20,7 @@ Contents of the .eh_frame section:

+    DW_CFA_offset: r16 \(rip\) at cfa-8

+    DW_CFA_nop

+    DW_CFA_nop

+ +#pass

+  

+  0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4

+    DW_CFA_nop

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830b.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830b.d

+ --- binutils.orig/ld/testsuite/ld-x86-64/pr20830b.d	2017-11-15 13:32:39.413064324 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830b.d	2017-11-15 15:16:20.115913358 +0000

+ @@ -20,7 +20,8 @@ Contents of the .eh_frame section:

+    DW_CFA_offset: r16 \(rip\) at cfa-8

+    DW_CFA_nop

+    DW_CFA_nop

+ -

+ +#pass

+ + 

+  0+18 0000000000000010 0000001c FDE cie=00000000 pc=0000000000000138..0000000000000144

+    DW_CFA_nop

+    DW_CFA_nop

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830b-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830b-now.d

+ --- binutils.orig/ld/testsuite/ld-x86-64/pr20830b-now.d	2017-11-15 13:32:39.411064348 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830b-now.d	2017-11-15 15:16:29.012807282 +0000

+ @@ -20,7 +20,8 @@ Contents of the .eh_frame section:

+    DW_CFA_offset: r16 \(rip\) at cfa-8

+    DW_CFA_nop

+    DW_CFA_nop

+ -

+ +#pass

+ + 

+  0+18 0000000000000010 0000001c FDE cie=00000000 pc=0000000000000138..0000000000000144

+    DW_CFA_nop

+    DW_CFA_nop

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038a.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a.d

+ --- binutils.orig/ld/testsuite/ld-x86-64/pr21038a.d	2017-11-15 13:32:39.408064384 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a.d	2017-11-15 15:19:48.097433680 +0000

+ @@ -19,7 +19,8 @@ Contents of the .eh_frame section:

+    DW_CFA_offset: r16 \(rip\) at cfa-8

+    DW_CFA_nop

+    DW_CFA_nop

+ -

+ +#pass

+ +  

+  0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4

+    DW_CFA_nop

+    DW_CFA_nop

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038a-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a-now.d

+ --- binutils.orig/ld/testsuite/ld-x86-64/pr21038a-now.d	2017-11-15 13:32:39.401064469 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a-now.d	2017-11-15 15:10:56.077760324 +0000

+ @@ -20,7 +20,8 @@ Contents of the .eh_frame section:

+    DW_CFA_offset: r16 \(rip\) at cfa-8

+    DW_CFA_nop

+    DW_CFA_nop

+ -

+ +#pass

+ +  

+  0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4

+    DW_CFA_nop

+    DW_CFA_nop

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038b.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b.d

+ --- binutils.orig/ld/testsuite/ld-x86-64/pr21038b.d	2017-11-15 13:32:39.405064420 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b.d	2017-11-15 15:10:42.828916844 +0000

+ @@ -19,6 +19,7 @@ Contents of the .eh_frame section:

+    DW_CFA_offset: r16 \(rip\) at cfa-8

+    DW_CFA_nop

+    DW_CFA_nop

+ +#pass

+  

+  0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001d8..00000000000001dd

+    DW_CFA_nop

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038b-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b-now.d

+ --- binutils.orig/ld/testsuite/ld-x86-64/pr21038b-now.d	2017-11-15 13:32:39.416064288 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b-now.d	2017-11-15 15:11:11.550577531 +0000

+ @@ -20,7 +20,8 @@ Contents of the .eh_frame section:

+    DW_CFA_offset: r16 \(rip\) at cfa-8

+    DW_CFA_nop

+    DW_CFA_nop

+ -

+ +#pass

+ +  

+  0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001d8..00000000000001dd

+    DW_CFA_nop

+    DW_CFA_nop

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038c.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c.d

+ --- binutils.orig/ld/testsuite/ld-x86-64/pr21038c.d	2017-11-15 13:32:39.411064348 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c.d	2017-11-15 15:09:52.664509478 +0000

+ @@ -19,7 +19,8 @@ Contents of the .eh_frame section:

+    DW_CFA_offset: r16 \(rip\) at cfa-8

+    DW_CFA_nop

+    DW_CFA_nop

+ -

+ +#pass

+ +  

+  0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000220..0000000000000231

+    DW_CFA_nop

+    DW_CFA_nop

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038c-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c-now.d

+ --- binutils.orig/ld/testsuite/ld-x86-64/pr21038c-now.d	2017-11-15 13:32:39.413064324 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c-now.d	2017-11-15 15:11:22.975442559 +0000

+ @@ -20,7 +20,8 @@ Contents of the .eh_frame section:

+    DW_CFA_offset: r16 \(rip\) at cfa-8

+    DW_CFA_nop

+    DW_CFA_nop

+ -

+ +#pass

+ +  

+  0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000220..0000000000000231

+    DW_CFA_nop

+    DW_CFA_nop

+ diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd binutils-2.29.1/ld/testsuite/ld-x86-64/tlspic2.rd

+ --- binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd	2017-11-15 13:32:39.417064276 +0000

+ +++ binutils-2.29.1/ld/testsuite/ld-x86-64/tlspic2.rd	2017-11-15 15:05:02.950932110 +0000

+ @@ -14,6 +14,7 @@ Section Headers:

+   +\[[ 0-9]+\] .dynsym +.*

+   +\[[ 0-9]+\] .dynstr +.*

+   +\[[ 0-9]+\] .rela.dyn +.*

+ +#pass

+   +\[[ 0-9]+\] .plt +.*

+   +\[[ 0-9]+\] .plt.got +.*

+   +\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+31a 00 +AX +0 +0 4096

+ --- binutils.orig/bfd/elfxx-x86.c	2018-01-22 15:59:25.875788033 +0000

+ +++ binutils-2.30.0/bfd/elfxx-x86.c	2018-01-22 16:00:20.789146597 +0000

+ @@ -107,7 +107,7 @@ elf_x86_allocate_dynrelocs (struct elf_l

+    plt_entry_size = htab->plt.plt_entry_size;

+  

+    resolved_to_zero = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh);

+ -

+ +#if 0

+    /* We can't use the GOT PLT if pointer equality is needed since

+       finish_dynamic_symbol won't clear symbol value and the dynamic

+       linker won't update the GOT slot.  We will get into an infinite

+ @@ -125,7 +125,7 @@ elf_x86_allocate_dynrelocs (struct elf_l

+        /* Use the GOT PLT.  */

+        eh->plt_got.refcount = 1;

+      }

+ -

+ +#endif

+    /* Since STT_GNU_IFUNC symbol must go through PLT, we handle it

+       here if it is defined and referenced in a non-shared object.  */

+    if (h->type == STT_GNU_IFUNC

+ --- binutils.orig/ld/testsuite/ld-i386/pr20830.d	2018-07-09 09:49:51.277239857 +0100

+ +++ binutils-2.30.90/ld/testsuite/ld-i386/pr20830.d	2018-07-09 10:32:41.113356733 +0100

+ @@ -19,7 +19,7 @@ Contents of the .eh_frame section:

+    DW_CFA_offset: r8 \(eip\) at cfa-4

+    DW_CFA_nop

+    DW_CFA_nop

+ -

+ +#pass

+  0+18 00000010 0000001c FDE cie=00000000 pc=00000128..00000133

+    DW_CFA_nop

+    DW_CFA_nop

@@ -0,0 +1,15 @@ 

+ --- binutils.orig/gold/fileread.cc	2019-08-06 14:22:08.669313110 +0100

+ +++ binutils-2.32/gold/fileread.cc	2019-08-06 14:22:28.799177543 +0100

+ @@ -381,6 +381,12 @@ File_read::do_read(off_t start, section_

+    ssize_t bytes;

+    if (this->whole_file_view_ != NULL)

+      {

+ +      // See PR 23765 for an example of a testcase that triggers this error.

+ +      if (((ssize_t) start) < 0)

+ +	gold_fatal(_("%s: read failed, starting offset (%#llx) less than zero"),

+ +		   this->filename().c_str(),

+ +		   static_cast<long long>(start));

+ +	

+        bytes = this->size_ - start;

+        if (static_cast<section_size_type>(bytes) >= size)

+  	{

@@ -0,0 +1,17 @@ 

+ --- binutils.orig/libiberty/simple-object-elf.c	2019-08-09 14:13:51.677330065 +0100

+ +++ binutils-2.32/libiberty/simple-object-elf.c	2019-08-09 14:14:31.177076298 +0100

+ @@ -549,6 +549,14 @@ simple_object_elf_match (unsigned char h

+        return NULL;

+      }

+  

+ +  if (eor->shstrndx == 0)

+ +    {

+ +      *errmsg = "invalid ELF shstrndx == 0";

+ +      *err = 0;

+ +      XDELETE (eor);

+ +      return NULL;

+ +    }

+ +

+    return (void *) eor;

+  }

+  

@@ -0,0 +1,11 @@ 

+ --- binutils.orig/binutils/readelf.c	2019-08-13 10:03:33.518792590 +0100

+ +++ binutils-2.32/binutils/readelf.c	2019-08-13 10:04:22.885418269 +0100

+ @@ -13234,7 +13234,7 @@ apply_relocations (Filedata *

+  	    }

+  

+  	  rloc = start + rp->r_offset;

+ -	  if ((rloc + reloc_size) > end || (rloc < start))

+ +	  if (rloc >= end || (rloc + reloc_size) > end || (rloc < start))

+  	    {

+  	      warn (_("skipping invalid relocation offset 0x%lx in section %s\n"),

+  		    (unsigned long) rp->r_offset,

@@ -0,0 +1,110 @@ 

+ --- binutils.orig/libiberty/cp-demangle.c	2019-04-10 10:31:27.854997707 +0100

+ +++ binutils-2.31.1/libiberty/cp-demangle.c	2019-04-10 16:00:35.820350978 +0100

+ @@ -858,7 +858,7 @@ CP_STATIC_IF_GLIBCPP_V3

+  int

+  cplus_demangle_fill_name (struct demangle_component *p, const char *s, int len)

+  {

+ -  if (p == NULL || s == NULL || len == 0)

+ +  if (p == NULL || s == NULL || len <= 0)

+      return 0;

+    p->d_printing = 0;

+    p->type = DEMANGLE_COMPONENT_NAME;

+ @@ -4032,7 +4032,7 @@ d_growable_string_callback_adapter (cons

+     are larger than the actual numbers encountered.  */

+  

+  static void

+ -d_count_templates_scopes (int *num_templates, int *num_scopes,

+ +d_count_templates_scopes (struct d_print_info *dpi,

+  			  const struct demangle_component *dc)

+  {

+    if (dc == NULL)

+ @@ -4052,13 +4052,13 @@ d_count_templates_scopes (int *num_templ

+        break;

+  

+      case DEMANGLE_COMPONENT_TEMPLATE:

+ -      (*num_templates)++;

+ +      dpi->num_copy_templates++;

+        goto recurse_left_right;

+  

+      case DEMANGLE_COMPONENT_REFERENCE:

+      case DEMANGLE_COMPONENT_RVALUE_REFERENCE:

+        if (d_left (dc)->type == DEMANGLE_COMPONENT_TEMPLATE_PARAM)

+ -	(*num_scopes)++;

+ +	dpi->num_saved_scopes++;

+        goto recurse_left_right;

+  

+      case DEMANGLE_COMPONENT_QUAL_NAME:

+ @@ -4122,42 +4122,42 @@ d_count_templates_scopes (int *num_templ

+      case DEMANGLE_COMPONENT_TAGGED_NAME:

+      case DEMANGLE_COMPONENT_CLONE:

+      recurse_left_right:

+ -      d_count_templates_scopes (num_templates, num_scopes,

+ -				d_left (dc));

+ -      d_count_templates_scopes (num_templates, num_scopes,

+ -				d_right (dc));

+ +      /* PR 89394 - Check for too much recursion.  */

+ +      if (dpi->recursion > DEMANGLE_RECURSION_LIMIT)

+ +	/* FIXME: There ought to be a way to report to the

+ +	   user that the recursion limit has been reached.  */

+ +	return;

+ +

+ +      ++ dpi->recursion;

+ +      d_count_templates_scopes (dpi, d_left (dc));

+ +      d_count_templates_scopes (dpi, d_right (dc));

+ +      -- dpi->recursion;

+        break;

+  

+      case DEMANGLE_COMPONENT_CTOR:

+ -      d_count_templates_scopes (num_templates, num_scopes,

+ -				dc->u.s_ctor.name);

+ +      d_count_templates_scopes (dpi, dc->u.s_ctor.name);

+        break;

+  

+      case DEMANGLE_COMPONENT_DTOR:

+ -      d_count_templates_scopes (num_templates, num_scopes,

+ -				dc->u.s_dtor.name);

+ +      d_count_templates_scopes (dpi, dc->u.s_dtor.name);

+        break;

+  

+      case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:

+ -      d_count_templates_scopes (num_templates, num_scopes,

+ -				dc->u.s_extended_operator.name);

+ +      d_count_templates_scopes (dpi, dc->u.s_extended_operator.name);

+        break;

+  

+      case DEMANGLE_COMPONENT_FIXED_TYPE:

+ -      d_count_templates_scopes (num_templates, num_scopes,

+ -                                dc->u.s_fixed.length);

+ +      d_count_templates_scopes (dpi, dc->u.s_fixed.length);

+        break;

+  

+      case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS:

+      case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS:

+ -      d_count_templates_scopes (num_templates, num_scopes,

+ -				d_left (dc));

+ +      d_count_templates_scopes (dpi, d_left (dc));

+        break;

+  

+      case DEMANGLE_COMPONENT_LAMBDA:

+      case DEMANGLE_COMPONENT_DEFAULT_ARG:

+ -      d_count_templates_scopes (num_templates, num_scopes,

+ -				dc->u.s_unary_num.sub);

+ +      d_count_templates_scopes (dpi, dc->u.s_unary_num.sub);

+        break;

+      }

+  }

+ @@ -4192,8 +4192,12 @@ d_print_init (struct d_print_info *dpi,

+    dpi->next_copy_template = 0;

+    dpi->num_copy_templates = 0;

+  

+ -  d_count_templates_scopes (&dpi->num_copy_templates,

+ -			    &dpi->num_saved_scopes, dc);

+ +  d_count_templates_scopes (dpi, dc);

+ +  /* If we did not reach the recursion limit, then reset the

+ +     current recursion value back to 0, so that we can print

+ +     the templates.  */

+ +  if (dpi->recursion < DEMANGLE_RECURSION_LIMIT)

+ +    dpi->recursion = 0;

+    dpi->num_copy_templates *= dpi->num_saved_scopes;

+  

+    dpi->current_template = NULL;

@@ -0,0 +1,13 @@ 

+ --- binutils.orig/binutils/objdump.c	2019-02-25 16:12:30.394056901 +0000

+ +++ binutils-2.31.1/binutils/objdump.c	2019-02-25 16:13:07.224778005 +0000

+ @@ -2993,7 +2993,9 @@ dump_bfd_header (bfd *abfd)

+  static void

+  dump_bfd_private_header (bfd *abfd)

+  {

+ -  bfd_print_private_bfd_data (abfd, stdout);

+ +  if (!bfd_print_private_bfd_data (abfd, stdout))

+ +    non_fatal (_("warning: private headers incomplete: %s"),

+ +              bfd_errmsg (bfd_get_error ()));

+  }

+  

+  static void

@@ -0,0 +1,32 @@ 

+ --- binutils.orig/bfd/pei-x86_64.c	2019-02-25 16:12:29.798061414 +0000

+ +++ binutils-2.31.1/bfd/pei-x86_64.c	2019-02-25 17:09:02.783425236 +0000

+ @@ -541,7 +541,7 @@ pex64_bfd_print_pdata_section (bfd *abfd

+    /* virt_size might be zero for objects.  */

+    if (stop == 0 && strcmp (abfd->xvec->name, "pe-x86-64") == 0)

+      {

+ -      stop = (datasize / onaline) * onaline;

+ +      stop = datasize;

+        virt_size_is_zero = TRUE;

+      }

+    else if (datasize < stop)

+ @@ -551,8 +551,8 @@ pex64_bfd_print_pdata_section (bfd *abfd

+  		 _("Warning: %s section size (%ld) is smaller than virtual size (%ld)\n"),

+  		 pdata_section->name, (unsigned long) datasize,

+  		 (unsigned long) stop);

+ -	/* Be sure not to read passed datasize.  */

+ -	stop = datasize / onaline;

+ +	/* Be sure not to read past datasize.  */

+ +	stop = datasize;

+        }

+  

+    /* Display functions table.  */

+ @@ -724,8 +724,7 @@ pex64_bfd_print_pdata_section (bfd *abfd

+  	      altent += imagebase;

+  

+  	      if (altent >= pdata_vma

+ -		  && (altent + PDATA_ROW_SIZE <= pdata_vma

+ -		      + pei_section_data (abfd, pdata_section)->virt_size))

+ +		  && altent - pdata_vma + PDATA_ROW_SIZE <= stop)

+  		{

+  		  pex64_get_runtime_function

+  		    (abfd, &arf, &pdata[altent - pdata_vma]);

@@ -0,0 +1,73 @@ 

+ diff -rup binutils.orig/bfd/archive64.c binutils-2.31.1/bfd/archive64.c

+ --- binutils.orig/bfd/archive64.c	2019-02-26 11:17:11.882530151 +0000

+ +++ binutils-2.31.1/bfd/archive64.c	2019-02-26 11:19:18.422488805 +0000

+ @@ -100,8 +100,6 @@ _bfd_archive_64_bit_slurp_armap (bfd *ab

+      return FALSE;

+    carsyms = ardata->symdefs;

+    stringbase = ((char *) ardata->symdefs) + carsym_size;

+ -  stringbase[stringsize] = 0;

+ -  stringend = stringbase + stringsize;

+  

+    raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize);

+    if (raw_armap == NULL)

+ @@ -115,15 +113,17 @@ _bfd_archive_64_bit_slurp_armap (bfd *ab

+        goto release_raw_armap;

+      }

+  

+ +  stringend = stringbase + stringsize;

+ +  *stringend = 0;

+    for (i = 0; i < nsymz; i++)

+      {

+        carsyms->file_offset = bfd_getb64 (raw_armap + i * 8);

+        carsyms->name = stringbase;

+ -      if (stringbase < stringend)

+ -	stringbase += strlen (stringbase) + 1;

+ +      stringbase += strlen (stringbase);

+ +      if (stringbase != stringend)

+ +	++stringbase;

+        ++carsyms;

+      }

+ -  *stringbase = '\0';

+  

+    ardata->symdef_count = nsymz;

+    ardata->first_file_filepos = bfd_tell (abfd);

+ diff -rup binutils.orig/bfd/archive.c binutils-2.31.1/bfd/archive.c

+ --- binutils.orig/bfd/archive.c	2019-02-26 11:17:11.884530134 +0000

+ +++ binutils-2.31.1/bfd/archive.c	2019-02-26 11:18:33.354859687 +0000

+ @@ -1014,6 +1014,7 @@ do_slurp_coff_armap (bfd *abfd)

+    int *raw_armap, *rawptr;

+    struct artdata *ardata = bfd_ardata (abfd);

+    char *stringbase;

+ +  char *stringend;

+    bfd_size_type stringsize;

+    bfd_size_type parsed_size;

+    carsym *carsyms;

+ @@ -1073,22 +1074,20 @@ do_slurp_coff_armap (bfd *abfd)

+      }

+  

+    /* OK, build the carsyms.  */

+ -  for (i = 0; i < nsymz && stringsize > 0; i++)

+ +  stringend = stringbase + stringsize;

+ +  *stringend = 0;

+ +  for (i = 0; i < nsymz; i++)

+      {

+        bfd_size_type len;

+  

+        rawptr = raw_armap + i;

+        carsyms->file_offset = swap ((bfd_byte *) rawptr);

+        carsyms->name = stringbase;

+ -      /* PR 17512: file: 4a1d50c1.  */

+ -      len = strnlen (stringbase, stringsize);

+ -      if (len < stringsize)

+ -	len ++;

+ -      stringbase += len;

+ -      stringsize -= len;

+ +      stringbase += strlen (stringbase);

+ +      if (stringbase != stringend)

+ +	++stringbase;

+        carsyms++;

+      }

+ -  *stringbase = 0;

+  

+    ardata->symdef_count = nsymz;

+    ardata->first_file_filepos = bfd_tell (abfd);

@@ -0,0 +1,16 @@ 

+ --- binutils.orig/binutils/readelf.c	2019-02-26 11:17:12.414525772 +0000

+ +++ binutils-2.31.1/binutils/readelf.c	2019-02-26 12:11:40.642876742 +0000

+ @@ -16009,6 +16009,13 @@ process_mips_specific (Filedata * fileda

+  	  return FALSE;

+  	}

+  

+ +      /* PR 24243  */

+ +      if (sect->sh_size < sizeof (* eopt))

+ +	{

+ +	  error (_("The MIPS options section is too small.\n"));

+ +	  return FALSE;

+ +	}

+ +

+        eopt = (Elf_External_Options *) get_data (NULL, filedata, options_offset, 1,

+                                                  sect->sh_size, _("options"));

+        if (eopt)

@@ -0,0 +1,20 @@ 

+ --- binutils.orig/gold/aarch64.cc	2019-05-21 11:24:07.642560743 +0100

+ +++ binutils-2.32/gold/aarch64.cc	2019-05-21 11:25:02.425157682 +0100

+ @@ -6496,6 +6496,17 @@ Target_aarch64<size, big_endian>::Scan::

+  	  gold_error(_("%s: unsupported reloc %u in pos independent link."),

+  		     object->name().c_str(), r_type);

+  	}

+ +      // Make a PLT entry if necessary.

+ +      if (gsym->needs_plt_entry())

+ +	{

+ +	  target->make_plt_entry(symtab, layout, gsym);

+ +	  // Since this is not a PC-relative relocation, we may be

+ +	  // taking the address of a function. In that case we need to

+ +	  // set the entry in the dynamic symbol table to the address of

+ +	  // the PLT entry.

+ +	  if (gsym->is_from_dynobj() && !parameters->options().shared())

+ +	    gsym->set_needs_dynsym_value();

+ +	}

+        break;

+  

+      case elfcpp::R_AARCH64_LD_PREL_LO19:        // 273

@@ -0,0 +1,447 @@ 

+ diff -rup binutils.orig/bfd/bfd.c binutils-2.31.1/bfd/bfd.c

+ --- binutils.orig/bfd/bfd.c	2019-02-18 11:53:32.155652114 +0000

+ +++ binutils-2.31.1/bfd/bfd.c	2019-02-18 12:03:21.591459682 +0000

+ @@ -2332,6 +2332,8 @@ bfd_update_compression_header (bfd *abfd

+  		  bfd_put_32 (abfd, sec->size, &echdr->ch_size);

+  		  bfd_put_32 (abfd, 1 << sec->alignment_power,

+  			      &echdr->ch_addralign);

+ +		  /* bfd_log2 (alignof (Elf32_Chdr)).  */

+ +		  bfd_set_section_alignment (abfd, sec, 2);

+  		}

+  	      else

+  		{

+ @@ -2342,6 +2344,8 @@ bfd_update_compression_header (bfd *abfd

+  		  bfd_put_64 (abfd, sec->size, &echdr->ch_size);

+  		  bfd_put_64 (abfd, 1 << sec->alignment_power,

+  			      &echdr->ch_addralign);

+ +		  /* bfd_log2 (alignof (Elf64_Chdr)).  */

+ +		  bfd_set_section_alignment (abfd, sec, 3);

+  		}

+  	    }

+  	  else

+ @@ -2354,6 +2358,8 @@ bfd_update_compression_header (bfd *abfd

+  		 order.  */

+  	      memcpy (contents, "ZLIB", 4);

+  	      bfd_putb64 (sec->size, contents + 4);

+ +	      /* No way to keep the original alignment, just use 1 always.  */

+ +	      bfd_set_section_alignment (abfd, sec, 0);

+  	    }

+  	}

+      }

+ @@ -2368,12 +2374,15 @@ bfd_update_compression_header (bfd *abfd

+     SYNOPSIS

+  	bfd_boolean bfd_check_compression_header

+  	  (bfd *abfd, bfd_byte *contents, asection *sec,

+ -	  bfd_size_type *uncompressed_size);

+ +          bfd_size_type *uncompressed_size,

+ +          unsigned int *uncompressed_alignment_power);

+ +

+  

+  DESCRIPTION

+  	Check the compression header at CONTENTS of SEC in ABFD and

+ -	store the uncompressed size in UNCOMPRESSED_SIZE if the

+ -	compression header is valid.

+ +        store the uncompressed size in UNCOMPRESSED_SIZE and the

+ +        uncompressed data alignment in UNCOMPRESSED_ALIGNMENT_POWER

+ +        if the compression header is valid.

+  

+  RETURNS

+  	Return TRUE if the compression header is valid.

+ @@ -2382,7 +2391,8 @@ RETURNS

+  bfd_boolean

+  bfd_check_compression_header (bfd *abfd, bfd_byte *contents,

+  			      asection *sec,

+ -			      bfd_size_type *uncompressed_size)

+ +			      bfd_size_type *uncompressed_size,

+ +			      unsigned int *uncompressed_alignment_power)

+  {

+    if (bfd_get_flavour (abfd) == bfd_target_elf_flavour

+        && (elf_section_flags (sec) & SHF_COMPRESSED) != 0)

+ @@ -2404,9 +2414,10 @@ bfd_check_compression_header (bfd *abfd,

+  	  chdr.ch_addralign = bfd_get_64 (abfd, &echdr->ch_addralign);

+  	}

+        if (chdr.ch_type == ELFCOMPRESS_ZLIB

+ -	  && chdr.ch_addralign == 1U << sec->alignment_power)

+ +	  && chdr.ch_addralign == (1U << bfd_log2 (chdr.ch_addralign)))

+  	{

+  	  *uncompressed_size = chdr.ch_size;

+ +	  *uncompressed_alignment_power = bfd_log2 (chdr.ch_addralign);

+  	  return TRUE;

+  	}

+      }

+ diff -rup binutils.orig/bfd/bfd-in2.h binutils-2.31.1/bfd/bfd-in2.h

+ --- binutils.orig/bfd/bfd-in2.h	2019-02-18 11:53:32.156652107 +0000

+ +++ binutils-2.31.1/bfd/bfd-in2.h	2019-02-18 12:00:23.849723903 +0000

+ @@ -7274,7 +7274,8 @@ void bfd_update_compression_header

+  

+  bfd_boolean bfd_check_compression_header

+     (bfd *abfd, bfd_byte *contents, asection *sec,

+ -    bfd_size_type *uncompressed_size);

+ +    bfd_size_type *uncompressed_size,

+ +    unsigned int *uncompressed_alignment_power);

+  

+  int bfd_get_compression_header_size (bfd *abfd, asection *sec);

+  

+ @@ -7850,7 +7851,8 @@ void bfd_cache_section_contents

+  bfd_boolean bfd_is_section_compressed_with_header

+     (bfd *abfd, asection *section,

+      int *compression_header_size_p,

+ -    bfd_size_type *uncompressed_size_p);

+ +    bfd_size_type *uncompressed_size_p,

+ +    unsigned int *uncompressed_alignment_power_p);

+  

+  bfd_boolean bfd_is_section_compressed

+     (bfd *abfd, asection *section);

+ diff -rup binutils.orig/bfd/compress.c binutils-2.31.1/bfd/compress.c

+ --- binutils.orig/bfd/compress.c	2019-02-18 11:53:32.153652128 +0000

+ +++ binutils-2.31.1/bfd/compress.c	2019-02-18 12:11:44.899886376 +0000

+ @@ -84,11 +84,13 @@ bfd_compress_section_contents (bfd *abfd

+    int zlib_size = 0;

+    int orig_compression_header_size;

+    bfd_size_type orig_uncompressed_size;

+ +  unsigned int orig_uncompressed_alignment_pow;

+    int header_size = bfd_get_compression_header_size (abfd, NULL);

+    bfd_boolean compressed

+      = bfd_is_section_compressed_with_header (abfd, sec,

+  					     &orig_compression_header_size,

+ -					     &orig_uncompressed_size);

+ +					     &orig_uncompressed_size,

+ +					     &orig_uncompressed_alignment_pow);

+  

+    /* Either ELF compression header or the 12-byte, "ZLIB" + 8-byte size,

+       overhead in .zdebug* section.  */

+ @@ -153,6 +155,8 @@ bfd_compress_section_contents (bfd *abfd

+  	      return 0;

+  	    }

+  	  free (uncompressed_buffer);

+ +	  bfd_set_section_alignment (abfd, sec,

+ +				     orig_uncompressed_alignment_pow);

+  	  sec->contents = buffer;

+  	  sec->compress_status = COMPRESS_SECTION_DONE;

+  	  return orig_uncompressed_size;

+ @@ -364,20 +368,25 @@ SYNOPSIS

+  	bfd_boolean bfd_is_section_compressed_with_header

+  	  (bfd *abfd, asection *section,

+  	  int *compression_header_size_p,

+ -	  bfd_size_type *uncompressed_size_p);

+ +	  bfd_size_type *uncompressed_size_p,

+ +	  unsigned int *uncompressed_alignment_power_p);

+ +

+  

+  DESCRIPTION

+  	Return @code{TRUE} if @var{section} is compressed.  Compression

+ -	header size is returned in @var{compression_header_size_p} and

+ -	uncompressed size is returned in @var{uncompressed_size_p}.  If

+ -	compression is unsupported, compression header size is returned

+ -	with -1 and uncompressed size is returned with 0.

+ +	header size is returned in @var{compression_header_size_p},

+ +        uncompressed size is returned in @var{uncompressed_size_p}

+ +        and the uncompressed data alignement power is returned in

+ +        @var{uncompressed_align_pow_p}.  If compression is

+ +        unsupported, compression header size is returned with -1

+ +        and uncompressed size is returned with 0.

+  */

+  

+  bfd_boolean

+  bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec,

+  				       int *compression_header_size_p,

+ -				       bfd_size_type *uncompressed_size_p)

+ +				       bfd_size_type *uncompressed_size_p,

+ +				       unsigned int *uncompressed_align_pow_p)

+  {

+    bfd_byte header[MAX_COMPRESSION_HEADER_SIZE];

+    int compression_header_size;

+ @@ -385,6 +394,8 @@ bfd_is_section_compressed_with_header (b

+    unsigned int saved = sec->compress_status;

+    bfd_boolean compressed;

+  

+ +  *uncompressed_align_pow_p = 0;

+ +

+    compression_header_size = bfd_get_compression_header_size (abfd, sec);

+    if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE)

+      abort ();

+ @@ -412,7 +423,8 @@ bfd_is_section_compressed_with_header (b

+        if (compression_header_size != 0)

+  	{

+  	  if (!bfd_check_compression_header (abfd, header, sec,

+ -					     uncompressed_size_p))

+ +					     uncompressed_size_p,

+ +					     uncompressed_align_pow_p))

+  	    compression_header_size = -1;

+  	}

+        /* Check for the pathalogical case of a debug string section that

+ @@ -449,9 +461,11 @@ bfd_is_section_compressed (bfd *abfd, se

+  {

+    int compression_header_size;

+    bfd_size_type uncompressed_size;

+ +  unsigned int uncompressed_align_power;

+    return (bfd_is_section_compressed_with_header (abfd, sec,

+  						 &compression_header_size,

+ -						 &uncompressed_size)

+ +						 &uncompressed_size,

+ +						 &uncompressed_align_power)

+  	  && compression_header_size >= 0

+  	  && uncompressed_size > 0);

+  }

+ @@ -480,6 +494,7 @@ bfd_init_section_decompress_status (bfd

+    int compression_header_size;

+    int header_size;

+    bfd_size_type uncompressed_size;

+ +  unsigned int uncompressed_alignment_power = 0;

+  

+    compression_header_size = bfd_get_compression_header_size (abfd, sec);

+    if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE)

+ @@ -508,7 +523,8 @@ bfd_init_section_decompress_status (bfd

+        uncompressed_size = bfd_getb64 (header + 4);

+      }

+    else if (!bfd_check_compression_header (abfd, header, sec,

+ -					 &uncompressed_size))

+ +					  &uncompressed_size,

+ +					  &uncompressed_alignment_power))

+      {

+        bfd_set_error (bfd_error_wrong_format);

+        return FALSE;

+ @@ -516,6 +532,7 @@ bfd_init_section_decompress_status (bfd

+  

+    sec->compressed_size = sec->size;

+    sec->size = uncompressed_size;

+ +  bfd_set_section_alignment (abfd, sec, uncompressed_alignment_power);

+    sec->compress_status = DECOMPRESS_SECTION_SIZED;

+  

+    return TRUE;

+ diff -rup binutils.orig/bfd/elf.c binutils-2.31.1/bfd/elf.c

+ --- binutils.orig/bfd/elf.c	2019-02-18 11:53:32.161652071 +0000

+ +++ binutils-2.31.1/bfd/elf.c	2019-02-18 12:08:52.135108638 +0000

+ @@ -1177,10 +1177,12 @@ _bfd_elf_make_section_from_shdr (bfd *ab

+        enum { nothing, compress, decompress } action = nothing;

+        int compression_header_size;

+        bfd_size_type uncompressed_size;

+ +      unsigned int uncompressed_align_power;

+        bfd_boolean compressed

+  	= bfd_is_section_compressed_with_header (abfd, newsect,

+  						 &compression_header_size,

+ -						 &uncompressed_size);

+ +						 &uncompressed_size,

+ +						 &uncompressed_align_power);

+  

+        if (compressed)

+  	{

+ diff -rup binutils.orig/binutils/readelf.c binutils-2.31.1/binutils/readelf.c

+ --- binutils.orig/binutils/readelf.c	2019-02-18 11:53:32.947646480 +0000

+ +++ binutils-2.31.1/binutils/readelf.c	2019-02-18 12:10:13.142535034 +0000

+ @@ -13366,12 +13366,6 @@ dump_section_as_strings (Elf_Internal_Sh

+  		    printable_section_name (filedata, section), chdr.ch_type);

+  	      return FALSE;

+  	    }

+ -	  else if (chdr.ch_addralign != section->sh_addralign)

+ -	    {

+ -	      warn (_("compressed section '%s' is corrupted\n"),

+ -		    printable_section_name (filedata, section));

+ -	      return FALSE;

+ -	    }

+  	  uncompressed_size = chdr.ch_size;

+  	  start += compression_header_size;

+  	  new_size -= compression_header_size;

+ @@ -13513,12 +13507,6 @@ dump_section_as_bytes (Elf_Internal_Shdr

+  		    printable_section_name (filedata, section), chdr.ch_type);

+  	      return FALSE;

+  	    }

+ -	  else if (chdr.ch_addralign != section->sh_addralign)

+ -	    {

+ -	      warn (_("compressed section '%s' is corrupted\n"),

+ -		    printable_section_name (filedata, section));

+ -	      return FALSE;

+ -	    }

+  	  uncompressed_size = chdr.ch_size;

+  	  start += compression_header_size;

+  	  new_size -= compression_header_size;

+ @@ -13688,12 +13676,6 @@ load_specific_debug_section (enum dwarf_

+  		    section->name, chdr.ch_type);

+  	      return FALSE;

+  	    }

+ -	  else if (chdr.ch_addralign != sec->sh_addralign)

+ -	    {

+ -	      warn (_("compressed section '%s' is corrupted\n"),

+ -		    section->name);

+ -	      return FALSE;

+ -	    }

+  	  uncompressed_size = chdr.ch_size;

+  	  start += compression_header_size;

+  	  size -= compression_header_size;

+ diff -rup binutils.orig/binutils/testsuite/binutils-all/dw2-3.rS binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rS

+ --- binutils.orig/binutils/testsuite/binutils-all/dw2-3.rS	2019-02-18 11:53:32.908646758 +0000

+ +++ binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rS	2019-02-18 12:10:40.884338917 +0000

+ @@ -1,3 +1,3 @@

+  #...

+ - +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +1

+ + +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +(4|8)

+  #pass

+ diff -rup binutils.orig/binutils/testsuite/binutils-all/dw2-3.rt binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rt

+ --- binutils.orig/binutils/testsuite/binutils-all/dw2-3.rt	2019-02-18 11:53:32.905646779 +0000

+ +++ binutils-2.31.1/binutils/testsuite/binutils-all/dw2-3.rt	2019-02-18 12:11:13.476108521 +0000

+ @@ -1,6 +1,6 @@

+  #...

+   +\[[ 0-9]+\] .debug_info

+ - +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +1

+ + +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +(4|8)

+   +\[0+800\]: COMPRESSED

+   +ZLIB, 0+9d, 1

+  #pass

+ diff -rup binutils.orig/gold/merge.cc binutils-2.31.1/gold/merge.cc

+ --- binutils.orig/gold/merge.cc	2019-02-18 11:53:32.210651723 +0000

+ +++ binutils-2.31.1/gold/merge.cc	2019-02-18 12:12:59.027362334 +0000

+ @@ -440,9 +440,11 @@ Output_merge_string<Char_type>::do_add_i

+  {

+    section_size_type sec_len;

+    bool is_new;

+ +  uint64_t addralign = this->addralign();

+    const unsigned char* pdata = object->decompressed_section_contents(shndx,

+  								     &sec_len,

+ -								     &is_new);

+ +								     &is_new,

+ +								     &addralign);

+  

+    const Char_type* p = reinterpret_cast<const Char_type*>(pdata);

+    const Char_type* pend = p + sec_len / sizeof(Char_type);

+ @@ -494,7 +496,7 @@ Output_merge_string<Char_type>::do_add_i

+    // aligned, so each string within the section must retain the same

+    // modulo.

+    uintptr_t init_align_modulo = (reinterpret_cast<uintptr_t>(pdata)

+ -				 & (this->addralign() - 1));

+ +				 & (addralign - 1));

+    bool has_misaligned_strings = false;

+  

+    while (p < pend)

+ @@ -503,7 +505,7 @@ Output_merge_string<Char_type>::do_add_i

+  

+        // Within merge input section each string must be aligned.

+        if (len != 0

+ -	  && ((reinterpret_cast<uintptr_t>(p) & (this->addralign() - 1))

+ +	  && ((reinterpret_cast<uintptr_t>(p) & (addralign - 1))

+  	      != init_align_modulo))

+  	  has_misaligned_strings = true;

+  

+ diff -rup binutils.orig/gold/object.cc binutils-2.31.1/gold/object.cc

+ --- binutils.orig/gold/object.cc	2019-02-18 11:53:32.208651737 +0000

+ +++ binutils-2.31.1/gold/object.cc	2019-02-18 12:16:35.938828914 +0000

+ @@ -751,11 +751,13 @@ build_compressed_section_map(

+  	      const unsigned char* contents =

+  		  obj->section_contents(i, &len, false);

+  	      uint64_t uncompressed_size;

+ +	      Compressed_section_info info;

+  	      if (is_zcompressed)

+  		{

+  		  // Skip over the ".zdebug" prefix.

+  		  name += 7;

+  		  uncompressed_size = get_uncompressed_size(contents, len);

+ +		  info.addralign = shdr.get_sh_addralign();

+  		}

+  	      else

+  		{

+ @@ -763,8 +765,8 @@ build_compressed_section_map(

+  		  name += 6;

+  		  elfcpp::Chdr<size, big_endian> chdr(contents);

+  		  uncompressed_size = chdr.get_ch_size();

+ +		  info.addralign = chdr.get_ch_addralign();

+  		}

+ -	      Compressed_section_info info;

+  	      info.size = convert_to_section_size_type(uncompressed_size);

+  	      info.flag = shdr.get_sh_flags();

+  	      info.contents = NULL;

+ @@ -3060,7 +3062,8 @@ const unsigned char*

+  Object::decompressed_section_contents(

+      unsigned int shndx,

+      section_size_type* plen,

+ -    bool* is_new)

+ +    bool* is_new,

+ +    uint64_t* palign)

+  {

+    section_size_type buffer_size;

+    const unsigned char* buffer = this->do_section_contents(shndx, &buffer_size,

+ @@ -3087,6 +3090,8 @@ Object::decompressed_section_contents(

+      {

+        *plen = uncompressed_size;

+        *is_new = false;

+ +      if (palign != NULL)

+ +	*palign = p->second.addralign;

+        return p->second.contents;

+      }

+  

+ @@ -3108,6 +3113,8 @@ Object::decompressed_section_contents(

+    // once in this pass.

+    *plen = uncompressed_size;

+    *is_new = true;

+ +  if (palign != NULL)

+ +    *palign = p->second.addralign;

+    return uncompressed_data;

+  }

+  

+ diff -rup binutils.orig/gold/object.h binutils-2.31.1/gold/object.h

+ --- binutils.orig/gold/object.h	2019-02-18 11:53:32.210651723 +0000

+ +++ binutils-2.31.1/gold/object.h	2019-02-18 12:17:50.625300926 +0000

+ @@ -373,6 +373,7 @@ struct Compressed_section_info

+  {

+    section_size_type size;

+    elfcpp::Elf_Xword flag;

+ +  uint64_t addralign;

+    const unsigned char* contents;

+  };

+  typedef std::map<unsigned int, Compressed_section_info> Compressed_section_map;

+ @@ -808,7 +809,8 @@ class Object

+  

+    bool

+    section_is_compressed(unsigned int shndx,

+ -			section_size_type* uncompressed_size) const

+ +			section_size_type* uncompressed_size,

+ +			elfcpp::Elf_Xword* palign = NULL) const

+    {

+      if (this->compressed_sections_ == NULL)

+        return false;

+ @@ -818,6 +820,8 @@ class Object

+        {

+  	if (uncompressed_size != NULL)

+  	  *uncompressed_size = p->second.size;

+ +	if (palign != NULL)

+ +	  *palign = p->second.addralign;

+  	return true;

+        }

+      return false;

+ @@ -828,7 +832,7 @@ class Object

+    // by the caller.

+    const unsigned char*

+    decompressed_section_contents(unsigned int shndx, section_size_type* plen,

+ -				bool* is_cached);

+ +				bool* is_cached, uint64_t* palign = NULL);

+  

+    // Discard any buffers of decompressed sections.  This is done

+    // at the end of the Add_symbols task.

+ diff -rup binutils.orig/gold/output.cc binutils-2.31.1/gold/output.cc

+ --- binutils.orig/gold/output.cc	2019-02-18 11:53:32.209651729 +0000

+ +++ binutils-2.31.1/gold/output.cc	2019-02-18 12:18:39.729953797 +0000

+ @@ -2448,7 +2448,14 @@ Output_section::add_input_section(Layout

+  				  unsigned int reloc_shndx,

+  				  bool have_sections_script)

+  {

+ +  section_size_type input_section_size = shdr.get_sh_size();

+ +  section_size_type uncompressed_size;

+    elfcpp::Elf_Xword addralign = shdr.get_sh_addralign();

+ +

+ +  if (object->section_is_compressed(shndx, &uncompressed_size,

+ +                                   &addralign))

+ +    input_section_size = uncompressed_size;

+ +

+    if ((addralign & (addralign - 1)) != 0)

+      {

+        object->error(_("invalid alignment %lu for section \"%s\""),

+ @@ -2498,11 +2505,6 @@ Output_section::add_input_section(Layout

+  	}

+      }

+  

+ -  section_size_type input_section_size = shdr.get_sh_size();

+ -  section_size_type uncompressed_size;

+ -  if (object->section_is_compressed(shndx, &uncompressed_size))

+ -    input_section_size = uncompressed_size;

+ -

+    off_t offset_in_section;

+  

+    if (this->has_fixed_layout())

@@ -0,0 +1,68 @@