config BR2_BINUTILS_VERSION
string
- default "arc-2016.09-eng008" if BR2_arc
+ default "arc-2016.09-eng010" if BR2_arc
default "2.24" if BR2_BINUTILS_VERSION_2_24_X
default "2.25.1" if BR2_BINUTILS_VERSION_2_25_X
default "2.26.1" if BR2_BINUTILS_VERSION_2_26_X
+++ /dev/null
-From d76a7549b43974fe8564971a3f40459bc495a8a7 Mon Sep 17 00:00:00 2001
-From: Romain Naour <romain.naour@gmail.com>
-Date: Fri, 25 Dec 2015 11:40:53 +0100
-Subject: [PATCH] ld-makefile
-
-[Romain: rebase on top of 2.26]
-Signed-off-by: Romain Naour <romain.naour@gmail.com>
----
- ld/Makefile.am | 2 +-
- ld/Makefile.in | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/ld/Makefile.am b/ld/Makefile.am
-index 0b3b049..3871c74 100644
---- a/ld/Makefile.am
-+++ b/ld/Makefile.am
-@@ -57,7 +57,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 ed98f87..530e4c9 100644
---- a/ld/Makefile.in
-+++ b/ld/Makefile.in
-@@ -413,7 +413,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS)
- # 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
---
-2.4.3
-
+++ /dev/null
-From ebe1cba46df52d7bf86def3d681271fd05fb453b Mon Sep 17 00:00:00 2001
-From: Romain Naour <romain.naour@gmail.com>
-Date: Fri, 25 Dec 2015 11:41:47 +0100
-Subject: [PATCH] check-ldrunpath-length
-
-[Romain: rebase on top of 2.26]
-Signed-off-by: Romain Naour <romain.naour@gmail.com>
----
- ld/emultempl/elf32.em | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
-index 0405d4f..efd3300 100644
---- a/ld/emultempl/elf32.em
-+++ b/ld/emultempl/elf32.em
-@@ -1242,6 +1242,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;
-@@ -1523,6 +1525,8 @@ gld${EMULATION_NAME}_before_allocation (void)
- rpath = command_line.rpath;
- if (rpath == NULL)
- rpath = (const char *) getenv ("LD_RUN_PATH");
-+ if ((rpath) && (strlen (rpath) == 0))
-+ rpath = NULL;
-
- for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
---
-2.4.3
-
+++ /dev/null
-From 30628870e583375f8927c04398c7219c6e9f703c Mon Sep 17 00:00:00 2001
-From: Romain Naour <romain.naour@gmail.com>
-Date: Fri, 25 Dec 2015 11:42:48 +0100
-Subject: [PATCH] add sysroot fix from bug #3049
-
-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
-
-Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
-[Romain: rebase on top of 2.26]
-Signed-off-by: Romain Naour <romain.naour@gmail.com>
----
- ld/ldfile.c | 11 +++++++++--
- 1 file changed, 9 insertions(+), 2 deletions(-)
-
-diff --git a/ld/ldfile.c b/ld/ldfile.c
-index 96f9ecc..1439309 100644
---- a/ld/ldfile.c
-+++ b/ld/ldfile.c
-@@ -335,18 +335,25 @@ ldfile_open_file_search (const char *arch,
- 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))
---
-2.4.3
-
+++ /dev/null
-From be366461dd49e760440fb28eaee5164eb281adcc Mon Sep 17 00:00:00 2001
-From: Romain Naour <romain.naour@gmail.com>
-Date: Fri, 25 Dec 2015 11:45:38 +0100
-Subject: [PATCH] poison-system-directories
-
-Patch adapted to binutils 2.23.2 and extended to use
-BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni.
-
-[Romain: rebase on top of 2.26]
-Signed-off-by: Romain Naour <romain.naour@gmail.com>
-[Gustavo: adapt to binutils 2.25]
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
-
-Upstream-Status: Inappropriate [distribution: codesourcery]
-
-Patch originally created by Mark Hatle, forward-ported to
-binutils 2.21 by Scott Garman.
-
-purpose: warn for uses of system directories when cross linking
-
-Code Merged from Sourcery G++ binutils 2.19 - 4.4-277
-
-2008-07-02 Joseph Myers <joseph@codesourcery.com>
-
- ld/
- * ld.h (args_type): Add error_poison_system_directories.
- * ld.texinfo (--error-poison-system-directories): Document.
- * ldfile.c (ldfile_add_library_path): Check
- command_line.error_poison_system_directories.
- * ldmain.c (main): Initialize
- command_line.error_poison_system_directories.
- * lexsup.c (enum option_values): Add
- OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
- (ld_options): Add --error-poison-system-directories.
- (parse_args): Handle new option.
-
-2007-06-13 Joseph Myers <joseph@codesourcery.com>
-
- ld/
- * config.in: Regenerate.
- * ld.h (args_type): Add poison_system_directories.
- * ld.texinfo (--no-poison-system-directories): Document.
- * ldfile.c (ldfile_add_library_path): Check
- command_line.poison_system_directories.
- * ldmain.c (main): Initialize
- command_line.poison_system_directories.
- * lexsup.c (enum option_values): Add
- OPTION_NO_POISON_SYSTEM_DIRECTORIES.
- (ld_options): Add --no-poison-system-directories.
- (parse_args): Handle new option.
-
-2007-04-20 Joseph Myers <joseph@codesourcery.com>
-
- Merge from Sourcery G++ binutils 2.17:
-
- 2007-03-20 Joseph Myers <joseph@codesourcery.com>
- Based on patch by Mark Hatle <mark.hatle@windriver.com>.
- ld/
- * configure.ac (--enable-poison-system-directories): New option.
- * configure, config.in: Regenerate.
- * ldfile.c (ldfile_add_library_path): If
- ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
- /usr/lib, /usr/local/lib or /usr/X11R6/lib.
-
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-Signed-off-by: Scott Garman <scott.a.garman@intel.com>
----
- ld/config.in | 3 +++
- ld/configure | 14 ++++++++++++++
- ld/configure.ac | 10 ++++++++++
- ld/ld.h | 8 ++++++++
- ld/ld.texinfo | 12 ++++++++++++
- ld/ldfile.c | 17 +++++++++++++++++
- ld/ldlex.h | 2 ++
- ld/ldmain.c | 2 ++
- ld/lexsup.c | 21 +++++++++++++++++++++
- 9 files changed, 89 insertions(+)
-
-diff --git a/ld/config.in b/ld/config.in
-index 276fb77..35c58eb 100644
---- a/ld/config.in
-+++ b/ld/config.in
-@@ -14,6 +14,9 @@
- language is requested. */
- #undef ENABLE_NLS
-
-+/* Define to warn for use of native system library directories */
-+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
-+
- /* Additional extension a shared object might have. */
- #undef EXTRA_SHLIB_EXTENSION
-
-diff --git a/ld/configure b/ld/configure
-index a446283..d1f9504 100755
---- a/ld/configure
-+++ b/ld/configure
-@@ -786,6 +786,7 @@ with_lib_path
- enable_targets
- enable_64_bit_bfd
- with_sysroot
-+enable_poison_system_directories
- enable_gold
- enable_got
- enable_compressed_debug_sections
-@@ -1442,6 +1443,8 @@ Optional Features:
- --disable-largefile omit support for large files
- --enable-targets alternative target configurations
- --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
-+ --enable-poison-system-directories
-+ warn for use of native system library directories
- --enable-gold[=ARG] build gold [ARG={default,yes,no}]
- --enable-got=<type> GOT handling scheme (target, single, negative,
- multigot)
-@@ -15491,7 +15494,18 @@ else
- fi
-
-
-+# Check whether --enable-poison-system-directories was given.
-+if test "${enable_poison_system_directories+set}" = set; then :
-+ enableval=$enable_poison_system_directories;
-+else
-+ enable_poison_system_directories=no
-+fi
-+
-+if test "x${enable_poison_system_directories}" = "xyes"; then
-
-+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
-+
-+fi
-
- # Check whether --enable-got was given.
- if test "${enable_got+set}" = set; then :
-diff --git a/ld/configure.ac b/ld/configure.ac
-index 188172d..2cd8443 100644
---- a/ld/configure.ac
-+++ b/ld/configure.ac
-@@ -95,6 +95,16 @@ AC_SUBST(use_sysroot)
- AC_SUBST(TARGET_SYSTEM_ROOT)
- AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
-
-+AC_ARG_ENABLE([poison-system-directories],
-+ AS_HELP_STRING([--enable-poison-system-directories],
-+ [warn for use of native system library directories]),,
-+ [enable_poison_system_directories=no])
-+if test "x${enable_poison_system_directories}" = "xyes"; then
-+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
-+ [1],
-+ [Define to warn for use of native system library directories])
-+fi
-+
- dnl Use --enable-gold to decide if this linker should be the default.
- dnl "install_as_default" is set to false if gold is the default linker.
- dnl "installed_linker" is the installed BFD linker name.
-diff --git a/ld/ld.h b/ld/ld.h
-index d84ec4e..3476b26 100644
---- a/ld/ld.h
-+++ b/ld/ld.h
-@@ -164,6 +164,14 @@ typedef struct {
- /* If set, display the target memory usage (per memory region). */
- bfd_boolean print_memory_usage;
-
-+ /* If TRUE (the default) warn for uses of system directories when
-+ cross linking. */
-+ bfd_boolean poison_system_directories;
-+
-+ /* If TRUE (default FALSE) give an error for uses of system
-+ directories when cross linking instead of a warning. */
-+ bfd_boolean error_poison_system_directories;
-+
- /* Big or little endian as set on command line. */
- enum endian_enum endian;
-
-diff --git a/ld/ld.texinfo b/ld/ld.texinfo
-index 1dd7492..fb1438e 100644
---- a/ld/ld.texinfo
-+++ b/ld/ld.texinfo
-@@ -2332,6 +2332,18 @@ string identifying the original linked file does not change.
-
- Passing @code{none} for @var{style} disables the setting from any
- @code{--build-id} options earlier on the command line.
-+
-+@kindex --no-poison-system-directories
-+@item --no-poison-system-directories
-+Do not warn for @option{-L} options using system directories such as
-+@file{/usr/lib} when cross linking. This option is intended for use
-+in chroot environments when such directories contain the correct
-+libraries for the target system rather than the host.
-+
-+@kindex --error-poison-system-directories
-+@item --error-poison-system-directories
-+Give an error instead of a warning for @option{-L} options using
-+system directories when cross linking.
- @end table
-
- @c man end
-diff --git a/ld/ldfile.c b/ld/ldfile.c
-index 1439309..086b354 100644
---- a/ld/ldfile.c
-+++ b/ld/ldfile.c
-@@ -114,6 +114,23 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline)
- new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL);
- else
- new_dirs->name = xstrdup (name);
-+
-+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
-+ if (command_line.poison_system_directories
-+ && ((!strncmp (name, "/lib", 4))
-+ || (!strncmp (name, "/usr/lib", 8))
-+ || (!strncmp (name, "/usr/local/lib", 14))
-+ || (!strncmp (name, "/usr/X11R6/lib", 14))))
-+ {
-+ if (command_line.error_poison_system_directories)
-+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
-+ "cross-compilation\n"), name);
-+ else
-+ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
-+ "cross-compilation\n"), name);
-+ }
-+#endif
-+
- }
-
- /* Try to open a BFD for a lang_input_statement. */
-diff --git a/ld/ldlex.h b/ld/ldlex.h
-index 6f11e7b..0ca3110 100644
---- a/ld/ldlex.h
-+++ b/ld/ldlex.h
-@@ -144,6 +144,8 @@ enum option_values
- OPTION_PRINT_MEMORY_USAGE,
- OPTION_REQUIRE_DEFINED_SYMBOL,
- OPTION_ORPHAN_HANDLING,
-+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
-+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
- };
-
- /* The initial parser states. */
-diff --git a/ld/ldmain.c b/ld/ldmain.c
-index bb0b9cc..a23c56c 100644
---- a/ld/ldmain.c
-+++ b/ld/ldmain.c
-@@ -257,6 +257,8 @@ main (int argc, char **argv)
- command_line.warn_mismatch = TRUE;
- command_line.warn_search_mismatch = TRUE;
- command_line.check_section_addresses = -1;
-+ command_line.poison_system_directories = TRUE;
-+ command_line.error_poison_system_directories = FALSE;
-
- /* We initialize DEMANGLING based on the environment variable
- COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
-diff --git a/ld/lexsup.c b/ld/lexsup.c
-index 4cad209..be7d584 100644
---- a/ld/lexsup.c
-+++ b/ld/lexsup.c
-@@ -530,6 +530,14 @@ static const struct ld_option ld_options[] =
- { {"orphan-handling", required_argument, NULL, OPTION_ORPHAN_HANDLING},
- '\0', N_("=MODE"), N_("Control how orphan sections are handled."),
- TWO_DASHES },
-+ { {"no-poison-system-directories", no_argument, NULL,
-+ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
-+ '\0', NULL, N_("Do not warn for -L options using system directories"),
-+ TWO_DASHES },
-+ { {"error-poison-system-directories", no_argument, NULL,
-+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
-+ '\0', NULL, N_("Give an error for -L options using system directories"),
-+ TWO_DASHES },
- };
-
- #define OPTION_COUNT ARRAY_SIZE (ld_options)
-@@ -542,6 +550,7 @@ parse_args (unsigned argc, char **argv)
- int ingroup = 0;
- char *default_dirlist = NULL;
- char *shortopts;
-+ char *BR_paranoid_env;
- struct option *longopts;
- struct option *really_longopts;
- int last_optind;
-@@ -1516,6 +1525,14 @@ parse_args (unsigned argc, char **argv)
- }
- break;
-
-+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
-+ command_line.poison_system_directories = FALSE;
-+ break;
-+
-+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
-+ command_line.error_poison_system_directories = TRUE;
-+ break;
-+
- case OPTION_PUSH_STATE:
- input_flags.pushed = xmemdup (&input_flags,
- sizeof (input_flags),
-@@ -1559,6 +1576,10 @@ parse_args (unsigned argc, char **argv)
- command_line.soname = NULL;
- }
-
-+ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH");
-+ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0)
-+ command_line.error_poison_system_directories = TRUE;
-+
- while (ingroup)
- {
- lang_leave_group ();
---
-2.4.3
-
+++ /dev/null
-From f73e79e550cd92dcdd002b62931d11c79db50115 Mon Sep 17 00:00:00 2001
-From: Cupertino Miranda <cmiranda@synopsys.com>
-Date: Wed, 13 Jul 2016 18:04:20 +0200
-Subject: [PATCH 700/703] PIE fixes in for ARC bfd.
-
-Signed-off-by: Cupertino Miranda <cmiranda@synopsys.com>
-Signed-off-by: Vlad Zakharov <vzakhar@synopsys.com>
----
- bfd/elf-bfd.h | 1 +
- bfd/elf32-arc.c | 187 ++++++++++++++++++++++++++++++++++++++++++++------------
- 2 files changed, 149 insertions(+), 39 deletions(-)
-
-diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
-index bb3371f..fbe0464 100644
---- a/bfd/elf-bfd.h
-+++ b/bfd/elf-bfd.h
-@@ -444,6 +444,7 @@ enum elf_target_id
- {
- AARCH64_ELF_DATA = 1,
- ALPHA_ELF_DATA,
-+ ARC_ELF_DATA,
- ARM_ELF_DATA,
- AVR_ELF_DATA,
- BFIN_ELF_DATA,
-diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
-index 00828be..17670f0 100644
---- a/bfd/elf32-arc.c
-+++ b/bfd/elf32-arc.c
-@@ -301,6 +301,92 @@ struct arc_reloc_map
- unsigned char elf_reloc_val;
- };
-
-+/* ARC ELF linker hash entry. */
-+struct elf_arc_link_hash_entry
-+{
-+ struct elf_link_hash_entry root;
-+
-+ /* Track dynamic relocs copied for this symbol. */
-+ struct elf_dyn_relocs *dyn_relocs;
-+};
-+
-+/* ARC ELF linker hash table. */
-+struct elf_arc_link_hash_table
-+{
-+ struct elf_link_hash_table elf;
-+
-+ /* Short-cuts to get to dynamic linker sections. */
-+ asection *srelbss;
-+};
-+
-+static struct bfd_hash_entry *
-+elf_arc_link_hash_newfunc (struct bfd_hash_entry *entry,
-+ struct bfd_hash_table *table,
-+ const char *string)
-+{
-+ /* Allocate the structure if it has not already been allocated by a
-+ subclass. */
-+ if (entry == NULL)
-+ {
-+ entry = (struct bfd_hash_entry *)
-+ bfd_hash_allocate (table,
-+ sizeof (struct elf_arc_link_hash_entry));
-+ if (entry == NULL)
-+ return entry;
-+ }
-+
-+ /* Call the allocation method of the superclass. */
-+ entry = _bfd_elf_link_hash_newfunc (entry, table, string);
-+ if (entry != NULL)
-+ {
-+ struct elf_arc_link_hash_entry *eh;
-+
-+ eh = (struct elf_arc_link_hash_entry *) entry;
-+ eh->dyn_relocs = NULL;
-+ }
-+
-+ return entry;
-+}
-+
-+/* Destroy an ARC ELF linker hash table. */
-+/*
-+static void
-+elf_arc_link_hash_table_free (bfd *obfd)
-+{
-+ _bfd_elf_link_hash_table_free (obfd);
-+}
-+*/
-+
-+/* Create an X86-64 ELF linker hash table. */
-+
-+static struct bfd_link_hash_table *
-+arc_elf_link_hash_table_create (bfd *abfd)
-+{
-+ struct elf_arc_link_hash_table *ret;
-+
-+ ret = (struct elf_arc_link_hash_table *) bfd_zmalloc (sizeof (*ret));
-+ if (ret == NULL)
-+ return NULL;
-+
-+ if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
-+ elf_arc_link_hash_newfunc,
-+ sizeof (struct elf_arc_link_hash_entry),
-+ ARC_ELF_DATA))
-+ {
-+ free (ret);
-+ return NULL;
-+ }
-+
-+ ret->srelbss = NULL;
-+
-+ ret->elf.init_got_refcount.refcount = 0;
-+ ret->elf.init_got_refcount.glist = NULL;
-+ ret->elf.init_got_offset.offset = 0;
-+ ret->elf.init_got_offset.glist = NULL;
-+
-+ return &ret->elf.root;
-+}
-+
- #define ARC_RELOC_HOWTO(TYPE, VALUE, SIZE, BITSIZE, RELOC_FUNCTION, OVERFLOW, FORMULA) \
- { BFD_RELOC_##TYPE, R_##TYPE },
- static const struct arc_reloc_map arc_reloc_map[] =
-@@ -1317,7 +1403,7 @@ elf_arc_relocate_section (bfd * output_bfd,
- case R_ARC_32_ME:
- case R_ARC_PC32:
- case R_ARC_32_PCREL:
-- if ((bfd_link_pic (info))// || bfd_link_pie (info))
-+ if ((bfd_link_pic (info))
- && ((r_type != R_ARC_PC32 && r_type != R_ARC_32_PCREL)
- || (h != NULL
- && h->dynindx != -1
-@@ -1470,6 +1556,49 @@ elf_arc_relocate_section (bfd * output_bfd,
- return TRUE;
- }
-
-+#define elf_arc_hash_table(p) \
-+ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-+ == ARC_ELF_DATA ? ((struct elf_arc_link_hash_table *) ((p)->hash)) : NULL)
-+
-+/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
-+ .rela.bss sections in DYNOBJ, and set up shortcuts to them in our
-+ hash table. */
-+
-+static bfd_boolean
-+arc_elf_create_dynamic_sections (bfd *dynobj,
-+ struct bfd_link_info *info)
-+{
-+ struct elf_arc_link_hash_table *htab;
-+
-+ if (!_bfd_elf_create_dynamic_sections (dynobj, info))
-+ return FALSE;
-+
-+ htab = elf_arc_hash_table (info);
-+ if (htab == NULL)
-+ return FALSE;
-+
-+ if (bfd_link_executable (info))
-+ {
-+ /* Always allow copy relocs for building executables. */
-+ asection *s = bfd_get_linker_section (dynobj, ".rela.bss");
-+ if (s == NULL)
-+ {
-+ const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
-+ s = bfd_make_section_anyway_with_flags (dynobj,
-+ ".rela.bss",
-+ (bed->dynamic_sec_flags
-+ | SEC_READONLY));
-+ if (s == NULL
-+ || ! bfd_set_section_alignment (dynobj, s,
-+ bed->s->log_file_align))
-+ return FALSE;
-+ }
-+ htab->srelbss = s;
-+ }
-+
-+ return TRUE;
-+}
-+
- static struct dynamic_sections
- arc_create_dynamic_sections (bfd * abfd, struct bfd_link_info *info)
- {
-@@ -1615,7 +1744,7 @@ elf_arc_check_relocs (bfd * abfd,
- /* FALLTHROUGH */
- case R_ARC_PC32:
- case R_ARC_32_PCREL:
-- if ((bfd_link_pic (info))// || bfd_link_pie (info))
-+ if ((bfd_link_pic (info))
- && ((r_type != R_ARC_PC32 && r_type != R_ARC_32_PCREL)
- || (h != NULL
- && h->dynindx != -1
-@@ -1967,14 +2096,14 @@ elf_arc_adjust_dynamic_symbol (struct bfd_link_info *info,
- .rela.bss section we are going to use. */
- if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
- {
-- asection *srel;
-+ struct elf_arc_link_hash_table *arc_htab = elf_arc_hash_table (info);
-
-- srel = bfd_get_section_by_name (dynobj, ".rela.bss");
-- BFD_ASSERT (srel != NULL);
-- srel->size += sizeof (Elf32_External_Rela);
-+ BFD_ASSERT (arc_htab->srelbss != NULL);
-+ arc_htab->srelbss->size += sizeof (Elf32_External_Rela);
- h->needs_copy = 1;
- }
-
-+ /* TODO: Move this also to arc_hash_table. */
- s = bfd_get_section_by_name (dynobj, ".dynbss");
- BFD_ASSERT (s != NULL);
-
-@@ -2020,17 +2149,21 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd,
-
- if (h->needs_copy)
- {
-+ struct elf_arc_link_hash_table *arc_htab = elf_arc_hash_table (info);
-+
-+ if (h->dynindx == -1
-+ || (h->root.type != bfd_link_hash_defined
-+ && h->root.type != bfd_link_hash_defweak)
-+ || arc_htab->srelbss == NULL)
-+ abort ();
-+
- bfd_vma rel_offset = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
-
-- asection *srelbss
-- = bfd_get_section_by_name (h->root.u.def.section->owner,
-- ".rela.bss");
--
-- bfd_byte * loc = srelbss->contents
-- + (srelbss->reloc_count * sizeof (Elf32_External_Rela));
-- srelbss->reloc_count++;
-+ bfd_byte * loc = arc_htab->srelbss->contents
-+ + (arc_htab->srelbss->reloc_count * sizeof (Elf32_External_Rela));
-+ arc_htab->srelbss->reloc_count++;
-
- Elf_Internal_Rela rel;
- rel.r_addend = 0;
-@@ -2394,31 +2527,6 @@ const struct elf_size_info arc_elf32_size_info =
-
- #define elf_backend_size_info arc_elf32_size_info
-
--static struct bfd_link_hash_table *
--arc_elf_link_hash_table_create (bfd *abfd)
--{
-- struct elf_link_hash_table *htab;
--
-- htab = bfd_zmalloc (sizeof (*htab));
-- if (htab == NULL)
-- return NULL;
--
-- if (!_bfd_elf_link_hash_table_init (htab, abfd,
-- _bfd_elf_link_hash_newfunc,
-- sizeof (struct elf_link_hash_entry),
-- GENERIC_ELF_DATA))
-- {
-- free (htab);
-- return NULL;
-- }
--
-- htab->init_got_refcount.refcount = 0;
-- htab->init_got_refcount.glist = NULL;
-- htab->init_got_offset.offset = 0;
-- htab->init_got_offset.glist = NULL;
-- return (struct bfd_link_hash_table *) htab;
--}
--
- /* Hook called by the linker routine which adds symbols from an object
- file. */
-
-@@ -2444,6 +2552,7 @@ elf_arc_add_symbol_hook (bfd * abfd,
- #define TARGET_BIG_SYM arc_elf32_be_vec
- #define TARGET_BIG_NAME "elf32-bigarc"
- #define ELF_ARCH bfd_arch_arc
-+#define ELF_TARGET_ID ARC_ELF_DATA
- #define ELF_MACHINE_CODE EM_ARC_COMPACT
- #define ELF_MACHINE_ALT1 EM_ARC_COMPACT2
- #define ELF_MAXPAGESIZE 0x2000
-@@ -2462,7 +2571,7 @@ elf_arc_add_symbol_hook (bfd * abfd,
-
- #define elf_backend_relocate_section elf_arc_relocate_section
- #define elf_backend_check_relocs elf_arc_check_relocs
--#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
-+#define elf_backend_create_dynamic_sections arc_elf_create_dynamic_sections
-
- #define elf_backend_reloc_type_class elf32_arc_reloc_type_class
-
---
-2.5.5
-
+++ /dev/null
-From 156a0ec59728ae2b27ad84bcf86fec77c01aec5d Mon Sep 17 00:00:00 2001
-From: Cupertino Miranda <cmiranda@synopsys.com>
-Date: Tue, 19 Jul 2016 14:33:34 +0200
-Subject: [PATCH 701/703] Fixed -init, -fini linker options.
-
-ARC was overloading this options by forcing DT_INIT AND DT_FINI
-to always point to _init and _fini, respectively.
-
-Signed-off-by: Cupertino Miranda <cmiranda@synopsys.com>
-Signed-off-by: Vlad Zakharov <vzakhar@synopsys.com>
----
- bfd/elf32-arc.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
-index 17670f0..a0533f2 100644
---- a/bfd/elf32-arc.c
-+++ b/bfd/elf32-arc.c
-@@ -2228,8 +2228,8 @@ elf_arc_finish_dynamic_sections (bfd * output_bfd,
-
- switch (internal_dyn.d_tag)
- {
-- GET_SYMBOL_OR_SECTION (DT_INIT, "_init", NULL)
-- GET_SYMBOL_OR_SECTION (DT_FINI, "_fini", NULL)
-+ GET_SYMBOL_OR_SECTION (DT_INIT, info->init_function, NULL)
-+ GET_SYMBOL_OR_SECTION (DT_FINI, info->fini_function, NULL)
- GET_SYMBOL_OR_SECTION (DT_PLTGOT, NULL, ".plt")
- GET_SYMBOL_OR_SECTION (DT_JMPREL, NULL, ".rela.plt")
- GET_SYMBOL_OR_SECTION (DT_PLTRELSZ, NULL, ".rela.plt")
-@@ -2377,8 +2377,8 @@ elf_arc_size_dynamic_sections (bfd * output_bfd,
- section. Checking if the .init section is present. We also
- create DT_INIT and DT_FINI entries if the init_str has been
- changed by the user. */
-- ADD_DYNAMIC_SYMBOL ("init", DT_INIT);
-- ADD_DYNAMIC_SYMBOL ("fini", DT_FINI);
-+ ADD_DYNAMIC_SYMBOL (info->init_function, DT_INIT);
-+ ADD_DYNAMIC_SYMBOL (info->fini_function, DT_FINI);
- }
- else
- {
---
-2.5.5
-
+++ /dev/null
-From 5bc929f1609ddcc1180d9f004dd0064fa1f351ca Mon Sep 17 00:00:00 2001
-From: Cupertino Miranda <cmiranda@synopsys.com>
-Date: Fri, 22 Jul 2016 13:53:35 +0200
-Subject: [PATCH 702/703] Fix undefined symbols aborting on PIE cases.
-
-In the context of STAR 9000925001.
-Extended check instruction to validate for this case.
-
-Signed-off-by: Cupertino Miranda <cmiranda@synopsys.com>
-Signed-off-by: Vlad Zakharov <vzakhar@synopsys.com>
----
- bfd/elf32-arc.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
-index a0533f2..f4e1521 100644
---- a/bfd/elf32-arc.c
-+++ b/bfd/elf32-arc.c
-@@ -1359,7 +1359,7 @@ elf_arc_relocate_section (bfd * output_bfd,
-
- reloc_data.should_relocate = TRUE;
- }
-- else if (!bfd_link_pic (info))
-+ else if (!bfd_link_pic (info) || bfd_link_executable (info))
- (*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd, input_section,
- rel->r_offset, TRUE);
---
-2.5.5
-
+++ /dev/null
-From d10d05e66fd2f8431a08ceaf8b655bc47ce13a21 Mon Sep 17 00:00:00 2001
-From: Cupertino Miranda <cmiranda@synopsys.com>
-Date: Tue, 26 Jul 2016 17:34:05 +0200
-Subject: [PATCH 703/703] Fixed issue in tvheadend package.
-
-Signed-off-by: Cupertino Miranda <cmiranda@synopsys.com>
-Signed-off-by: Vlad Zakharov <vzakhar@synopsys.com>
----
- bfd/elf32-arc.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
-index f4e1521..857b7b6 100644
---- a/bfd/elf32-arc.c
-+++ b/bfd/elf32-arc.c
-@@ -1747,7 +1747,6 @@ elf_arc_check_relocs (bfd * abfd,
- if ((bfd_link_pic (info))
- && ((r_type != R_ARC_PC32 && r_type != R_ARC_32_PCREL)
- || (h != NULL
-- && h->dynindx != -1
- && (!info->symbolic || !h->def_regular))))
- {
- if (sreloc == NULL)
---
-2.5.5
-
--- /dev/null
+From d76a7549b43974fe8564971a3f40459bc495a8a7 Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Fri, 25 Dec 2015 11:40:53 +0100
+Subject: [PATCH] ld-makefile
+
+[Romain: rebase on top of 2.26]
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ ld/Makefile.am | 2 +-
+ ld/Makefile.in | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/ld/Makefile.am b/ld/Makefile.am
+index 0b3b049..3871c74 100644
+--- a/ld/Makefile.am
++++ b/ld/Makefile.am
+@@ -57,7 +57,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 ed98f87..530e4c9 100644
+--- a/ld/Makefile.in
++++ b/ld/Makefile.in
+@@ -413,7 +413,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS)
+ # 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
+--
+2.4.3
+
--- /dev/null
+From ebe1cba46df52d7bf86def3d681271fd05fb453b Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Fri, 25 Dec 2015 11:41:47 +0100
+Subject: [PATCH] check-ldrunpath-length
+
+[Romain: rebase on top of 2.26]
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ ld/emultempl/elf32.em | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
+index 0405d4f..efd3300 100644
+--- a/ld/emultempl/elf32.em
++++ b/ld/emultempl/elf32.em
+@@ -1242,6 +1242,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;
+@@ -1523,6 +1525,8 @@ gld${EMULATION_NAME}_before_allocation (void)
+ rpath = command_line.rpath;
+ if (rpath == NULL)
+ rpath = (const char *) getenv ("LD_RUN_PATH");
++ if ((rpath) && (strlen (rpath) == 0))
++ rpath = NULL;
+
+ for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+--
+2.4.3
+
--- /dev/null
+From 30628870e583375f8927c04398c7219c6e9f703c Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Fri, 25 Dec 2015 11:42:48 +0100
+Subject: [PATCH] add sysroot fix from bug #3049
+
+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
+
+Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
+[Romain: rebase on top of 2.26]
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ ld/ldfile.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/ld/ldfile.c b/ld/ldfile.c
+index 96f9ecc..1439309 100644
+--- a/ld/ldfile.c
++++ b/ld/ldfile.c
+@@ -335,18 +335,25 @@ ldfile_open_file_search (const char *arch,
+ 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))
+--
+2.4.3
+
--- /dev/null
+From be366461dd49e760440fb28eaee5164eb281adcc Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Fri, 25 Dec 2015 11:45:38 +0100
+Subject: [PATCH] poison-system-directories
+
+Patch adapted to binutils 2.23.2 and extended to use
+BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni.
+
+[Romain: rebase on top of 2.26]
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+[Gustavo: adapt to binutils 2.25]
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+
+Upstream-Status: Inappropriate [distribution: codesourcery]
+
+Patch originally created by Mark Hatle, forward-ported to
+binutils 2.21 by Scott Garman.
+
+purpose: warn for uses of system directories when cross linking
+
+Code Merged from Sourcery G++ binutils 2.19 - 4.4-277
+
+2008-07-02 Joseph Myers <joseph@codesourcery.com>
+
+ ld/
+ * ld.h (args_type): Add error_poison_system_directories.
+ * ld.texinfo (--error-poison-system-directories): Document.
+ * ldfile.c (ldfile_add_library_path): Check
+ command_line.error_poison_system_directories.
+ * ldmain.c (main): Initialize
+ command_line.error_poison_system_directories.
+ * lexsup.c (enum option_values): Add
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
+ (ld_options): Add --error-poison-system-directories.
+ (parse_args): Handle new option.
+
+2007-06-13 Joseph Myers <joseph@codesourcery.com>
+
+ ld/
+ * config.in: Regenerate.
+ * ld.h (args_type): Add poison_system_directories.
+ * ld.texinfo (--no-poison-system-directories): Document.
+ * ldfile.c (ldfile_add_library_path): Check
+ command_line.poison_system_directories.
+ * ldmain.c (main): Initialize
+ command_line.poison_system_directories.
+ * lexsup.c (enum option_values): Add
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES.
+ (ld_options): Add --no-poison-system-directories.
+ (parse_args): Handle new option.
+
+2007-04-20 Joseph Myers <joseph@codesourcery.com>
+
+ Merge from Sourcery G++ binutils 2.17:
+
+ 2007-03-20 Joseph Myers <joseph@codesourcery.com>
+ Based on patch by Mark Hatle <mark.hatle@windriver.com>.
+ ld/
+ * configure.ac (--enable-poison-system-directories): New option.
+ * configure, config.in: Regenerate.
+ * ldfile.c (ldfile_add_library_path): If
+ ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
+ /usr/lib, /usr/local/lib or /usr/X11R6/lib.
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+Signed-off-by: Scott Garman <scott.a.garman@intel.com>
+---
+ ld/config.in | 3 +++
+ ld/configure | 14 ++++++++++++++
+ ld/configure.ac | 10 ++++++++++
+ ld/ld.h | 8 ++++++++
+ ld/ld.texinfo | 12 ++++++++++++
+ ld/ldfile.c | 17 +++++++++++++++++
+ ld/ldlex.h | 2 ++
+ ld/ldmain.c | 2 ++
+ ld/lexsup.c | 21 +++++++++++++++++++++
+ 9 files changed, 89 insertions(+)
+
+diff --git a/ld/config.in b/ld/config.in
+index 276fb77..35c58eb 100644
+--- a/ld/config.in
++++ b/ld/config.in
+@@ -14,6 +14,9 @@
+ language is requested. */
+ #undef ENABLE_NLS
+
++/* Define to warn for use of native system library directories */
++#undef ENABLE_POISON_SYSTEM_DIRECTORIES
++
+ /* Additional extension a shared object might have. */
+ #undef EXTRA_SHLIB_EXTENSION
+
+diff --git a/ld/configure b/ld/configure
+index a446283..d1f9504 100755
+--- a/ld/configure
++++ b/ld/configure
+@@ -786,6 +786,7 @@ with_lib_path
+ enable_targets
+ enable_64_bit_bfd
+ with_sysroot
++enable_poison_system_directories
+ enable_gold
+ enable_got
+ enable_compressed_debug_sections
+@@ -1442,6 +1443,8 @@ Optional Features:
+ --disable-largefile omit support for large files
+ --enable-targets alternative target configurations
+ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
++ --enable-poison-system-directories
++ warn for use of native system library directories
+ --enable-gold[=ARG] build gold [ARG={default,yes,no}]
+ --enable-got=<type> GOT handling scheme (target, single, negative,
+ multigot)
+@@ -15491,7 +15494,18 @@ else
+ fi
+
+
++# Check whether --enable-poison-system-directories was given.
++if test "${enable_poison_system_directories+set}" = set; then :
++ enableval=$enable_poison_system_directories;
++else
++ enable_poison_system_directories=no
++fi
++
++if test "x${enable_poison_system_directories}" = "xyes"; then
+
++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
++
++fi
+
+ # Check whether --enable-got was given.
+ if test "${enable_got+set}" = set; then :
+diff --git a/ld/configure.ac b/ld/configure.ac
+index 188172d..2cd8443 100644
+--- a/ld/configure.ac
++++ b/ld/configure.ac
+@@ -95,6 +95,16 @@ AC_SUBST(use_sysroot)
+ AC_SUBST(TARGET_SYSTEM_ROOT)
+ AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+
++AC_ARG_ENABLE([poison-system-directories],
++ AS_HELP_STRING([--enable-poison-system-directories],
++ [warn for use of native system library directories]),,
++ [enable_poison_system_directories=no])
++if test "x${enable_poison_system_directories}" = "xyes"; then
++ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
++ [1],
++ [Define to warn for use of native system library directories])
++fi
++
+ dnl Use --enable-gold to decide if this linker should be the default.
+ dnl "install_as_default" is set to false if gold is the default linker.
+ dnl "installed_linker" is the installed BFD linker name.
+diff --git a/ld/ld.h b/ld/ld.h
+index d84ec4e..3476b26 100644
+--- a/ld/ld.h
++++ b/ld/ld.h
+@@ -164,6 +164,14 @@ typedef struct {
+ /* If set, display the target memory usage (per memory region). */
+ bfd_boolean print_memory_usage;
+
++ /* If TRUE (the default) warn for uses of system directories when
++ cross linking. */
++ bfd_boolean poison_system_directories;
++
++ /* If TRUE (default FALSE) give an error for uses of system
++ directories when cross linking instead of a warning. */
++ bfd_boolean error_poison_system_directories;
++
+ /* Big or little endian as set on command line. */
+ enum endian_enum endian;
+
+diff --git a/ld/ld.texinfo b/ld/ld.texinfo
+index 1dd7492..fb1438e 100644
+--- a/ld/ld.texinfo
++++ b/ld/ld.texinfo
+@@ -2332,6 +2332,18 @@ string identifying the original linked file does not change.
+
+ Passing @code{none} for @var{style} disables the setting from any
+ @code{--build-id} options earlier on the command line.
++
++@kindex --no-poison-system-directories
++@item --no-poison-system-directories
++Do not warn for @option{-L} options using system directories such as
++@file{/usr/lib} when cross linking. This option is intended for use
++in chroot environments when such directories contain the correct
++libraries for the target system rather than the host.
++
++@kindex --error-poison-system-directories
++@item --error-poison-system-directories
++Give an error instead of a warning for @option{-L} options using
++system directories when cross linking.
+ @end table
+
+ @c man end
+diff --git a/ld/ldfile.c b/ld/ldfile.c
+index 1439309..086b354 100644
+--- a/ld/ldfile.c
++++ b/ld/ldfile.c
+@@ -114,6 +114,23 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline)
+ new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL);
+ else
+ new_dirs->name = xstrdup (name);
++
++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
++ if (command_line.poison_system_directories
++ && ((!strncmp (name, "/lib", 4))
++ || (!strncmp (name, "/usr/lib", 8))
++ || (!strncmp (name, "/usr/local/lib", 14))
++ || (!strncmp (name, "/usr/X11R6/lib", 14))))
++ {
++ if (command_line.error_poison_system_directories)
++ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
++ "cross-compilation\n"), name);
++ else
++ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
++ "cross-compilation\n"), name);
++ }
++#endif
++
+ }
+
+ /* Try to open a BFD for a lang_input_statement. */
+diff --git a/ld/ldlex.h b/ld/ldlex.h
+index 6f11e7b..0ca3110 100644
+--- a/ld/ldlex.h
++++ b/ld/ldlex.h
+@@ -144,6 +144,8 @@ enum option_values
+ OPTION_PRINT_MEMORY_USAGE,
+ OPTION_REQUIRE_DEFINED_SYMBOL,
+ OPTION_ORPHAN_HANDLING,
++ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
+ };
+
+ /* The initial parser states. */
+diff --git a/ld/ldmain.c b/ld/ldmain.c
+index bb0b9cc..a23c56c 100644
+--- a/ld/ldmain.c
++++ b/ld/ldmain.c
+@@ -257,6 +257,8 @@ main (int argc, char **argv)
+ command_line.warn_mismatch = TRUE;
+ command_line.warn_search_mismatch = TRUE;
+ command_line.check_section_addresses = -1;
++ command_line.poison_system_directories = TRUE;
++ command_line.error_poison_system_directories = FALSE;
+
+ /* We initialize DEMANGLING based on the environment variable
+ COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
+diff --git a/ld/lexsup.c b/ld/lexsup.c
+index 4cad209..be7d584 100644
+--- a/ld/lexsup.c
++++ b/ld/lexsup.c
+@@ -530,6 +530,14 @@ static const struct ld_option ld_options[] =
+ { {"orphan-handling", required_argument, NULL, OPTION_ORPHAN_HANDLING},
+ '\0', N_("=MODE"), N_("Control how orphan sections are handled."),
+ TWO_DASHES },
++ { {"no-poison-system-directories", no_argument, NULL,
++ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
++ '\0', NULL, N_("Do not warn for -L options using system directories"),
++ TWO_DASHES },
++ { {"error-poison-system-directories", no_argument, NULL,
++ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
++ '\0', NULL, N_("Give an error for -L options using system directories"),
++ TWO_DASHES },
+ };
+
+ #define OPTION_COUNT ARRAY_SIZE (ld_options)
+@@ -542,6 +550,7 @@ parse_args (unsigned argc, char **argv)
+ int ingroup = 0;
+ char *default_dirlist = NULL;
+ char *shortopts;
++ char *BR_paranoid_env;
+ struct option *longopts;
+ struct option *really_longopts;
+ int last_optind;
+@@ -1516,6 +1525,14 @@ parse_args (unsigned argc, char **argv)
+ }
+ break;
+
++ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
++ command_line.poison_system_directories = FALSE;
++ break;
++
++ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
++ command_line.error_poison_system_directories = TRUE;
++ break;
++
+ case OPTION_PUSH_STATE:
+ input_flags.pushed = xmemdup (&input_flags,
+ sizeof (input_flags),
+@@ -1559,6 +1576,10 @@ parse_args (unsigned argc, char **argv)
+ command_line.soname = NULL;
+ }
+
++ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH");
++ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0)
++ command_line.error_poison_system_directories = TRUE;
++
+ while (ingroup)
+ {
+ lang_leave_group ();
+--
+2.4.3
+
sha512 9d9165609fd3b0f20d616f9891fc8e2b466eb13e2bfce40125e12427f8f201d20e2b8322bb6cb2b45e8df812f0e8ac059149f8a1f69ba3ed9d86a35c6a540b67 binutils-2.26.1.tar.bz2
# Locally calculated (fetched from Github)
-sha512 ab2914329cd2c725de567d7d2b6c3018779f0c3109dcbb26663e379d38434f48fd35cd46f680cc47165b6dc77aa35571ed2c09499161fd11bb86dcf5fa7ec068 binutils-arc-2016.09-eng008.tar.gz
+sha512 32d2f04ec62ee0491fd711baf7e6f28052170b1fa4cb8f6046ca4709e03250335a65b362295c13c7c44f8a28d91d2c54b0ab7c8f0f2e2324ea8ba2c80cbee29a binutils-arc-2016.09-eng010.tar.gz
BINUTILS_VERSION = $(call qstrip,$(BR2_BINUTILS_VERSION))
ifeq ($(BINUTILS_VERSION),)
ifeq ($(BR2_arc),y)
-BINUTILS_VERSION = arc-2016.09-eng008
+BINUTILS_VERSION = arc-2016.09-eng010
else
BINUTILS_VERSION = 2.25.1
endif
default "4.9.4" if BR2_GCC_VERSION_4_9_X
default "5.4.0" if BR2_GCC_VERSION_5_X
default "6.1.0" if BR2_GCC_VERSION_6_X
- default "arc-2016.09-eng008" if BR2_GCC_VERSION_4_8_ARC
+ default "arc-2016.09-eng010" if BR2_GCC_VERSION_4_8_ARC
config BR2_EXTRA_GCC_CONFIG_OPTIONS
string "Additional gcc options"
+++ /dev/null
-Index: b/boehm-gc/include/gc.h
-===================================================================
---- a/boehm-gc/include/gc.h
-+++ b/boehm-gc/include/gc.h
-@@ -503,7 +503,7 @@
- #if defined(__linux__) || defined(__GLIBC__)
- # include <features.h>
- # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
-- && !defined(__ia64__)
-+ && !defined(__ia64__) && !defined(__UCLIBC__)
- # ifndef GC_HAVE_BUILTIN_BACKTRACE
- # define GC_HAVE_BUILTIN_BACKTRACE
- # endif
+++ /dev/null
-[PATCH] cilk: fix build without wchar
-
-When building against uClibc with wchar support disabled, WCHAR_MIN and
-WCHAR_MAX are not defined leading to compilation errors.
-
-Fix it by only including the wchar code if available.
-
-Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
----
- libcilkrts/include/cilk/reducer_min_max.h | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-Index: b/libcilkrts/include/cilk/reducer_min_max.h
-===================================================================
---- a/libcilkrts/include/cilk/reducer_min_max.h
-+++ b/libcilkrts/include/cilk/reducer_min_max.h
-@@ -3154,7 +3154,9 @@
- CILK_C_REDUCER_MAX_INSTANCE(char, char, CHAR_MIN)
- CILK_C_REDUCER_MAX_INSTANCE(unsigned char, uchar, 0)
- CILK_C_REDUCER_MAX_INSTANCE(signed char, schar, SCHAR_MIN)
-+#ifdef WCHAR_MIN
- CILK_C_REDUCER_MAX_INSTANCE(wchar_t, wchar_t, WCHAR_MIN)
-+#endif
- CILK_C_REDUCER_MAX_INSTANCE(short, short, SHRT_MIN)
- CILK_C_REDUCER_MAX_INSTANCE(unsigned short, ushort, 0)
- CILK_C_REDUCER_MAX_INSTANCE(int, int, INT_MIN)
-@@ -3306,7 +3308,9 @@
- CILK_C_REDUCER_MAX_INDEX_INSTANCE(char, char, CHAR_MIN)
- CILK_C_REDUCER_MAX_INDEX_INSTANCE(unsigned char, uchar, 0)
- CILK_C_REDUCER_MAX_INDEX_INSTANCE(signed char, schar, SCHAR_MIN)
-+#ifdef WCHAR_MIN
- CILK_C_REDUCER_MAX_INDEX_INSTANCE(wchar_t, wchar_t, WCHAR_MIN)
-+#endif
- CILK_C_REDUCER_MAX_INDEX_INSTANCE(short, short, SHRT_MIN)
- CILK_C_REDUCER_MAX_INDEX_INSTANCE(unsigned short, ushort, 0)
- CILK_C_REDUCER_MAX_INDEX_INSTANCE(int, int, INT_MIN)
-@@ -3432,7 +3436,9 @@
- CILK_C_REDUCER_MIN_INSTANCE(char, char, CHAR_MAX)
- CILK_C_REDUCER_MIN_INSTANCE(unsigned char, uchar, CHAR_MAX)
- CILK_C_REDUCER_MIN_INSTANCE(signed char, schar, SCHAR_MAX)
-+#ifdef WCHAR_MAX
- CILK_C_REDUCER_MIN_INSTANCE(wchar_t, wchar_t, WCHAR_MAX)
-+#endif
- CILK_C_REDUCER_MIN_INSTANCE(short, short, SHRT_MAX)
- CILK_C_REDUCER_MIN_INSTANCE(unsigned short, ushort, USHRT_MAX)
- CILK_C_REDUCER_MIN_INSTANCE(int, int, INT_MAX)
-@@ -3584,7 +3590,9 @@
- CILK_C_REDUCER_MIN_INDEX_INSTANCE(char, char, CHAR_MAX)
- CILK_C_REDUCER_MIN_INDEX_INSTANCE(unsigned char, uchar, CHAR_MAX)
- CILK_C_REDUCER_MIN_INDEX_INSTANCE(signed char, schar, SCHAR_MAX)
-+#ifdef WCHAR_MAX
- CILK_C_REDUCER_MIN_INDEX_INSTANCE(wchar_t, wchar_t, WCHAR_MAX)
-+#endif
- CILK_C_REDUCER_MIN_INDEX_INSTANCE(short, short, SHRT_MAX)
- CILK_C_REDUCER_MIN_INDEX_INSTANCE(unsigned short, ushort, USHRT_MAX)
- CILK_C_REDUCER_MIN_INDEX_INSTANCE(int, int, INT_MAX)
+++ /dev/null
-Enable POSIX threads for uClinux targets
-Reported upstream:
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71721
-
-Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
-
-diff -Nur gcc-6.1.0.orig/gcc/config.gcc gcc-6.1.0/gcc/config.gcc
---- gcc-6.1.0.orig/gcc/config.gcc 2016-04-11 12:14:59.000000000 +0200
-+++ gcc-6.1.0/gcc/config.gcc 2016-07-02 20:04:25.732169982 +0200
-@@ -833,6 +833,9 @@
- *-*-uclinux*)
- extra_options="$extra_options gnu-user.opt"
- use_gcc_stdint=wrap
-+ case ${enable_threads} in
-+ "" | yes | posix) thread_file='posix' ;;
-+ esac
- tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC"
- ;;
- *-*-rdos*)
+++ /dev/null
-From e569e9c2ce2273f5175e0928efd6e45c3e71c45f Mon Sep 17 00:00:00 2001
-From: Claudiu Zissulescu <claziss@synopsys.com>
-Date: Mon, 22 Aug 2016 19:58:25 +0200
-Subject: [PATCH] [ARC] Fix conditional move contstraint
-
-Move pattern (movsi_insn) allows predicated instructions to be
-instructions which can hold all registers. However, the conditional
-variant doesn't. This patch fixes this problem.
-
-2016-08-22 Claudiu Zissulescu <claziss@synopsys.com>
-
- * config/arc/arc.md (movsi_cond_exec): Update constraint.
-
-Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
----
- gcc/config/arc/arc.md | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
-index d87174a..607c6e6 100644
---- a/gcc/config/arc/arc.md
-+++ b/gcc/config/arc/arc.md
-@@ -3603,7 +3603,7 @@
- (match_operator 3 "proper_comparison_operator"
- [(match_operand 2 "cc_register" "Rcc,Rcc") (const_int 0)])
- (set (match_operand:SI 0 "dest_reg_operand" "=w,w")
-- (match_operand:SI 1 "nonmemory_operand" "Lc,?Cal")))]
-+ (match_operand:SI 1 "nonmemory_operand" "LRac,?Cal")))]
- ""
- "mov.%d3 %0,%S1"
- [(set_attr "type" "cmove")
---
-2.6.3
-
--- /dev/null
+Index: b/boehm-gc/include/gc.h
+===================================================================
+--- a/boehm-gc/include/gc.h
++++ b/boehm-gc/include/gc.h
+@@ -503,7 +503,7 @@
+ #if defined(__linux__) || defined(__GLIBC__)
+ # include <features.h>
+ # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
+- && !defined(__ia64__)
++ && !defined(__ia64__) && !defined(__UCLIBC__)
+ # ifndef GC_HAVE_BUILTIN_BACKTRACE
+ # define GC_HAVE_BUILTIN_BACKTRACE
+ # endif
--- /dev/null
+[PATCH] cilk: fix build without wchar
+
+When building against uClibc with wchar support disabled, WCHAR_MIN and
+WCHAR_MAX are not defined leading to compilation errors.
+
+Fix it by only including the wchar code if available.
+
+Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
+---
+ libcilkrts/include/cilk/reducer_min_max.h | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+Index: b/libcilkrts/include/cilk/reducer_min_max.h
+===================================================================
+--- a/libcilkrts/include/cilk/reducer_min_max.h
++++ b/libcilkrts/include/cilk/reducer_min_max.h
+@@ -3154,7 +3154,9 @@
+ CILK_C_REDUCER_MAX_INSTANCE(char, char, CHAR_MIN)
+ CILK_C_REDUCER_MAX_INSTANCE(unsigned char, uchar, 0)
+ CILK_C_REDUCER_MAX_INSTANCE(signed char, schar, SCHAR_MIN)
++#ifdef WCHAR_MIN
+ CILK_C_REDUCER_MAX_INSTANCE(wchar_t, wchar_t, WCHAR_MIN)
++#endif
+ CILK_C_REDUCER_MAX_INSTANCE(short, short, SHRT_MIN)
+ CILK_C_REDUCER_MAX_INSTANCE(unsigned short, ushort, 0)
+ CILK_C_REDUCER_MAX_INSTANCE(int, int, INT_MIN)
+@@ -3306,7 +3308,9 @@
+ CILK_C_REDUCER_MAX_INDEX_INSTANCE(char, char, CHAR_MIN)
+ CILK_C_REDUCER_MAX_INDEX_INSTANCE(unsigned char, uchar, 0)
+ CILK_C_REDUCER_MAX_INDEX_INSTANCE(signed char, schar, SCHAR_MIN)
++#ifdef WCHAR_MIN
+ CILK_C_REDUCER_MAX_INDEX_INSTANCE(wchar_t, wchar_t, WCHAR_MIN)
++#endif
+ CILK_C_REDUCER_MAX_INDEX_INSTANCE(short, short, SHRT_MIN)
+ CILK_C_REDUCER_MAX_INDEX_INSTANCE(unsigned short, ushort, 0)
+ CILK_C_REDUCER_MAX_INDEX_INSTANCE(int, int, INT_MIN)
+@@ -3432,7 +3436,9 @@
+ CILK_C_REDUCER_MIN_INSTANCE(char, char, CHAR_MAX)
+ CILK_C_REDUCER_MIN_INSTANCE(unsigned char, uchar, CHAR_MAX)
+ CILK_C_REDUCER_MIN_INSTANCE(signed char, schar, SCHAR_MAX)
++#ifdef WCHAR_MAX
+ CILK_C_REDUCER_MIN_INSTANCE(wchar_t, wchar_t, WCHAR_MAX)
++#endif
+ CILK_C_REDUCER_MIN_INSTANCE(short, short, SHRT_MAX)
+ CILK_C_REDUCER_MIN_INSTANCE(unsigned short, ushort, USHRT_MAX)
+ CILK_C_REDUCER_MIN_INSTANCE(int, int, INT_MAX)
+@@ -3584,7 +3590,9 @@
+ CILK_C_REDUCER_MIN_INDEX_INSTANCE(char, char, CHAR_MAX)
+ CILK_C_REDUCER_MIN_INDEX_INSTANCE(unsigned char, uchar, CHAR_MAX)
+ CILK_C_REDUCER_MIN_INDEX_INSTANCE(signed char, schar, SCHAR_MAX)
++#ifdef WCHAR_MAX
+ CILK_C_REDUCER_MIN_INDEX_INSTANCE(wchar_t, wchar_t, WCHAR_MAX)
++#endif
+ CILK_C_REDUCER_MIN_INDEX_INSTANCE(short, short, SHRT_MAX)
+ CILK_C_REDUCER_MIN_INDEX_INSTANCE(unsigned short, ushort, USHRT_MAX)
+ CILK_C_REDUCER_MIN_INDEX_INSTANCE(int, int, INT_MAX)
--- /dev/null
+Enable POSIX threads for uClinux targets
+Reported upstream:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71721
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-6.1.0.orig/gcc/config.gcc gcc-6.1.0/gcc/config.gcc
+--- gcc-6.1.0.orig/gcc/config.gcc 2016-04-11 12:14:59.000000000 +0200
++++ gcc-6.1.0/gcc/config.gcc 2016-07-02 20:04:25.732169982 +0200
+@@ -833,6 +833,9 @@
+ *-*-uclinux*)
+ extra_options="$extra_options gnu-user.opt"
+ use_gcc_stdint=wrap
++ case ${enable_threads} in
++ "" | yes | posix) thread_file='posix' ;;
++ esac
+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC"
+ ;;
+ *-*-rdos*)
sha512 eeed3e2018b8c012aabce419e8d718fde701e5c3c179b4486c61ba46e5736eecc8fccdd18b01fcd973a42c6ad3116dbbe2ee247fe3757d622d373f93ebaf8d2e gcc-6.1.0.tar.bz2
# Locally calculated (fetched from Github)
-sha512 481302b50c8d6a3db3ea0a3c3713666d3aea990461cf0e1e0a670a2db90b8f2024e02a2fab6f2e7ccba14a92ca82218db0b585ace1aa932f5ae109e21ddbc83e gcc-arc-2016.09-eng008.tar.gz
+sha512 a788737022c178a1e7704e4ecd3438937f2239bf27fd487db2b00e4bb5c6604535842e4d6798f120488bdbf0b226fa9c94f4b8aede4ce9d20b0add6bcec82927 gcc-arc-2016.09-eng010.tar.gz