summaryrefslogtreecommitdiffstats
path: root/poky/meta/recipes-devtools/binutils/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'poky/meta/recipes-devtools/binutils/binutils')
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/0017-improve-check-for-input-file-matching-output-file.patch59
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch201
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch38
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch46
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch40
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/0022-Handle-ELF-compressed-header-alignment-correctly-by-.patch332
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/0023-gold-Get-alignment-of-uncompressed-section-from-ch_a.patch200
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/CVE-2018-17358.patch37
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/CVE-2018-17360.patch24
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18309.patch87
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18605.patch20
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18606.patch22
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18607.patch25
-rw-r--r--poky/meta/recipes-devtools/binutils/binutils/clang-bfd-fix.patch30
14 files changed, 590 insertions, 571 deletions
diff --git a/poky/meta/recipes-devtools/binutils/binutils/0017-improve-check-for-input-file-matching-output-file.patch b/poky/meta/recipes-devtools/binutils/binutils/0017-improve-check-for-input-file-matching-output-file.patch
deleted file mode 100644
index 265e52633..000000000
--- a/poky/meta/recipes-devtools/binutils/binutils/0017-improve-check-for-input-file-matching-output-file.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 2a50366ded329bfb39d387253450c9d5302c3503 Mon Sep 17 00:00:00 2001
-From: Robert Yang <liezhi.yang@windriver.com>
-Date: Tue, 14 Aug 2018 12:22:35 +0100
-Subject: [PATCH] as.c: Improve check for input file matching output file.
-
-When the assembler reports that the input and output are the same, report the
-file names involved, in order to help debugging. Also do not equate two files
-are the same if the have the same inode value but reside on different file
-systems.
-
-Upstream-Status: Backport
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
----
- gas/as.c | 27 ++++++++++++++++++++-------
- 2 files changed, 20 insertions(+), 7 deletions(-)
-
-diff --git a/gas/as.c b/gas/as.c
-index b2a908a..3105d06 100644
---- a/gas/as.c
-+++ b/gas/as.c
-@@ -1259,14 +1259,27 @@ main (int argc, char ** argv)
- {
- struct stat sib;
-
-- if (stat (argv[i], &sib) == 0)
-+ /* Check that the input file and output file are different. */
-+ if (stat (argv[i], &sib) == 0
-+ && sib.st_ino == sob.st_ino
-+ /* POSIX emulating systems may support stat() but if the
-+ underlying file system does not support a file serial number
-+ of some kind then they will return 0 for the inode. So
-+ two files with an inode of 0 may not actually be the same.
-+ On real POSIX systems no ordinary file will ever have an
-+ inode of 0. */
-+ && sib.st_ino != 0
-+ /* Different files may have the same inode number if they
-+ reside on different devices, so check the st_dev field as
-+ well. */
-+ && sib.st_dev == sob.st_dev)
- {
-- if (sib.st_ino == sob.st_ino && sib.st_ino != 0)
-- {
-- /* Don't let as_fatal remove the output file! */
-- out_file_name = NULL;
-- as_fatal (_("The input and output files must be distinct"));
-- }
-+ const char *saved_out_file_name = out_file_name;
-+
-+ /* Don't let as_fatal remove the output file! */
-+ out_file_name = NULL;
-+ as_fatal (_("The input '%s' and output '%s' files are the same"),
-+ argv[i], saved_out_file_name);
- }
- }
- }
---
-2.7.4
-
diff --git a/poky/meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch b/poky/meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch
deleted file mode 100644
index d41339a9a..000000000
--- a/poky/meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch
+++ /dev/null
@@ -1,201 +0,0 @@
-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: Cupertino Miranda <cmiranda@synopsys.com>
-Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
-[Romain: rebase on top of 2.31]
-Signed-off-by: Romain Naour <romain.naour@gmail.com>
-
-Upstream-Status: Pending
----
- 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
-
diff --git a/poky/meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch b/poky/meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch
deleted file mode 100644
index 6a58ee06a..000000000
--- a/poky/meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-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: Cupertino Miranda <cmiranda@synopsys.com>
-Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
-[Romain: rebase on top of 2.31]
-Signed-off-by: Romain Naour <romain.naour@gmail.com>
-
-Upstream-Status: Pending
----
- 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
-
diff --git a/poky/meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch b/poky/meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch
deleted file mode 100644
index 01e42c03b..000000000
--- a/poky/meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-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: Cupertino Miranda <cmiranda@synopsys.com>
-Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
-[Romain: rebase on top of 2.31]
-Signed-off-by: Romain Naour <romain.naour@gmail.com>
-
-Upstream-Status: Pending
----
- 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
-
diff --git a/poky/meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch b/poky/meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch
deleted file mode 100644
index 9e942399c..000000000
--- a/poky/meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-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: Cupertino Miranda <cmiranda@synopsys.com>
-Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
-[Romain: rebase on top of 2.31]
-Signed-off-by: Romain Naour <romain.naour@gmail.com>
-
-Upstream-Status: Pending
----
- 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
-
diff --git a/poky/meta/recipes-devtools/binutils/binutils/0022-Handle-ELF-compressed-header-alignment-correctly-by-.patch b/poky/meta/recipes-devtools/binutils/binutils/0022-Handle-ELF-compressed-header-alignment-correctly-by-.patch
new file mode 100644
index 000000000..650de9b9a
--- /dev/null
+++ b/poky/meta/recipes-devtools/binutils/binutils/0022-Handle-ELF-compressed-header-alignment-correctly-by-.patch
@@ -0,0 +1,332 @@
+From bb9c8cc3c5f4ffd6019a8c53adead429954162e1 Mon Sep 17 00:00:00 2001
+From: Mark Wielaard <mark@klomp.org>
+Date: Tue, 27 Nov 2018 11:59:10 +0000
+Subject: [PATCH 1/2] Handle ELF compressed header alignment correctly by
+ setting up the section alignment correctly for the Elf32_Chdr or Elf64_Chdr
+ type and respect the ch_addralign field when decompressing the section data.
+
+ PR binutils/23919
+binutils* readelf.c (dump_sections_as_strings): Remove bogus addralign check.
+ (dump_sections_as_bytes): Likewise.
+ (load_specific_debug_sections): Likewise.
+ * testsuite/binutils-all/dw2-3.rS: Adjust alignment.
+ * testsuite/binutils-all/dw2-3.rt: Likewise.
+
+bfd * bfd.c (bfd_update_compression_header): Explicitly set alignment.
+ (bfd_check_compression_header): Add uncompressed_alignment_power
+ argument. Check ch_addralign is a power of 2.
+ * bfd-in2.h: Regenerated.
+ * compress.c (bfd_compress_section_contents): Get and set
+ orig_uncompressed_alignment_pow if section is decompressed.
+ (bfd_is_section_compressed_with_header): Add and get
+ uncompressed_align_pow_p argument.
+ (bfd_is_section_compressed): Add uncompressed_align_power argument
+ to bfd_is_section_compressed_with_header call.
+ (bfd_init_section_decompress_status): Get and set
+ uncompressed_alignment_power.
+ * elf.c (_bfd_elf_make_section_from_shdr): Add
+ uncompressed_align_power argument to
+ bfd_is_section_compressed_with_header call.
+---
+ bfd/bfd-in2.h | 6 ++--
+ bfd/bfd.c | 20 ++++++++++----
+ bfd/compress.c | 35 +++++++++++++++++-------
+ bfd/elf.c | 5 ++--
+ binutils/readelf.c | 18 ------------
+ binutils/testsuite/binutils-all/dw2-3.rS | 2 +-
+ binutils/testsuite/binutils-all/dw2-3.rt | 2 +-
+ 7 files changed, 49 insertions(+), 39 deletions(-)
+
+Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4207142d6a5d2359170c5f9a140fc1a2351fbda9]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
+index f53dbb5e8c..d0c2190d0b 100644
+--- a/bfd/bfd-in2.h
++++ b/bfd/bfd-in2.h
+@@ -7279,7 +7279,8 @@ void bfd_update_compression_header
+
+ bfd_boolean bfd_check_compression_header
+ (bfd *abfd, bfd_byte *contents, asection *sec,
+- bfd_size_type *uncompressed_size);
++ bfd_size_type *uncompressed_size,
++ unsigned int *uncompressed_alignment_power);
+
+ int bfd_get_compression_header_size (bfd *abfd, asection *sec);
+
+@@ -7855,7 +7856,8 @@ void bfd_cache_section_contents
+ bfd_boolean bfd_is_section_compressed_with_header
+ (bfd *abfd, asection *section,
+ int *compression_header_size_p,
+- bfd_size_type *uncompressed_size_p);
++ bfd_size_type *uncompressed_size_p,
++ unsigned int *uncompressed_alignment_power_p);
+
+ bfd_boolean bfd_is_section_compressed
+ (bfd *abfd, asection *section);
+diff --git a/bfd/bfd.c b/bfd/bfd.c
+index 851710401e..ea10d7b185 100644
+--- a/bfd/bfd.c
++++ b/bfd/bfd.c
+@@ -2332,6 +2332,8 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
+ bfd_put_32 (abfd, sec->size, &echdr->ch_size);
+ bfd_put_32 (abfd, 1 << sec->alignment_power,
+ &echdr->ch_addralign);
++ /* bfd_log2 (alignof (Elf32_Chdr)) */
++ bfd_set_section_alignment (abfd, sec, 2);
+ }
+ else
+ {
+@@ -2342,6 +2344,8 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
+ bfd_put_64 (abfd, sec->size, &echdr->ch_size);
+ bfd_put_64 (abfd, 1 << sec->alignment_power,
+ &echdr->ch_addralign);
++ /* bfd_log2 (alignof (Elf64_Chdr)) */
++ bfd_set_section_alignment (abfd, sec, 3);
+ }
+ }
+ else
+@@ -2354,6 +2358,8 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
+ order. */
+ memcpy (contents, "ZLIB", 4);
+ bfd_putb64 (sec->size, contents + 4);
++ /* No way to keep the original alignment, just use 1 always. */
++ bfd_set_section_alignment (abfd, sec, 0);
+ }
+ }
+ }
+@@ -2368,12 +2374,14 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
+ SYNOPSIS
+ bfd_boolean bfd_check_compression_header
+ (bfd *abfd, bfd_byte *contents, asection *sec,
+- bfd_size_type *uncompressed_size);
++ bfd_size_type *uncompressed_size,
++ unsigned int *uncompressed_alignment_power);
+
+ DESCRIPTION
+ Check the compression header at CONTENTS of SEC in ABFD and
+- store the uncompressed size in UNCOMPRESSED_SIZE if the
+- compression header is valid.
++ store the uncompressed size in UNCOMPRESSED_SIZE and the
++ uncompressed data alignment in UNCOMPRESSED_ALIGNMENT_POWER
++ if the compression header is valid.
+
+ RETURNS
+ Return TRUE if the compression header is valid.
+@@ -2382,7 +2390,8 @@ RETURNS
+ bfd_boolean
+ bfd_check_compression_header (bfd *abfd, bfd_byte *contents,
+ asection *sec,
+- bfd_size_type *uncompressed_size)
++ bfd_size_type *uncompressed_size,
++ unsigned int *uncompressed_alignment_power)
+ {
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
+ && (elf_section_flags (sec) & SHF_COMPRESSED) != 0)
+@@ -2404,9 +2413,10 @@ bfd_check_compression_header (bfd *abfd, bfd_byte *contents,
+ chdr.ch_addralign = bfd_get_64 (abfd, &echdr->ch_addralign);
+ }
+ if (chdr.ch_type == ELFCOMPRESS_ZLIB
+- && chdr.ch_addralign == 1U << sec->alignment_power)
++ && chdr.ch_addralign == (1U << bfd_log2 (chdr.ch_addralign)))
+ {
+ *uncompressed_size = chdr.ch_size;
++ *uncompressed_alignment_power = bfd_log2 (chdr.ch_addralign);
+ return TRUE;
+ }
+ }
+diff --git a/bfd/compress.c b/bfd/compress.c
+index 53e566e498..97ea624eb8 100644
+--- a/bfd/compress.c
++++ b/bfd/compress.c
+@@ -84,11 +84,13 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec,
+ int zlib_size = 0;
+ int orig_compression_header_size;
+ bfd_size_type orig_uncompressed_size;
++ unsigned int orig_uncompressed_alignment_pow;
+ int header_size = bfd_get_compression_header_size (abfd, NULL);
+ bfd_boolean compressed
+ = bfd_is_section_compressed_with_header (abfd, sec,
+ &orig_compression_header_size,
+- &orig_uncompressed_size);
++ &orig_uncompressed_size,
++ &orig_uncompressed_alignment_pow);
+
+ /* Either ELF compression header or the 12-byte, "ZLIB" + 8-byte size,
+ overhead in .zdebug* section. */
+@@ -153,6 +155,9 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec,
+ return 0;
+ }
+ free (uncompressed_buffer);
++ bfd_set_section_alignment (abfd, sec,
++ orig_uncompressed_alignment_pow);
++
+ sec->contents = buffer;
+ sec->compress_status = COMPRESS_SECTION_DONE;
+ return orig_uncompressed_size;
+@@ -364,20 +369,24 @@ SYNOPSIS
+ bfd_boolean bfd_is_section_compressed_with_header
+ (bfd *abfd, asection *section,
+ int *compression_header_size_p,
+- bfd_size_type *uncompressed_size_p);
++ bfd_size_type *uncompressed_size_p,
++ unsigned int *uncompressed_alignment_power_p);
+
+ DESCRIPTION
+ Return @code{TRUE} if @var{section} is compressed. Compression
+- header size is returned in @var{compression_header_size_p} and
+- uncompressed size is returned in @var{uncompressed_size_p}. If
+- compression is unsupported, compression header size is returned
+- with -1 and uncompressed size is returned with 0.
++ header size is returned in @var{compression_header_size_p},
++ uncompressed size is returned in @var{uncompressed_size_p}
++ and the uncompressed data alignement power is returned in
++ @var{uncompressed_align_pow_p}. If compression is
++ unsupported, compression header size is returned with -1
++ and uncompressed size is returned with 0.
+ */
+
+ bfd_boolean
+ bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec,
+ int *compression_header_size_p,
+- bfd_size_type *uncompressed_size_p)
++ bfd_size_type *uncompressed_size_p,
++ unsigned int *uncompressed_align_pow_p)
+ {
+ bfd_byte header[MAX_COMPRESSION_HEADER_SIZE];
+ int compression_header_size;
+@@ -412,7 +421,8 @@ bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec,
+ if (compression_header_size != 0)
+ {
+ if (!bfd_check_compression_header (abfd, header, sec,
+- uncompressed_size_p))
++ uncompressed_size_p,
++ uncompressed_align_pow_p))
+ compression_header_size = -1;
+ }
+ /* Check for the pathalogical case of a debug string section that
+@@ -449,9 +459,11 @@ bfd_is_section_compressed (bfd *abfd, sec_ptr sec)
+ {
+ int compression_header_size;
+ bfd_size_type uncompressed_size;
++ unsigned int uncompressed_align_power;
+ return (bfd_is_section_compressed_with_header (abfd, sec,
+ &compression_header_size,
+- &uncompressed_size)
++ &uncompressed_size,
++ &uncompressed_align_power)
+ && compression_header_size >= 0
+ && uncompressed_size > 0);
+ }
+@@ -480,6 +492,7 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec)
+ int compression_header_size;
+ int header_size;
+ bfd_size_type uncompressed_size;
++ unsigned int uncompressed_alignment_power = 0;
+
+ compression_header_size = bfd_get_compression_header_size (abfd, sec);
+ if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE)
+@@ -508,7 +521,8 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec)
+ uncompressed_size = bfd_getb64 (header + 4);
+ }
+ else if (!bfd_check_compression_header (abfd, header, sec,
+- &uncompressed_size))
++ &uncompressed_size,
++ &uncompressed_alignment_power))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+@@ -516,6 +530,7 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec)
+
+ sec->compressed_size = sec->size;
+ sec->size = uncompressed_size;
++ bfd_set_section_alignment (abfd, sec, uncompressed_alignment_power);
+ sec->compress_status = DECOMPRESS_SECTION_SIZED;
+
+ return TRUE;
+diff --git a/bfd/elf.c b/bfd/elf.c
+index 828241d48a..c4f131ddcf 100644
+--- a/bfd/elf.c
++++ b/bfd/elf.c
+@@ -1177,11 +1177,12 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
+ enum { nothing, compress, decompress } action = nothing;
+ int compression_header_size;
+ bfd_size_type uncompressed_size;
++ unsigned int uncompressed_align_power;
+ bfd_boolean compressed
+ = bfd_is_section_compressed_with_header (abfd, newsect,
+ &compression_header_size,
+- &uncompressed_size);
+-
++ &uncompressed_size,
++ &uncompressed_align_power);
+ if (compressed)
+ {
+ /* Compressed section. Check if we should decompress. */
+diff --git a/binutils/readelf.c b/binutils/readelf.c
+index f4df697a7d..4b0efa884f 100644
+--- a/binutils/readelf.c
++++ b/binutils/readelf.c
+@@ -13345,12 +13345,6 @@ dump_section_as_strings (Elf_Internal_Shdr * section, Filedata * filedata)
+ printable_section_name (filedata, section), chdr.ch_type);
+ return FALSE;
+ }
+- else if (chdr.ch_addralign != section->sh_addralign)
+- {
+- warn (_("compressed section '%s' is corrupted\n"),
+- printable_section_name (filedata, section));
+- return FALSE;
+- }
+ uncompressed_size = chdr.ch_size;
+ start += compression_header_size;
+ new_size -= compression_header_size;
+@@ -13492,12 +13486,6 @@ dump_section_as_bytes (Elf_Internal_Shdr * section,
+ printable_section_name (filedata, section), chdr.ch_type);
+ return FALSE;
+ }
+- else if (chdr.ch_addralign != section->sh_addralign)
+- {
+- warn (_("compressed section '%s' is corrupted\n"),
+- printable_section_name (filedata, section));
+- return FALSE;
+- }
+ uncompressed_size = chdr.ch_size;
+ start += compression_header_size;
+ new_size -= compression_header_size;
+@@ -13667,12 +13655,6 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
+ section->name, chdr.ch_type);
+ return FALSE;
+ }
+- else if (chdr.ch_addralign != sec->sh_addralign)
+- {
+- warn (_("compressed section '%s' is corrupted\n"),
+- section->name);
+- return FALSE;
+- }
+ uncompressed_size = chdr.ch_size;
+ start += compression_header_size;
+ size -= compression_header_size;
+diff --git a/binutils/testsuite/binutils-all/dw2-3.rS b/binutils/testsuite/binutils-all/dw2-3.rS
+index f1637e9149..86bc73d9a2 100644
+--- a/binutils/testsuite/binutils-all/dw2-3.rS
++++ b/binutils/testsuite/binutils-all/dw2-3.rS
+@@ -1,3 +1,3 @@
+ #...
+- +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +1
++ +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +(4|8)
+ #pass
+diff --git a/binutils/testsuite/binutils-all/dw2-3.rt b/binutils/testsuite/binutils-all/dw2-3.rt
+index f59cbaa22b..74e7f8deca 100644
+--- a/binutils/testsuite/binutils-all/dw2-3.rt
++++ b/binutils/testsuite/binutils-all/dw2-3.rt
+@@ -1,6 +1,6 @@
+ #...
+ +\[[ 0-9]+\] .debug_info
+- +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +1
++ +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +(4|8)
+ +\[0+800\]: COMPRESSED
+ +ZLIB, 0+9d, 1
+ #pass
+--
+2.20.1
+
diff --git a/poky/meta/recipes-devtools/binutils/binutils/0023-gold-Get-alignment-of-uncompressed-section-from-ch_a.patch b/poky/meta/recipes-devtools/binutils/binutils/0023-gold-Get-alignment-of-uncompressed-section-from-ch_a.patch
new file mode 100644
index 000000000..1f072a605
--- /dev/null
+++ b/poky/meta/recipes-devtools/binutils/binutils/0023-gold-Get-alignment-of-uncompressed-section-from-ch_a.patch
@@ -0,0 +1,200 @@
+From 0261ec511ac07177fa488133e0bb3c03860977b3 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Sun, 2 Dec 2018 05:42:36 -0800
+Subject: [PATCH 2/2] gold: Get alignment of uncompressed section from
+ ch_addralign
+
+The ELF compression header has a field (ch_addralign) that is set to
+the alignment of the uncompressed section. This way the section itself
+can have a different alignment than the decompressed section. Update
+decompress_input_section to get alignment of the decompressed section
+and use it when merging decompressed strings.
+
+ PR binutils/23919
+ * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
+ Get addralign from decompressed_section_contents.
+ * object.cc (build_compressed_section_map): Set info.addralign.
+ (Object::decompressed_section_contents): Add a palign
+ argument and store p->second.addralign in *palign if it isn't
+ NULL.
+ * object.h (Compressed_section_info): Add addralign.
+ (section_is_compressed): Add a palign argument, default it
+ to NULL, store p->second.addralign in *palign if it isn't NULL.
+ (Object::decompressed_section_contents): Likewise.
+ * output.cc (Output_section::add_input_section): Get addralign
+ from section_is_compressed.
+---
+ gold/merge.cc | 8 +++++---
+ gold/object.cc | 11 +++++++++--
+ gold/object.h | 8 ++++++--
+ gold/output.cc | 11 ++++++-----
+ 4 files changed, 26 insertions(+), 12 deletions(-)
+
+Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5f6c22aee74f17393b82934a5682d985672e011a]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+
+diff --git a/gold/merge.cc b/gold/merge.cc
+index de00ee9ae9..d7de11789f 100644
+--- a/gold/merge.cc
++++ b/gold/merge.cc
+@@ -440,9 +440,11 @@ Output_merge_string<Char_type>::do_add_input_section(Relobj* object,
+ {
+ section_size_type sec_len;
+ bool is_new;
++ uint64_t addralign = this->addralign();
+ const unsigned char* pdata = object->decompressed_section_contents(shndx,
+ &sec_len,
+- &is_new);
++ &is_new,
++ &addralign);
+
+ const Char_type* p = reinterpret_cast<const Char_type*>(pdata);
+ const Char_type* pend = p + sec_len / sizeof(Char_type);
+@@ -494,7 +496,7 @@ Output_merge_string<Char_type>::do_add_input_section(Relobj* object,
+ // aligned, so each string within the section must retain the same
+ // modulo.
+ uintptr_t init_align_modulo = (reinterpret_cast<uintptr_t>(pdata)
+- & (this->addralign() - 1));
++ & (addralign - 1));
+ bool has_misaligned_strings = false;
+
+ while (p < pend)
+@@ -503,7 +505,7 @@ Output_merge_string<Char_type>::do_add_input_section(Relobj* object,
+
+ // Within merge input section each string must be aligned.
+ if (len != 0
+- && ((reinterpret_cast<uintptr_t>(p) & (this->addralign() - 1))
++ && ((reinterpret_cast<uintptr_t>(p) & (addralign - 1))
+ != init_align_modulo))
+ has_misaligned_strings = true;
+
+diff --git a/gold/object.cc b/gold/object.cc
+index 374340fa16..711793e5e4 100644
+--- a/gold/object.cc
++++ b/gold/object.cc
+@@ -751,11 +751,13 @@ build_compressed_section_map(
+ const unsigned char* contents =
+ obj->section_contents(i, &len, false);
+ uint64_t uncompressed_size;
++ Compressed_section_info info;
+ if (is_zcompressed)
+ {
+ // Skip over the ".zdebug" prefix.
+ name += 7;
+ uncompressed_size = get_uncompressed_size(contents, len);
++ info.addralign = shdr.get_sh_addralign();
+ }
+ else
+ {
+@@ -763,8 +765,8 @@ build_compressed_section_map(
+ name += 6;
+ elfcpp::Chdr<size, big_endian> chdr(contents);
+ uncompressed_size = chdr.get_ch_size();
++ info.addralign = chdr.get_ch_addralign();
+ }
+- Compressed_section_info info;
+ info.size = convert_to_section_size_type(uncompressed_size);
+ info.flag = shdr.get_sh_flags();
+ info.contents = NULL;
+@@ -3060,7 +3062,8 @@ const unsigned char*
+ Object::decompressed_section_contents(
+ unsigned int shndx,
+ section_size_type* plen,
+- bool* is_new)
++ bool* is_new,
++ uint64_t* palign)
+ {
+ section_size_type buffer_size;
+ const unsigned char* buffer = this->do_section_contents(shndx, &buffer_size,
+@@ -3087,6 +3090,8 @@ Object::decompressed_section_contents(
+ {
+ *plen = uncompressed_size;
+ *is_new = false;
++ if (palign != NULL)
++ *palign = p->second.addralign;
+ return p->second.contents;
+ }
+
+@@ -3108,6 +3113,8 @@ Object::decompressed_section_contents(
+ // once in this pass.
+ *plen = uncompressed_size;
+ *is_new = true;
++ if (palign != NULL)
++ *palign = p->second.addralign;
+ return uncompressed_data;
+ }
+
+diff --git a/gold/object.h b/gold/object.h
+index 0b786a5471..b99548463d 100644
+--- a/gold/object.h
++++ b/gold/object.h
+@@ -373,6 +373,7 @@ struct Compressed_section_info
+ {
+ section_size_type size;
+ elfcpp::Elf_Xword flag;
++ uint64_t addralign;
+ const unsigned char* contents;
+ };
+ typedef std::map<unsigned int, Compressed_section_info> Compressed_section_map;
+@@ -808,7 +809,8 @@ class Object
+
+ bool
+ section_is_compressed(unsigned int shndx,
+- section_size_type* uncompressed_size) const
++ section_size_type* uncompressed_size,
++ elfcpp::Elf_Xword* palign = NULL) const
+ {
+ if (this->compressed_sections_ == NULL)
+ return false;
+@@ -818,6 +820,8 @@ class Object
+ {
+ if (uncompressed_size != NULL)
+ *uncompressed_size = p->second.size;
++ if (palign != NULL)
++ *palign = p->second.addralign;
+ return true;
+ }
+ return false;
+@@ -828,7 +832,7 @@ class Object
+ // by the caller.
+ const unsigned char*
+ decompressed_section_contents(unsigned int shndx, section_size_type* plen,
+- bool* is_cached);
++ bool* is_cached, uint64_t* palign = NULL);
+
+ // Discard any buffers of decompressed sections. This is done
+ // at the end of the Add_symbols task.
+diff --git a/gold/output.cc b/gold/output.cc
+index 1701db1c99..75ac3bcf97 100644
+--- a/gold/output.cc
++++ b/gold/output.cc
+@@ -2448,7 +2448,13 @@ Output_section::add_input_section(Layout* layout,
+ unsigned int reloc_shndx,
+ bool have_sections_script)
+ {
++ section_size_type input_section_size = shdr.get_sh_size();
++ section_size_type uncompressed_size;
+ elfcpp::Elf_Xword addralign = shdr.get_sh_addralign();
++ if (object->section_is_compressed(shndx, &uncompressed_size,
++ &addralign))
++ input_section_size = uncompressed_size;
++
+ if ((addralign & (addralign - 1)) != 0)
+ {
+ object->error(_("invalid alignment %lu for section \"%s\""),
+@@ -2498,11 +2504,6 @@ Output_section::add_input_section(Layout* layout,
+ }
+ }
+
+- section_size_type input_section_size = shdr.get_sh_size();
+- section_size_type uncompressed_size;
+- if (object->section_is_compressed(shndx, &uncompressed_size))
+- input_section_size = uncompressed_size;
+-
+ off_t offset_in_section;
+
+ if (this->has_fixed_layout())
+--
+2.20.1
+
diff --git a/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-17358.patch b/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-17358.patch
index 813509160..d5a1ea1dc 100644
--- a/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-17358.patch
+++ b/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-17358.patch
@@ -21,25 +21,6 @@ Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
bfd/syms.c | 22 ++++++++++++++++------
3 files changed, 33 insertions(+), 7 deletions(-)
-diff --git a/bfd/ChangeLog b/bfd/ChangeLog
-index 04c0c2a..fef5479 100644
---- a/bfd/ChangeLog
-+++ b/bfd/ChangeLog
-@@ -1,3 +1,12 @@
-+2018-09-20 Alan Modra <amodra@gmail.com>
-+
-+ PR 23686
-+ * dwarf2.c (read_section): Error when attempting to malloc
-+ "(bfd_size_type) -1".
-+ * syms.c (_bfd_stab_section_find_nearest_line): Bounds check
-+ function_name. Bounds check reloc address. Formatting. Ensure
-+ .stabstr zero terminated.
-+
- 2018-08-12 H.J. Lu <hongjiu.lu@intel.com>
-
- PR ld/23428
-diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
-index 3b28855..77a7368 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -527,6 +527,7 @@ read_section (bfd * abfd,
@@ -65,11 +46,9 @@ index 3b28855..77a7368 100644
if (contents == NULL)
return FALSE;
if (syms
-diff --git a/bfd/syms.c b/bfd/syms.c
-index 187071f..e09640a 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
-@@ -1035,6 +1035,10 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
+@@ -1035,6 +1035,10 @@ _bfd_stab_section_find_nearest_line (bfd
0, strsize))
return FALSE;
@@ -80,7 +59,7 @@ index 187071f..e09640a 100644
/* If this is a relocatable object file, we have to relocate
the entries in .stab. This should always be simple 32 bit
relocations against symbols defined in this object file, so
-@@ -1073,7 +1077,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
+@@ -1073,7 +1077,8 @@ _bfd_stab_section_find_nearest_line (bfd
|| r->howto->bitsize != 32
|| r->howto->pc_relative
|| r->howto->bitpos != 0
@@ -90,7 +69,7 @@ index 187071f..e09640a 100644
{
_bfd_error_handler
(_("unsupported .stab relocation"));
-@@ -1195,7 +1200,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
+@@ -1195,7 +1200,8 @@ _bfd_stab_section_find_nearest_line (bfd
{
nul_fun = stab;
nul_str = str;
@@ -100,7 +79,7 @@ index 187071f..e09640a 100644
file_name = NULL;
if (stab + STABSIZE + TYPEOFF < info->stabs + stabsize
&& *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO)
-@@ -1206,7 +1212,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
+@@ -1206,7 +1212,8 @@ _bfd_stab_section_find_nearest_line (bfd
directory_name = file_name;
file_name = ((char *) str
+ bfd_get_32 (abfd, stab + STRDXOFF));
@@ -110,7 +89,7 @@ index 187071f..e09640a 100644
file_name = NULL;
}
}
-@@ -1217,7 +1224,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
+@@ -1217,7 +1224,8 @@ _bfd_stab_section_find_nearest_line (bfd
file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
/* PR 17512: file: 0c680a1f. */
/* PR 17512: file: 5da8aec4. */
@@ -120,7 +99,7 @@ index 187071f..e09640a 100644
file_name = NULL;
break;
-@@ -1226,7 +1234,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
+@@ -1226,7 +1234,8 @@ _bfd_stab_section_find_nearest_line (bfd
function_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
if (function_name == (char *) str)
continue;
@@ -130,7 +109,7 @@ index 187071f..e09640a 100644
function_name = NULL;
nul_fun = NULL;
-@@ -1335,7 +1344,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
+@@ -1335,7 +1344,8 @@ _bfd_stab_section_find_nearest_line (bfd
if (val <= offset)
{
file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
@@ -140,5 +119,3 @@ index 187071f..e09640a 100644
file_name = NULL;
*pline = 0;
}
---
-2.9.3
diff --git a/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-17360.patch b/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-17360.patch
index cef10a754..45c637967 100644
--- a/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-17360.patch
+++ b/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-17360.patch
@@ -15,27 +15,9 @@ Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
bfd/peXXigen.c | 11 ++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
-diff --git a/bfd/ChangeLog b/bfd/ChangeLog
-index fef5479..81b9e56 100644
---- a/bfd/ChangeLog
-+++ b/bfd/ChangeLog
-@@ -1,5 +1,11 @@
- 2018-09-20 Alan Modra <amodra@gmail.com>
-
-+ PR 23685
-+ * peXXigen.c (pe_print_edata): Correct export address table
-+ overflow checks. Check dataoff against section size too.
-+
-+2018-09-20 Alan Modra <amodra@gmail.com>
-+
- PR 23686
- * dwarf2.c (read_section): Error when attempting to malloc
- "(bfd_size_type) -1".
-diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
-index 598f2ca..1645ef4 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
-@@ -1661,7 +1661,8 @@ pe_print_edata (bfd * abfd, void * vfile)
+@@ -1661,7 +1661,8 @@ pe_print_edata (bfd * abfd, void * vfile
dataoff = addr - section->vma;
datasize = extra->DataDirectory[PE_EXPORT_TABLE].Size;
@@ -45,7 +27,7 @@ index 598f2ca..1645ef4 100644
{
fprintf (file,
_("\nThere is an export table in %s, but it does not fit into that section\n"),
-@@ -1778,11 +1779,11 @@ pe_print_edata (bfd * abfd, void * vfile)
+@@ -1778,11 +1779,11 @@ pe_print_edata (bfd * abfd, void * vfile
edt.base);
/* PR 17512: Handle corrupt PE binaries. */
@@ -61,5 +43,3 @@ index 598f2ca..1645ef4 100644
fprintf (file, _("\tInvalid Export Address Table rva (0x%lx) or entry count (0x%lx)\n"),
(long) edt.eat_addr,
(long) edt.num_functions);
---
-2.9.3
diff --git a/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18309.patch b/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18309.patch
index b240a3f99..010e6b5d5 100644
--- a/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18309.patch
+++ b/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18309.patch
@@ -49,39 +49,9 @@ Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
bfd/reloc.c | 19 +++++++++++++------
14 files changed, 50 insertions(+), 23 deletions(-)
-diff --git a/bfd/ChangeLog b/bfd/ChangeLog
-index 68c1ff665b..e9696ee314 100644
---- a/bfd/ChangeLog
-+++ b/bfd/ChangeLog
-@@ -1,3 +1,23 @@
-+2018-10-13 Alan Modra <amodra@gmail.com>
-+
-+ PR 23770
-+ PR 23425
-+ * reloc.c (_bfd_clear_contents): Replace "location" param with
-+ "buf" and "off". Bounds check "off". Return status.
-+ * cofflink.c (_bfd_coff_generic_relocate_section): Update
-+ _bfd_clear_contents call.
-+ * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Likewise.
-+ * elf32-arc.c (elf_arc_relocate_section): Likewise.
-+ * elf32-i386.c (elf_i386_relocate_section): Likewise.
-+ * elf32-metag.c (metag_final_link_relocate): Likewise.
-+ * elf32-nds32.c (nds32_elf_get_relocated_section_contents): Likewise.
-+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
-+ * elf32-visium.c (visium_elf_relocate_section): Likewise.
-+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
-+ * elf64-x86-64.c *(elf_x86_64_relocate_section): Likewise.
-+ * libbfd-in.h (_bfd_clear_contents): Update prototype.
-+ * libbfd.h: Regenerate.
-+
- 2018-09-20 Alan Modra <amodra@gmail.com>
-
- PR 23685
-diff --git a/bfd/cofflink.c b/bfd/cofflink.c
-index 2f73f72e31..b7ea69b7f9 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
-@@ -3080,7 +3080,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
+@@ -3080,7 +3080,7 @@ _bfd_coff_generic_relocate_section (bfd
if (sec != NULL && discarded_section (sec))
{
_bfd_clear_contents (howto, input_bfd, input_section,
@@ -90,11 +60,9 @@ index 2f73f72e31..b7ea69b7f9 100644
continue;
}
-diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
-index cf256f70e0..3374f411f9 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
-@@ -2811,7 +2811,7 @@ extern asection _bfd_elf_large_com_section;
+@@ -2811,7 +2811,7 @@ extern asection _bfd_elf_large_com_secti
{ \
int i_; \
_bfd_clear_contents (howto, input_bfd, input_section, \
@@ -103,11 +71,9 @@ index cf256f70e0..3374f411f9 100644
\
if (bfd_link_relocatable (info) \
&& (input_section->flags & SEC_DEBUGGING)) \
-diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
-index 7a1b3042ae..30f47a5b22 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
-@@ -1549,7 +1549,7 @@ elf_arc_relocate_section (bfd * output_bfd,
+@@ -1552,7 +1552,7 @@ elf_arc_relocate_section (bfd * outp
if (sec != NULL && discarded_section (sec))
{
_bfd_clear_contents (howto, input_bfd, input_section,
@@ -116,11 +82,9 @@ index 7a1b3042ae..30f47a5b22 100644
rel->r_info = 0;
rel->r_addend = 0;
-diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
-index 49797dcbfa..177471777d 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
-@@ -2197,7 +2197,7 @@ elf_i386_relocate_section (bfd *output_bfd,
+@@ -2197,7 +2197,7 @@ elf_i386_relocate_section (bfd *output_b
if (sec != NULL && discarded_section (sec))
{
_bfd_clear_contents (howto, input_bfd, input_section,
@@ -129,11 +93,9 @@ index 49797dcbfa..177471777d 100644
wrel->r_offset = rel->r_offset;
wrel->r_info = 0;
wrel->r_addend = 0;
-diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c
-index efe95bddff..7f96246e5d 100644
--- a/bfd/elf32-metag.c
+++ b/bfd/elf32-metag.c
-@@ -1396,7 +1396,7 @@ metag_final_link_relocate (reloc_howto_type *howto,
+@@ -1396,7 +1396,7 @@ metag_final_link_relocate (reloc_howto_t
rel, relend, howto, contents) \
{ \
_bfd_clear_contents (howto, input_bfd, input_section, \
@@ -142,11 +104,9 @@ index efe95bddff..7f96246e5d 100644
\
if (bfd_link_relocatable (info) \
&& (input_section->flags & SEC_DEBUGGING)) \
-diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
-index 0d86e5b865..184cf320f7 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
-@@ -12582,14 +12582,14 @@ nds32_elf_get_relocated_section_contents (bfd *abfd,
+@@ -12582,14 +12582,14 @@ nds32_elf_get_relocated_section_contents
symbol = *(*parent)->sym_ptr_ptr;
if (symbol->section && discarded_section (symbol->section))
{
@@ -165,11 +125,9 @@ index 0d86e5b865..184cf320f7 100644
(*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
(*parent)->addend = 0;
(*parent)->howto = &none_howto;
-diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
-index 61f70de12e..c31e26efd7 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
-@@ -8232,7 +8232,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
+@@ -8232,7 +8232,7 @@ ppc_elf_relocate_section (bfd *output_bf
howto = ppc_elf_howto_table[r_type];
_bfd_clear_contents (howto, input_bfd, input_section,
@@ -178,11 +136,9 @@ index 61f70de12e..c31e26efd7 100644
wrel->r_offset = rel->r_offset;
wrel->r_info = 0;
wrel->r_addend = 0;
-diff --git a/bfd/elf32-visium.c b/bfd/elf32-visium.c
-index e8f1c4c9e4..961366cd87 100644
--- a/bfd/elf32-visium.c
+++ b/bfd/elf32-visium.c
-@@ -621,7 +621,7 @@ visium_elf_relocate_section (bfd *output_bfd,
+@@ -621,7 +621,7 @@ visium_elf_relocate_section (bfd *output
or sections discarded by a linker script, we just want the
section contents zeroed. Avoid any special processing. */
_bfd_clear_contents (howto, input_bfd, input_section,
@@ -191,11 +147,9 @@ index e8f1c4c9e4..961366cd87 100644
rel->r_info = 0;
rel->r_addend = 0;
-diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
-index eadde17615..7c3534ac65 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
-@@ -14073,7 +14073,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
+@@ -14074,7 +14074,7 @@ ppc64_elf_relocate_section (bfd *output_
{
_bfd_clear_contents (ppc64_elf_howto_table[r_type],
input_bfd, input_section,
@@ -204,11 +158,9 @@ index eadde17615..7c3534ac65 100644
wrel->r_offset = rel->r_offset;
wrel->r_info = 0;
wrel->r_addend = 0;
-diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
-index c3a6c31ed2..4dcab43478 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
-@@ -2490,7 +2490,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
+@@ -2490,7 +2490,7 @@ elf_x86_64_relocate_section (bfd *output
if (sec != NULL && discarded_section (sec))
{
_bfd_clear_contents (howto, input_bfd, input_section,
@@ -217,11 +169,9 @@ index c3a6c31ed2..4dcab43478 100644
wrel->r_offset = rel->r_offset;
wrel->r_info = 0;
wrel->r_addend = 0;
-diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
-index e53b255dad..f6d9565f03 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
-@@ -696,8 +696,8 @@ extern bfd_reloc_status_type _bfd_relocate_contents
+@@ -696,8 +696,8 @@ extern bfd_reloc_status_type _bfd_reloca
(reloc_howto_type *, bfd *, bfd_vma, bfd_byte *) ATTRIBUTE_HIDDEN;
/* Clear a given location using a given howto. */
@@ -232,11 +182,9 @@ index e53b255dad..f6d9565f03 100644
/* Link stabs in sections in the first pass. */
-diff --git a/bfd/libbfd.h b/bfd/libbfd.h
-index a8851c8026..1189e63358 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
-@@ -701,8 +701,8 @@ extern bfd_reloc_status_type _bfd_relocate_contents
+@@ -701,8 +701,8 @@ extern bfd_reloc_status_type _bfd_reloca
(reloc_howto_type *, bfd *, bfd_vma, bfd_byte *) ATTRIBUTE_HIDDEN;
/* Clear a given location using a given howto. */
@@ -247,11 +195,9 @@ index a8851c8026..1189e63358 100644
/* Link stabs in sections in the first pass. */
-diff --git a/bfd/reloc.c b/bfd/reloc.c
-index 8dbb8896d3..1686780669 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
-@@ -1613,16 +1613,22 @@ _bfd_relocate_contents (reloc_howto_type *howto,
+@@ -1613,16 +1613,22 @@ _bfd_relocate_contents (reloc_howto_type
relocations against discarded symbols, to make ignorable debug or unwind
information more obvious. */
@@ -276,7 +222,7 @@ index 8dbb8896d3..1686780669 100644
size = bfd_get_reloc_size (howto);
switch (size)
{
-@@ -1687,6 +1693,7 @@ _bfd_clear_contents (reloc_howto_type *howto,
+@@ -1681,6 +1687,7 @@ _bfd_clear_contents (reloc_howto_type *h
#endif
break;
}
@@ -284,7 +230,7 @@ index 8dbb8896d3..1686780669 100644
}
/*
-@@ -8275,14 +8282,14 @@ bfd_generic_get_relocated_section_contents (bfd *abfd,
+@@ -8268,14 +8275,14 @@ bfd_generic_get_relocated_section_conten
if (symbol->section && discarded_section (symbol->section))
{
@@ -303,6 +249,3 @@ index 8dbb8896d3..1686780669 100644
(*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
(*parent)->addend = 0;
(*parent)->howto = &none_howto;
---
-2.13.3
-
diff --git a/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18605.patch b/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18605.patch
index d6c706771..a117f95df 100644
--- a/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18605.patch
+++ b/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18605.patch
@@ -15,25 +15,9 @@ Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
bfd/merge.c | 3 +++
2 files changed, 9 insertions(+)
-diff --git a/bfd/ChangeLog b/bfd/ChangeLog
-index 31ff3d6..da423b1 100644
---- a/bfd/ChangeLog
-+++ b/bfd/ChangeLog
-@@ -1,3 +1,9 @@
-+2018-10-23 Alan Modra <amodra@gmail.com>
-+
-+ PR 23804
-+ * merge.c (_bfd_add_merge_section): Don't attempt to merge
-+ sections where size is not a multiple of entsize.
-+
- 2018-10-13 Alan Modra <amodra@gmail.com>
-
- PR 23770
-diff --git a/bfd/merge.c b/bfd/merge.c
-index 7904552..5e3bba0 100644
--- a/bfd/merge.c
+++ b/bfd/merge.c
-@@ -376,6 +376,9 @@ _bfd_add_merge_section (bfd *abfd, void **psinfo, asection *sec,
+@@ -376,6 +376,9 @@ _bfd_add_merge_section (bfd *abfd, void
|| sec->entsize == 0)
return TRUE;
@@ -43,5 +27,3 @@ index 7904552..5e3bba0 100644
if ((sec->flags & SEC_RELOC) != 0)
{
/* We aren't prepared to handle relocations in merged sections. */
---
-2.9.3
diff --git a/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18606.patch b/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18606.patch
index 35cf328a1..325c339b8 100644
--- a/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18606.patch
+++ b/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18606.patch
@@ -15,24 +15,6 @@ Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
bfd/merge.c | 15 +++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
-diff --git a/bfd/ChangeLog b/bfd/ChangeLog
-index 1f3fc1c..c5f7ec7 100644
---- a/bfd/ChangeLog
-+++ b/bfd/ChangeLog
-@@ -1,5 +1,11 @@
- 2018-10-23 Alan Modra <amodra@gmail.com>
-
-+ PR 23806
-+ * merge.c (_bfd_add_merge_section): Don't attempt to merge
-+ sections with ridiculously large alignments.
-+
-+2018-10-23 Alan Modra <amodra@gmail.com>
-+
- PR 23804
- * merge.c (_bfd_add_merge_section): Don't attempt to merge
- sections where size is not a multiple of entsize.
-diff --git a/bfd/merge.c b/bfd/merge.c
-index 5e3bba0..7de0c88 100644
--- a/bfd/merge.c
+++ b/bfd/merge.c
@@ -24,6 +24,7 @@
@@ -43,7 +25,7 @@ index 5e3bba0..7de0c88 100644
#include "bfd.h"
#include "elf-bfd.h"
#include "libbfd.h"
-@@ -385,12 +386,18 @@ _bfd_add_merge_section (bfd *abfd, void **psinfo, asection *sec,
+@@ -385,12 +386,18 @@ _bfd_add_merge_section (bfd *abfd, void
return TRUE;
}
@@ -66,5 +48,3 @@ index 5e3bba0..7de0c88 100644
{
/* Sanity check. If string character size is smaller than
alignment, then we require character size to be a power
---
-2.9.3
diff --git a/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18607.patch b/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18607.patch
index 38225d171..902a90dbc 100644
--- a/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18607.patch
+++ b/poky/meta/recipes-devtools/binutils/binutils/CVE-2018-18607.patch
@@ -16,28 +16,9 @@ Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
bfd/elflink.c | 20 ++++++++++++++------
2 files changed, 21 insertions(+), 6 deletions(-)
-diff --git a/bfd/ChangeLog b/bfd/ChangeLog
-index da423b1..1f3fc1c 100644
---- a/bfd/ChangeLog
-+++ b/bfd/ChangeLog
-@@ -1,5 +1,12 @@
- 2018-10-23 Alan Modra <amodra@gmail.com>
-
-+ PR 23805
-+ * elflink.c (elf_link_input_bfd): Don't segfault on finding
-+ STT_TLS symbols without any TLS sections. Instead, change the
-+ symbol type to STT_NOTYPE.
-+
-+2018-10-23 Alan Modra <amodra@gmail.com>
-+
- PR 23806
- * merge.c (_bfd_add_merge_section): Don't attempt to merge
- sections with ridiculously large alignments.
-diff --git a/bfd/elflink.c b/bfd/elflink.c
-index c3876cb..87440db 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
-@@ -10489,8 +10489,11 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
+@@ -10496,8 +10496,11 @@ elf_link_input_bfd (struct elf_final_lin
if (ELF_ST_TYPE (osym.st_info) == STT_TLS)
{
/* STT_TLS symbols are relative to PT_TLS segment base. */
@@ -51,7 +32,7 @@ index c3876cb..87440db 100644
}
}
-@@ -11046,12 +11049,17 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
+@@ -11053,12 +11056,17 @@ elf_link_input_bfd (struct elf_final_lin
sym.st_value += osec->vma;
if (ELF_ST_TYPE (sym.st_info) == STT_TLS)
{
@@ -73,5 +54,3 @@ index c3876cb..87440db 100644
}
}
---
-2.9.3
diff --git a/poky/meta/recipes-devtools/binutils/binutils/clang-bfd-fix.patch b/poky/meta/recipes-devtools/binutils/binutils/clang-bfd-fix.patch
new file mode 100644
index 000000000..29c0d48fe
--- /dev/null
+++ b/poky/meta/recipes-devtools/binutils/binutils/clang-bfd-fix.patch
@@ -0,0 +1,30 @@
+Fix compiler error seen with clang, The return value of this
+function is not checked anywhere so in a way its useless but
+still technically correct to return a value here
+
+Fixes
+
+../../bfd/reloc.c:1638:7: error: non-void function '_bfd_clear_contents' should return a value [-Wreturn-type]
+ return;
+ ^
+1 error generated.
+
+It has been fixed in master along with a larger cleanup and fix for relocations
+
+https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=1dc9e2d63e37839ff1768346b2e3f52e338baba5
+
+Upstream-Status: Backport [Fixes differently]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+--- a/bfd/reloc.c
++++ b/bfd/reloc.c
+@@ -1629,7 +1629,7 @@ _bfd_clear_contents (reloc_howto_type *h
+ default:
+ abort ();
+ case 0:
+- return;
++ return 0;
+ case 1:
+ x = bfd_get_8 (input_bfd, location);
+ break;
OpenPOWER on IntegriCloud