Skip to content

Commit

Permalink
binutils: Update patches for binutils-2.26
Browse files Browse the repository at this point in the history
This updates patches for 2.26. Most notably, the removal of the xtensa
patches which seem to be upstream in binutils now.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
  • Loading branch information
bhundven committed Feb 5, 2016
1 parent 2241a42 commit 46c9c48
Show file tree
Hide file tree
Showing 10 changed files with 626 additions and 0 deletions.
33 changes: 33 additions & 0 deletions patches/binutils/2.26/120-sh-conf.patch
@@ -0,0 +1,33 @@
r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines

Likewise, binutils has no idea about any of these new targets either, so we
fix that up too.. now we're able to actually build a real toolchain for
sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
inept targets than that one, really. Go look, I promise).

diff --git a/configure b/configure
index 87677bc..2d916f1 100755
--- a/configure
+++ b/configure
@@ -3812,7 +3812,7 @@ case "${target}" in
or1k*-*-*)
noconfigdirs="$noconfigdirs gdb"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${target}" in
sh*-*-elf)
;;
diff --git a/configure.ac b/configure.ac
index 8fe0eca..b10a99f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1140,7 +1140,7 @@ case "${target}" in
or1k*-*-*)
noconfigdirs="$noconfigdirs gdb"
;;
- sh-*-* | sh64-*-*)
+ sh*-*-* | sh64-*-*)
case "${target}" in
sh*-*-elf)
;;
26 changes: 26 additions & 0 deletions patches/binutils/2.26/300-001_ld_makefile_patch.patch
@@ -0,0 +1,26 @@
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 9575f1f..84df0bf 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -54,7 +54,7 @@ endif
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)

EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 9f56ca1..272860f 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -388,7 +388,7 @@ AM_CFLAGS = $(WARN_CFLAGS)
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
INCDIR = $(BASEDIR)/include
22 changes: 22 additions & 0 deletions patches/binutils/2.26/300-012_check_ldrunpath_length.patch
@@ -0,0 +1,22 @@
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 137446f..bb8391a 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1195,6 +1195,8 @@ fragment <<EOF
&& command_line.rpath == NULL)
{
lib_path = (const char *) getenv ("LD_RUN_PATH");
+ if ((lib_path) && (strlen (lib_path) == 0))
+ lib_path = NULL;
if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
force))
break;
@@ -1458,6 +1460,8 @@ gld${EMULATION_NAME}_before_allocation (void)
rpath = command_line.rpath;
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
+ if ((rpath) && (*rpath == '\0'))
+ rpath = NULL;

for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
14 changes: 14 additions & 0 deletions patches/binutils/2.26/310-fix-gold-pthreads-typo.patch
@@ -0,0 +1,14 @@
--- binutils-2.25.1/gold/gold-threads.cc.orig 2014-10-14 08:32:04.000000000 +0100
+++ binutils-2.25.1/gold/gold-threads.cc 2015-10-20 22:38:18.640819300 +0100
@@ -102,9 +102,9 @@
if (err != 0)
gold_fatal(_("pthead_mutextattr_init failed: %s"), strerror(err));
#ifdef PTHREAD_MUTEX_ADAPTIVE_NP
- err = pthread_mutextattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
+ err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
if (err != 0)
- gold_fatal(_("pthread_mutextattr_settype failed: %s"), strerror(err));
+ gold_fatal(_("pthread_mutexattr_settype failed: %s"), strerror(err));
#endif

err = pthread_mutex_init(&this->mutex_, &attr);
@@ -0,0 +1,11 @@
--- binutils-2.25.1/gold/gold-threads.cc.orig 2015-10-20 22:39:36.371169400 +0100
+++ binutils-2.25.1/gold/gold-threads.cc 2015-10-20 22:39:38.182772700 +0100
@@ -101,7 +101,7 @@
int err = pthread_mutexattr_init(&attr);
if (err != 0)
gold_fatal(_("pthead_mutextattr_init failed: %s"), strerror(err));
-#ifdef PTHREAD_MUTEX_ADAPTIVE_NP
+#if defined(PTHREAD_MUTEX_ADAPTIVE_NP) && !defined(_WIN32)
err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
if (err != 0)
gold_fatal(_("pthread_mutexattr_settype failed: %s"), strerror(err));
108 changes: 108 additions & 0 deletions patches/binutils/2.26/330-Dont-link-to-libfl-as-its-unnecessary.patch
@@ -0,0 +1,108 @@
diff --git a/binutils/configure b/binutils/configure
index 6e1f21e..78bf4ae 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -12069,6 +12069,7 @@ fi
done
test -n "$YACC" || YACC="yacc"

+save_LIBS=$LIBS
for ac_prog in flex lex
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -12230,6 +12231,8 @@ esac
if test "$LEX" = :; then
LEX=${am_missing_run}flex
fi
+LIBS=$save_LIBS
+LEXLIB=

ALL_LINGUAS="bg ca da es fi fr id it ja ro ru rw sk sv tr uk vi zh_CN zh_TW hr"
# If we haven't got the data from the intl directory,
diff --git a/binutils/configure.ac b/binutils/configure.ac
index defe781..8fd236a 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -87,7 +87,10 @@ if test -z "$host" ; then
fi

AC_PROG_YACC
+save_LIBS=$LIBS
AM_PROG_LEX
+LIBS=$save_LIBS
+LEXLIB=

ALL_LINGUAS="bg ca da es fi fr id it ja ro ru rw sk sv tr uk vi zh_CN zh_TW hr"
ZW_GNU_GETTEXT_SISTER_DIR
diff --git a/gas/configure b/gas/configure
index f959e95..9bb4043 100755
--- a/gas/configure
+++ b/gas/configure
@@ -12819,6 +12819,7 @@ fi
done
test -n "$YACC" || YACC="yacc"

+save_LIBS=$LIBS
for ac_prog in flex lex
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -12980,6 +12981,8 @@ esac
if test "$LEX" = :; then
LEX=${am_missing_run}flex
fi
+LIBS=$save_LIBS
+LEXLIB=

ALL_LINGUAS="fr tr es rw id ru fi ja zh_CN"
# If we haven't got the data from the intl directory,
diff --git a/gas/configure.ac b/gas/configure.ac
index 07f825d..c552b7e 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -734,7 +734,10 @@ AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}", [Target vendor.])
AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}", [Target OS.])

AC_PROG_YACC
+save_LIBS=$LIBS
AM_PROG_LEX
+LIBS=$save_LIBS
+LEXLIB=

ALL_LINGUAS="fr tr es rw id ru fi ja zh_CN"
ZW_GNU_GETTEXT_SISTER_DIR
diff --git a/ld/configure b/ld/configure
index a446283..1a6bf81 100755
--- a/ld/configure
+++ b/ld/configure
@@ -16087,6 +16087,7 @@ fi
done
test -n "$YACC" || YACC="yacc"

+save_LIBS=$LIBS
for ac_prog in flex lex
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -16248,6 +16249,8 @@ esac
if test "$LEX" = :; then
LEX=${am_missing_run}flex
fi
+LIBS=$save_LIBS
+LEXLIB=


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
diff --git a/ld/configure.ac b/ld/configure.ac
index 188172d..45eec53 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -186,7 +186,10 @@ AM_PO_SUBDIRS
AC_EXEEXT

AC_PROG_YACC
+save_LIBS=$LIBS
AM_PROG_LEX
+LIBS=$save_LIBS
+LEXLIB=

AM_MAINTAINER_MODE
AM_CONDITIONAL(GENINSRC_NEVER, false)
@@ -0,0 +1,13 @@
diff --git a/gold/binary.cc b/gold/binary.cc
index 52df81a..03a8f20 100644
--- a/gold/binary.cc
+++ b/gold/binary.cc
@@ -23,7 +23,7 @@
#include "gold.h"

#include <cerrno>
-#include <cstring>
+#include <string>

#include "elfcpp.h"
#include "stringpool.h"
@@ -0,0 +1,77 @@
From c39479f4ab4d372b518957871e1f205a03e7c3d6 Mon Sep 17 00:00:00 2001
From: Andrew Hsieh <andrewhsieh@google.com>
Date: Wed, 18 Mar 2015 10:57:24 +0800
Subject: [PATCH] Fix darwin build

1. In Drawin PTHREAD_ONCE_INIT is {0x30B1BCBA, {0}} and the GCC < 4.4
doesn't support ended initializer list
2. wcsncasecmp doesn't exist in MacSDK10.6.x

Change-Id: I69204a72f853f5263dffedc448379d75ed4eca2e
---
binutils-2.25/bfd/peXXigen.c | 22 ++++++++++++++++++++++
binutils-2.25/gold/gold-threads.cc | 15 ++++++++++++---
2 files changed, 34 insertions(+), 3 deletions(-)

diff --git binutils-2.25.orig/bfd/peXXigen.c binutils-2.25/bfd/peXXigen.c
index 13e39e4..7a98306 100644
--- binutils-2.25.orig/bfd/peXXigen.c
+++ binutils-2.25/bfd/peXXigen.c
@@ -3522,6 +3522,28 @@ u16_mbtouc (wchar_t * puc, const unsigned short * s, unsigned int n)
}
#endif /* HAVE_WCHAR_H and not Cygwin/Mingw */

+#if defined __APPLE__ && __DARWIN_C_LEVEL < 200809L
+/* wcsncasecmp isn't always defined in Mac SDK */
+static int
+wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
+{
+ wchar_t c1, c2;
+
+ if (n == 0)
+ return (0);
+ for (; *s1; s1++, s2++)
+ {
+ c1 = towlower(*s1);
+ c2 = towlower(*s2);
+ if (c1 != c2)
+ return ((int)c1 - c2);
+ if (--n == 0)
+ return (0);
+ }
+ return (-*s2);
+}
+#endif
+
/* Perform a comparison of two entries. */
static signed int
rsrc_cmp (bfd_boolean is_name, rsrc_entry * a, rsrc_entry * b)
diff --git binutils-2.25.orig/gold/gold-threads.cc binutils-2.25/gold/gold-threads.cc
index ff5a8ac..45140e0 100644
--- binutils-2.25.orig/gold/gold-threads.cc
+++ binutils-2.25/gold/gold-threads.cc
@@ -284,9 +284,18 @@ Condvar::~Condvar()
class Once_initialize
{
public:
- Once_initialize()
- : once_(PTHREAD_ONCE_INIT)
- { }
+ Once_initialize()
+#if !defined(__APPLE__)
+ : once_(PTHREAD_ONCE_INIT)
+ { }
+#else
+// In Drawin PTHREAD_ONCE_INIT is {0x30B1BCBA, {0}} and the GCC < 4.4 doesn't support
+// extended initializer list as above */
+ {
+ pthread_once_t once_2 = PTHREAD_ONCE_INIT;
+ once_ = once_2;
+ }
+#endif

// Return a pointer to the pthread_once_t variable.
pthread_once_t*
--
2.1.3

37 changes: 37 additions & 0 deletions patches/binutils/2.26/500-sysroot.patch
@@ -0,0 +1,37 @@
Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>

Always try to prepend the sysroot prefix to absolute filenames first.

http://bugs.gentoo.org/275666
http://sourceware.org/bugzilla/show_bug.cgi?id=10340

--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -308,18 +308,25 @@
directory first. */
if (! entry->flags.maybe_archive)
{
- if (entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename))
+ /* For absolute pathnames, try to always open the file in the
+ sysroot first. If this fails, try to open the file at the
+ given location. */
+ entry->flags.sysrooted = is_sysrooted_pathname (entry->filename);
+ if (!entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename)
+ && ld_sysroot)
{
char *name = concat (ld_sysroot, entry->filename,
(const char *) NULL);
if (ldfile_try_open_bfd (name, entry))
{
entry->filename = name;
+ entry->flags.sysrooted = TRUE;
return TRUE;
}
free (name);
}
- else if (ldfile_try_open_bfd (entry->filename, entry))
+
+ if (ldfile_try_open_bfd (entry->filename, entry))
return TRUE;

if (IS_ABSOLUTE_PATH (entry->filename))

0 comments on commit 46c9c48

Please sign in to comment.