Bump buildroot to 2019.02

This commit is contained in:
2019-03-28 22:49:48 +01:00
parent 5598b1b762
commit 920d307141
5121 changed files with 78550 additions and 46132 deletions

View File

@@ -1,21 +0,0 @@
Fixes: LINKER BUG: .rofixup section size mismatch
Workaround from adi-toolchain commit:
af414ec1fb628ddb1562f062f3db49823ca14ca2
[#6798] binutils-2.21/bfd: temp workaround for rofixup mismatch errors.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
diff -Nur binutils-2.26.1.orig/bfd/elf32-bfin.c binutils-2.26.1/bfd/elf32-bfin.c
--- binutils-2.26.1.orig/bfd/elf32-bfin.c 2015-11-13 09:27:40.000000000 +0100
+++ binutils-2.26.1/bfd/elf32-bfin.c 2016-07-31 00:50:48.357995132 +0200
@@ -4879,7 +4879,8 @@
case R_BFIN_FUNCDESC:
picrel->fd++;
- picrel->relocsfd++;
+ if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
+ picrel->relocsfd++;
break;
/* This relocation describes the C++ object vtable hierarchy.

View File

@@ -1,21 +0,0 @@
Fixes: LINKER BUG: .rofixup section size mismatch
Workaround from adi-toolchain commit:
af414ec1fb628ddb1562f062f3db49823ca14ca2
[#6798] binutils-2.21/bfd: temp workaround for rofixup mismatch errors.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
diff -Nur binutils-2.26.1.orig/bfd/elf32-bfin.c binutils-2.26.1/bfd/elf32-bfin.c
--- binutils-2.26.1.orig/bfd/elf32-bfin.c 2015-11-13 09:27:40.000000000 +0100
+++ binutils-2.26.1/bfd/elf32-bfin.c 2016-07-31 00:50:48.357995132 +0200
@@ -4845,7 +4845,8 @@
case R_BFIN_FUNCDESC:
picrel->fd++;
- picrel->relocsfd++;
+ if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
+ picrel->relocsfd++;
break;
/* This relocation describes the C++ object vtable hierarchy.

View File

@@ -1,31 +0,0 @@
From 122de3b633f4273826a2d01702d7c515f93ec2be Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Sat, 29 Jul 2017 14:08:20 +0200
Subject: [PATCH] Fixes: LINKER BUG: .rofixup section size mismatch
Workaround from adi-toolchain commit:
af414ec1fb628ddb1562f062f3db49823ca14ca2
[#6798] binutils-2.21/bfd: temp workaround for rofixup mismatch errors.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
bfd/elf32-bfin.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index b3e09bd..660eec5 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -4845,7 +4845,8 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_BFIN_FUNCDESC:
picrel->fd++;
- picrel->relocsfd++;
+ if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
+ picrel->relocsfd++;
break;
/* This relocation describes the C++ object vtable hierarchy.
--
2.9.4

View File

@@ -0,0 +1,197 @@
From 141346d3968bdc82d3e487f3effdc3f835a09403 Mon Sep 17 00:00:00 2001
From: Cupertino Miranda <cmiranda@synopsys.com>
Date: Fri, 2 Mar 2018 17:16:21 +0100
Subject: [PATCH] [ARC] Refactored location where GOT information is
collected.
Change location where GOT information is collected for ARC target, avoiding
posible use conflicts of the previous .got field in the symbols hash_entry.
bfd/
2018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
* arc-got.h (get_got_entry_list_for_symbol): Changed.
* ef32-arc.c (struct elf_arc_link_hash_entry): Moved and changed.
(elf_arc_link_hash_newfunc): Changed.
(arc_elf_link_hash_table_create): Removed old initializations.
(elf_arc_relocate_section, elf_arc_finish_dynamic_symbol): Changed.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
bfd/arc-got.h | 6 ++--
bfd/elf32-arc.c | 77 +++++++++++++++++++++++++++----------------------
2 files changed, 46 insertions(+), 37 deletions(-)
diff --git a/bfd/arc-got.h b/bfd/arc-got.h
index a86061bcb38f..81ce88fe21a0 100644
--- a/bfd/arc-got.h
+++ b/bfd/arc-got.h
@@ -156,9 +156,11 @@ get_got_entry_list_for_symbol (bfd *abfd,
unsigned long r_symndx,
struct elf_link_hash_entry *h)
{
- if (h != NULL)
+ struct elf_arc_link_hash_entry *h1 =
+ ((struct elf_arc_link_hash_entry *) h);
+ if (h1 != NULL)
{
- return &h->got.glist;
+ return &h1->got_ents;
}
else
{
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 5921cc25259e..166a5ef604ff 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -159,6 +159,18 @@ struct arc_relocation_data
const char * symbol_name;
};
+/* 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;
+
+ struct got_entry *got_ents;
+};
+
+
/* Should be included at this location due to static declarations
* defined before this point. */
#include "arc-got.h"
@@ -275,15 +287,6 @@ 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
{
@@ -295,28 +298,28 @@ elf_arc_link_hash_newfunc (struct bfd_hash_entry *entry,
struct bfd_hash_table *table,
const char *string)
{
+ struct elf_arc_link_hash_entry * ret =
+ (struct elf_arc_link_hash_entry *) entry;
+
/* 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;
- }
+ if (ret == NULL)
+ ret = (struct elf_arc_link_hash_entry *)
+ bfd_hash_allocate (table, sizeof (struct elf_arc_link_hash_entry));
+ if (ret == NULL)
+ return (struct bfd_hash_entry *) ret;
/* Call the allocation method of the superclass. */
- entry = _bfd_elf_link_hash_newfunc (entry, table, string);
- if (entry != NULL)
+ ret = ((struct elf_arc_link_hash_entry *)
+ _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
+ table, string));
+ if (ret != NULL)
{
- struct elf_arc_link_hash_entry *eh;
-
- eh = (struct elf_arc_link_hash_entry *) entry;
- eh->dyn_relocs = NULL;
+ ret->dyn_relocs = NULL;
+ ret->got_ents = NULL;
}
- return entry;
+ return (struct bfd_hash_entry *) ret;
}
/* Destroy an ARC ELF linker hash table. */
@@ -346,11 +349,6 @@ arc_elf_link_hash_table_create (bfd *abfd)
return 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;
-
ret->elf.root.hash_table_free = elf_arc_link_hash_table_free;
return &ret->elf.root;
@@ -1598,10 +1596,14 @@ elf_arc_relocate_section (bfd * output_bfd,
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
{
- struct elf_link_hash_entry *h_old = h;
+ struct elf_arc_link_hash_entry *ah_old =
+ (struct elf_arc_link_hash_entry *) h;
h = (struct elf_link_hash_entry *) h->root.u.i.link;
- if (h->got.glist == 0 && h_old->got.glist != h->got.glist)
- h->got.glist = h_old->got.glist;
+ struct elf_arc_link_hash_entry *ah =
+ (struct elf_arc_link_hash_entry *) h;
+
+ if (ah->got_ents == 0 && ah_old->got_ents != ah->got_ents)
+ ah->got_ents = ah_old->got_ents;
}
/* TODO: Need to validate what was the intention. */
@@ -1619,6 +1621,8 @@ elf_arc_relocate_section (bfd * output_bfd,
if (is_reloc_for_GOT (howto) && !bfd_link_pic (info))
{
+ struct elf_arc_link_hash_entry *ah =
+ (struct elf_arc_link_hash_entry *) h;
/* TODO: Change it to use arc_do_relocation with
ARC_32 reloc. Try to use ADD_RELA macro. */
bfd_vma relocation =
@@ -1628,8 +1632,8 @@ elf_arc_relocate_section (bfd * output_bfd,
+ reloc_data.sym_section->output_section->vma)
: 0);
- BFD_ASSERT (h->got.glist);
- bfd_vma got_offset = h->got.glist->offset;
+ BFD_ASSERT (ah->got_ents);
+ bfd_vma got_offset = ah->got_ents->offset;
bfd_put_32 (output_bfd, relocation,
htab->sgot->contents + got_offset);
}
@@ -1941,6 +1945,7 @@ elf_arc_check_relocs (bfd * abfd,
else /* Global one. */
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
switch (r_type)
{
case R_ARC_32:
@@ -2387,7 +2392,9 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd,
create respective dynamic relocs. */
/* TODO: Make function to get list and not access the list directly. */
/* TODO: Move function to relocate_section create this relocs eagerly. */
- create_got_dynrelocs_for_got_info (&h->got.glist,
+ struct elf_arc_link_hash_entry *ah =
+ (struct elf_arc_link_hash_entry *) h;
+ create_got_dynrelocs_for_got_info (&ah->got_ents,
output_bfd,
info,
h);
--
2.17.1

View File

@@ -1,31 +0,0 @@
From c3bd478ac1b7e83765230505eb08a0acf2fe3867 Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Sat, 29 Jul 2017 14:08:20 +0200
Subject: [PATCH] Fixes: LINKER BUG: .rofixup section size mismatch
Workaround from adi-toolchain commit:
af414ec1fb628ddb1562f062f3db49823ca14ca2
[#6798] binutils-2.21/bfd: temp workaround for rofixup mismatch errors.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
bfd/elf32-bfin.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index 478b8d4731..a38519b585 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -4655,7 +4655,8 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_BFIN_FUNCDESC:
picrel->fd++;
- picrel->relocsfd++;
+ if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
+ picrel->relocsfd++;
break;
/* This relocation describes the C++ object vtable hierarchy.
--
2.14.3

View File

@@ -0,0 +1,34 @@
From 4bac50c2c94023cb1b5bf947abfb1c72eeeb12d5 Mon Sep 17 00:00:00 2001
From: Cupertino Miranda <cmiranda@synopsys.com>
Date: Fri, 2 Mar 2018 17:33:48 +0100
Subject: [PATCH] [ARC] Improved robustness. Return FALSE in case of NULL
pointer.
bfd/
2018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
* elf32-arc.c (elf_arc_finish_dynamic_symbol) Return FALSE in case
arc_htab is NULL.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
bfd/elf32-arc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 166a5ef604ff..72b808b99127 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -2403,6 +2403,9 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd,
{
struct elf_arc_link_hash_table *arc_htab = elf_arc_hash_table (info);
+ if(arc_htab == NULL)
+ return FALSE;
+
if (h->dynindx == -1
|| (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
--
2.17.1

View File

@@ -0,0 +1,42 @@
From b182c9f81daa08cf18cd78af3e7aca74640e8551 Mon Sep 17 00:00:00 2001
From: Cupertino Miranda <cmiranda@synopsys.com>
Date: Fri, 2 Mar 2018 17:38:14 +0100
Subject: [PATCH] [ARC] Make sure global symbol is not an indirect or
warning.
Problem identified in the context of glibc with latest upstream binutils.
Dynamic symbol space was being reserved but, no actual information for the
symbol was being set. Data for the symbol was kept initialized with -1.
No easy test case was possible to be created.
bfd/
2018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
* elf32-arc.c (elf_arc_check_relocs): Changed.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
bfd/elf32-arc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 72b808b99127..6f6470f6f202 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -1943,7 +1943,12 @@ elf_arc_check_relocs (bfd * abfd,
if (r_symndx < symtab_hdr->sh_info) /* Is a local symbol. */
h = NULL;
else /* Global one. */
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ }
switch (r_type)
--
2.17.1

View File

@@ -0,0 +1,35 @@
From e2f2d7f939435280003983ef822acd0844648643 Mon Sep 17 00:00:00 2001
From: Cupertino Miranda <cmiranda@synopsys.com>
Date: Fri, 2 Mar 2018 17:44:29 +0100
Subject: [PATCH] [ARC] PLT information was still being generated when
symbol was forced_local.
A change upstream reveiled this issue, triggering an assert when linking glibc.
bfd/
2018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
* elf32-arc.c (elf_arc_check_relocs): Changed.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
bfd/elf32-arc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 6f6470f6f202..184957c7d750 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -2024,7 +2024,8 @@ elf_arc_check_relocs (bfd * abfd,
if (h == NULL)
continue;
else
- h->needs_plt = 1;
+ if(h->forced_local == 0)
+ h->needs_plt = 1;
}
/* Add info to the symbol got_entry_list. */
--
2.17.1

View File

@@ -0,0 +1,48 @@
From ac36af7d97d7920512068316fac6159aead97a01 Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Fri, 25 Dec 2015 11:38:13 +0100
Subject: [PATCH] sh-conf
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).
[Romain: rebase on top of 2.26]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
[Thomas: rebase on top of 2.29, in which sh64 support was removed.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 462ad053066..27cb5571d0d 100755
--- a/configure
+++ b/configure
@@ -3855,7 +3855,7 @@ case "${target}" in
nvptx*-*-*)
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
;;
- sh-*-*)
+ sh*-*-*)
case "${target}" in
sh*-*-elf)
;;
diff --git a/configure.ac b/configure.ac
index a638f694134..2fd7bce1576 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1152,7 +1152,7 @@ case "${target}" in
nvptx*-*-*)
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
;;
- sh-*-*)
+ sh*-*-*)
case "${target}" in
sh*-*-elf)
;;
--
2.14.4

View File

@@ -1,4 +1,4 @@
From b100e9d16bfe6725b2624902af457ecfa490b150 Mon Sep 17 00:00:00 2001
From 7d1e6ed1d57e839207e0ece7561bd4709032de9f 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
@@ -70,7 +70,7 @@ Signed-off-by: Scott Garman <scott.a.garman@intel.com>
ld/configure | 14 ++++++++++++++
ld/configure.ac | 10 ++++++++++
ld/ld.h | 8 ++++++++
ld/ld.texinfo | 12 ++++++++++++
ld/ld.texi | 12 ++++++++++++
ld/ldfile.c | 17 +++++++++++++++++
ld/ldlex.h | 2 ++
ld/ldmain.c | 2 ++
@@ -78,10 +78,10 @@ Signed-off-by: Scott Garman <scott.a.garman@intel.com>
9 files changed, 89 insertions(+)
diff --git a/ld/config.in b/ld/config.in
index 5d91380..ffe84a7 100644
index d93c9b0..5da2742 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -21,6 +21,9 @@
@@ -31,6 +31,9 @@
language is requested. */
#undef ENABLE_NLS
@@ -92,10 +92,10 @@ index 5d91380..ffe84a7 100644
#undef EXTRA_SHLIB_EXTENSION
diff --git a/ld/configure b/ld/configure
index da20ab5..63e3da7 100755
index 300a272..d68890f 100755
--- a/ld/configure
+++ b/ld/configure
@@ -785,6 +785,7 @@ with_lib_path
@@ -822,6 +822,7 @@ with_lib_path
enable_targets
enable_64_bit_bfd
with_sysroot
@@ -103,7 +103,7 @@ index da20ab5..63e3da7 100755
enable_gold
enable_got
enable_compressed_debug_sections
@@ -1443,6 +1444,8 @@ Optional Features:
@@ -1486,6 +1487,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)
@@ -112,7 +112,7 @@ index da20ab5..63e3da7 100755
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
@@ -15497,7 +15500,18 @@ else
@@ -15803,7 +15806,18 @@ else
fi
@@ -132,10 +132,10 @@ index da20ab5..63e3da7 100755
# Check whether --enable-got was given.
if test "${enable_got+set}" = set; then :
diff --git a/ld/configure.ac b/ld/configure.ac
index 34315e6..5ade9a0 100644
index d10c553..9f1b57b 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -95,6 +95,16 @@ AC_SUBST(use_sysroot)
@@ -94,6 +94,16 @@ AC_SUBST(use_sysroot)
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
@@ -153,10 +153,10 @@ index 34315e6..5ade9a0 100644
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 162e156..7d6d7ef 100644
index ba914b9..9df17da 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -177,6 +177,14 @@ typedef struct
@@ -180,6 +180,14 @@ typedef struct
in the linker script. */
bfd_boolean force_group_allocation;
@@ -171,11 +171,11 @@ index 162e156..7d6d7ef 100644
/* Big or little endian as set on command line. */
enum endian_enum endian;
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index bb5f719..78501e4 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -2480,6 +2480,18 @@ string identifying the original linked file does not change.
diff --git a/ld/ld.texi b/ld/ld.texi
index 40d79dd..137d46c 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -2479,6 +2479,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.
@@ -195,7 +195,7 @@ index bb5f719..78501e4 100644
@c man end
diff --git a/ld/ldfile.c b/ld/ldfile.c
index f7e5473..2cd84d3 100644
index b3d166c..3dcbf66 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -116,6 +116,23 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline)
@@ -223,10 +223,10 @@ index f7e5473..2cd84d3 100644
/* Try to open a BFD for a lang_input_statement. */
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 5aa7f6b..cb655e0 100644
index 04d6fd5..d7df005 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -147,6 +147,8 @@ enum option_values
@@ -148,6 +148,8 @@ enum option_values
OPTION_REQUIRE_DEFINED_SYMBOL,
OPTION_ORPHAN_HANDLING,
OPTION_FORCE_GROUP_ALLOCATION,
@@ -236,10 +236,10 @@ index 5aa7f6b..cb655e0 100644
/* The initial parser states. */
diff --git a/ld/ldmain.c b/ld/ldmain.c
index ee5ab11..5f6effd 100644
index f31eeb2..25f8497 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -270,6 +270,8 @@ main (int argc, char **argv)
@@ -268,6 +268,8 @@ main (int argc, char **argv)
command_line.warn_mismatch = TRUE;
command_line.warn_search_mismatch = TRUE;
command_line.check_section_addresses = -1;
@@ -249,10 +249,10 @@ index ee5ab11..5f6effd 100644
/* 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 08106bc..d619d50 100644
index 86a033a..f07f095 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -538,6 +538,14 @@ static const struct ld_option ld_options[] =
@@ -543,6 +543,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 },
@@ -267,7 +267,7 @@ index 08106bc..d619d50 100644
};
#define OPTION_COUNT ARRAY_SIZE (ld_options)
@@ -550,6 +558,7 @@ parse_args (unsigned argc, char **argv)
@@ -555,6 +563,7 @@ parse_args (unsigned argc, char **argv)
int ingroup = 0;
char *default_dirlist = NULL;
char *shortopts;
@@ -275,9 +275,9 @@ index 08106bc..d619d50 100644
struct option *longopts;
struct option *really_longopts;
int last_optind;
@@ -1534,6 +1543,14 @@ parse_args (unsigned argc, char **argv)
}
break;
@@ -1543,6 +1552,14 @@ parse_args (unsigned argc, char **argv)
}
break;
+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
+ command_line.poison_system_directories = FALSE;
@@ -290,7 +290,7 @@ index 08106bc..d619d50 100644
case OPTION_PUSH_STATE:
input_flags.pushed = xmemdup (&input_flags,
sizeof (input_flags),
@@ -1577,6 +1594,10 @@ parse_args (unsigned argc, char **argv)
@@ -1586,6 +1603,10 @@ parse_args (unsigned argc, char **argv)
command_line.soname = NULL;
}
@@ -302,5 +302,5 @@ index 08106bc..d619d50 100644
{
lang_leave_group ();
--
2.9.4
2.7.4

View File

@@ -0,0 +1,198 @@
From d930affa2d475d1cc6792f1e6d56bef3d6c617db Mon Sep 17 00:00:00 2001
From: Cupertino Miranda <cmiranda@synopsys.com>
Date: Fri, 2 Mar 2018 17:16:21 +0100
Subject: [PATCH] Refactored location where GOT information is collected.
Change location where GOT information is collected for ARC target, avoiding
posible use conflicts of the previous .got field in the symbols hash_entry.
bfd/
2018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
* arc-got.h (get_got_entry_list_for_symbol): Changed.
* ef32-arc.c (struct elf_arc_link_hash_entry): Moved and changed.
(elf_arc_link_hash_newfunc): Changed.
(arc_elf_link_hash_table_create): Removed old initializations.
(elf_arc_relocate_section, elf_arc_finish_dynamic_symbol): Changed.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
[Romain: rebase on top of 2.31]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
bfd/arc-got.h | 6 +++--
bfd/elf32-arc.c | 77 +++++++++++++++++++++++++++++++--------------------------
2 files changed, 46 insertions(+), 37 deletions(-)
diff --git a/bfd/arc-got.h b/bfd/arc-got.h
index a86061bcb38..81ce88fe21a 100644
--- a/bfd/arc-got.h
+++ b/bfd/arc-got.h
@@ -156,9 +156,11 @@ get_got_entry_list_for_symbol (bfd *abfd,
unsigned long r_symndx,
struct elf_link_hash_entry *h)
{
- if (h != NULL)
+ struct elf_arc_link_hash_entry *h1 =
+ ((struct elf_arc_link_hash_entry *) h);
+ if (h1 != NULL)
{
- return &h->got.glist;
+ return &h1->got_ents;
}
else
{
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index a48ef0ca15f..ab84de43815 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -160,6 +160,18 @@ struct arc_relocation_data
const char * symbol_name;
};
+/* 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;
+
+ struct got_entry *got_ents;
+};
+
+
/* Should be included at this location due to static declarations
defined before this point. */
#include "arc-got.h"
@@ -281,15 +293,6 @@ 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
{
@@ -301,28 +304,28 @@ elf_arc_link_hash_newfunc (struct bfd_hash_entry *entry,
struct bfd_hash_table *table,
const char *string)
{
+ struct elf_arc_link_hash_entry * ret =
+ (struct elf_arc_link_hash_entry *) entry;
+
/* 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;
- }
+ if (ret == NULL)
+ ret = (struct elf_arc_link_hash_entry *)
+ bfd_hash_allocate (table, sizeof (struct elf_arc_link_hash_entry));
+ if (ret == NULL)
+ return (struct bfd_hash_entry *) ret;
/* Call the allocation method of the superclass. */
- entry = _bfd_elf_link_hash_newfunc (entry, table, string);
- if (entry != NULL)
+ ret = ((struct elf_arc_link_hash_entry *)
+ _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
+ table, string));
+ if (ret != NULL)
{
- struct elf_arc_link_hash_entry *eh;
-
- eh = (struct elf_arc_link_hash_entry *) entry;
- eh->dyn_relocs = NULL;
+ ret->dyn_relocs = NULL;
+ ret->got_ents = NULL;
}
- return entry;
+ return (struct bfd_hash_entry *) ret;
}
/* Destroy an ARC ELF linker hash table. */
@@ -352,11 +355,6 @@ arc_elf_link_hash_table_create (bfd *abfd)
return 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;
-
ret->elf.root.hash_table_free = elf_arc_link_hash_table_free;
return &ret->elf.root;
@@ -1615,10 +1613,14 @@ elf_arc_relocate_section (bfd * output_bfd,
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
{
- struct elf_link_hash_entry *h_old = h;
+ struct elf_arc_link_hash_entry *ah_old =
+ (struct elf_arc_link_hash_entry *) h;
h = (struct elf_link_hash_entry *) h->root.u.i.link;
- if (h->got.glist == 0 && h_old->got.glist != h->got.glist)
- h->got.glist = h_old->got.glist;
+ struct elf_arc_link_hash_entry *ah =
+ (struct elf_arc_link_hash_entry *) h;
+
+ if (ah->got_ents == 0 && ah_old->got_ents != ah->got_ents)
+ ah->got_ents = ah_old->got_ents;
}
/* TODO: Need to validate what was the intention. */
@@ -1636,6 +1638,8 @@ elf_arc_relocate_section (bfd * output_bfd,
if (is_reloc_for_GOT (howto) && !bfd_link_pic (info))
{
+ struct elf_arc_link_hash_entry *ah =
+ (struct elf_arc_link_hash_entry *) h;
/* TODO: Change it to use arc_do_relocation with
ARC_32 reloc. Try to use ADD_RELA macro. */
bfd_vma relocation =
@@ -1645,8 +1649,8 @@ elf_arc_relocate_section (bfd * output_bfd,
+ reloc_data.sym_section->output_section->vma)
: 0);
- BFD_ASSERT (h->got.glist);
- bfd_vma got_offset = h->got.glist->offset;
+ BFD_ASSERT (ah->got_ents);
+ bfd_vma got_offset = ah->got_ents->offset;
bfd_put_32 (output_bfd, relocation,
htab->sgot->contents + got_offset);
}
@@ -1958,6 +1962,7 @@ elf_arc_check_relocs (bfd * abfd,
else /* Global one. */
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
switch (r_type)
{
case R_ARC_32:
@@ -2404,7 +2409,9 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd,
create respective dynamic relocs. */
/* TODO: Make function to get list and not access the list directly. */
/* TODO: Move function to relocate_section create this relocs eagerly. */
- create_got_dynrelocs_for_got_info (&h->got.glist,
+ struct elf_arc_link_hash_entry *ah =
+ (struct elf_arc_link_hash_entry *) h;
+ create_got_dynrelocs_for_got_info (&ah->got_ents,
output_bfd,
info,
h);
--
2.14.4

View File

@@ -0,0 +1,35 @@
From 955176bd999fe80c5b937ab8786665079e35c387 Mon Sep 17 00:00:00 2001
From: Cupertino Miranda <cmiranda@synopsys.com>
Date: Fri, 2 Mar 2018 17:33:48 +0100
Subject: [PATCH] Improved robustness. Return FALSE in case of NULL pointer.
bfd/
2018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
* elf32-arc.c (elf_arc_finish_dynamic_symbol) Return FALSE in case
arc_htab is NULL.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
[Romain: rebase on top of 2.31]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
bfd/elf32-arc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index ab84de43815..33fc72cff6e 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -2420,6 +2420,9 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd,
{
struct elf_arc_link_hash_table *arc_htab = elf_arc_hash_table (info);
+ if(arc_htab == NULL)
+ return FALSE;
+
if (h->dynindx == -1
|| (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
--
2.14.4

View File

@@ -0,0 +1,43 @@
From 9d09ce14b4eef2b56f24660fd69a44acd45128b2 Mon Sep 17 00:00:00 2001
From: Cupertino Miranda <cmiranda@synopsys.com>
Date: Fri, 2 Mar 2018 17:38:14 +0100
Subject: [PATCH] Make sure global symbol is not an indirect or warning.
Problem identified in the context of glibc with latest upstream binutils.
Dynamic symbol space was being reserved but, no actual information for the
symbol was being set. Data for the symbol was kept initialized with -1.
No easy test case was possible to be created.
bfd/
2018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
* elf32-arc.c (elf_arc_check_relocs): Changed.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
[Romain: rebase on top of 2.31]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
bfd/elf32-arc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 33fc72cff6e..9b72c5b4f4f 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -1960,7 +1960,12 @@ elf_arc_check_relocs (bfd * abfd,
if (r_symndx < symtab_hdr->sh_info) /* Is a local symbol. */
h = NULL;
else /* Global one. */
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ }
switch (r_type)
--
2.14.4

View File

@@ -0,0 +1,37 @@
From e4861c68067cb2166b4c2bb9c052abeb6ad9aaa1 Mon Sep 17 00:00:00 2001
From: Cupertino Miranda <cmiranda@synopsys.com>
Date: Fri, 2 Mar 2018 17:44:29 +0100
Subject: [PATCH] PLT information was still being generated when symbol was
forced_local.
A change upstream reveiled this issue, triggering an assert when linking glibc.
bfd/
2018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
* elf32-arc.c (elf_arc_check_relocs): Changed.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
[Romain: rebase on top of 2.31]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
bfd/elf32-arc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 9b72c5b4f4f..b40b463d34d 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -2041,7 +2041,8 @@ elf_arc_check_relocs (bfd * abfd,
if (h == NULL)
continue;
else
- h->needs_plt = 1;
+ if(h->forced_local == 0)
+ h->needs_plt = 1;
}
/* Add info to the symbol got_entry_list. */
--
2.14.4

View File

@@ -0,0 +1,48 @@
From 5d3a462f05cba5b0c0c96de899b84fb84155c760 Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Sun, 22 Jul 2018 13:52:28 -0700
Subject: [PATCH] xtensa: fix relaxation of undefined weak references in
shared objects
The change c451bb34ae8b ("xtensa: don't emit dynamic relocation for weak
undefined symbol") didn't properly handle shrinking of relocation
sections due to coalescing of references to a dynamic undefined weak
symbol in a shared object, which resulted in the following assertion
failure in ld when linking uClibc-ng libthread_db for xtensa:
BFD (GNU Binutils) 2.31 internal error, aborting at elf32-xtensa.c:3269
in elf_xtensa_finish_dynamic_sections
Shrink dynamic relocations section for dynamic undefined weak symbols
when linking a shared object.
bfd/
2018-07-23 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic
relocations section for dynamic undefined weak symbols when
linking a shared object.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Backported from: 5d3a462f05cba5b0c0c96de899b84fb84155c760
---
bfd/elf32-xtensa.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index f7f569d0c086..a4b046e445f1 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -10022,7 +10022,8 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
if ((r_type == R_XTENSA_32 || r_type == R_XTENSA_PLT)
&& (input_section->flags & SEC_ALLOC) != 0
&& (dynamic_symbol || bfd_link_pic (info))
- && (!h || h->root.type != bfd_link_hash_undefweak))
+ && (!h || h->root.type != bfd_link_hash_undefweak
+ || (dynamic_symbol && bfd_link_dll (info))))
{
asection *srel;
bfd_boolean is_plt = FALSE;
--
2.11.0

View File

@@ -0,0 +1,90 @@
From f82863d797e461b936dff2b659a3aa65088ee87e Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Sun, 22 Jul 2018 18:59:11 -0700
Subject: [PATCH] xtensa: move dynamic relocations sections consistency
check
The function elf_xtensa_finish_dynamic_sections checks that sizes of
sections .rela.dyn and .rela.plt match number of corresponding relocation
records, but the check is only done when .rela.plt is non-empty, so, e.g.
it is never run for the static PIE.
Rearrange the test so that .rela.dyn and .rela.plt are checked always.
bfd/
2018-07-23 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (elf_xtensa_finish_dynamic_sections): Move
relocation sections consistency check to always check both
.rela.dyn and .rela.plt when they exist. Rearrange variable
definition and assignment places.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Backported from: f82863d797e461b936dff2b659a3aa65088ee87e
---
bfd/elf32-xtensa.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index a4b046e445f1..cf085b7b0751 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -3156,7 +3156,7 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
{
struct elf_xtensa_link_hash_table *htab;
bfd *dynobj;
- asection *sdyn, *srelplt, *sgot, *sxtlit, *sgotloc;
+ asection *sdyn, *srelplt, *srelgot, *sgot, *sxtlit, *sgotloc;
Elf32_External_Dyn *dyncon, *dynconend;
int num_xtlit_entries = 0;
@@ -3186,15 +3186,15 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
}
srelplt = htab->elf.srelplt;
+ srelgot = htab->elf.srelgot;
if (srelplt && srelplt->size != 0)
{
- asection *sgotplt, *srelgot, *spltlittbl;
+ asection *sgotplt, *spltlittbl;
int chunk, plt_chunks, plt_entries;
Elf_Internal_Rela irela;
bfd_byte *loc;
unsigned rtld_reloc;
- srelgot = htab->elf.srelgot;
spltlittbl = htab->spltlittbl;
BFD_ASSERT (srelgot != NULL && spltlittbl != NULL);
@@ -3260,14 +3260,6 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
spltlittbl->contents + (chunk * 8) + 4);
}
- /* All the dynamic relocations have been emitted at this point.
- Make sure the relocation sections are the correct size. */
- if (srelgot->size != (sizeof (Elf32_External_Rela)
- * srelgot->reloc_count)
- || srelplt->size != (sizeof (Elf32_External_Rela)
- * srelplt->reloc_count))
- abort ();
-
/* The .xt.lit.plt section has just been modified. This must
happen before the code below which combines adjacent literal
table entries, and the .xt.lit.plt contents have to be forced to
@@ -3282,6 +3274,14 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
spltlittbl->flags &= ~SEC_HAS_CONTENTS;
}
+ /* All the dynamic relocations have been emitted at this point.
+ Make sure the relocation sections are the correct size. */
+ if ((srelgot && srelgot->size != (sizeof (Elf32_External_Rela)
+ * srelgot->reloc_count))
+ || (srelplt && srelplt->size != (sizeof (Elf32_External_Rela)
+ * srelplt->reloc_count)))
+ abort ();
+
/* Combine adjacent literal table entries. */
BFD_ASSERT (! bfd_link_relocatable (info));
sxtlit = bfd_get_section_by_name (output_bfd, ".xt.lit");
--
2.11.0

View File

@@ -18,24 +18,30 @@ choice
config BR2_BINUTILS_VERSION_2_28_X
bool "binutils 2.28.1"
depends on !BR2_arc
depends on !BR2_riscv
config BR2_BINUTILS_VERSION_2_29_X
bool "binutils 2.29.1"
depends on !BR2_riscv
config BR2_BINUTILS_VERSION_2_30_X
bool "binutils 2.30"
config BR2_BINUTILS_VERSION_2_31_X
bool "binutils 2.31.1"
config BR2_BINUTILS_VERSION_ARC
bool "binutils arc (2.29)"
bool "binutils arc (2.31)"
depends on BR2_arc
endchoice
config BR2_BINUTILS_VERSION
string
default "arc-2017.09-release" if BR2_BINUTILS_VERSION_ARC
default "arc-2018.09-release" if BR2_BINUTILS_VERSION_ARC
default "2.28.1" if BR2_BINUTILS_VERSION_2_28_X
default "2.29.1" if BR2_BINUTILS_VERSION_2_29_X
default "2.30" if BR2_BINUTILS_VERSION_2_30_X
default "2.31.1" if BR2_BINUTILS_VERSION_2_31_X
config BR2_BINUTILS_ENABLE_LTO
bool

View File

@@ -1,41 +0,0 @@
From d4e18ebc6ad810167a2de84b185a5f0d65b9ec2d 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 625347f..d5334d2 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 ba25177..a2cf228 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -446,7 +446,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.9.4

View File

@@ -1,36 +0,0 @@
From 3bd211025c890ef2971958915d500a9bb2913a2a 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 d2551b6..70fcb56 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1463,6 +1463,8 @@ fragment <<EOF
&& command_line.rpath == NULL)
{
path = (const char *) getenv ("LD_RUN_PATH");
+ if ((path) && (strlen (path) == 0))
+ path = NULL;
if (path
&& gld${EMULATION_NAME}_search_needed (path, &n, force))
break;
@@ -1740,6 +1742,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.9.4

View File

@@ -1,51 +0,0 @@
From 378bda0e19d279535b3f4a0e448a658a534a5d67 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 | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 3b37a0a..f7e5473 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -338,18 +338,24 @@ 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.9.4

View File

@@ -0,0 +1,306 @@
From 7d1e6ed1d57e839207e0ece7561bd4709032de9f 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.texi | 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 d93c9b0..5da2742 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -31,6 +31,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 300a272..d68890f 100755
--- a/ld/configure
+++ b/ld/configure
@@ -822,6 +822,7 @@ with_lib_path
enable_targets
enable_64_bit_bfd
with_sysroot
+enable_poison_system_directories
enable_gold
enable_got
enable_compressed_debug_sections
@@ -1486,6 +1487,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)
@@ -15803,7 +15806,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 d10c553..9f1b57b 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -94,6 +94,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 ba914b9..9df17da 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -180,6 +180,14 @@ typedef struct
in the linker script. */
bfd_boolean force_group_allocation;
+ /* 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.texi b/ld/ld.texi
index 40d79dd..137d46c 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -2479,6 +2479,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 b3d166c..3dcbf66 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -116,6 +116,23 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline)
new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (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 04d6fd5..d7df005 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -148,6 +148,8 @@ enum option_values
OPTION_REQUIRE_DEFINED_SYMBOL,
OPTION_ORPHAN_HANDLING,
OPTION_FORCE_GROUP_ALLOCATION,
+ 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 f31eeb2..25f8497 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -268,6 +268,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 86a033a..f07f095 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -543,6 +543,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)
@@ -555,6 +563,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;
@@ -1543,6 +1552,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),
@@ -1586,6 +1603,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.7.4

View File

@@ -2,6 +2,7 @@
sha512 dc5b6872ae01c07c12d38f3bb7ead06effc6da3265ac872e2d9c6104304f89f85f2645b029a43f308a7938a7299b1928d385205d0a2245674a621649032a138d binutils-2.28.1.tar.xz
sha512 d748d22306477d60d921078804d21943248c23fca0707aac9b016a352c01c75ca69e82624ae37fb0bbd03af3b17088a94f60dfe1a86a7ff82e18ece3c24f0fd0 binutils-2.29.1.tar.xz
sha512 e747ea20d8d79fcd21b9d9f6695059caa7189d60f19256da398e34b789fea9a133c32b192e9693b5828d27683739b0198431bf8b3e39fb3b04884cf89d9aa839 binutils-2.30.tar.xz
sha512 0fca326feb1d5f5fe505a827b20237fe3ec9c13eaf7ec7e35847fd71184f605ba1cefe1314b1b8f8a29c0aa9d88162849ee1c1a3e70c2f7407d88339b17edb30 binutils-2.31.1.tar.xz
# Locally calculated (fetched from Github)
sha512 cefff7521dc4ebd8b9773af4f173821ad82dcb3f1fbd0bfdf03e148ba8cec1262b876b221da628ff5db16c30b18c6cbf5ffbec0fddb4677182524684c4c232c1 binutils-arc-2017.09-release.tar.gz
sha512 a96dfcea6064fcd1aac1333ac0d631491bed8b0be9bdcf62f1447909c8f30d2cb8d9323ffeb7c9ad6b326ecddb72e3d28281684e73343189d0a4a37a11aef62f binutils-gdb-arc-2018.09-release.tar.gz

View File

@@ -9,15 +9,15 @@
BINUTILS_VERSION = $(call qstrip,$(BR2_BINUTILS_VERSION))
ifeq ($(BINUTILS_VERSION),)
ifeq ($(BR2_arc),y)
BINUTILS_VERSION = arc-2017.09-release
BINUTILS_VERSION = arc-2018.09-release
else
BINUTILS_VERSION = 2.29.1
endif
endif # BINUTILS_VERSION
ifeq ($(BINUTILS_VERSION),arc-2017.09-release)
ifeq ($(BINUTILS_VERSION),arc-2018.09-release)
BINUTILS_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb,$(BINUTILS_VERSION))
BINUTILS_SOURCE = binutils-$(BINUTILS_VERSION).tar.gz
BINUTILS_SOURCE = binutils-gdb-$(BINUTILS_VERSION).tar.gz
BINUTILS_FROM_GIT = y
endif
BINUTILS_SITE ?= $(BR2_GNU_MIRROR)/binutils
@@ -65,12 +65,6 @@ HOST_BINUTILS_CONF_ENV += MAKEINFO=true
HOST_BINUTILS_MAKE_OPTS += MAKEINFO=true
HOST_BINUTILS_INSTALL_OPTS += MAKEINFO=true install
# gcc bug with Os/O1/O2/O3, PR77311
# error: unable to find a register to spill in class 'CCREGS'
ifeq ($(BR2_bfin),y)
BINUTILS_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -O0"
endif
# Workaround a build issue with -Os for ARM Cortex-M cpus.
# (Binutils 2.25.1 and 2.26.1)
# https://sourceware.org/bugzilla/show_bug.cgi?id=20552
@@ -78,11 +72,6 @@ ifeq ($(BR2_ARM_CPU_ARMV7M)$(BR2_OPTIMIZE_S),yy)
BINUTILS_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -O2"
endif
# Install binutils after busybox to prefer full-blown utilities
ifeq ($(BR2_PACKAGE_BUSYBOX),y)
BINUTILS_DEPENDENCIES += busybox
endif
ifeq ($(BR2_PACKAGE_ZLIB),y)
BINUTILS_DEPENDENCIES += zlib
endif