Blame SOURCES/binutils-2.28-libiberty-bugfixes.patch

0b07f1
diff -rup binutils-2.28/libiberty/configure /work/sources/binutils/current/libiberty/configure
0b07f1
--- binutils-2.28/libiberty/configure	2017-03-02 11:41:42.254309307 +0000
0b07f1
+++ /work/sources/binutils/current/libiberty/configure	2017-01-04 16:01:24.944939339 +0000
0b07f1
@@ -5097,7 +5097,7 @@ case "${host}" in
0b07f1
 	  # If we are using a compiler supporting mdynamic-no-pic
0b07f1
 	  # and the option has been tested as safe to add, then cancel
0b07f1
 	  # it here, since the code generated is incompatible with shared
0b07f1
-	  # libs.
0b07f1
+	  # libs.
0b07f1
 	  *-mdynamic-no-pic*) PICFLAG='-fno-common -mno-dynamic-no-pic' ;;
0b07f1
 	  *) PICFLAG=-fno-common ;;
0b07f1
 	esac
0b07f1
diff -rup binutils-2.28/libiberty/cp-demangle.c /work/sources/binutils/current/libiberty/cp-demangle.c
0b07f1
--- binutils-2.28/libiberty/cp-demangle.c	2017-03-02 08:28:19.000000000 +0000
0b07f1
+++ /work/sources/binutils/current/libiberty/cp-demangle.c	2017-03-01 14:37:20.557586479 +0000
0b07f1
@@ -2595,7 +2594,11 @@ cplus_demangle_type (struct d_info *di)
0b07f1
 	  /* auto */
0b07f1
 	  ret = d_make_name (di, "auto", 4);
0b07f1
 	  break;
0b07f1
-	  
0b07f1
+	case 'c':
0b07f1
+	  /* decltype(auto) */
0b07f1
+	  ret = d_make_name (di, "decltype(auto)", 14);
0b07f1
+	  break;
0b07f1
+
0b07f1
 	case 'f':
0b07f1
 	  /* 32-bit decimal floating point */
0b07f1
 	  ret = d_make_builtin_type (di, &cplus_demangle_builtin_types[26]);
0b07f1
diff -rup binutils-2.28/libiberty/Makefile.in /work/sources/binutils/current/libiberty/Makefile.in
0b07f1
--- binutils-2.28/libiberty/Makefile.in	2016-12-23 08:40:18.000000000 +0000
0b07f1
+++ /work/sources/binutils/current/libiberty/Makefile.in	2017-01-04 16:01:24.943939351 +0000
0b07f1
@@ -1,9 +1,7 @@
0b07f1
 # Makefile for the libiberty library.
0b07f1
 # Originally written by K. Richard Pixley <rich@cygnus.com>.
0b07f1
 #
0b07f1
-# Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
0b07f1
-# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
0b07f1
-# 2012, 2014, 2015 Free Software Foundation
0b07f1
+# Copyright (C) 1990-2017 Free Software Foundation, Inc.
0b07f1
 #
0b07f1
 # This file is part of the libiberty library.
0b07f1
 # Libiberty is free software; you can redistribute it and/or
0b07f1
@@ -484,7 +482,8 @@ configure_deps = $(srcdir)/aclocal.m4 \
0b07f1
 	$(srcdir)/../config/acx.m4 \
0b07f1
 	$(srcdir)/../config/no-executables.m4 \
0b07f1
 	$(srcdir)/../config/override.m4 \
0b07f1
-	$(srcdir)/../config/warnings.m4 \
0b07f1
+	$(srcdir)/../config/picflag.m4 \
0b07f1
+	$(srcdir)/../config/warnings.m4
0b07f1
 
0b07f1
 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(configure_deps)
0b07f1
 	cd $(srcdir) && $(AUTOCONF)
0b07f1
diff -rup binutils-2.28/libiberty/strndup.c /work/sources/binutils/current/libiberty/strndup.c
0b07f1
--- binutils-2.28/libiberty/strndup.c	2013-11-04 15:33:40.000000000 +0000
0b07f1
+++ /work/sources/binutils/current/libiberty/strndup.c	2017-01-04 16:01:24.950939263 +0000
0b07f1
@@ -33,7 +33,7 @@ memory was available.  The result is alw
0b07f1
 #include "ansidecl.h"
0b07f1
 #include <stddef.h>
0b07f1
 
0b07f1
-extern size_t	strlen (const char*);
0b07f1
+extern size_t	strnlen (const char *s, size_t maxlen);
0b07f1
 extern PTR	malloc (size_t);
0b07f1
 extern PTR	memcpy (PTR, const PTR, size_t);
0b07f1
 
0b07f1
@@ -41,10 +41,7 @@ char *
0b07f1
 strndup (const char *s, size_t n)
0b07f1
 {
0b07f1
   char *result;
0b07f1
-  size_t len = strlen (s);
0b07f1
-
0b07f1
-  if (n < len)
0b07f1
-    len = n;
0b07f1
+  size_t len = strnlen (s, n);
0b07f1
 
0b07f1
   result = (char *) malloc (len + 1);
0b07f1
   if (!result)
0b07f1
diff -rup binutils-2.28/libiberty/testsuite/demangle-expected /work/sources/binutils/current/libiberty/testsuite/demangle-expected
0b07f1
--- binutils-2.28/libiberty/testsuite/demangle-expected	2017-03-02 08:28:19.000000000 +0000
0b07f1
+++ /work/sources/binutils/current/libiberty/testsuite/demangle-expected	2017-03-01 14:37:55.295138174 +0000
0b07f1
@@ -4200,6 +4200,9 @@ decltype (new auto({parm#1})) f<int>(int
0b07f1
 _Z1fIiERDaRKT_S1_
0b07f1
 auto& f<int>(int const&, int)
0b07f1
 --format=gnu-v3
0b07f1
+_Z1gIiEDcRKT_S0_
0b07f1
+decltype(auto) g<int>(int const&, int)
0b07f1
+--format=gnu-v3
0b07f1
 _Z1gILi1EEvR1AIXT_EER1BIXscbT_EE
0b07f1
 void g<1>(A<1>&, B<static_cast<bool>(1)>&)
0b07f1
 --format=gnu-v3
0b07f1
diff -rup binutils-2.28/libiberty/xstrndup.c /work/sources/binutils/current/libiberty/xstrndup.c
0b07f1
--- binutils-2.28/libiberty/xstrndup.c	2013-11-04 15:33:40.000000000 +0000
0b07f1
+++ /work/sources/binutils/current/libiberty/xstrndup.c	2017-01-04 16:01:24.951939251 +0000
0b07f1
@@ -48,10 +48,7 @@ char *
0b07f1
 xstrndup (const char *s, size_t n)
0b07f1
 {
0b07f1
   char *result;
0b07f1
-  size_t len = strlen (s);
0b07f1
-
0b07f1
-  if (n < len)
0b07f1
-    len = n;
0b07f1
+  size_t len = strnlen (s, n);
0b07f1
 
0b07f1
   result = XNEWVEC (char, len + 1);
0b07f1