From 4ede5d606aa949309389497475d4ff9ff8b3eb52 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 28 2020 09:34:26 +0000 Subject: import binutils-2.30-73.el8 --- diff --git a/SOURCES/binutils-CVE-2019-1010204.patch b/SOURCES/binutils-CVE-2019-1010204.patch new file mode 100644 index 0000000..d1d949f --- /dev/null +++ b/SOURCES/binutils-CVE-2019-1010204.patch @@ -0,0 +1,15 @@ +--- binutils.orig/gold/fileread.cc 2019-11-08 10:33:58.911577903 +0000 ++++ binutils-2.30/gold/fileread.cc 2019-11-08 10:34:13.001470092 +0000 +@@ -381,6 +381,12 @@ File_read::do_read(off_t start, section_ + ssize_t bytes; + if (this->whole_file_view_ != NULL) + { ++ // See PR 23765 for an example of a testcase that triggers this error. ++ if (((ssize_t) start) < 0) ++ gold_fatal(_("%s: read failed, starting offset (%#llx) less than zero"), ++ this->filename().c_str(), ++ static_cast(start)); ++ + bytes = this->size_ - start; + if (static_cast(bytes) >= size) + { diff --git a/SOURCES/binutils-CVE-2019-14444.patch b/SOURCES/binutils-CVE-2019-14444.patch new file mode 100644 index 0000000..ad554f5 --- /dev/null +++ b/SOURCES/binutils-CVE-2019-14444.patch @@ -0,0 +1,11 @@ +--- binutils.orig/binutils/readelf.c 2019-08-13 10:03:33.518792590 +0100 ++++ binutils-2.32/binutils/readelf.c 2019-08-13 10:04:22.885418269 +0100 +@@ -13234,7 +13234,7 @@ apply_relocations (Filedata * + } + + rloc = start + rp->r_offset; +- if ((rloc + reloc_size) > end || (rloc < start)) ++ if (rloc >= end || (rloc + reloc_size) > end || (rloc < start)) + { + warn (_("skipping invalid relocation offset 0x%lx in section %s\n"), + (unsigned long) rp->r_offset, diff --git a/SOURCES/binutils-CVE-2019-17450.patch b/SOURCES/binutils-CVE-2019-17450.patch new file mode 100644 index 0000000..63affa9 --- /dev/null +++ b/SOURCES/binutils-CVE-2019-17450.patch @@ -0,0 +1,62 @@ +--- binutils.orig/bfd/dwarf2.c 2019-12-03 15:50:43.324118062 +0000 ++++ binutils-2.30/bfd/dwarf2.c 2019-12-03 15:54:32.545489215 +0000 +@@ -2803,8 +2803,8 @@ lookup_symbol_in_variable_table (struct + + static bfd_boolean + find_abstract_instance_name (struct comp_unit *unit, +- bfd_byte *orig_info_ptr, + struct attribute *attr_ptr, ++ unsigned int recur_count, + const char **pname, + bfd_boolean *is_linkage) + { +@@ -2817,6 +2817,14 @@ find_abstract_instance_name (struct comp + struct attribute attr; + const char *name = NULL; + ++ if (recur_count == 100) ++ { ++ _bfd_error_handler ++ (_("DWARF error: abstract instance recursion detected")); ++ bfd_set_error (bfd_error_bad_value); ++ return FALSE; ++ } ++ + /* DW_FORM_ref_addr can reference an entry in a different CU. It + is an offset from the .debug_info section, not the current CU. */ + if (attr_ptr->form == DW_FORM_ref_addr) +@@ -2934,15 +2942,7 @@ find_abstract_instance_name (struct comp + info_ptr, info_ptr_end); + if (info_ptr == NULL) + break; +- /* It doesn't ever make sense for DW_AT_specification to +- refer to the same DIE. Stop simple recursion. */ +- if (info_ptr == orig_info_ptr) +- { +- _bfd_error_handler +- (_("Dwarf Error: Abstract instance recursion detected.")); +- bfd_set_error (bfd_error_bad_value); +- return FALSE; +- } ++ + switch (attr.name) + { + case DW_AT_name: +@@ -2956,7 +2956,7 @@ find_abstract_instance_name (struct comp + } + break; + case DW_AT_specification: +- if (!find_abstract_instance_name (unit, info_ptr, &attr, ++ if (!find_abstract_instance_name (unit, &attr, recur_count + 1, + pname, is_linkage)) + return FALSE; + break; +@@ -3162,7 +3162,7 @@ scan_unit_for_symbols (struct comp_unit + + case DW_AT_abstract_origin: + case DW_AT_specification: +- if (!find_abstract_instance_name (unit, info_ptr, &attr, ++ if (!find_abstract_instance_name (unit, &attr, 0, + &func->name, + &func->is_linkage)) + goto fail; diff --git a/SOURCES/binutils-CVE-2019-17451.patch b/SOURCES/binutils-CVE-2019-17451.patch new file mode 100644 index 0000000..0f503a3 --- /dev/null +++ b/SOURCES/binutils-CVE-2019-17451.patch @@ -0,0 +1,20 @@ +--- binutils.orig/bfd/dwarf2.c 2019-11-13 11:32:09.395430104 +0000 ++++ binutils-2.33.1/bfd/dwarf2.c 2019-11-13 11:33:17.272899503 +0000 +@@ -4440,7 +4440,16 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd, + for (total_size = 0; + msec; + msec = find_debug_info (debug_bfd, debug_sections, msec)) +- total_size += msec->size; ++ { ++ /* Catch PR25070 testcase overflowing size calculation here. */ ++ if (total_size + msec->size < total_size ++ || total_size + msec->size < msec->size) ++ { ++ bfd_set_error (bfd_error_no_memory); ++ return FALSE; ++ } ++ total_size += msec->size; ++ } + + stash->info_ptr_memory = (bfd_byte *) bfd_malloc (total_size); + if (stash->info_ptr_memory == NULL) diff --git a/SOURCES/binutils-aarch64-STO_AARCH64_VARIANT_PCS.patch b/SOURCES/binutils-aarch64-STO_AARCH64_VARIANT_PCS.patch new file mode 100644 index 0000000..89f4468 --- /dev/null +++ b/SOURCES/binutils-aarch64-STO_AARCH64_VARIANT_PCS.patch @@ -0,0 +1,855 @@ +diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.32/bfd/elfnn-aarch64.c +--- binutils.orig/bfd/elfnn-aarch64.c 2019-07-02 17:30:19.407892712 +0100 ++++ binutils-2.32/bfd/elfnn-aarch64.c 2019-07-02 17:35:21.874749884 +0100 +@@ -2579,6 +2579,9 @@ struct elf_aarch64_link_hash_table + unsigned int top_index; + asection **input_list; + ++ /* JUMP_SLOT relocs for variant PCS symbols may be present. */ ++ int variant_pcs; ++ + /* The offset into splt of the PLT entry for the TLS descriptor + resolver. Special values are 0, if not necessary (or not found + to be necessary yet), and -1 if needed but not determined +@@ -2790,6 +2793,31 @@ elfNN_aarch64_copy_indirect_symbol (stru + _bfd_elf_link_hash_copy_indirect (info, dir, ind); + } + ++/* Merge non-visibility st_other attributes. */ ++ ++static void ++elfNN_aarch64_merge_symbol_attribute (struct elf_link_hash_entry *h, ++ const Elf_Internal_Sym *isym, ++ bfd_boolean definition ATTRIBUTE_UNUSED, ++ bfd_boolean dynamic ATTRIBUTE_UNUSED) ++{ ++ unsigned int isym_sto = isym->st_other & ~ELF_ST_VISIBILITY (-1); ++ unsigned int h_sto = h->other & ~ELF_ST_VISIBILITY (-1); ++ ++ if (isym_sto == h_sto) ++ return; ++ ++ if (isym_sto & ~STO_AARCH64_VARIANT_PCS) ++ /* Not fatal, this callback cannot fail. */ ++ _bfd_error_handler (_("unknown attribute for symbol `%s': 0x%02x"), ++ h->root.root.string, isym_sto); ++ ++ /* Note: Ideally we would warn about any attribute mismatch, but ++ this api does not allow that without substantial changes. */ ++ if (isym_sto & STO_AARCH64_VARIANT_PCS) ++ h->other |= STO_AARCH64_VARIANT_PCS; ++} ++ + /* Destroy an AArch64 elf linker hash table. */ + + static void +@@ -8370,6 +8398,12 @@ elfNN_aarch64_allocate_dynrelocs (struct + updated. */ + + htab->root.srelplt->reloc_count++; ++ ++ /* Mark the DSO in case R__JUMP_SLOT relocs against ++ variant PCS symbols are present. */ ++ if (h->other & STO_AARCH64_VARIANT_PCS) ++ htab->variant_pcs = 1; ++ + } + else + { +@@ -8958,6 +8992,10 @@ elfNN_aarch64_size_dynamic_sections (bfd + || !add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + ++ if (htab->variant_pcs ++ && !add_dynamic_entry (DT_AARCH64_VARIANT_PCS, 0)) ++ return FALSE; ++ + if (htab->tlsdesc_plt + && (!add_dynamic_entry (DT_TLSDESC_PLT, 0) + || !add_dynamic_entry (DT_TLSDESC_GOT, 0))) +@@ -9708,6 +9746,9 @@ const struct elf_size_info elfNN_aarch64 + #define elf_backend_copy_indirect_symbol \ + elfNN_aarch64_copy_indirect_symbol + ++#define elf_backend_merge_symbol_attribute \ ++ elfNN_aarch64_merge_symbol_attribute ++ + /* Create .dynbss, and .rela.bss sections in DYNOBJ, and set up shortcuts + to them in our hash. */ + #define elf_backend_create_dynamic_sections \ +diff -rup binutils.orig/binutils/readelf.c binutils-2.32/binutils/readelf.c +--- binutils.orig/binutils/readelf.c 2019-07-02 17:30:18.890896375 +0100 ++++ binutils-2.32/binutils/readelf.c 2019-07-02 17:32:25.008002901 +0100 +@@ -1797,6 +1797,19 @@ dump_relocations (Filedata * fi + } + + static const char * ++get_aarch64_dynamic_type (unsigned long type) ++{ ++ switch (type) ++ { ++ case DT_AARCH64_BTI_PLT: return "AARCH64_BTI_PLT"; ++ case DT_AARCH64_PAC_PLT: return "AARCH64_PAC_PLT"; ++ case DT_AARCH64_VARIANT_PCS: return "AARCH64_VARIANT_PCS"; ++ default: ++ return NULL; ++ } ++} ++ ++static const char * + get_mips_dynamic_type (unsigned long type) + { + switch (type) +@@ -2169,6 +2182,9 @@ get_dynamic_type (Filedata * filedata, u + + switch (filedata->file_header.e_machine) + { ++ case EM_AARCH64: ++ result = get_aarch64_dynamic_type (type); ++ break; + case EM_MIPS: + case EM_MIPS_RS3_LE: + result = get_mips_dynamic_type (type); +@@ -11054,6 +11070,22 @@ get_solaris_symbol_visibility (unsigned + } + + static const char * ++get_aarch64_symbol_other (unsigned int other) ++{ ++ static char buf[32]; ++ ++ if (other & STO_AARCH64_VARIANT_PCS) ++ { ++ other &= ~STO_AARCH64_VARIANT_PCS; ++ if (other == 0) ++ return "VARIANT_PCS"; ++ snprintf (buf, sizeof buf, "VARIANT_PCS | %x", other); ++ return buf; ++ } ++ return NULL; ++} ++ ++static const char * + get_mips_symbol_other (unsigned int other) + { + switch (other) +@@ -11164,6 +11196,9 @@ get_symbol_other (Filedata * filedata, u + + switch (filedata->file_header.e_machine) + { ++ case EM_AARCH64: ++ result = get_aarch64_symbol_other (other); ++ break; + case EM_MIPS: + result = get_mips_symbol_other (other); + break; +diff -rup binutils.orig/gas/config/tc-aarch64.c binutils-2.32/gas/config/tc-aarch64.c +--- binutils.orig/gas/config/tc-aarch64.c 2019-07-02 17:30:19.131894667 +0100 ++++ binutils-2.32/gas/config/tc-aarch64.c 2019-07-02 17:35:45.202584620 +0100 +@@ -1938,6 +1938,28 @@ s_aarch64_elf_cons (int nbytes) + demand_empty_rest_of_line (); + } + ++/* Mark symbol that it follows a variant PCS convention. */ ++ ++static void ++s_variant_pcs (int ignored ATTRIBUTE_UNUSED) ++{ ++ char *name; ++ char c; ++ symbolS *sym; ++ asymbol *bfdsym; ++ elf_symbol_type *elfsym; ++ ++ c = get_symbol_name (&name); ++ if (!*name) ++ as_bad (_("Missing symbol name in directive")); ++ sym = symbol_find_or_make (name); ++ restore_line_pointer (c); ++ demand_empty_rest_of_line (); ++ bfdsym = symbol_get_bfdsym (sym); ++ elfsym = elf_symbol_from (bfd_asymbol_bfd (bfdsym), bfdsym); ++ gas_assert (elfsym); ++ elfsym->internal_elf_sym.st_other |= STO_AARCH64_VARIANT_PCS; ++} + #endif /* OBJ_ELF */ + + /* Output a 32-bit word, but mark as an instruction. */ +@@ -2084,6 +2106,7 @@ const pseudo_typeS md_pseudo_table[] = { + {"long", s_aarch64_elf_cons, 4}, + {"xword", s_aarch64_elf_cons, 8}, + {"dword", s_aarch64_elf_cons, 8}, ++ {"variant_pcs", s_variant_pcs, 0}, + #endif + {0, 0, 0} + }; +@@ -9320,3 +9343,35 @@ aarch64_copy_symbol_attributes (symbolS + { + AARCH64_GET_FLAG (dest) = AARCH64_GET_FLAG (src); + } ++ ++#ifdef OBJ_ELF ++/* Same as elf_copy_symbol_attributes, but without copying st_other. ++ This is needed so AArch64 specific st_other values can be independently ++ specified for an IFUNC resolver (that is called by the dynamic linker) ++ and the symbol it resolves (aliased to the resolver). In particular, ++ if a function symbol has special st_other value set via directives, ++ then attaching an IFUNC resolver to that symbol should not override ++ the st_other setting. Requiring the directive on the IFUNC resolver ++ symbol would be unexpected and problematic in C code, where the two ++ symbols appear as two independent function declarations. */ ++ ++void ++aarch64_elf_copy_symbol_attributes (symbolS *dest, symbolS *src) ++{ ++ struct elf_obj_sy *srcelf = symbol_get_obj (src); ++ struct elf_obj_sy *destelf = symbol_get_obj (dest); ++ if (srcelf->size) ++ { ++ if (destelf->size == NULL) ++ destelf->size = XNEW (expressionS); ++ *destelf->size = *srcelf->size; ++ } ++ else ++ { ++ if (destelf->size != NULL) ++ free (destelf->size); ++ destelf->size = NULL; ++ } ++ S_SET_SIZE (dest, S_GET_SIZE (src)); ++} ++#endif +diff -rup binutils.orig/gas/config/tc-aarch64.h binutils-2.32/gas/config/tc-aarch64.h +--- binutils.orig/gas/config/tc-aarch64.h 2019-07-02 17:30:19.136894632 +0100 ++++ binutils-2.32/gas/config/tc-aarch64.h 2019-07-02 17:35:45.202584620 +0100 +@@ -130,6 +130,12 @@ void aarch64_copy_symbol_attributes (sym + (aarch64_copy_symbol_attributes (DEST, SRC)) + #endif + ++#ifdef OBJ_ELF ++void aarch64_elf_copy_symbol_attributes (symbolS *, symbolS *); ++#define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST, SRC) \ ++ aarch64_elf_copy_symbol_attributes (DEST, SRC) ++#endif ++ + #define TC_START_LABEL(STR, NUL_CHAR, NEXT_CHAR) \ + (NEXT_CHAR == ':' || (NEXT_CHAR == '/' && aarch64_data_in_code ())) + #define tc_canonicalize_symbol_name(str) aarch64_canonicalize_symbol_name (str); +diff -rup binutils.orig/gas/doc/c-aarch64.texi binutils-2.32/gas/doc/c-aarch64.texi +--- binutils.orig/gas/doc/c-aarch64.texi 2019-07-02 17:30:19.125894710 +0100 ++++ binutils-2.32/gas/doc/c-aarch64.texi 2019-07-02 17:35:11.362824354 +0100 +@@ -425,6 +425,12 @@ should only be done if it is really nece + + @c VVVVVVVVVVVVVVVVVVVVVVVVVV + ++@cindex @code{.variant_pcs} directive, AArch64 ++@item .variant_pcs @var{symbol} ++This directive marks @var{symbol} referencing a function that may ++follow a variant procedure call standard with different register ++usage convention from the base procedure call standard. ++ + @c WWWWWWWWWWWWWWWWWWWWWWWWWW + @c XXXXXXXXXXXXXXXXXXXXXXXXXX + +diff -rup binutils.orig/include/elf/aarch64.h binutils-2.32/include/elf/aarch64.h +--- binutils.orig/include/elf/aarch64.h 2019-07-02 17:30:18.850896658 +0100 ++++ binutils-2.32/include/elf/aarch64.h 2019-07-02 17:32:55.678785616 +0100 +@@ -36,6 +36,15 @@ + #define SHF_COMDEF 0x80000000 /* Section may be multiply defined + in the input to a link step. */ + ++/* Processor specific dynamic array tags. */ ++#define DT_AARCH64_BTI_PLT (DT_LOPROC + 1) ++#define DT_AARCH64_PAC_PLT (DT_LOPROC + 3) ++#define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5) ++ ++/* AArch64-specific values for st_other. */ ++#define STO_AARCH64_VARIANT_PCS 0x80 /* Symbol may follow different call ++ convention from the base PCS. */ ++ + /* Relocation types. */ + + START_RELOC_NUMBERS (elf_aarch64_reloc_type) +diff -rup binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp binutils-2.32/ld/testsuite/ld-aarch64/aarch64-elf.exp +--- binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp 2019-07-02 17:30:18.922896148 +0100 ++++ binutils-2.32/ld/testsuite/ld-aarch64/aarch64-elf.exp 2019-07-02 17:35:21.875749878 +0100 +@@ -371,6 +371,10 @@ run_dump_test_lp64 "rela-abs-relative-op + + run_dump_test_lp64 "pie-bind-locally" + ++run_dump_test_lp64 "variant_pcs-r" ++run_dump_test_lp64 "variant_pcs-shared" ++run_dump_test_lp64 "variant_pcs-now" ++ + set aarch64elflinktests { + {"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s} + {} "copy-reloc-so.so"} +--- /dev/null 2019-07-02 08:01:33.386842704 +0100 ++++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-1.d 2019-07-02 17:35:11.362824354 +0100 +@@ -0,0 +1,10 @@ ++#objdump: -t ++ ++.*: file format .* ++ ++SYMBOL TABLE: ++0+ l d \.text 0+ \.text ++0+ l d \.data 0+ \.data ++0+ l d \.bss 0+ \.bss ++0+ l \.text 0+ func ++0+ \*UND\* 0+ 0x80 foobar +--- /dev/null 2019-07-02 08:01:33.386842704 +0100 ++++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-1.s 2019-07-02 17:35:11.362824354 +0100 +@@ -0,0 +1,8 @@ ++.text ++.variant_pcs foobar ++func: ++ bl foobar ++ b foobar ++ ++.data ++.xword foobar +--- /dev/null 2019-07-02 08:01:33.386842704 +0100 ++++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-2.d 2019-07-02 17:35:11.362824354 +0100 +@@ -0,0 +1,9 @@ ++#objdump: -t ++ ++.*: file format .* ++ ++SYMBOL TABLE: ++0+ l d \.text 0+ \.text ++0+ l d \.data 0+ \.data ++0+ l d \.bss 0+ \.bss ++0+ l \.text 0+ 0x80 foo +--- /dev/null 2019-07-02 08:01:33.386842704 +0100 ++++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-2.s 2019-07-02 17:35:11.362824354 +0100 +@@ -0,0 +1,4 @@ ++.text ++.variant_pcs foo ++foo: ++ ret +--- /dev/null 2019-07-02 08:01:33.386842704 +0100 ++++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-3.s 2019-07-02 17:35:45.202584620 +0100 +@@ -0,0 +1,20 @@ ++.text ++.global foo_vpcs ++.global foo_base ++.global alias_vpcs ++.global alias_base ++ ++.variant_pcs foo_vpcs ++.variant_pcs alias_vpcs ++ ++foo_vpcs: ++foo_base: ++ bl foo_vpcs ++ bl foo_base ++ bl alias_vpcs ++ bl alias_base ++ ++/* Check that the STO_AARCH64_VARIANT_PCS is not affected by .set. */ ++ ++.set alias_base, foo_vpcs ++.set alias_vpcs, foo_base +--- /dev/null 2019-07-02 08:01:33.386842704 +0100 ++++ binutils-2.32/gas/testsuite/gas/aarch64/symbol-variant_pcs-3.d 2019-07-02 17:35:45.202584620 +0100 +@@ -0,0 +1,12 @@ ++#objdump: -t ++ ++.*: file format .* ++ ++SYMBOL TABLE: ++0+ l d \.text 0+ \.text ++0+ l d \.data 0+ \.data ++0+ l d \.bss 0+ \.bss ++0+ g \.text 0+ 0x80 foo_vpcs ++0+ g \.text 0+ foo_base ++0+ g \.text 0+ 0x80 alias_vpcs ++0+ g \.text 0+ alias_base +--- /dev/null 2019-07-02 08:01:33.386842704 +0100 ++++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-1.s 2019-07-02 17:35:21.875749878 +0100 +@@ -0,0 +1,59 @@ ++.text ++ ++.variant_pcs f_spec_global_default_def ++.variant_pcs f_spec_global_default_undef ++.variant_pcs f_spec_global_hidden_def ++.variant_pcs f_spec_local ++.variant_pcs f_spec_global_default_ifunc ++.variant_pcs f_spec_global_hidden_ifunc ++.variant_pcs f_spec_local_ifunc ++ ++.global f_spec_global_default_def ++.global f_spec_global_default_undef ++.global f_spec_global_hidden_def ++.global f_spec_global_default_ifunc ++.global f_spec_global_hidden_ifunc ++.global f_base_global_default_def ++.global f_base_global_default_undef ++.global f_base_global_hidden_def ++.global f_base_global_default_ifunc ++.global f_base_global_hidden_ifunc ++ ++.hidden f_spec_global_hidden_def ++.hidden f_spec_global_hidden_ifunc ++.hidden f_base_global_hidden_def ++.hidden f_base_global_hidden_ifunc ++ ++.type f_spec_global_default_ifunc, %gnu_indirect_function ++.type f_spec_global_hidden_ifunc, %gnu_indirect_function ++.type f_spec_local_ifunc, %gnu_indirect_function ++.type f_base_global_default_ifunc, %gnu_indirect_function ++.type f_base_global_hidden_ifunc, %gnu_indirect_function ++.type f_base_local_ifunc, %gnu_indirect_function ++ ++f_spec_global_default_def: ++f_spec_global_hidden_def: ++f_spec_local: ++f_base_global_default_def: ++f_base_global_hidden_def: ++f_base_local: ++f_spec_global_default_ifunc: ++f_spec_global_hidden_ifunc: ++f_spec_local_ifunc: ++f_base_global_default_ifunc: ++f_base_global_hidden_ifunc: ++f_base_local_ifunc: ++ bl f_spec_global_default_def ++ bl f_spec_global_default_undef ++ bl f_spec_global_hidden_def ++ bl f_spec_local ++ bl f_base_global_default_def ++ bl f_base_global_default_undef ++ bl f_base_global_hidden_def ++ bl f_base_local ++ bl f_spec_global_default_ifunc ++ bl f_spec_global_hidden_ifunc ++ bl f_spec_local_ifunc ++ bl f_base_global_default_ifunc ++ bl f_base_global_hidden_ifunc ++ bl f_base_local_ifunc +--- /dev/null 2019-07-02 08:01:33.386842704 +0100 ++++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-2.s 2019-07-02 17:35:21.875749878 +0100 +@@ -0,0 +1,47 @@ ++.text ++ ++.variant_pcs f_spec_global_default_def ++.variant_pcs f_spec_global_default_undef ++.variant_pcs f_spec_global_hidden_def ++.variant_pcs f_spec_local2 ++.variant_pcs f_spec_global_default_ifunc ++.variant_pcs f_spec_global_hidden_ifunc ++.variant_pcs f_spec_local2_ifunc ++ ++.global f_spec_global_default_def ++.global f_spec_global_default_undef ++.global f_spec_global_hidden_def ++.global f_spec_global_default_ifunc ++.global f_spec_global_hidden_ifunc ++.global f_base_global_default_def ++.global f_base_global_default_undef ++.global f_base_global_hidden_def ++.global f_base_global_default_ifunc ++.global f_base_global_hidden_ifunc ++ ++.hidden f_spec_global_hidden_def ++.hidden f_spec_global_hidden_ifunc ++.hidden f_base_global_hidden_def ++.hidden f_base_global_hidden_ifunc ++ ++.type f_spec_local2_ifunc, %gnu_indirect_function ++.type f_base_local2_ifunc, %gnu_indirect_function ++ ++f_spec_local2: ++f_base_local2: ++f_spec_local2_ifunc: ++f_base_local2_ifunc: ++ bl f_spec_global_default_def ++ bl f_spec_global_default_undef ++ bl f_spec_global_hidden_def ++ bl f_spec_local2 ++ bl f_base_global_default_def ++ bl f_base_global_default_undef ++ bl f_base_global_hidden_def ++ bl f_base_local2 ++ bl f_spec_global_default_ifunc ++ bl f_spec_global_hidden_ifunc ++ bl f_spec_local2_ifunc ++ bl f_base_global_default_ifunc ++ bl f_base_global_hidden_ifunc ++ bl f_base_local2_ifunc +--- /dev/null 2019-07-02 08:01:33.386842704 +0100 ++++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs.ld 2019-07-02 17:35:37.100642017 +0100 +@@ -0,0 +1,23 @@ ++/* Script for .variant_pcs symbol tests. */ ++OUTPUT_ARCH(aarch64) ++ENTRY(_start) ++SECTIONS ++{ ++ /* Read-only sections, merged into text segment: */ ++ PROVIDE (__executable_start = 0x8000); . = 0x8000; ++ .text : ++ { ++ *(.before) ++ *(.text) ++ *(.after) ++ } =0 ++ . = 0x9000; ++ .got : { *(.got) *(.got.plt)} ++ . = 0x10000; ++ .rela.dyn : { *(.rela.ifunc) } ++ . = 0x11000; ++ .rela.plt : { *(.rela.plt) *(.rela.iplt) } ++ . = 0x12340000; ++ .far : { *(.far) } ++ .ARM.attributes 0 : { *(.ARM.atttributes) } ++} +--- /dev/null 2019-07-02 08:01:33.386842704 +0100 ++++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-now.d 2019-07-02 17:34:37.557063849 +0100 +@@ -0,0 +1,67 @@ ++#source: variant_pcs-1.s ++#source: variant_pcs-2.s ++#ld: -shared --hash-style=sysv -T variant_pcs.ld -z now ++#readelf: -rsW ++ ++Relocation section '\.rela\.plt' at offset 0x11000 contains 12 entries: ++ Offset Info Type Symbol's Value Symbol's Name \+ Addend ++0000000000009020 0000000100000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0 ++0000000000009028 0000000200000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0 ++0000000000009030 0000000400000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0 ++0000000000009038 0000000500000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0 ++0000000000009040 0000000000000408 R_AARCH64_IRELATIVE 8000 ++0000000000009048 0000000300000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0 ++0000000000009050 0000000000000408 R_AARCH64_IRELATIVE 8000 ++0000000000009058 0000000600000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0 ++0000000000009060 0000000000000408 R_AARCH64_IRELATIVE 8038 ++0000000000009068 0000000000000408 R_AARCH64_IRELATIVE 8000 ++0000000000009070 0000000000000408 R_AARCH64_IRELATIVE 8000 ++0000000000009078 0000000000000408 R_AARCH64_IRELATIVE 8038 ++ ++Symbol table '\.dynsym' contains 7 entries: ++ Num: Value Size Type Bind Vis Ndx Name ++ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND ++ 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef ++ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef ++ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def ++ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc ++ ++Symbol table '\.symtab' contains 35 entries: ++ Num: Value Size Type Bind Vis Ndx Name ++ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND ++ 1: 0000000000008000 0 SECTION LOCAL DEFAULT 1 ++ 2: 0000000000008070 0 SECTION LOCAL DEFAULT 2 ++ 3: 0000000000009000 0 SECTION LOCAL DEFAULT 3 ++ 4: 0000000000009080 0 SECTION LOCAL DEFAULT 4 ++ 5: 0000000000011000 0 SECTION LOCAL DEFAULT 5 ++ 6: 0000000000011120 0 SECTION LOCAL DEFAULT 6 ++ 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7 ++ 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8 ++ 9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o ++ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local ++ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc ++ 12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc ++ 13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local ++ 14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x ++ 15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o ++ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2 ++ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc ++ 18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc ++ 19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2 ++ 20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x ++ 21: 0000000000000000 0 FILE LOCAL DEFAULT ABS ++ 22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC ++ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def ++ 24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc ++ 25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def ++ 26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ ++ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc ++ 28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x ++ 29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef ++ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef ++ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def ++ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc +--- /dev/null 2019-07-02 08:01:33.386842704 +0100 ++++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-r.d 2019-07-02 17:35:35.244655166 +0100 +@@ -0,0 +1,60 @@ ++#source: variant_pcs-1.s ++#source: variant_pcs-2.s ++#ld: -r ++#readelf: -rsW ++ ++Relocation section '\.rela\.text' at offset .* contains 24 entries: ++ Offset Info Type Symbol's Value Symbol's Name \+ Addend ++0000000000000000 000000180000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_default_def \+ 0 ++0000000000000004 000000110000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_default_undef \+ 0 ++0000000000000008 000000120000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_hidden_def \+ 0 ++0000000000000010 000000170000011b R_AARCH64_CALL26 0000000000000000 f_base_global_default_def \+ 0 ++0000000000000014 000000100000011b R_AARCH64_CALL26 0000000000000000 f_base_global_default_undef \+ 0 ++0000000000000018 000000150000011b R_AARCH64_CALL26 0000000000000000 f_base_global_hidden_def \+ 0 ++0000000000000020 000000140000011b R_AARCH64_CALL26 f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0 ++0000000000000024 000000160000011b R_AARCH64_CALL26 f_spec_global_hidden_ifunc\(\) f_spec_global_hidden_ifunc \+ 0 ++0000000000000028 000000060000011b R_AARCH64_CALL26 f_spec_local_ifunc\(\) f_spec_local_ifunc \+ 0 ++000000000000002c 000000190000011b R_AARCH64_CALL26 f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0 ++0000000000000030 000000130000011b R_AARCH64_CALL26 f_base_global_hidden_ifunc\(\) f_base_global_hidden_ifunc \+ 0 ++0000000000000034 000000070000011b R_AARCH64_CALL26 f_base_local_ifunc\(\) f_base_local_ifunc \+ 0 ++0000000000000038 000000180000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_default_def \+ 0 ++000000000000003c 000000110000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_default_undef \+ 0 ++0000000000000040 000000120000011b R_AARCH64_CALL26 0000000000000000 f_spec_global_hidden_def \+ 0 ++0000000000000048 000000170000011b R_AARCH64_CALL26 0000000000000000 f_base_global_default_def \+ 0 ++000000000000004c 000000100000011b R_AARCH64_CALL26 0000000000000000 f_base_global_default_undef \+ 0 ++0000000000000050 000000150000011b R_AARCH64_CALL26 0000000000000000 f_base_global_hidden_def \+ 0 ++0000000000000058 000000140000011b R_AARCH64_CALL26 f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0 ++000000000000005c 000000160000011b R_AARCH64_CALL26 f_spec_global_hidden_ifunc\(\) f_spec_global_hidden_ifunc \+ 0 ++0000000000000060 0000000c0000011b R_AARCH64_CALL26 f_spec_local2_ifunc\(\) f_spec_local2_ifunc \+ 0 ++0000000000000064 000000190000011b R_AARCH64_CALL26 f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0 ++0000000000000068 000000130000011b R_AARCH64_CALL26 f_base_global_hidden_ifunc\(\) f_base_global_hidden_ifunc \+ 0 ++000000000000006c 0000000d0000011b R_AARCH64_CALL26 f_base_local2_ifunc\(\) f_base_local2_ifunc \+ 0 ++ ++Symbol table '\.symtab' contains 26 entries: ++ Num: Value Size Type Bind Vis Ndx Name ++ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND ++ 1: 0000000000000000 0 SECTION LOCAL DEFAULT 1 ++ 2: 0000000000000000 0 SECTION LOCAL DEFAULT 3 ++ 3: 0000000000000000 0 SECTION LOCAL DEFAULT 4 ++ 4: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o ++ 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local ++ 6: 0000000000000000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc ++ 7: 0000000000000000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc ++ 8: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 f_base_local ++ 9: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 \$x ++ 10: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o ++ 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2 ++ 12: 0000000000000038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc ++ 13: 0000000000000038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc ++ 14: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2 ++ 15: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 \$x ++ 16: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef ++ 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef ++ 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_def ++ 19: 0000000000000000 0 IFUNC GLOBAL HIDDEN 1 f_base_global_hidden_ifunc ++ 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 21: 0000000000000000 0 NOTYPE GLOBAL HIDDEN 1 f_base_global_hidden_def ++ 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc ++ 23: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def ++ 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 25: 0000000000000000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc +--- /dev/null 2019-07-02 08:01:33.386842704 +0100 ++++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2019-07-02 17:34:45.635006622 +0100 +@@ -0,0 +1,67 @@ ++#source: variant_pcs-1.s ++#source: variant_pcs-2.s ++#ld: -shared --hash-style=sysv -T variant_pcs.ld ++#readelf: -rsW ++ ++Relocation section '\.rela\.plt' at offset 0x11000 contains 12 entries: ++ Offset Info Type Symbol's Value Symbol's Name \+ Addend ++0000000000009020 0000000100000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_base_global_default_undef \+ 0 ++0000000000009028 0000000200000402 R_AARCH64_JUMP_SLOT 0000000000000000 f_spec_global_default_undef \+ 0 ++0000000000009030 0000000400000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_base_global_default_def \+ 0 ++0000000000009038 0000000500000402 R_AARCH64_JUMP_SLOT 0000000000008000 f_spec_global_default_def \+ 0 ++0000000000009040 0000000000000408 R_AARCH64_IRELATIVE 8000 ++0000000000009048 0000000300000402 R_AARCH64_JUMP_SLOT f_spec_global_default_ifunc\(\) f_spec_global_default_ifunc \+ 0 ++0000000000009050 0000000000000408 R_AARCH64_IRELATIVE 8000 ++0000000000009058 0000000600000402 R_AARCH64_JUMP_SLOT f_base_global_default_ifunc\(\) f_base_global_default_ifunc \+ 0 ++0000000000009060 0000000000000408 R_AARCH64_IRELATIVE 8038 ++0000000000009068 0000000000000408 R_AARCH64_IRELATIVE 8000 ++0000000000009070 0000000000000408 R_AARCH64_IRELATIVE 8000 ++0000000000009078 0000000000000408 R_AARCH64_IRELATIVE 8038 ++ ++Symbol table '\.dynsym' contains 7 entries: ++ Num: Value Size Type Bind Vis Ndx Name ++ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND ++ 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef ++ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef ++ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def ++ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc ++ ++Symbol table '\.symtab' contains 35 entries: ++ Num: Value Size Type Bind Vis Ndx Name ++ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND ++ 1: 0000000000008000 0 SECTION LOCAL DEFAULT 1 ++ 2: 0000000000008070 0 SECTION LOCAL DEFAULT 2 ++ 3: 0000000000009000 0 SECTION LOCAL DEFAULT 3 ++ 4: 0000000000009080 0 SECTION LOCAL DEFAULT 4 ++ 5: 0000000000011000 0 SECTION LOCAL DEFAULT 5 ++ 6: 0000000000011120 0 SECTION LOCAL DEFAULT 6 ++ 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7 ++ 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8 ++ 9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o ++ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local ++ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc ++ 12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc ++ 13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local ++ 14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x ++ 15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o ++ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2 ++ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc ++ 18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc ++ 19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2 ++ 20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x ++ 21: 0000000000000000 0 FILE LOCAL DEFAULT ABS ++ 22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC ++ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def ++ 24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc ++ 25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def ++ 26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ ++ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc ++ 28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x ++ 29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef ++ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef ++ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def ++ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc +diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-now.d +--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-now.d 2019-07-03 10:06:20.012412075 +0100 ++++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-now.d 2019-07-03 10:20:51.959203582 +0100 +@@ -22,10 +22,10 @@ Symbol table '\.dynsym' contains 7 entri + Num: Value Size Type Bind Vis Ndx Name + 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND + 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef +- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef +- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\] ++ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\] + 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def +- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\] + 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc + + Symbol table '\.symtab' contains 35 entries: +@@ -40,28 +40,28 @@ Symbol table '\.symtab' contains 35 entr + 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7 + 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8 + 9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o +- 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local +- 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc ++ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local \[VARIANT_PCS\] ++ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc \[VARIANT_PCS\] + 12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc + 13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local + 14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x + 15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o +- 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2 +- 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc ++ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_spec_local2 \[VARIANT_PCS\] ++ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_spec_local2_ifunc \[VARIANT_PCS\] + 18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc + 19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2 + 20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x + 21: 0000000000000000 0 FILE LOCAL DEFAULT ABS + 22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC +- 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def ++ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_global_hidden_def \[VARIANT_PCS\] + 24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc + 25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def + 26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ +- 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc ++ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_global_hidden_ifunc \[VARIANT_PCS\] + 28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x + 29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef +- 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef +- 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\] ++ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\] + 32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def +- 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\] + 34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc +diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-r.d binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-r.d +--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-r.d 2019-07-03 10:06:20.012412075 +0100 ++++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-r.d 2019-07-03 10:14:28.152933189 +0100 +@@ -37,24 +37,24 @@ Symbol table '\.symtab' contains 26 entr + 2: 0000000000000000 0 SECTION LOCAL DEFAULT 3 + 3: 0000000000000000 0 SECTION LOCAL DEFAULT 4 + 4: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o +- 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local +- 6: 0000000000000000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc ++ 5: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local \[VARIANT_PCS\] ++ 6: 0000000000000000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc \[VARIANT_PCS\] + 7: 0000000000000000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc + 8: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 f_base_local + 9: 0000000000000000 0 NOTYPE LOCAL DEFAULT 1 \$x + 10: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o +- 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2 +- 12: 0000000000000038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc ++ 11: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 f_spec_local2 \[VARIANT_PCS\] ++ 12: 0000000000000038 0 IFUNC LOCAL DEFAULT 1 f_spec_local2_ifunc \[VARIANT_PCS\] + 13: 0000000000000038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc + 14: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2 + 15: 0000000000000038 0 NOTYPE LOCAL DEFAULT 1 \$x + 16: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef +- 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef +- 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_def ++ 17: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\] ++ 18: 0000000000000000 0 NOTYPE GLOBAL HIDDEN 1 f_spec_global_hidden_def \[VARIANT_PCS\] + 19: 0000000000000000 0 IFUNC GLOBAL HIDDEN 1 f_base_global_hidden_ifunc +- 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 20: 0000000000000000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\] + 21: 0000000000000000 0 NOTYPE GLOBAL HIDDEN 1 f_base_global_hidden_def +- 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc ++ 22: 0000000000000000 0 IFUNC GLOBAL HIDDEN 1 f_spec_global_hidden_ifunc \[VARIANT_PCS\] + 23: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def +- 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 24: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\] + 25: 0000000000000000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc +diff -rup binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-shared.d +--- binutils.orig/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2019-07-03 10:06:20.012412075 +0100 ++++ binutils-2.32/ld/testsuite/ld-aarch64/variant_pcs-shared.d 2019-07-03 10:19:00.760994532 +0100 +@@ -22,10 +22,10 @@ Symbol table '\.dynsym' contains 7 entri + Num: Value Size Type Bind Vis Ndx Name + 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND + 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef +- 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef +- 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 2: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\] ++ 3: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\] + 4: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def +- 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 5: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\] + 6: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc + + Symbol table '\.symtab' contains 35 entries: +@@ -40,28 +40,28 @@ Symbol table '\.symtab' contains 35 entr + 7: 00000000000111c8 0 SECTION LOCAL DEFAULT 7 + 8: 0000000000011270 0 SECTION LOCAL DEFAULT 8 + 9: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-1\.o +- 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local +- 11: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local_ifunc ++ 10: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_local \[VARIANT_PCS\] ++ 11: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_local_ifunc \[VARIANT_PCS\] + 12: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_local_ifunc + 13: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_local + 14: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 \$x + 15: 0000000000000000 0 FILE LOCAL DEFAULT ABS .*variant_pcs-2\.o +- 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2 +- 17: 0000000000008038 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_local2_ifunc ++ 16: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_spec_local2 \[VARIANT_PCS\] ++ 17: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_spec_local2_ifunc \[VARIANT_PCS\] + 18: 0000000000008038 0 IFUNC LOCAL DEFAULT 1 f_base_local2_ifunc + 19: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 f_base_local2 + 20: 0000000000008038 0 NOTYPE LOCAL DEFAULT 1 \$x + 21: 0000000000000000 0 FILE LOCAL DEFAULT ABS + 22: 0000000000009080 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC +- 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_def ++ 23: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_spec_global_hidden_def \[VARIANT_PCS\] + 24: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_base_global_hidden_ifunc + 25: 0000000000008000 0 NOTYPE LOCAL DEFAULT 1 f_base_global_hidden_def + 26: 0000000000009000 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_ +- 27: 0000000000008000 0 IFUNC LOCAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_hidden_ifunc ++ 27: 0000000000008000 0 IFUNC LOCAL DEFAULT 1 f_spec_global_hidden_ifunc \[VARIANT_PCS\] + 28: 0000000000008070 0 NOTYPE LOCAL DEFAULT 2 \$x + 29: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_base_global_default_undef +- 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] UND f_spec_global_default_undef +- 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_ifunc ++ 30: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f_spec_global_default_undef \[VARIANT_PCS\] ++ 31: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_spec_global_default_ifunc \[VARIANT_PCS\] + 32: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_base_global_default_def +- 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT \[VARIANT_PCS\] 1 f_spec_global_default_def ++ 33: 0000000000008000 0 NOTYPE GLOBAL DEFAULT 1 f_spec_global_default_def \[VARIANT_PCS\] + 34: 0000000000008000 0 IFUNC GLOBAL DEFAULT 1 f_base_global_default_ifunc diff --git a/SOURCES/binutils-coverity-fixes.patch b/SOURCES/binutils-coverity-fixes.patch new file mode 100644 index 0000000..328ea45 --- /dev/null +++ b/SOURCES/binutils-coverity-fixes.patch @@ -0,0 +1,2307 @@ +--- binutils.orig/bfd/archive.c 2019-10-04 15:26:08.544327573 +0100 ++++ binutils-2.30/bfd/archive.c 2019-10-04 16:58:45.088039134 +0100 +@@ -734,6 +734,9 @@ _bfd_get_elt_at_filepos (bfd *archive, f + /* Copy is_linker_input. */ + n_bfd->is_linker_input = archive->is_linker_input; + ++ /* Coverity does not realise that _bfd_add_bfd_to_archive_cache actually ++ stores the newly created bfd and so flags a resource leak. */ ++ /* coverity[noescape: FALSE] */ + if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_bfd)) + return n_bfd; + +diff -rup binutils.orig/bfd/coffcode.h binutils-2.30/bfd/coffcode.h +--- binutils.orig/bfd/coffcode.h 2019-10-07 15:49:39.425618524 +0100 ++++ binutils-2.30/bfd/coffcode.h 2019-10-07 15:53:18.335157361 +0100 +@@ -3737,6 +3737,9 @@ coff_write_object_contents (bfd * abfd) + + internal_f.f_nscns++; + ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (section.s_name, current->name, SCNNMLEN); + + #ifdef COFF_LONG_SECTION_NAMES +@@ -3775,6 +3778,9 @@ coff_write_object_contents (bfd * abfd) + buffer, just in case. */ + sprintf (s_name_buf, "/%lu", (unsigned long) string_size); + /* Then strncpy takes care of any padding for us. */ ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (section.s_name, s_name_buf, SCNNMLEN); + string_size += len + 1; + long_section_names = TRUE; +diff -rup binutils.orig/bfd/coffgen.c binutils-2.30/bfd/coffgen.c +--- binutils.orig/bfd/coffgen.c 2019-10-07 15:49:37.845629069 +0100 ++++ binutils-2.30/bfd/coffgen.c 2019-10-07 15:53:46.443969714 +0100 +@@ -923,6 +923,9 @@ coff_fix_symbol_name (bfd *abfd, + { + if (name_length <= SYMNMLEN && !bfd_coff_force_symnames_in_strings (abfd)) + /* This name will fit into the symbol neatly. */ ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (native->u.syment._n._n_name, symbol->name, SYMNMLEN); + + else if (!bfd_coff_symname_in_debug (abfd, &native->u.syment)) +diff -rup binutils.orig/bfd/cofflink.c binutils-2.30/bfd/cofflink.c +--- binutils.orig/bfd/cofflink.c 2019-10-07 15:49:37.565630938 +0100 ++++ binutils-2.30/bfd/cofflink.c 2019-10-07 15:54:21.177736099 +0100 +@@ -2633,6 +2633,9 @@ _bfd_coff_write_global_sym (struct bfd_h + } + + if (strlen (h->root.root.string) <= SYMNMLEN) ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (isym._n._n_name, h->root.root.string, SYMNMLEN); + else + { +diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.30/bfd/elf64-x86-64.c +--- binutils.orig/bfd/elf64-x86-64.c 2019-10-07 15:49:38.144627073 +0100 ++++ binutils-2.30/bfd/elf64-x86-64.c 2019-10-07 15:56:53.559674302 +0100 +@@ -463,7 +463,13 @@ elf_x86_64_write_core_note (bfd *abfd, c + { + prpsinfo32_t data; + memset (&data, 0, sizeof (data)); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); + return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type, + &data, sizeof (data)); +@@ -472,7 +478,13 @@ elf_x86_64_write_core_note (bfd *abfd, c + { + prpsinfo64_t data; + memset (&data, 0, sizeof (data)); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); + return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type, + &data, sizeof (data)); +diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c +--- binutils.orig/bfd/elf.c 2019-10-07 15:49:37.616630597 +0100 ++++ binutils-2.30/bfd/elf.c 2019-10-07 15:56:16.776930603 +0100 +@@ -10549,7 +10549,13 @@ elfcore_write_prpsinfo (bfd *abfd, + #endif + + memset (&data, 0, sizeof (data)); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); + return elfcore_write_note (abfd, buf, bufsiz, + "CORE", note_type, &data, sizeof (data)); +@@ -10566,7 +10572,13 @@ elfcore_write_prpsinfo (bfd *abfd, + #endif + + memset (&data, 0, sizeof (data)); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); + return elfcore_write_note (abfd, buf, bufsiz, + "CORE", note_type, &data, sizeof (data)); +diff -rup binutils.orig/bfd/elf-linux-core.h binutils-2.30/bfd/elf-linux-core.h +--- binutils.orig/bfd/elf-linux-core.h 2019-10-07 15:49:37.744629743 +0100 ++++ binutils-2.30/bfd/elf-linux-core.h 2019-10-07 15:55:43.976159158 +0100 +@@ -69,7 +69,13 @@ swap_linux_prpsinfo32_ugid32_out + bfd_put_32 (obfd, from->pr_ppid, to->pr_ppid); + bfd_put_32 (obfd, from->pr_pgrp, to->pr_pgrp); + bfd_put_32 (obfd, from->pr_sid, to->pr_sid); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (to->pr_fname, from->pr_fname, sizeof (to->pr_fname)); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (to->pr_psargs, from->pr_psargs, sizeof (to->pr_psargs)); + } + +@@ -121,7 +127,13 @@ swap_linux_prpsinfo32_ugid16_out + bfd_put_32 (obfd, from->pr_ppid, to->pr_ppid); + bfd_put_32 (obfd, from->pr_pgrp, to->pr_pgrp); + bfd_put_32 (obfd, from->pr_sid, to->pr_sid); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (to->pr_fname, from->pr_fname, sizeof (to->pr_fname)); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (to->pr_psargs, from->pr_psargs, sizeof (to->pr_psargs)); + } + +@@ -174,7 +186,13 @@ swap_linux_prpsinfo64_ugid32_out + bfd_put_32 (obfd, from->pr_ppid, to->pr_ppid); + bfd_put_32 (obfd, from->pr_pgrp, to->pr_pgrp); + bfd_put_32 (obfd, from->pr_sid, to->pr_sid); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (to->pr_fname, from->pr_fname, sizeof (to->pr_fname)); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (to->pr_psargs, from->pr_psargs, sizeof (to->pr_psargs)); + } + +@@ -227,7 +245,13 @@ swap_linux_prpsinfo64_ugid16_out + bfd_put_32 (obfd, from->pr_ppid, to->pr_ppid); + bfd_put_32 (obfd, from->pr_pgrp, to->pr_pgrp); + bfd_put_32 (obfd, from->pr_sid, to->pr_sid); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (to->pr_fname, from->pr_fname, sizeof (to->pr_fname)); ++ /* Coverity flags this strncpy as possibly creating a string ++ that is not NUL terminated. This is in fact OK. */ ++ /* coverity[buffer_size_warning: FALSE] */ + strncpy (to->pr_psargs, from->pr_psargs, sizeof (to->pr_psargs)); + } + +diff -rup binutils.orig/bfd/peXXigen.c binutils-2.30/bfd/peXXigen.c +--- binutils.orig/bfd/peXXigen.c 2019-10-07 15:49:37.695630070 +0100 ++++ binutils-2.30/bfd/peXXigen.c 2019-10-07 16:02:02.117524278 +0100 +@@ -385,7 +385,7 @@ _bfd_XXi_swap_aux_out (bfd * abfd, + H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset); + } + else +- memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN); ++ memcpy (ext->x_file.x_fname, in->x_file.x_fname, E_FILNMLEN); + + return AUXESZ; + +diff -rup binutils.orig/ld/pe-dll.c binutils-2.30/ld/pe-dll.c +--- binutils.orig/ld/pe-dll.c 2019-10-07 15:48:49.851949423 +0100 ++++ binutils-2.30/ld/pe-dll.c 2019-10-07 16:04:09.055639773 +0100 +@@ -2929,7 +2929,7 @@ pe_find_cdecl_alias_match (struct bfd_li + if (pe_details->underscored) + lname[0] = '_'; + else +- strcpy (lname, lname + 1); ++ memmove (lname, lname + 1, strlen (lname) + 1); + key.key = lname; + kv = bsearch (&key, udef_table, undef_count, + sizeof (struct key_value), undef_sort_cmp); +diff -rup binutils.orig/libiberty/sha1.c binutils-2.30/libiberty/sha1.c +--- binutils.orig/libiberty/sha1.c 2019-10-07 15:49:37.016634602 +0100 ++++ binutils-2.30/libiberty/sha1.c 2019-10-07 16:04:41.788411691 +0100 +@@ -258,7 +258,7 @@ sha1_process_bytes (const void *buffer, + { + sha1_process_block (ctx->buffer, 64, ctx); + left_over -= 64; +- memcpy (ctx->buffer, &ctx->buffer[16], left_over); ++ memmove (ctx->buffer, &ctx->buffer[16], left_over); + } + ctx->buflen = left_over; + } +diff -rup binutils.orig/bfd/cofflink.c binutils-2.30/bfd/cofflink.c +--- binutils.orig/bfd/cofflink.c 2019-10-07 17:01:58.787679337 +0100 ++++ binutils-2.30/bfd/cofflink.c 2019-10-07 17:02:20.641529805 +0100 +@@ -1406,6 +1406,8 @@ mark_relocs (struct coff_final_link_info + for (; irel < irelend; irel++) + if ((unsigned long) irel->r_symndx < obj_raw_syment_count (input_bfd)) + flaginfo->sym_indices[irel->r_symndx] = -1; ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + } + +diff -rup binutils.orig/bfd/doc/chew.c binutils-2.30/bfd/doc/chew.c +--- binutils.orig/bfd/doc/chew.c 2019-10-07 17:01:58.796679276 +0100 ++++ binutils-2.30/bfd/doc/chew.c 2019-10-07 17:04:21.265720634 +0100 +@@ -1264,6 +1264,7 @@ free_words (void) + if (ptr->code[i] == push_text + && ptr->code[i + 1]) + { ++ /* coverity[fnptr_free: FALSE] */ + free (ptr->code[i + 1] - 1); + ++ i; + } +@@ -1387,6 +1388,7 @@ compile (string) + ptr = newentry (word); + string = nextword (string, &word); + ++ /* coverity[use_after_free: FALSE] */ + while (word[0] != ';') + { + switch (word[0]) +diff -rup binutils.orig/bfd/elflink.c binutils-2.30/bfd/elflink.c +--- binutils.orig/bfd/elflink.c 2019-10-07 17:01:58.779679392 +0100 ++++ binutils-2.30/bfd/elflink.c 2019-10-07 17:04:57.025483171 +0100 +@@ -10579,6 +10579,8 @@ elf_link_input_bfd (struct elf_final_lin + "that references a non-existent global symbol"), + input_bfd, rel->r_info, o); + bfd_set_error (bfd_error_bad_value); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + +diff -rup binutils.orig/bfd/peXXigen.c binutils-2.30/bfd/peXXigen.c +--- binutils.orig/bfd/peXXigen.c 2019-10-07 17:01:58.784679358 +0100 ++++ binutils-2.30/bfd/peXXigen.c 2019-10-07 17:07:22.047520136 +0100 +@@ -385,7 +385,9 @@ _bfd_XXi_swap_aux_out (bfd * abfd, + H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset); + } + else +- memcpy (ext->x_file.x_fname, in->x_file.x_fname, E_FILNMLEN); ++ /* Coverity gets confused about the size of these buffers. */ ++ /* coverity[buffer_size: FALSE] */ ++ memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN); + + return AUXESZ; + +@@ -4343,6 +4345,8 @@ rsrc_process_section (bfd * abfd, + /* FIXME: Free the resource tree, if we have one. */ + free (datastart); + free (rsrc_sizes); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + /* Handle the .idata section and other things that need symbol table +diff -rup binutils.orig/bfd/plugin.c binutils-2.30/bfd/plugin.c +--- binutils.orig/bfd/plugin.c 2019-10-07 17:01:58.780679385 +0100 ++++ binutils-2.30/bfd/plugin.c 2019-10-07 17:07:45.871361935 +0100 +@@ -403,9 +403,13 @@ try_load_plugin (const char *pname, bfd + + abfd->plugin_format = bfd_plugin_yes; + ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return 1; + + err: ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return 0; + } + +diff -rup binutils.orig/bfd/stabs.c binutils-2.30/bfd/stabs.c +--- binutils.orig/bfd/stabs.c 2019-10-07 17:01:58.778679399 +0100 ++++ binutils-2.30/bfd/stabs.c 2019-10-07 17:08:14.655170795 +0100 +@@ -377,6 +377,8 @@ _bfd_link_section_stabs (bfd *abfd, + amt = sizeof *ne; + ne = (struct stab_excl_list *) bfd_alloc (abfd, amt); + if (ne == NULL) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + goto error_return; + ne->offset = sym - stabbuf; + ne->val = sum_chars; +diff -rup binutils.orig/binutils/ar.c binutils-2.30/binutils/ar.c +--- binutils.orig/binutils/ar.c 2019-10-07 17:01:57.998684736 +0100 ++++ binutils-2.30/binutils/ar.c 2019-10-07 17:10:18.109350993 +0100 +@@ -228,6 +228,8 @@ map_over_members (bfd *arch, void (*func + filename = normalize (filename, arch); + } + ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + if (filename != NULL + && !FILENAME_CMP (normalize (*files, arch), filename)) + { +@@ -237,6 +239,8 @@ map_over_members (bfd *arch, void (*func + { + /* Counting, and didn't match on count; go on to the + next one. */ ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + continue; + } + +@@ -250,6 +254,8 @@ map_over_members (bfd *arch, void (*func + to the ar command. */ + break; + } ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + if (!found) +@@ -1268,6 +1274,8 @@ delete_members (bfd *arch, char **files_ + current_ptr_ptr = &(arch->archive_next); + while (*current_ptr_ptr) + { ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + if (FILENAME_CMP (normalize (*files_to_delete, arch), + (*current_ptr_ptr)->filename) == 0) + { +@@ -1323,6 +1331,8 @@ move_members (bfd *arch, char **files_to + while (*current_ptr_ptr) + { + bfd *current_ptr = *current_ptr_ptr; ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + if (FILENAME_CMP (normalize (*files_to_move, arch), + current_ptr->filename) == 0) + { +@@ -1375,6 +1385,8 @@ replace_members (bfd *arch, char **files + + /* For compatibility with existing ar programs, we + permit the same file to be added multiple times. */ ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + if (FILENAME_CMP (normalize (*files_to_move, arch), + normalize (current->filename, arch)) == 0 + && current->arelt_data != NULL) +diff -rup binutils.orig/binutils/arparse.c binutils-2.30/binutils/arparse.c +--- binutils.orig/binutils/arparse.c 2019-10-07 17:01:58.003684702 +0100 ++++ binutils-2.30/binutils/arparse.c 2019-10-07 17:10:55.998099392 +0100 +@@ -1193,6 +1193,8 @@ yyparse (void) + # undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + # endif + #endif /* no yyoverflow */ +diff -rup binutils.orig/binutils/arsup.c binutils-2.30/binutils/arsup.c +--- binutils.orig/binutils/arsup.c 2019-10-07 17:01:58.006684681 +0100 ++++ binutils-2.30/binutils/arsup.c 2019-10-07 17:11:21.789928112 +0100 +@@ -209,6 +209,8 @@ ar_open (char *name, int t) + obfd->has_armap = 1; + obfd->is_thin_archive = 0; + } ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + static void +diff -rup binutils.orig/binutils/dwarf.c binutils-2.30/binutils/dwarf.c +--- binutils.orig/binutils/dwarf.c 2019-10-07 17:01:57.958685010 +0100 ++++ binutils-2.30/binutils/dwarf.c 2019-10-07 17:13:31.950063779 +0100 +@@ -4098,6 +4098,8 @@ display_debug_lines_decoded (struct dwar + if (data == end) + { + warn (_("Corrupt file name list\n")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + break; + } + +@@ -4234,6 +4236,8 @@ display_debug_lines_decoded (struct dwar + { + warn (_("file table ends unexpectedly\n")); + n_files = 0; ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + break; + } + +@@ -7231,6 +7235,8 @@ read_cie (unsigned char *start, unsigned + if (start == end) + { + warn (_("No terminator for augmentation name\n")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return start; + } + +@@ -7243,6 +7249,8 @@ read_cie (unsigned char *start, unsigned + if (fc->ptr_size < 1 || fc->ptr_size > 8) + { + warn (_("Invalid pointer size (%d) in CIE data\n"), fc->ptr_size); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return end; + } + +@@ -7251,6 +7259,8 @@ read_cie (unsigned char *start, unsigned + if (fc->segment_size > 8 || fc->segment_size + fc->ptr_size > 8) + { + warn (_("Invalid segment size (%d) in CIE data\n"), fc->segment_size); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return end; + } + +@@ -8305,6 +8315,8 @@ display_debug_frames (struct dwarf_secti + + printf ("\n"); + ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return 1; + } + +@@ -9733,6 +9745,8 @@ load_separate_debug_info (const char * + if (debugfile == NULL) + { + warn (_("Out of memory")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return NULL; + } + +diff -rup binutils.orig/binutils/elfedit.c binutils-2.30/binutils/elfedit.c +--- binutils.orig/binutils/elfedit.c 2019-10-07 17:01:58.000684722 +0100 ++++ binutils-2.30/binutils/elfedit.c 2019-10-07 17:13:51.916931183 +0100 +@@ -468,6 +468,8 @@ process_archive (const char * file_name, + } + + free (qualified_name); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + out: +diff -rup binutils.orig/binutils/ieee.c binutils-2.30/binutils/ieee.c +--- binutils.orig/binutils/ieee.c 2019-10-07 17:01:57.963684975 +0100 ++++ binutils-2.30/binutils/ieee.c 2019-10-07 17:18:54.442922250 +0100 +@@ -1503,6 +1503,8 @@ parse_ieee_ty (struct ieee_info *info, c + bfd_boolean present; + + if (! ieee_read_optional_id (info, pp, &name, &namlen, &present)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + if (! present) + break; +@@ -1516,6 +1518,8 @@ parse_ieee_ty (struct ieee_info *info, c + + names[c] = savestring (name, namlen); + if (names[c] == NULL) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + ++c; + } +@@ -1554,12 +1558,16 @@ parse_ieee_ty (struct ieee_info *info, c + bfd_vma bitpos, bitsize; + + if (! ieee_read_optional_id (info, pp, &name, &namlen, &present)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + if (! present) + break; + if (! ieee_read_type_index (info, pp, &ftype) + || ! ieee_read_number (info, pp, &bitpos) + || ! ieee_read_number (info, pp, &bitsize)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + if (c + 1 >= alloc) +@@ -1573,6 +1581,8 @@ parse_ieee_ty (struct ieee_info *info, c + ftype, bitpos, bitsize, + DEBUG_VISIBILITY_PUBLIC); + if (fields[c] == NULL) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + ++c; + } +@@ -1604,10 +1614,14 @@ parse_ieee_ty (struct ieee_info *info, c + bfd_vma val; + + if (! ieee_read_optional_id (info, pp, &name, &namlen, &present)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + if (! present) + break; + if (! ieee_read_number (info, pp, &val)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + /* If the length of the name is zero, then the value is +@@ -1627,6 +1641,8 @@ parse_ieee_ty (struct ieee_info *info, c + + names[c] = savestring (name, namlen); + if (names[c] == NULL) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + vals[c] = (bfd_signed_vma) val; + ++c; +@@ -1646,6 +1662,8 @@ parse_ieee_ty (struct ieee_info *info, c + debug_type t; + + if (! ieee_read_type_index (info, pp, &t)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + type = debug_make_pointer_type (dhandle, t); + } +@@ -1660,6 +1678,8 @@ parse_ieee_ty (struct ieee_info *info, c + || ! ieee_read_number (info, pp, &high) + || ! ieee_read_number (info, pp, &signedp) + || ! ieee_read_number (info, pp, &size)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + type = debug_make_range_type (dhandle, +@@ -1679,6 +1699,8 @@ parse_ieee_ty (struct ieee_info *info, c + unsigned int c; + + if (! ieee_read_number (info, pp, &size)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + alloc = 10; +@@ -1695,11 +1717,15 @@ parse_ieee_ty (struct ieee_info *info, c + bfd_vma bitsize; + + if (! ieee_read_optional_id (info, pp, &name, &namlen, &present)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + if (! present) + break; + if (! ieee_read_number (info, pp, &tindx) + || ! ieee_read_number (info, pp, &offset)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + if (tindx < 256) +@@ -1733,6 +1759,8 @@ parse_ieee_ty (struct ieee_info *info, c + ftype, offset, bitsize, + DEBUG_VISIBILITY_PUBLIC); + if (fields[c] == NULL) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + ++c; + } +@@ -1747,6 +1775,8 @@ parse_ieee_ty (struct ieee_info *info, c + case 'T': + /* Typedef. */ + if (! ieee_read_type_index (info, pp, &type)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + typdef = TRUE; + break; +@@ -1766,6 +1796,8 @@ parse_ieee_ty (struct ieee_info *info, c + if (! ieee_read_number (info, pp, &attr) + || ! ieee_read_type_index (info, pp, &rtype) + || ! ieee_read_number (info, pp, &nargs)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + do + { +@@ -1773,6 +1805,8 @@ parse_ieee_ty (struct ieee_info *info, c + unsigned long namlen; + + if (! ieee_read_optional_id (info, pp, &name, &namlen, &present)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + while (present); +@@ -1810,6 +1844,8 @@ parse_ieee_ty (struct ieee_info *info, c + + if (! ieee_read_type_index (info, pp, &etype) + || ! ieee_read_number (info, pp, &high)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + type = debug_make_array_type (dhandle, etype, +@@ -1829,6 +1865,8 @@ parse_ieee_ty (struct ieee_info *info, c + /* FIXME: I don't know what the name means. */ + + if (! ieee_read_id (info, pp, &name, &namlen)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + type = debug_make_complex_type (dhandle, tc == 'c' ? 4 : 8); +@@ -1838,6 +1876,8 @@ parse_ieee_ty (struct ieee_info *info, c + case 'f': + /* Pascal file name. FIXME. */ + ieee_error (info, ty_code_start, _("Pascal file name not supported")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + case 'g': +@@ -1849,12 +1889,16 @@ parse_ieee_ty (struct ieee_info *info, c + + if (! ieee_read_number (info, pp, &signedp) + || ! ieee_read_number (info, pp, &bitsize)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + /* I think the documentation says that there is a type index, + but some actual files do not have one. */ + hold = *pp; + if (! ieee_read_optional_number (info, pp, &dummy, &present)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + if (! present) + { +@@ -1866,6 +1910,8 @@ parse_ieee_ty (struct ieee_info *info, c + { + *pp = hold; + if (! ieee_read_type_index (info, pp, &type)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + type_bitsize = bitsize; +@@ -1880,12 +1926,16 @@ parse_ieee_ty (struct ieee_info *info, c + + if (! ieee_read_number (info, pp, &kind) + || ! ieee_read_type_index (info, pp, &t)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + switch (kind) + { + default: + ieee_error (info, ty_start, _("unsupported qualifier")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + case 1: +@@ -1907,6 +1957,8 @@ parse_ieee_ty (struct ieee_info *info, c + + if (! ieee_read_number (info, pp, &size) + || ! ieee_read_type_index (info, pp, &etype)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + /* FIXME: We ignore the size. */ +@@ -1934,6 +1986,8 @@ parse_ieee_ty (struct ieee_info *info, c + || ! ieee_read_number (info, pp, &push_mask) + || ! ieee_read_type_index (info, pp, &rtype) + || ! ieee_read_number (info, pp, &nargs)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + if (nargs == (bfd_vma) -1) + { +@@ -1948,6 +2002,8 @@ parse_ieee_ty (struct ieee_info *info, c + xmalloc ((nargs + 1) * sizeof *arg_types)); + for (i = 0; i < nargs; i++) + if (! ieee_read_type_index (info, pp, arg_types + i)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + /* If the last type is pointer to void, this is really a +@@ -1995,6 +2051,8 @@ parse_ieee_ty (struct ieee_info *info, c + } + if (! ieee_read_number (info, pp, &level) + || ! ieee_read_optional_number (info, pp, &father, &present)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + /* We can't distinguish between a global function and a static +diff -rup binutils.orig/binutils/objcopy.c binutils-2.30/binutils/objcopy.c +--- binutils.orig/binutils/objcopy.c 2019-10-07 17:01:58.036684476 +0100 ++++ binutils-2.30/binutils/objcopy.c 2019-10-07 17:26:39.304812562 +0100 +@@ -1142,6 +1142,8 @@ add_specific_symbols (const char *filena + line = eol; + line_count ++; + } ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + /* See whether a symbol should be stripped or kept +@@ -1817,6 +1819,8 @@ add_redefine_syms_file (const char *file + fatal (_("%s:%d: premature end of file"), filename, lineno); + + free (buf); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + /* Copy unknown object file IBFD onto OBFD. +@@ -2855,6 +2859,8 @@ copy_object (bfd *ibfd, bfd *obfd, const + strerror (errno)); + free (contents); + return FALSE; ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + } + else +@@ -3063,6 +3069,8 @@ copy_object (bfd *ibfd, bfd *obfd, const + { + status = 1; + return FALSE; ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + } + +@@ -3097,6 +3105,8 @@ copy_object (bfd *ibfd, bfd *obfd, const + 0, padd->size)) + { + bfd_nonfatal_message (NULL, obfd, padd->section, NULL); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + } +@@ -3115,6 +3125,8 @@ copy_object (bfd *ibfd, bfd *obfd, const + 0, pupdate->size)) + { + bfd_nonfatal_message (NULL, obfd, osec, NULL); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + } +@@ -3128,6 +3140,8 @@ copy_object (bfd *ibfd, bfd *obfd, const + if (! bfd_set_section_contents (obfd, osec, merged_notes, 0, merged_size)) + { + bfd_nonfatal_message (NULL, obfd, osec, _("error: failed to copy merged notes into output")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + } +@@ -3146,6 +3160,8 @@ copy_object (bfd *ibfd, bfd *obfd, const + bfd_nonfatal_message (NULL, obfd, NULL, + _("cannot fill debug link section `%s'"), + gnu_debuglink_filename); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + } +@@ -3184,6 +3200,8 @@ copy_object (bfd *ibfd, bfd *obfd, const + off, now)) + { + bfd_nonfatal_message (NULL, obfd, osections[i], NULL); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + +@@ -3202,6 +3220,8 @@ copy_object (bfd *ibfd, bfd *obfd, const + { + bfd_nonfatal_message (NULL, obfd, NULL, + _("error copying private BFD data")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + +@@ -3224,6 +3244,8 @@ copy_object (bfd *ibfd, bfd *obfd, const + } + } + ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return TRUE; + } + +@@ -3302,6 +3324,7 @@ copy_archive (bfd *ibfd, bfd *obfd, cons + /* If the file already exists, make another temp dir. */ + if (stat (output_name, &buf) >= 0) + { ++ free (output_name); + output_name = make_tempdir (output_name); + if (output_name == NULL) + { +@@ -3435,6 +3458,7 @@ copy_archive (bfd *ibfd, bfd *obfd, cons + } + + rmdir (dir); ++ free (dir); + } + + static void +@@ -4310,6 +4334,8 @@ write_debugging_info (bfd *obfd, void *d + { + bfd_nonfatal_message (NULL, obfd, NULL, + _("can't create debugging section")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + +@@ -4323,6 +4349,8 @@ write_debugging_info (bfd *obfd, void *d + { + bfd_nonfatal_message (NULL, obfd, NULL, + _("can't set debugging section contents")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + +@@ -5569,6 +5597,8 @@ copy_main (int argc, char *argv[]) + } + } + ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return 0; + } + +diff -rup binutils-2.30/binutils/ieee.c binutils.new/binutils/ieee.c +--- binutils-2.30/binutils/ieee.c 2019-10-08 10:20:47.186432611 +0100 ++++ binutils.new/binutils/ieee.c 2019-10-08 10:20:33.515525367 +0100 +@@ -2661,13 +2661,18 @@ ieee_read_cxx_class (struct ieee_info *i + spec_start = *pp; + + if (! ieee_require_asn (info, pp, &id)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; ++ + --count; + + switch (id) + { + default: + ieee_error (info, spec_start, _("unrecognized C++ object spec")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + case 'b': +@@ -2704,6 +2709,8 @@ ieee_read_cxx_class (struct ieee_info *i + if ((fieldlen == 0) == (cinline == 0)) + { + ieee_error (info, start, _("unsupported C++ object type")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + +@@ -2887,12 +2894,16 @@ ieee_read_cxx_class (struct ieee_info *i + } + } + if (ftype == DEBUG_TYPE_NULL) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + switch (flags & CXXFLAGS_VISIBILITY) + { + default: + ieee_error (info, start, _("unknown C++ visibility")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + case CXXFLAGS_VISIBILITY_PUBLIC: +@@ -2927,6 +2938,8 @@ ieee_read_cxx_class (struct ieee_info *i + if (bitpos == (bfd_vma) -1 || bitsize == (bfd_vma) -1) + { + ieee_error (info, start, _("bad C++ field bit pos or size")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + field = debug_make_field (dhandle, fieldcopy, ftype, bitpos, +@@ -3043,6 +3056,8 @@ ieee_read_cxx_class (struct ieee_info *i + { + default: + ieee_error (info, start, _("unknown C++ visibility")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + case CXXFLAGS_VISIBILITY_PUBLIC: +@@ -3229,6 +3244,8 @@ ieee_read_cxx_class (struct ieee_info *i + dmethods[i] = debug_make_method (dhandle, namcopy, + methods[i].variants); + if (dmethods[i] == DEBUG_METHOD_NULL) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + dmethods[i] = DEBUG_METHOD_NULL; +diff -rup binutils-2.30/binutils/objcopy.c binutils.new/binutils/objcopy.c +--- binutils-2.30/binutils/objcopy.c 2019-10-08 10:20:47.186432611 +0100 ++++ binutils.new/binutils/objcopy.c 2019-10-08 10:20:33.513525381 +0100 +@@ -2858,9 +2858,9 @@ copy_object (bfd *ibfd, bfd *obfd, const + pdump->filename, + strerror (errno)); + free (contents); +- return FALSE; + /* There is a potential resource leak here, but it is not important. */ + /* coverity[leaked_storage: FALSE] */ ++ return FALSE; + } + } + else +@@ -3068,9 +3068,9 @@ copy_object (bfd *ibfd, bfd *obfd, const + if (bfd_get_error () != bfd_error_no_error) + { + status = 1; +- return FALSE; + /* There is a potential resource leak here, but it is not important. */ + /* coverity[leaked_storage: FALSE] */ ++ return FALSE; + } + } + +@@ -3083,6 +3083,8 @@ copy_object (bfd *ibfd, bfd *obfd, const + if (! write_debugging_info (obfd, dhandle, &symcount, &osympp)) + { + status = 1; ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + } +@@ -3210,6 +3212,8 @@ copy_object (bfd *ibfd, bfd *obfd, const + } + } + } ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + /* Allow the BFD backend to copy any private data it understands +@@ -3324,8 +3328,10 @@ copy_archive (bfd *ibfd, bfd *obfd, cons + /* If the file already exists, make another temp dir. */ + if (stat (output_name, &buf) >= 0) + { ++ char * on; ++ on = make_tempdir (output_name); + free (output_name); +- output_name = make_tempdir (output_name); ++ output_name = on; + if (output_name == NULL) + { + non_fatal (_("cannot create tempdir for archive copying (error: %s)"), +diff -rup binutils-2.30/binutils/rdcoff.c binutils.new/binutils/rdcoff.c +--- binutils-2.30/binutils/rdcoff.c 2018-01-13 13:31:15.000000000 +0000 ++++ binutils.new/binutils/rdcoff.c 2019-10-08 10:20:33.512525387 +0100 +@@ -409,6 +409,8 @@ parse_coff_struct_type (bfd *abfd, struc + { + non_fatal (_("bfd_coff_get_syment failed: %s"), + bfd_errmsg (bfd_get_error ())); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return DEBUG_TYPE_NULL; + } + +@@ -425,6 +427,8 @@ parse_coff_struct_type (bfd *abfd, struc + { + non_fatal (_("bfd_coff_get_auxent failed: %s"), + bfd_errmsg (bfd_get_error ())); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return DEBUG_TYPE_NULL; + } + psubaux = &auxent; +@@ -514,6 +518,8 @@ parse_coff_enum_type (bfd *abfd, struct + { + non_fatal (_("bfd_coff_get_syment failed: %s"), + bfd_errmsg (bfd_get_error ())); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return DEBUG_TYPE_NULL; + } + +diff -rup binutils-2.30/binutils/readelf.c binutils.new/binutils/readelf.c +--- binutils-2.30/binutils/readelf.c 2019-10-08 10:20:47.161432781 +0100 ++++ binutils.new/binutils/readelf.c 2019-10-08 10:20:33.507525422 +0100 +@@ -5304,6 +5304,8 @@ get_32bit_section_headers (Filedata * fi + { + if (!probe) + error (_("Out of memory reading %u section headers\n"), num); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + +@@ -5370,6 +5372,8 @@ get_64bit_section_headers (Filedata * fi + { + if (! probe) + error (_("Out of memory reading %u section headers\n"), num); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + +@@ -5456,6 +5460,7 @@ get_32bit_elf_symbols (Filedata * + for (entry = symtab_shndx_list; entry != NULL; entry = entry->next) + if (entry->hdr->sh_link == (unsigned long) (section - filedata->section_headers)) + { ++ free (shndx); + shndx = (Elf_External_Sym_Shndx *) get_data (NULL, filedata, + entry->hdr->sh_offset, + 1, entry->hdr->sh_size, +@@ -5569,6 +5574,7 @@ get_64bit_elf_symbols (Filedata * + for (entry = symtab_shndx_list; entry != NULL; entry = entry->next) + if (entry->hdr->sh_link == (unsigned long) (section - filedata->section_headers)) + { ++ free (shndx); + shndx = (Elf_External_Sym_Shndx *) get_data (NULL, filedata, + entry->hdr->sh_offset, + 1, entry->hdr->sh_size, +@@ -9647,6 +9653,7 @@ process_dynamic_section (Filedata * file + section.sh_entsize = sizeof (Elf64_External_Sym); + section.sh_name = filedata->string_table_length; + ++ free (dynamic_symbols); + dynamic_symbols = GET_ELF_SYMBOLS (filedata, §ion, & num_dynamic_syms); + if (num_dynamic_syms < 1) + { +@@ -11500,6 +11507,8 @@ process_symbol_table (Filedata * filedat + if (gnubuckets[i] != 0) + { + if (gnubuckets[i] < gnusymidx) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + if (maxchain == 0xffffffff || gnubuckets[i] > maxchain) +@@ -12950,6 +12959,8 @@ apply_relocations (Filedata * + symsec = filedata->section_headers + relsec->sh_link; + if (symsec->sh_type != SHT_SYMTAB + && symsec->sh_type != SHT_DYNSYM) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + symtab = GET_ELF_SYMBOLS (filedata, symsec, & num_syms); + +@@ -16096,6 +16107,8 @@ process_mips_specific (Filedata * fileda + } + else + res = FALSE; ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + if (conflicts_offset != 0 && conflictsno != 0) +@@ -16133,6 +16146,8 @@ process_mips_specific (Filedata * fileda + get_data (NULL, filedata, conflicts_offset, conflictsno, + sizeof (* econf32), _("conflict")); + if (!econf32) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + for (cnt = 0; cnt < conflictsno; ++cnt) +@@ -16148,6 +16163,8 @@ process_mips_specific (Filedata * fileda + get_data (NULL, filedata, conflicts_offset, conflictsno, + sizeof (* econf64), _("conflict")); + if (!econf64) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + for (cnt = 0; cnt < conflictsno; ++cnt) +@@ -16350,6 +16367,8 @@ process_mips_specific (Filedata * fileda + data = (unsigned char *) get_data (NULL, filedata, offset, end - mips_pltgot, + 1, _("Procedure Linkage Table data")); + if (data == NULL) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + printf ("\nPLT GOT:\n\n"); +@@ -16434,6 +16453,8 @@ process_nds32_specific (Filedata * filed + printf ("(VEC_SIZE):\treserved\n"); + break; + } ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + return TRUE; +@@ -17488,9 +17509,9 @@ get_symbol_for_build_attribute (Filedata + const char ** pname) + { + static Filedata * saved_filedata = NULL; +- static char * strtab; ++ static char * strtab = NULL; + static unsigned long strtablen; +- static Elf_Internal_Sym * symtab; ++ static Elf_Internal_Sym * symtab = NULL; + static unsigned long nsyms; + Elf_Internal_Sym * saved_sym = NULL; + Elf_Internal_Sym * sym; +@@ -17507,12 +17528,14 @@ get_symbol_for_build_attribute (Filedata + { + if (symsec->sh_type == SHT_SYMTAB) + { ++ free (symtab); + symtab = GET_ELF_SYMBOLS (filedata, symsec, & nsyms); + + if (symsec->sh_link < filedata->file_header.e_shnum) + { + Elf_Internal_Shdr * strtab_sec = filedata->section_headers + symsec->sh_link; + ++ free (strtab); + strtab = (char *) get_data (NULL, filedata, strtab_sec->sh_offset, + 1, strtab_sec->sh_size, + _("string table")); +@@ -18095,6 +18118,8 @@ process_notes_at (Filedata * f + { + warn (_("Corrupt note: alignment %ld, expecting 4 or 8\n"), + (long) align); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + +diff -rup binutils.orig/binutils/ieee.c binutils-2.30/binutils/ieee.c +--- binutils.orig/binutils/ieee.c 2019-10-08 11:33:02.620958088 +0100 ++++ binutils-2.30/binutils/ieee.c 2019-10-08 11:34:44.609294479 +0100 +@@ -2838,6 +2838,8 @@ ieee_read_cxx_class (struct ieee_info *i + if (structfields == NULL) + { + ieee_error (info, start, _("C++ object has no fields")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + +diff -rup binutils.orig/binutils/rddbg.c binutils-2.30/binutils/rddbg.c +--- binutils.orig/binutils/rddbg.c 2019-10-08 11:33:02.619958094 +0100 ++++ binutils-2.30/binutils/rddbg.c 2019-10-08 11:34:35.169355901 +0100 +@@ -86,6 +86,8 @@ read_debugging_info (bfd *abfd, asymbol + if (! no_messages) + non_fatal (_("%s: no recognized debugging information"), + bfd_get_filename (abfd)); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return NULL; + } + +@@ -300,6 +302,8 @@ read_symbol_stabs_debugging_info (bfd *a + + s = i.name; + if (s == NULL || strlen (s) < 1) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + f = NULL; + +diff -rup binutils.orig/binutils/stabs.c binutils-2.30/binutils/stabs.c +--- binutils.orig/binutils/stabs.c 2019-10-08 11:33:02.607958173 +0100 ++++ binutils-2.30/binutils/stabs.c 2019-10-08 11:34:25.489418884 +0100 +@@ -758,6 +758,8 @@ parse_stab_string (void *dhandle, struct + if (*p != '=') + { + bad_stab (string); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + ++p; +@@ -791,6 +793,8 @@ parse_stab_string (void *dhandle, struct + if (*p != ',') + { + bad_stab (string); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + if (! debug_record_typed_const (dhandle, name, dtype, atoi (p))) +@@ -798,6 +802,8 @@ parse_stab_string (void *dhandle, struct + break; + default: + bad_stab (string); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + +@@ -810,6 +816,8 @@ parse_stab_string (void *dhandle, struct + if (dtype == DEBUG_TYPE_NULL) + return FALSE; + if (! debug_record_label (dhandle, name, dtype, value)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + break; + +@@ -1114,6 +1122,8 @@ parse_stab_string (void *dhandle, struct + while (*p != ';') + ++p; + ++p; ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return TRUE; + } + /* TODO SUNPro C++ support: +@@ -1127,12 +1137,16 @@ parse_stab_string (void *dhandle, struct + + default: + bad_stab (string); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + + /* FIXME: gdb converts structure values to structure pointers in a + couple of cases, depending upon the target. */ + ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return TRUE; + } + +@@ -1499,6 +1513,8 @@ parse_stab_type (void *dhandle, struct s + if (**pp != ',') + { + bad_stab (orig); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return DEBUG_TYPE_NULL; + } + ++*pp; +@@ -1513,6 +1529,8 @@ parse_stab_type (void *dhandle, struct s + args[n] = parse_stab_type (dhandle, info, (const char *) NULL, + pp, (debug_type **) NULL); + if (args[n] == DEBUG_TYPE_NULL) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return DEBUG_TYPE_NULL; + ++n; + } +@@ -2290,6 +2308,8 @@ parse_stab_struct_fields (void *dhandle, + + if (! parse_stab_one_struct_field (dhandle, info, pp, p, fields + c, + staticsp)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + + ++c; +@@ -2365,6 +2385,8 @@ parse_stab_cpp_abbrev (void *dhandle, st + if (**pp != ':') + { + bad_stab (orig); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + ++*pp; +@@ -2374,6 +2396,8 @@ parse_stab_cpp_abbrev (void *dhandle, st + if (**pp != ',') + { + bad_stab (orig); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + ++*pp; +@@ -2382,6 +2406,8 @@ parse_stab_cpp_abbrev (void *dhandle, st + if (**pp != ';') + { + bad_stab (orig); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + ++*pp; +@@ -2787,6 +2813,8 @@ parse_stab_members (void *dhandle, struc + if (return_type == DEBUG_TYPE_NULL) + { + bad_stab (orig); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + goto fail; + } + type = parse_stab_argtypes (dhandle, info, class_type, name, +@@ -3104,6 +3132,8 @@ parse_stab_array_type (void *dhandle, st + if (**pp != ';') + { + bad_stab (orig); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return DEBUG_TYPE_NULL; + } + ++*pp; +@@ -3120,6 +3150,8 @@ parse_stab_array_type (void *dhandle, st + if (**pp != ';') + { + bad_stab (orig); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return DEBUG_TYPE_NULL; + } + ++*pp; +@@ -3134,6 +3166,8 @@ parse_stab_array_type (void *dhandle, st + if (**pp != ';') + { + bad_stab (orig); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return DEBUG_TYPE_NULL; + } + ++*pp; +@@ -3141,6 +3175,8 @@ parse_stab_array_type (void *dhandle, st + element_type = parse_stab_type (dhandle, info, (const char *) NULL, pp, + (debug_type **) NULL); + if (element_type == DEBUG_TYPE_NULL) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return DEBUG_TYPE_NULL; + + if (adjustable) +@@ -5366,6 +5402,8 @@ stab_demangle_v3_arg (void *dhandle, str + dc->u.s_binary.right, + &varargs); + if (pargs == NULL) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return NULL; + + return debug_make_function_type (dhandle, dt, pargs, varargs); +diff -rup binutils.orig/gas/as.c binutils-2.30/gas/as.c +--- binutils.orig/gas/as.c 2019-10-08 11:33:02.834956696 +0100 ++++ binutils-2.30/gas/as.c 2019-10-08 11:34:17.073473644 +0100 +@@ -934,6 +934,8 @@ This program has absolutely no warranty. + case OPTION_AL: + listing |= LISTING_LISTING; + if (optarg) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + listing_filename = xstrdup (optarg); + break; + +@@ -988,6 +990,8 @@ This program has absolutely no warranty. + listing |= LISTING_SYMBOLS; + break; + case '=': ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + listing_filename = xstrdup (optarg + 1); + optarg += strlen (listing_filename); + break; +@@ -1021,6 +1025,8 @@ This program has absolutely no warranty. + } + + case 'o': ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + out_file_name = xstrdup (optarg); + break; + +diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.30/gas/config/obj-elf.c +--- binutils.orig/gas/config/obj-elf.c 2019-10-08 11:33:02.848956604 +0100 ++++ binutils-2.30/gas/config/obj-elf.c 2019-10-08 11:34:09.473523094 +0100 +@@ -1028,6 +1028,8 @@ obj_elf_attach_to_group (int dummy ATTRI + + elf_group_name (now_seg) = xstrdup (gname); + elf_section_flags (now_seg) |= SHF_GROUP; ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + void +@@ -1103,6 +1105,8 @@ obj_elf_section (int push) + if (beg == NULL) + { + ignore_rest_of_line (); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return; + } + attr |= obj_elf_parse_section_letters (beg, strlen (beg), &is_clone); +@@ -1233,6 +1237,8 @@ obj_elf_section (int push) + { + as_bad (_("character following name is not '#'")); + ignore_rest_of_line (); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return; + } + ++input_line_pointer; +diff -rup binutils.orig/gas/dwarf2dbg.c binutils-2.30/gas/dwarf2dbg.c +--- binutils.orig/gas/dwarf2dbg.c 2019-10-08 11:33:02.839956663 +0100 ++++ binutils-2.30/gas/dwarf2dbg.c 2019-10-08 11:34:00.913578791 +0100 +@@ -1701,6 +1701,8 @@ out_file_list (void) + + /* Terminate filename list. */ + out_byte (0); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + /* Switch to SEC and output a header length field. Return the size of +@@ -2115,6 +2117,8 @@ out_debug_str (segT str_seg, symbolS **n + len = strlen (producer) + 1; + p = frag_more (len); + memcpy (p, producer, len); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + void +diff -rup binutils.orig/gas/read.c binutils-2.30/gas/read.c +--- binutils.orig/gas/read.c 2019-10-08 11:33:02.852956578 +0100 ++++ binutils-2.30/gas/read.c 2019-10-08 11:33:51.537639797 +0100 +@@ -1714,6 +1714,8 @@ read_symbol_name (void) + { + as_bad (_("expected symbol name")); + ignore_rest_of_line (); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return NULL; + } + +diff -rup binutils.orig/gas/write.c binutils-2.30/gas/write.c +--- binutils.orig/gas/write.c 2019-10-08 11:33:02.833956702 +0100 ++++ binutils-2.30/gas/write.c 2019-10-08 11:33:36.033740679 +0100 +@@ -1366,6 +1366,8 @@ write_relocs (bfd *abfd, asection *sec, + } + } + #endif ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + static int +@@ -1868,6 +1870,8 @@ create_note_reloc (segT sec, + if (reloc->u.b.r.howto == NULL) + { + as_bad (_("unable to create reloc for build note")); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return; + } + +diff -rup binutils.orig/gas/as.c binutils-2.30/gas/as.c +--- binutils.orig/gas/as.c 2019-10-08 13:45:17.382428420 +0100 ++++ binutils-2.30/gas/as.c 2019-10-08 13:46:01.613135558 +0100 +@@ -935,7 +935,7 @@ This program has absolutely no warranty. + listing |= LISTING_LISTING; + if (optarg) + /* There is a potential resource leak here, but it is not important. */ +- /* coverity[leaked_storage: FALSE] */ ++ /* coverity[overwrite_var: FALSE] */ + listing_filename = xstrdup (optarg); + break; + +@@ -991,7 +991,7 @@ This program has absolutely no warranty. + break; + case '=': + /* There is a potential resource leak here, but it is not important. */ +- /* coverity[leaked_storage: FALSE] */ ++ /* coverity[overwrite_var: FALSE] */ + listing_filename = xstrdup (optarg + 1); + optarg += strlen (listing_filename); + break; +@@ -1026,7 +1026,7 @@ This program has absolutely no warranty. + + case 'o': + /* There is a potential resource leak here, but it is not important. */ +- /* coverity[leaked_storage: FALSE] */ ++ /* coverity[overwrite_var: FALSE] */ + out_file_name = xstrdup (optarg); + break; + +diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.30/gas/config/obj-elf.c +--- binutils.orig/gas/config/obj-elf.c 2019-10-08 13:45:17.371428492 +0100 ++++ binutils-2.30/gas/config/obj-elf.c 2019-10-08 13:46:49.916815725 +0100 +@@ -1023,6 +1023,8 @@ obj_elf_attach_to_group (int dummy ATTRI + if (elf_group_name (now_seg)) + { + as_warn ("already has a group"); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return; + } + +diff -rup binutils.orig/gas/dwarf2dbg.c binutils-2.30/gas/dwarf2dbg.c +--- binutils.orig/gas/dwarf2dbg.c 2019-10-08 13:45:17.384428407 +0100 ++++ binutils-2.30/gas/dwarf2dbg.c 2019-10-08 13:47:29.198555634 +0100 +@@ -1664,6 +1664,8 @@ out_file_list (void) + /* Emit directory list. */ + for (i = 1; i < dirs_in_use; ++i) + { ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[overwrite_var: FALSE] */ + dir = remap_debug_filename (dirs[i]); + size = strlen (dir) + 1; + cp = frag_more (size); +diff -rup binutils.orig/gold/cref.cc binutils-2.30/gold/cref.cc +--- binutils.orig/gold/cref.cc 2019-10-08 13:45:17.653426626 +0100 ++++ binutils-2.30/gold/cref.cc 2019-10-08 13:47:46.669439951 +0100 +@@ -391,6 +391,8 @@ Cref::print_symbol_counts(const Symbol_t + } + if (f != NULL) + this->inputs_->print_symbol_counts(symtab, f); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + } + +diff -rup binutils.orig/gold/dwarf_reader.cc binutils-2.30/gold/dwarf_reader.cc +--- binutils.orig/gold/dwarf_reader.cc 2019-10-08 13:45:17.654426619 +0100 ++++ binutils-2.30/gold/dwarf_reader.cc 2019-10-08 13:48:03.292329889 +0100 +@@ -265,12 +265,16 @@ Dwarf_abbrev_table::do_get_abbrev(unsign + { + // Read the attribute. + if (this->buffer_pos_ >= this->buffer_end_) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return NULL; + uint64_t attr = read_unsigned_LEB_128(this->buffer_pos_, &len); + this->buffer_pos_ += len; + + // Read the form. + if (this->buffer_pos_ >= this->buffer_end_) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return NULL; + uint64_t form = read_unsigned_LEB_128(this->buffer_pos_, &len); + this->buffer_pos_ += len; +diff -rup binutils.orig/gold/dwp.cc binutils-2.30/gold/dwp.cc +--- binutils.orig/gold/dwp.cc 2019-10-08 13:45:17.656426606 +0100 ++++ binutils-2.30/gold/dwp.cc 2019-10-08 13:48:12.317270132 +0100 +@@ -803,6 +803,8 @@ Sized_relobj_dwo::setu + pshdrs, this->shnum(), names, section_names_size, this, true); + if (compressed_sections != NULL && !compressed_sections->empty()) + this->set_compressed_sections(compressed_sections); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + // Return a view of the contents of a section. +@@ -1163,6 +1165,8 @@ Dwo_file::sized_read_unit_index(unsigned + elfcpp::Swap_unaligned<32, big_endian>::readval(contents + + 2 * sizeof(uint32_t)); + if (ncols == 0 || nused == 0) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return; + + gold_assert(info_shndx > 0); +@@ -1305,6 +1309,8 @@ Dwo_file::sized_verify_dwo_list(unsigned + elfcpp::Swap_unaligned<32, big_endian>::readval(contents + + 2 * sizeof(uint32_t)); + if (ncols == 0 || nused == 0) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return true; + + unsigned int nslots = +diff -rup binutils.orig/gold/ehframe.cc binutils-2.30/gold/ehframe.cc +--- binutils.orig/gold/ehframe.cc 2019-10-08 13:45:17.653426626 +0100 ++++ binutils-2.30/gold/ehframe.cc 2019-10-08 13:48:21.580208800 +0100 +@@ -1187,6 +1187,8 @@ Eh_frame::remove_ehframe_for_plt(Output_ + + if (this->mappings_are_done_) + this->final_data_size_ -= align_address(fde_length + 8, this->addralign()); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + // Return the number of FDEs. +diff -rup binutils.orig/gold/fileread.cc binutils-2.30/gold/fileread.cc +--- binutils.orig/gold/fileread.cc 2019-10-08 13:45:17.657426599 +0100 ++++ binutils-2.30/gold/fileread.cc 2019-10-08 13:48:33.645128913 +0100 +@@ -873,6 +873,8 @@ File_view::~File_view() + Input_file::Input_file(const char* name) + : found_name_(), file_(), is_in_sysroot_(false), format_(FORMAT_NONE) + { ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[ctor_dtor_leak: FALSE] */ + this->input_argument_ = + new Input_file_argument(name, Input_file_argument::INPUT_FILE_TYPE_FILE, + "", false, Position_dependent_options()); +@@ -884,6 +886,8 @@ Input_file::Input_file(const Task* task, + const unsigned char* contents, off_t size) + : file_() + { ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[ctor_dtor_leak: FALSE] */ + this->input_argument_ = + new Input_file_argument(name, Input_file_argument::INPUT_FILE_TYPE_FILE, + "", false, Position_dependent_options()); +diff -rup binutils.orig/gold/gdb-index.cc binutils-2.30/gold/gdb-index.cc +--- binutils.orig/gold/gdb-index.cc 2019-10-08 13:45:17.656426606 +0100 ++++ binutils-2.30/gold/gdb-index.cc 2019-10-08 13:48:46.061046705 +0100 +@@ -1043,6 +1043,8 @@ Gdb_index::map_pubtable_to_dies(unsigned + + map->clear(); + if (!table->read_section(object, symbols, symbols_size)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return NULL; + + while (table->read_header(section_offset)) +diff -rup binutils.orig/gold/gold.cc binutils-2.30/gold/gold.cc +--- binutils.orig/gold/gold.cc 2019-10-08 13:45:17.656426606 +0100 ++++ binutils-2.30/gold/gold.cc 2019-10-08 13:48:57.387971709 +0100 +@@ -349,6 +349,8 @@ process_incremental_input(Incremental_bi + // Incremental_binary::check_inputs should have cancelled the + // incremental update if the script has changed. + gold_assert(!ibase->file_has_changed(input_file_index)); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return new Check_script(layout, ibase, input_file_index, input_reader, + this_blocker, next_blocker); + } +@@ -362,6 +364,8 @@ process_incremental_input(Incremental_bi + { + // Queue a task to check that no references have been added to any + // of the library's unused symbols. ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return new Check_library(symtab, layout, ibase, input_file_index, + input_reader, this_blocker, next_blocker); + } +@@ -384,6 +388,8 @@ process_incremental_input(Incremental_bi + { + if (ibase->file_has_changed(lib->input_file_index())) + { ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return new Read_member(input_objects, symtab, layout, mapfile, + input_reader, this_blocker, next_blocker); + } +diff -rup binutils.orig/gold/layout.cc binutils-2.30/gold/layout.cc +--- binutils.orig/gold/layout.cc 2019-10-08 13:45:17.654426619 +0100 ++++ binutils-2.30/gold/layout.cc 2019-10-08 13:49:09.579890984 +0100 +@@ -487,6 +487,8 @@ Layout::Layout(int number_of_input_files + + // Initialize structure needed for an incremental build. + if (parameters->incremental()) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[ctor_dtor_leak: FALSE] */ + this->incremental_inputs_ = new Incremental_inputs; + + // The section name pool is worth optimizing in all cases, because +@@ -3239,6 +3241,8 @@ Layout::create_note(const char* name, in + flags, false, order, false, + false, true); + if (os == NULL) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return NULL; + + Output_section_data* posd = new Output_data_const_buffer(buffer, notehdrsz, +@@ -3301,6 +3305,8 @@ Layout::create_gnu_properties_note() + } + Output_section_data* posd = new Output_data_const(desc, descsz, 4); + os->add_output_section_data(posd); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + // For an executable or shared library, create a note to record the +@@ -4790,6 +4796,8 @@ Layout::create_dynamic_symtab(const Inpu + + if (odyn != NULL) + odyn->add_section_address(elfcpp::DT_GNU_HASH, hashsec); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + } + +@@ -4824,6 +4832,8 @@ Layout::create_dynamic_symtab(const Inpu + + if (odyn != NULL) + odyn->add_section_address(elfcpp::DT_HASH, hashsec); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + } + +@@ -5030,6 +5040,8 @@ Layout::create_interp(const Target* targ + false, false, false); + if (osec != NULL) + osec->add_output_section_data(odata); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + // Add dynamic tags for the PLT and the dynamic relocs. This is +diff -rup binutils.orig/gold/object.cc binutils-2.30/gold/object.cc +--- binutils.orig/gold/object.cc 2019-10-08 13:45:17.669426519 +0100 ++++ binutils-2.30/gold/object.cc 2019-10-08 13:49:36.027715869 +0100 +@@ -896,6 +896,8 @@ Sized_relobj_file::bas + if (strtab_shndx >= this->shnum()) + { + this->error(_("invalid symbol table name index: %u"), strtab_shndx); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return; + } + typename This::Shdr strtabshdr(pshdrs + strtab_shndx * This::shdr_size); +@@ -903,6 +905,8 @@ Sized_relobj_file::bas + { + this->error(_("symbol table name section has wrong type: %u"), + static_cast(strtabshdr.get_sh_type())); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return; + } + +diff -rup binutils.orig/gold/output.cc binutils-2.30/gold/output.cc +--- binutils.orig/gold/output.cc 2019-10-08 13:45:17.655426612 +0100 ++++ binutils-2.30/gold/output.cc 2019-10-08 13:49:48.571632811 +0100 +@@ -2392,6 +2392,8 @@ Output_section::Output_section(const cha + extra_segment_flags_(0), + segment_alignment_(0), + checkpoint_(NULL), ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[ctor_dtor_leak: FALSE] */ + lookup_maps_(new Output_section_lookup_maps), + free_list_(), + free_space_fill_(NULL), +diff -rup binutils.orig/gold/plugin.cc binutils-2.30/gold/plugin.cc +--- binutils.orig/gold/plugin.cc 2019-10-08 13:45:17.669426519 +0100 ++++ binutils-2.30/gold/plugin.cc 2019-10-08 13:49:58.427567551 +0100 +@@ -1919,6 +1919,8 @@ unique_segment_for_sections(const char* + Object* obj = parameters->options().plugins()->get_elf_object( + section_list[i].handle); + if (obj == NULL || obj->is_dynamic()) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return LDPS_BAD_HANDLE; + unsigned int shndx = section_list[i].shndx; + Const_section_id secn_id(static_cast(obj), shndx); +diff -rup binutils.orig/gold/readsyms.cc binutils-2.30/gold/readsyms.cc +--- binutils.orig/gold/readsyms.cc 2019-10-08 13:45:17.656426606 +0100 ++++ binutils-2.30/gold/readsyms.cc 2019-10-08 13:50:09.964491164 +0100 +@@ -274,6 +274,8 @@ Read_symbols::do_read_symbols(Workqueue* + + Input_file* input_file = new Input_file(&this->input_argument_->file()); + if (!input_file->open(*this->dirpath_, this, &this->dirindex_)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return false; + + // Read enough of the file to pick up the entire ELF header. +diff -rup binutils.orig/gold/script.cc binutils-2.30/gold/script.cc +--- binutils.orig/gold/script.cc 2019-10-08 13:45:17.652426632 +0100 ++++ binutils-2.30/gold/script.cc 2019-10-08 13:50:19.708426645 +0100 +@@ -2844,6 +2844,8 @@ script_parse_option(void* closurev, cons + // The General_options class will quite possibly store a pointer + // into mutable_option, so we can't free it. In cases the class + // does not store such a pointer, this is a memory leak. Alas. :( ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + closure->clear_skip_on_incompatible_target(); + } +diff -rup binutils.orig/gold/workqueue.cc binutils-2.30/gold/workqueue.cc +--- binutils.orig/gold/workqueue.cc 2019-10-08 13:45:17.655426612 +0100 ++++ binutils-2.30/gold/workqueue.cc 2019-10-08 13:50:28.076371238 +0100 +@@ -130,6 +130,8 @@ Workqueue::Workqueue(const General_optio + threads = false; + #endif + if (!threads) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[ctor_dtor_leak: FALSE] */ + this->threader_ = new Workqueue_threader_single(this); + else + { +diff -rup binutils.orig/gprof/cg_print.c binutils-2.30/gprof/cg_print.c +--- binutils.orig/gprof/cg_print.c 2019-10-08 13:45:17.127430108 +0100 ++++ binutils-2.30/gprof/cg_print.c 2019-10-08 13:50:40.732287437 +0100 +@@ -1287,4 +1287,6 @@ cg_print_file_ordering (void) + printf ("%s\n", symbol_map[sym_index].file_name); + last = symbol_map[sym_index].file_name; + } ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } +diff -rup binutils.orig/gold/gold.cc binutils-2.30/gold/gold.cc +--- binutils.orig/gold/gold.cc 2019-10-08 14:45:28.076504486 +0100 ++++ binutils-2.30/gold/gold.cc 2019-10-08 14:45:47.877373236 +0100 +@@ -221,6 +221,8 @@ queue_initial_tasks(const General_option + else + gold_fallback(_("restart link with --incremental-full")); + } ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + // Read the input files. We have to add the symbols to the symbol +diff -rup binutils.orig/gprof/gmon_io.c binutils-2.30/gprof/gmon_io.c +--- binutils.orig/gprof/gmon_io.c 2019-10-08 14:45:27.582507760 +0100 ++++ binutils-2.30/gprof/gmon_io.c 2019-10-08 14:46:22.454144044 +0100 +@@ -749,4 +749,6 @@ gmon_out_write (const char *filename) + whoami, file_format); + done (1); + } ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } +diff -rup binutils.orig/gprof/source.c binutils-2.30/gprof/source.c +--- binutils.orig/gprof/source.c 2019-10-08 14:45:27.583507753 +0100 ++++ binutils-2.30/gprof/source.c 2019-10-08 14:46:33.925068010 +0100 +@@ -216,6 +216,8 @@ annotate_source (Source_File *sf, unsign + if (!ofp) + { + perror (fname); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return 0; + } + } +diff -rup binutils.orig/ld/emultempl/elf32.em binutils-2.30/ld/emultempl/elf32.em +--- binutils.orig/ld/emultempl/elf32.em 2019-10-08 14:45:27.638507389 +0100 ++++ binutils-2.30/ld/emultempl/elf32.em 2019-10-08 14:47:40.916623958 +0100 +@@ -1776,6 +1776,9 @@ gld${EMULATION_NAME}_before_allocation ( + if (cp != NULL && *cp != '\0') + gld${EMULATION_NAME}_append_to_separated_string (&depaudit, cp); + ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[overwrite_var: FALSE] */ ++ /* coverity[leaked_storage: FALSE] */ + cp = more ? ++cp2 : NULL; + } + while (cp != NULL); +diff -rup binutils.orig/ld/emultempl/pe.em binutils-2.30/ld/emultempl/pe.em +--- binutils.orig/ld/emultempl/pe.em 2019-10-08 14:45:27.637507396 +0100 ++++ binutils-2.30/ld/emultempl/pe.em 2019-10-08 14:48:22.133350756 +0100 +@@ -1371,6 +1371,8 @@ write_build_id (bfd *abfd) + return 0; + + if (bfd_bwrite (contents, size, abfd) != size) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return 0; + + /* Construct the CodeView record. */ +diff -rup binutils.orig/ld/emultempl/pep.em binutils-2.30/ld/emultempl/pep.em +--- binutils.orig/ld/emultempl/pep.em 2019-10-08 14:45:27.638507389 +0100 ++++ binutils-2.30/ld/emultempl/pep.em 2019-10-08 14:48:42.356216712 +0100 +@@ -1338,6 +1338,8 @@ write_build_id (bfd *abfd) + return 0; + + if (bfd_bwrite (contents, size, abfd) != size) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return 0; + + /* Construct the CodeView record. */ +diff -rup binutils.orig/ld/ldfile.c binutils-2.30/ld/ldfile.c +--- binutils.orig/ld/ldfile.c 2019-10-08 14:45:27.635507409 +0100 ++++ binutils-2.30/ld/ldfile.c 2019-10-08 14:49:24.851935030 +0100 +@@ -563,6 +563,8 @@ ldfile_find_command_file (const char *na + ldfile_add_library_path (script_dir, TRUE); + search_tail_ptr = save_tail_ptr; + } ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + /* Temporarily append script_search to the path list so that the +diff -rup binutils.orig/ld/ldlang.c binutils-2.30/ld/ldlang.c +--- binutils.orig/ld/ldlang.c 2019-10-08 14:45:27.638507389 +0100 ++++ binutils-2.30/ld/ldlang.c 2019-10-08 14:49:37.283852627 +0100 +@@ -9272,6 +9272,8 @@ cmdline_fopen_temp (const char *path, co + fd = open (tmpname, O_RDWR | O_CREAT | O_EXCL, 0600); + #endif + if (fd == -1) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return NULL; + return bfd_fopen (tmpname, target, mode, fd); + } +diff -rup binutils.orig/ld/ldmain.c binutils-2.30/ld/ldmain.c +--- binutils.orig/ld/ldmain.c 2019-10-08 14:45:27.650507310 +0100 ++++ binutils-2.30/ld/ldmain.c 2019-10-08 14:52:26.130733447 +0100 +@@ -802,6 +802,8 @@ add_archive_element (struct bfd_link_inf + info_msg ("%I: no new IR symbols to claimi\n", + &orig_input); + input->flags.claimed = 0; ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return FALSE; + } + input->flags.claim_archive = TRUE; +@@ -855,6 +857,8 @@ add_archive_element (struct bfd_link_inf + header_printed = TRUE; + } + ++ /* Coverity incorrectly believes that abfd might be NULL at this point. */ ++ /* coverity[deref_after_free: FALSE] */ + if (abfd->my_archive == NULL + || bfd_is_thin_archive (abfd->my_archive)) + { +diff -rup binutils.orig/ld/ldwrite.c binutils-2.30/ld/ldwrite.c +--- binutils.orig/ld/ldwrite.c 2019-10-08 14:45:27.635507409 +0100 ++++ binutils-2.30/ld/ldwrite.c 2019-10-08 14:53:32.850291467 +0100 +@@ -367,6 +367,8 @@ clone_section (bfd *abfd, asection *s, c + { + einfo (_ ("%F%P: cannot create split section name for %s\n"), name); + /* Silence gcc warnings. einfo exits, so we never reach here. */ ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return NULL; + } + tname[5] = 0; +@@ -379,6 +381,8 @@ clone_section (bfd *abfd, asection *s, c + { + einfo (_("%F%P: clone section failed: %E\n")); + /* Silence gcc warnings. einfo exits, so we never reach here. */ ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return NULL; + } + free (tname); +diff -rup binutils.orig/ld/pe-dll.c binutils-2.30/ld/pe-dll.c +--- binutils.orig/ld/pe-dll.c 2019-10-08 14:45:27.650507310 +0100 ++++ binutils-2.30/ld/pe-dll.c 2019-10-08 14:54:58.385725320 +0100 +@@ -1397,6 +1397,8 @@ generate_reloc (bfd *abfd, struct bfd_li + if (!bfd_generic_link_read_symbols (b)) + { + einfo (_("%B%F: could not read symbols: %E\n"), b); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return; + } + +@@ -1585,6 +1587,8 @@ generate_reloc (bfd *abfd, struct bfd_li + + while (reloc_sz < reloc_s->size) + reloc_d[reloc_sz++] = 0; ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + + /* Given the exiting def_file structure, print out a .DEF file that +@@ -2043,6 +2047,8 @@ make_tail (bfd *parent) + bfd_set_section_contents (abfd, id7, d7, 0, len); + + bfd_make_readable (abfd); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return abfd; + } + +@@ -2323,6 +2329,8 @@ make_one (def_file_export *exp, bfd *par + bfd_set_section_contents (abfd, id6, d6, 0, len); + + bfd_make_readable (abfd); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return abfd; + } + +@@ -2364,6 +2372,8 @@ make_singleton_name_imp (const char *imp + bfd_set_section_contents (abfd, id5, d5, 0, PE_IDATA4_SIZE * 2); + + bfd_make_readable (abfd); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return abfd; + } + +@@ -2406,6 +2416,8 @@ make_singleton_name_thunk (const char *i + bfd_set_section_contents (abfd, id4, d4, 0, PE_IDATA4_SIZE * 2); + + bfd_make_readable (abfd); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return abfd; + } + +@@ -2491,6 +2503,8 @@ make_import_fixup_entry (const char *nam + bfd_set_section_contents (abfd, id2, d2, 0, 20); + + bfd_make_readable (abfd); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return abfd; + } + +diff -rup binutils.orig/ld/pe-dll.c binutils-2.30/ld/pe-dll.c +--- binutils.orig/ld/pe-dll.c 2019-10-08 15:28:31.546363527 +0100 ++++ binutils-2.30/ld/pe-dll.c 2019-10-08 15:28:46.677262539 +0100 +@@ -1977,6 +1977,8 @@ make_head (bfd *parent) + } + + bfd_make_readable (abfd); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return abfd; + } + +@@ -2590,6 +2592,8 @@ make_runtime_pseudo_reloc (const char *n + bfd_set_section_contents (abfd, rt_rel, rt_rel_d, 0, 8); + } + bfd_make_readable (abfd); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return abfd; + } + +@@ -2634,6 +2638,8 @@ pe_create_runtime_relocator_reference (b + bfd_set_section_contents (abfd, extern_rt_rel, extern_rt_rel_d, 0, PE_IDATA5_SIZE); + + bfd_make_readable (abfd); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return abfd; + } + +diff -rup binutils.orig/ld/plugin.c binutils-2.30/ld/plugin.c +--- binutils.orig/ld/plugin.c 2019-10-08 15:28:31.560363434 +0100 ++++ binutils-2.30/ld/plugin.c 2019-10-08 15:29:32.579956181 +0100 +@@ -314,6 +314,8 @@ plugin_get_ir_dummy_bfd (const char *nam + + bfd_use_reserved_id = 1; + bfd_plugin_target = bfd_plugin_target_p (srctemplate->xvec); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + abfd = bfd_create (concat (name, IRONLY_SUFFIX, (const char *) NULL), + bfd_plugin_target ? link_info.output_bfd : srctemplate); + if (abfd != NULL) +@@ -503,6 +505,8 @@ add_symbols (void *handle, int nsyms, co + symptrs[n] = bfdsym; + rv = asymbol_from_plugin_symbol (abfd, bfdsym, syms + n); + if (rv != LDPS_OK) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return rv; + } + bfd_set_symtab (abfd, symptrs, nsyms); +@@ -842,6 +846,8 @@ static enum ld_plugin_status + set_extra_library_path (const char *path) + { + ASSERT (called_plugin); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + ldfile_add_library_path (xstrdup (path), FALSE); + return LDPS_OK; + } +diff -rup binutils.orig/ld/testplug2.c binutils-2.30/ld/testplug2.c +--- binutils.orig/ld/testplug2.c 2019-10-08 15:28:31.547363520 +0100 ++++ binutils-2.30/ld/testplug2.c 2019-10-08 15:31:08.483316106 +0100 +@@ -242,7 +242,7 @@ parse_symdefstr (const char *str, struct + sym->version = NULL; + if (colon5 && colon5[1]) + { +- sym->comdat_key = malloc (strlen (colon5 + 1) + 1); ++ sym->comdat_key = malloc (strlen (colon5) + 1 + 1); + if (!sym->comdat_key) + return LDPS_ERR; + strcpy (sym->comdat_key, colon5 + 1); +diff -rup binutils.orig/ld/testplug3.c binutils-2.30/ld/testplug3.c +--- binutils.orig/ld/testplug3.c 2019-10-08 15:28:31.561363427 +0100 ++++ binutils-2.30/ld/testplug3.c 2019-10-08 15:31:28.351183504 +0100 +@@ -241,7 +241,7 @@ parse_symdefstr (const char *str, struct + sym->version = NULL; + if (colon5 && colon5[1]) + { +- sym->comdat_key = malloc (strlen (colon5 + 1) + 1); ++ sym->comdat_key = malloc (strlen (colon5) + 1 + 1); + if (!sym->comdat_key) + return LDPS_ERR; + strcpy (sym->comdat_key, colon5 + 1); +diff -rup binutils.orig/ld/testplug4.c binutils-2.30/ld/testplug4.c +--- binutils.orig/ld/testplug4.c 2019-10-08 15:28:31.547363520 +0100 ++++ binutils-2.30/ld/testplug4.c 2019-10-08 15:31:38.739114175 +0100 +@@ -242,7 +242,7 @@ parse_symdefstr (const char *str, struct + sym->version = NULL; + if (colon5 && colon5[1]) + { +- sym->comdat_key = malloc (strlen (colon5 + 1) + 1); ++ sym->comdat_key = malloc (strlen (colon5) + 1 + 1); + if (!sym->comdat_key) + return LDPS_ERR; + strcpy (sym->comdat_key, colon5 + 1); +diff -rup binutils.orig/ld/testplug.c binutils-2.30/ld/testplug.c +--- binutils.orig/ld/testplug.c 2019-10-08 15:28:31.560363434 +0100 ++++ binutils-2.30/ld/testplug.c 2019-10-08 15:30:37.140525299 +0100 +@@ -263,7 +263,7 @@ parse_symdefstr (const char *str, struct + sym->version = NULL; + if (colon5 && colon5[1]) + { +- sym->comdat_key = malloc (strlen (colon5 + 1) + 1); ++ sym->comdat_key = malloc (strlen (colon5) + 1 + 1); + if (!sym->comdat_key) + return LDPS_ERR; + strcpy (sym->comdat_key, colon5 + 1); +@@ -564,6 +564,8 @@ onclaim_file (const struct ld_plugin_inp + if (buffer == NULL) + return LDPS_ERR; + if (read (file->fd, buffer, bytes_to_read_before_claim) < 0) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return LDPS_ERR; + free (buffer); + } +diff -rup binutils.orig/libiberty/argv.c binutils-2.30/libiberty/argv.c +--- binutils.orig/libiberty/argv.c 2019-10-08 15:28:32.008360444 +0100 ++++ binutils-2.30/libiberty/argv.c 2019-10-08 15:32:06.258930502 +0100 +@@ -477,6 +477,8 @@ expandargv (int *argcp, char ***argvp) + error: + /* We're all done with the file now. */ + fclose (f); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + } + } + +diff -rup binutils.orig/libiberty/regex.c binutils-2.30/libiberty/regex.c +--- binutils.orig/libiberty/regex.c 2019-10-08 15:28:32.009360437 +0100 ++++ binutils-2.30/libiberty/regex.c 2019-10-08 15:33:10.899499081 +0100 +@@ -2453,6 +2453,8 @@ PREFIX(regex_compile) (const char *ARG_P + /* Loop through the uncompiled pattern until we're at the end. */ + while (p != pend) + { ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[memleak: FALSE] */ + PATFETCH (c); + + switch (c) +diff -rup binutils.orig/libiberty/simple-object-elf.c binutils-2.30/libiberty/simple-object-elf.c +--- binutils.orig/libiberty/simple-object-elf.c 2019-10-08 15:28:32.011360423 +0100 ++++ binutils-2.30/libiberty/simple-object-elf.c 2019-10-08 15:33:40.483301634 +0100 +@@ -1151,6 +1151,8 @@ simple_object_elf_copy_lto_debug_section + *err = 0; + XDELETEVEC (names); + XDELETEVEC (shdrs); ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return "ELF section name out of range"; + } + +diff -rup binutils.orig/libiberty/simple-object-mach-o.c binutils-2.30/libiberty/simple-object-mach-o.c +--- binutils.orig/libiberty/simple-object-mach-o.c 2019-10-08 15:28:32.008360444 +0100 ++++ binutils-2.30/libiberty/simple-object-mach-o.c 2019-10-08 15:34:16.530061049 +0100 +@@ -1139,6 +1139,8 @@ simple_object_mach_o_write_segment (simp + write = sizeof zeroes; + if (!simple_object_internal_write (descriptor, offset, zeroes, write, + errmsg, err)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return 0; + offset += write; + } +@@ -1245,6 +1247,8 @@ simple_object_mach_o_write_segment (simp + if (!simple_object_internal_write (descriptor, offset, + (const unsigned char *) snames, + name_offset, errmsg, err)) ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[leaked_storage: FALSE] */ + return 0; + + sechdr_offset += sechdrsize; +diff -rup binutils.orig/libiberty/vprintf-support.c binutils-2.30/libiberty/vprintf-support.c +--- binutils.orig/libiberty/vprintf-support.c 2019-10-08 15:28:32.008360444 +0100 ++++ binutils-2.30/libiberty/vprintf-support.c 2019-10-08 15:35:10.785698942 +0100 +@@ -49,6 +49,8 @@ libiberty_vprintf_buffer_size (const cha + #ifdef va_copy + va_copy (ap, args); + #else ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[va_list_usedBeforeStarted: FALSE] */ + memcpy ((PTR) &ap, (PTR) &args, sizeof (va_list)); + #endif + +diff -rup binutils.orig/libiberty/regex.c binutils-2.30/libiberty/regex.c +--- binutils.orig/libiberty/regex.c 2019-10-08 16:19:10.299014643 +0100 ++++ binutils-2.30/libiberty/regex.c 2019-10-08 16:20:19.168553441 +0100 +@@ -2454,7 +2454,7 @@ PREFIX(regex_compile) (const char *ARG_P + while (p != pend) + { + /* There is a potential resource leak here, but it is not important. */ +- /* coverity[memleak: FALSE] */ ++ /* coverity[error[memleak]: FALSE] */ + PATFETCH (c); + + switch (c) +diff -rup binutils.orig/libiberty/vprintf-support.c binutils-2.30/libiberty/vprintf-support.c +--- binutils.orig/libiberty/vprintf-support.c 2019-10-08 16:19:10.299014643 +0100 ++++ binutils-2.30/libiberty/vprintf-support.c 2019-10-08 16:24:37.917821604 +0100 +@@ -49,8 +49,8 @@ libiberty_vprintf_buffer_size (const cha + #ifdef va_copy + va_copy (ap, args); + #else +- /* There is a potential resource leak here, but it is not important. */ +- /* coverity[va_list_usedBeforeStarted: FALSE] */ ++ /* Coverity insists on va_start being used. */ ++ va_start (ap); + memcpy ((PTR) &ap, (PTR) &args, sizeof (va_list)); + #endif + +diff -rup binutils.orig/zlib/gzlib.c binutils-2.30/zlib/gzlib.c +--- binutils.orig/zlib/gzlib.c 2019-10-08 16:19:10.304014609 +0100 ++++ binutils-2.30/zlib/gzlib.c 2019-10-08 16:23:11.678398812 +0100 +@@ -291,7 +291,9 @@ gzFile ZEXPORT gzdopen(fd, mode) + gzFile gz; + + if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL) +- return NULL; ++ /* There is a potential resource leak here, but it is not important. */ ++ /* coverity[Memory Leak: FALSE] */ ++ return NULL; + #if !defined(NO_snprintf) && !defined(NO_vsnprintf) + (void)snprintf(path, 7 + 3 * sizeof(int), "", fd); + #else +diff -rup binutils.orig/libiberty/regex.c binutils-2.30/libiberty/regex.c +--- binutils.orig/libiberty/regex.c 2019-10-08 17:18:32.431500412 +0100 ++++ binutils-2.30/libiberty/regex.c 2019-10-08 17:26:31.013117409 +0100 +@@ -2453,8 +2453,13 @@ PREFIX(regex_compile) (const char *ARG_P + /* Loop through the uncompiled pattern until we're at the end. */ + while (p != pend) + { +- /* There is a potential resource leak here, but it is not important. */ +- /* coverity[error[memleak]: FALSE] */ ++ if (p == pend) ++ { ++ /* This free is to silence coverity. */ ++ free (compile_stack.stack); ++ compile_stack.stack = NULL; ++ compile_stack.avail = 0; ++ } + PATFETCH (c); + + switch (c) +diff -rup binutils.orig/zlib/gzlib.c binutils-2.30/zlib/gzlib.c +--- binutils.orig/zlib/gzlib.c 2019-10-08 17:18:32.435500384 +0100 ++++ binutils-2.30/zlib/gzlib.c 2019-10-08 17:20:23.718713753 +0100 +@@ -287,13 +287,15 @@ gzFile ZEXPORT gzdopen(fd, mode) + int fd; + const char *mode; + { +- char *path; /* identifier for error messages */ ++ char *path = NULL; /* identifier for error messages */ + gzFile gz; + + if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL) +- /* There is a potential resource leak here, but it is not important. */ +- /* coverity[Memory Leak: FALSE] */ +- return NULL; ++ { ++ /* This free is to silence coverity. */ ++ free (path); ++ return NULL; ++ } + #if !defined(NO_snprintf) && !defined(NO_vsnprintf) + (void)snprintf(path, 7 + 3 * sizeof(int), "", fd); + #else diff --git a/SOURCES/binutils-do-not-merge-differing-SHF_EXCLUDE-groups.patch b/SOURCES/binutils-do-not-merge-differing-SHF_EXCLUDE-groups.patch new file mode 100644 index 0000000..e0653f9 --- /dev/null +++ b/SOURCES/binutils-do-not-merge-differing-SHF_EXCLUDE-groups.patch @@ -0,0 +1,18 @@ +--- binutils.orig/ld/emultempl/elf32.em 2019-07-22 13:25:51.601030174 +0100 ++++ binutils-2.32/ld/emultempl/elf32.em 2019-07-22 13:27:36.070394830 +0100 +@@ -2029,10 +2029,12 @@ elf_orphan_compatible (asection *in, ase + if (elf_section_data (out)->this_hdr.sh_info + != elf_section_data (in)->this_hdr.sh_info) + return FALSE; +- /* We can't merge two sections with differing SHF_EXCLUDE when doing +- a relocatable link. */ ++ /* We can't merge with member of output section group nor merge two ++ sections with differing SHF_EXCLUDE when doing a relocatable link. */ + if (bfd_link_relocatable (&link_info) +- && ((elf_section_flags (out) ^ elf_section_flags (in)) & SHF_EXCLUDE) != 0) ++ && (elf_next_in_group (out) != NULL ++ || ((elf_section_flags (out) ^ elf_section_flags (in)) ++ & SHF_EXCLUDE) != 0)) + return FALSE; + return _bfd_elf_match_sections_by_type (link_info.output_bfd, out, + in->owner, in); diff --git a/SOURCES/binutils-fix-testsuite-failures.patch b/SOURCES/binutils-fix-testsuite-failures.patch index d441a6c..34c1f87 100644 --- a/SOURCES/binutils-fix-testsuite-failures.patch +++ b/SOURCES/binutils-fix-testsuite-failures.patch @@ -753,3 +753,16 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.30/ld/tests run_cc_link_tests [list \ [list \ "Build plt-lib.so" \ +--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2019-12-02 10:22:47.019526080 +0000 ++++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2019-12-02 10:28:11.413354928 +0000 +@@ -33,8 +33,8 @@ global CFLAGS + global CXXFLAGS + set saved_CFLAGS "$CFLAGS" + set saved_CXXFLAGS "$CXXFLAGS" +-regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS +-regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS ++# regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS ++# regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS + + proc restore_notify { } { + global saved_CFLAGS diff --git a/SOURCES/binutils-improved-note-merging.patch b/SOURCES/binutils-improved-note-merging.patch new file mode 100644 index 0000000..3715e73 --- /dev/null +++ b/SOURCES/binutils-improved-note-merging.patch @@ -0,0 +1,2075 @@ +diff -rupN binutils.orig/binutils/objcopy.c binutils-2.30/binutils/objcopy.c +--- binutils.orig/binutils/objcopy.c 2019-10-28 17:08:43.352324932 +0000 ++++ binutils-2.30/binutils/objcopy.c 2019-10-28 17:20:26.378052081 +0000 +@@ -97,8 +97,14 @@ static int deterministic = -1; /* Enabl + static int status = 0; /* Exit status. */ + + static bfd_boolean merge_notes = FALSE; /* Merge note sections. */ +-static bfd_byte * merged_notes = NULL; /* Contents on note section undergoing a merge. */ +-static bfd_size_type merged_size = 0; /* New, smaller size of the merged note section. */ ++ ++typedef struct merged_note_section ++{ ++ asection * sec; /* The section that is being merged. */ ++ bfd_byte * contents;/* New contents of the section. */ ++ bfd_size_type size; /* New size of the section. */ ++ struct merged_note_section * next; /* Link to next merged note section. */ ++} merged_note_section; + + enum strip_action + { +@@ -1259,7 +1265,7 @@ is_update_section (bfd *abfd ATTRIBUTE_U + } + + static bfd_boolean +-is_merged_note_section (bfd * abfd, asection * sec) ++is_mergeable_note_section (bfd * abfd, asection * sec) + { + if (merge_notes + && bfd_get_flavour (abfd) == bfd_target_elf_flavour +@@ -1268,9 +1274,9 @@ is_merged_note_section (bfd * abfd, asec + We should add support for more note types. */ + && ((elf_section_data (sec)->this_hdr.sh_flags & SHF_GNU_BUILD_NOTE) != 0 + /* Old versions of GAS (prior to 2.27) could not set the section +- flags to OS-specific values, so we also accept sections with the +- expected name. */ +- || (strcmp (sec->name, GNU_BUILD_ATTRS_SECTION_NAME) == 0))) ++ flags to OS-specific values, so we also accept sections that ++ start with the expected name. */ ++ || (CONST_STRNEQ (sec->name, GNU_BUILD_ATTRS_SECTION_NAME)))) + return TRUE; + + return FALSE; +@@ -1893,56 +1899,81 @@ copy_unknown_object (bfd *ibfd, bfd *obf + return TRUE; + } + +-/* Returns the number of bytes needed to store VAL. */ +- +-static inline unsigned int +-num_bytes (unsigned long val) +-{ +- unsigned int count = 0; +- +- /* FIXME: There must be a faster way to do this. */ +- while (val) +- { +- count ++; +- val >>= 8; +- } +- return count; +-} +- + typedef struct objcopy_internal_note + { + Elf_Internal_Note note; ++ unsigned long padded_namesz; + bfd_vma start; + bfd_vma end; +- bfd_boolean modified; + } objcopy_internal_note; + +-/* Returns TRUE if a gap does, or could, exist between the address range +- covered by PNOTE1 and PNOTE2. */ ++#define DEBUG_MERGE 0 ++ ++#if DEBUG_MERGE ++#define merge_debug(format, ...) fprintf (stderr, format, ## __VA_ARGS__) ++#else ++#define merge_debug(format, ...) ++#endif ++ ++/* Returns TRUE iff PNOTE1 overlaps or adjoins PNOTE2. */ + + static bfd_boolean +-gap_exists (objcopy_internal_note * pnote1, +- objcopy_internal_note * pnote2) ++overlaps_or_adjoins (objcopy_internal_note * pnote1, ++ objcopy_internal_note * pnote2) + { +- /* Without range end notes, we assume that a gap might exist. */ +- if (pnote1->end == 0 || pnote2->end == 0) ++ if (pnote1->end < pnote2->start) ++ /* FIXME: Alignment of 16 bytes taken from x86_64 binaries. ++ Really we should extract the alignment of the section ++ covered by the notes. */ ++ return BFD_ALIGN (pnote1->end, 16) < pnote2->start; ++ ++ if (pnote2->end < pnote2->start) ++ return BFD_ALIGN (pnote2->end, 16) < pnote1->start; ++ ++ if (pnote1->end < pnote2->end) + return TRUE; + +- /* FIXME: Alignment of 16 bytes taken from x86_64 binaries. +- Really we should extract the alignment of the section covered by the notes. */ +- return BFD_ALIGN (pnote1->end, 16) < pnote2->start; ++ if (pnote2->end < pnote1->end) ++ return TRUE; ++ ++ return FALSE; ++} ++ ++/* Returns TRUE iff NEEDLE is fully contained by HAYSTACK. */ ++ ++static bfd_boolean ++contained_by (objcopy_internal_note * needle, ++ objcopy_internal_note * haystack) ++{ ++ return needle->start >= haystack->start && needle->end <= haystack->end; + } + + static bfd_boolean + is_open_note (objcopy_internal_note * pnote) + { +- return (pnote->note.type == NT_GNU_BUILD_ATTRIBUTE_OPEN); ++ return pnote->note.type == NT_GNU_BUILD_ATTRIBUTE_OPEN; + } + + static bfd_boolean + is_func_note (objcopy_internal_note * pnote) + { +- return (pnote->note.type == NT_GNU_BUILD_ATTRIBUTE_FUNC); ++ return pnote->note.type == NT_GNU_BUILD_ATTRIBUTE_FUNC; ++} ++ ++static bfd_boolean ++is_deleted_note (objcopy_internal_note * pnote) ++{ ++ return pnote->note.type == 0; ++} ++ ++static bfd_boolean ++is_version_note (objcopy_internal_note * pnote) ++{ ++ return (pnote->note.namesz > 4 ++ && pnote->note.namedata[0] == 'G' ++ && pnote->note.namedata[1] == 'A' ++ && pnote->note.namedata[2] == '$' ++ && pnote->note.namedata[3] == GNU_BUILD_ATTRIBUTE_VERSION); + } + + static bfd_boolean +@@ -1955,11 +1986,97 @@ is_64bit (bfd * abfd) + return elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64; + } + ++/* This sorting function is used to get the notes into an order ++ that makes merging easy. */ ++ ++static int ++compare_gnu_build_notes (const void * data1, const void * data2) ++{ ++ objcopy_internal_note * pnote1 = (objcopy_internal_note *) data1; ++ objcopy_internal_note * pnote2 = (objcopy_internal_note *) data2; ++ ++ /* Sort notes based upon the attribute they record. */ ++ int cmp = memcmp (pnote1->note.namedata + 3, ++ pnote2->note.namedata + 3, ++ pnote1->note.namesz < pnote2->note.namesz ? ++ pnote1->note.namesz - 3 : pnote2->note.namesz - 3); ++ if (cmp) ++ return cmp; ++ ++ if (pnote1->end < pnote2->start) ++ return -1; ++ if (pnote1->start > pnote2->end) ++ return 1; ++ ++ /* Overlaps - we should merge the two ranges. */ ++ if (pnote1->start < pnote2->start) ++ return -1; ++ if (pnote1->end > pnote2->end) ++ return 1; ++ ++ /* Put OPEN notes before function notes. */ ++ if (is_open_note (pnote1) && ! is_open_note (pnote2)) ++ return -1; ++ if (! is_open_note (pnote1) && is_open_note (pnote2)) ++ return 1; ++ ++ return 0; ++} ++ ++/* This sorting function is used to get the notes into an order ++ that makes eliminating address ranges easier. */ ++ ++static int ++sort_gnu_build_notes (const void * data1, const void * data2) ++{ ++ objcopy_internal_note * pnote1 = (objcopy_internal_note *) data1; ++ objcopy_internal_note * pnote2 = (objcopy_internal_note *) data2; ++ ++ if (pnote1->note.type != pnote2->note.type) ++ { ++ /* Move deleted notes to the end. */ ++ if (is_deleted_note (pnote1)) /* 1: OFD 2: OFD */ ++ return 1; ++ ++ /* Move OPEN notes to the start. */ ++ if (is_open_note (pnote1)) /* 1: OF 2: OFD */ ++ return -1; ++ ++ if (is_deleted_note (pnote2)) /* 1: F 2: O D */ ++ return 1; ++ ++ return 1; /* 1: F 2: O */ ++ } ++ ++ /* Sort by starting address. */ ++ if (pnote1->start < pnote2->start) ++ return -1; ++ if (pnote1->start > pnote2->start) ++ return 1; ++ ++ /* Then by end address (bigger range first). */ ++ if (pnote1->end > pnote2->end) ++ return -1; ++ if (pnote1->end < pnote2->end) ++ return 1; ++ ++ /* Then by attribute type. */ ++ if (pnote1->note.namesz > 4 ++ && pnote2->note.namesz > 4 ++ && pnote1->note.namedata[3] != pnote2->note.namedata[3]) ++ return pnote1->note.namedata[3] - pnote2->note.namedata[3]; ++ ++ return 0; ++} ++ + /* Merge the notes on SEC, removing redundant entries. + Returns the new, smaller size of the section upon success. */ + + static bfd_size_type +-merge_gnu_build_notes (bfd * abfd, asection * sec, bfd_size_type size, bfd_byte * contents) ++merge_gnu_build_notes (bfd * abfd, ++ asection * sec, ++ bfd_size_type size, ++ bfd_byte * contents) + { + objcopy_internal_note * pnotes_end; + objcopy_internal_note * pnotes = NULL; +@@ -1968,18 +2085,14 @@ merge_gnu_build_notes (bfd * abfd, asect + unsigned version_1_seen = 0; + unsigned version_2_seen = 0; + unsigned version_3_seen = 0; +- bfd_boolean duplicate_found = FALSE; + const char * err = NULL; + bfd_byte * in = contents; +- int attribute_type_byte; +- int val_start; + unsigned long previous_func_start = 0; + unsigned long previous_open_start = 0; + unsigned long previous_func_end = 0; + unsigned long previous_open_end = 0; + long relsize; + +- + relsize = bfd_get_reloc_upper_bound (abfd, sec); + if (relsize > 0) + { +@@ -1992,19 +2105,33 @@ merge_gnu_build_notes (bfd * abfd, asect + relcount = bfd_canonicalize_reloc (abfd, sec, relpp, isympp); + free (relpp); + if (relcount != 0) +- goto done; ++ { ++ if (! is_strip) ++ non_fatal (_("%s[%s]: Cannot merge - there are relocations against this section"), ++ bfd_get_filename (abfd), bfd_section_name (abfd, sec)); ++ goto done; ++ } + } + + /* Make a copy of the notes and convert to our internal format. +- Minimum size of a note is 12 bytes. */ +- pnote = pnotes = (objcopy_internal_note *) xcalloc ((size / 12), sizeof (* pnote)); ++ Minimum size of a note is 12 bytes. Also locate the version ++ notes and check them. */ ++ pnote = pnotes = (objcopy_internal_note *) ++ xcalloc ((size / 12), sizeof (* pnote)); + while (remain >= 12) + { + bfd_vma start, end; + +- pnote->note.namesz = (bfd_get_32 (abfd, in ) + 3) & ~3; +- pnote->note.descsz = (bfd_get_32 (abfd, in + 4) + 3) & ~3; +- pnote->note.type = bfd_get_32 (abfd, in + 8); ++ pnote->note.namesz = bfd_get_32 (abfd, in); ++ pnote->note.descsz = bfd_get_32 (abfd, in + 4); ++ pnote->note.type = bfd_get_32 (abfd, in + 8); ++ pnote->padded_namesz = (pnote->note.namesz + 3) & ~3; ++ ++ if (((pnote->note.descsz + 3) & ~3) != pnote->note.descsz) ++ { ++ err = _("corrupt GNU build attribute note: description size not a factor of 4"); ++ goto done; ++ } + + if (pnote->note.type != NT_GNU_BUILD_ATTRIBUTE_OPEN + && pnote->note.type != NT_GNU_BUILD_ATTRIBUTE_FUNC) +@@ -2013,7 +2140,7 @@ merge_gnu_build_notes (bfd * abfd, asect + goto done; + } + +- if (pnote->note.namesz + pnote->note.descsz + 12 > remain) ++ if (pnote->padded_namesz + pnote->note.descsz + 12 > remain) + { + err = _("corrupt GNU build attribute note: note too big"); + goto done; +@@ -2026,21 +2153,17 @@ merge_gnu_build_notes (bfd * abfd, asect + } + + pnote->note.namedata = (char *)(in + 12); +- pnote->note.descdata = (char *)(in + 12 + pnote->note.namesz); ++ pnote->note.descdata = (char *)(in + 12 + pnote->padded_namesz); + +- remain -= 12 + pnote->note.namesz + pnote->note.descsz; +- in += 12 + pnote->note.namesz + pnote->note.descsz; ++ remain -= 12 + pnote->padded_namesz + pnote->note.descsz; ++ in += 12 + pnote->padded_namesz + pnote->note.descsz; + + if (pnote->note.namesz > 2 + && pnote->note.namedata[0] == '$' + && pnote->note.namedata[1] == GNU_BUILD_ATTRIBUTE_VERSION + && pnote->note.namedata[2] == '1') + ++ version_1_seen; +- else if (pnote->note.namesz > 4 +- && pnote->note.namedata[0] == 'G' +- && pnote->note.namedata[1] == 'A' +- && pnote->note.namedata[2] == '$' +- && pnote->note.namedata[3] == GNU_BUILD_ATTRIBUTE_VERSION) ++ else if (is_version_note (pnote)) + { + if (pnote->note.namedata[4] == '2') + ++ version_2_seen; +@@ -2146,11 +2269,18 @@ merge_gnu_build_notes (bfd * abfd, asect + + if (version_1_seen == 0 && version_2_seen == 0 && version_3_seen == 0) + { ++#if 0 + err = _("bad GNU build attribute notes: no known versions detected"); + goto done; ++#else ++ /* This happens with glibc. No idea why. */ ++ non_fatal (_("%s[%s]: Warning: version note missing - assuming version 3"), ++ bfd_get_filename (abfd), bfd_section_name (abfd, sec)); ++ version_3_seen = 2; ++#endif + } + +- if ((version_1_seen > 0 && version_2_seen > 0) ++ if ( (version_1_seen > 0 && version_2_seen > 0) + || (version_1_seen > 0 && version_3_seen > 0) + || (version_2_seen > 0 && version_3_seen > 0)) + { +@@ -2158,271 +2288,215 @@ merge_gnu_build_notes (bfd * abfd, asect + goto done; + } + +- /* Merging is only needed if there is more than one version note... */ +- if (version_1_seen == 1 || version_2_seen == 1 || version_3_seen == 1) +- goto done; +- +- attribute_type_byte = version_1_seen ? 1 : 3; +- val_start = attribute_type_byte + 1; +- +- /* The first note should be the first version note. */ +- if (pnotes[0].note.namedata[attribute_type_byte] != GNU_BUILD_ATTRIBUTE_VERSION) ++ /* We are now only supporting the merging v3+ notes ++ - it makes things much simpler. */ ++ if (version_3_seen == 0) + { +- err = _("bad GNU build attribute notes: first note not version note"); ++ merge_debug ("%s: skipping merge - not using v3 notes", bfd_section_name (sec)); + goto done; + } + ++ merge_debug ("Merging section %s which contains %ld notes\n", ++ sec->name, pnotes_end - pnotes); ++ ++ /* Sort the notes. */ ++ qsort (pnotes, pnotes_end - pnotes, sizeof (* pnotes), ++ compare_gnu_build_notes); ++ ++#if DEBUG_MERGE ++ merge_debug ("Results of initial sort:\n"); ++ for (pnote = pnotes; pnote < pnotes_end; pnote ++) ++ merge_debug ("offset %#08lx range %#08lx..%#08lx type %ld attribute %d namesz %ld\n", ++ (pnote->note.namedata - (char *) contents) - 12, ++ pnote->start, pnote->end, ++ pnote->note.type, ++ pnote->note.namedata[3], ++ pnote->note.namesz ++ ); ++#endif ++ + /* Now merge the notes. The rules are: +- 1. Preserve the ordering of the notes. +- 2. Preserve any NT_GNU_BUILD_ATTRIBUTE_FUNC notes. +- 3. Eliminate any NT_GNU_BUILD_ATTRIBUTE_OPEN notes that have the same +- full name field as the immediately preceeding note with the same type +- of name and whose address ranges coincide. +- IE - if there are gaps in the coverage of the notes, then these gaps +- must be preserved. +- 4. Combine the numeric value of any NT_GNU_BUILD_ATTRIBUTE_OPEN notes +- of type GNU_BUILD_ATTRIBUTE_STACK_SIZE. +- 5. If an NT_GNU_BUILD_ATTRIBUTE_OPEN note is going to be preserved and +- its description field is empty then the nearest preceeding OPEN note +- with a non-empty description field must also be preserved *OR* the +- description field of the note must be changed to contain the starting +- address to which it refers. +- 6. Notes with the same start and end address can be deleted. */ ++ 1. If a note has a zero range, it can be eliminated. ++ 2. If two notes have the same namedata then: ++ 2a. If one note's range is fully covered by the other note ++ then it can be deleted. ++ 2b. If one note's range partially overlaps or adjoins the ++ other note then if they are both of the same type (open ++ or func) then they can be merged and one deleted. If ++ they are of different types then they cannot be merged. */ + for (pnote = pnotes + 1; pnote < pnotes_end; pnote ++) + { +- int note_type; +- objcopy_internal_note * back; +- objcopy_internal_note * prev_open_with_range = NULL; ++ /* Skip already deleted notes. ++ FIXME: Can this happen ? We are scanning forwards and ++ deleting backwards after all. */ ++ if (is_deleted_note (pnote)) ++ continue; + +- /* Rule 6 - delete 0-range notes. */ ++ /* Rule 1 - delete 0-range notes. */ + if (pnote->start == pnote->end) + { +- duplicate_found = TRUE; ++ merge_debug ("Delete note at offset %#08lx - empty range\n", ++ (pnote->note.namedata - (char *) contents) - 12); + pnote->note.type = 0; + continue; + } + +- /* Rule 2 - preserve function notes. */ +- if (! is_open_note (pnote)) +- { +- int iter; +- +- /* Check to see if there is an identical previous function note. +- This can happen with overlays for example. */ +- for (iter = 0, back = pnote -1; back >= pnotes; back --) +- { +- if (back->start == pnote->start +- && back->end == pnote->end +- && back->note.namesz == pnote->note.namesz +- && memcmp (back->note.namedata, pnote->note.namedata, pnote->note.namesz) == 0) +- { +- duplicate_found = TRUE; +- pnote->note.type = 0; +- break; +- } +- +- /* Don't scan too far back however. */ +- if (iter ++ > 16) +- break; +- } +- continue; +- } +- +- note_type = pnote->note.namedata[attribute_type_byte]; +- +- /* Scan backwards from pnote, looking for duplicates. +- Clear the type field of any found - but do not delete them just yet. */ +- for (back = pnote - 1; back >= pnotes; back --) +- { +- int back_type = back->note.namedata[attribute_type_byte]; +- +- /* If this is the first open note with an address +- range that we have encountered then record it. */ +- if (prev_open_with_range == NULL +- && back->note.descsz > 0 +- && ! is_func_note (back)) +- prev_open_with_range = back; +- +- if (! is_open_note (back)) +- continue; ++ int iter; ++ objcopy_internal_note * back; + +- /* If the two notes are different then keep on searching. */ +- if (back_type != note_type) ++ /* Rule 2: Check to see if there is an identical previous note. */ ++ for (iter = 0, back = pnote - 1; back >= pnotes; back --) ++ { ++ if (is_deleted_note (back)) + continue; + +- /* Rule 4 - combine stack size notes. */ +- if (back_type == GNU_BUILD_ATTRIBUTE_STACK_SIZE) ++ /* Our sorting function should have placed all identically ++ attributed notes together, so if we see a note of a different ++ attribute type stop searching. */ ++ if (back->note.namesz != pnote->note.namesz ++ || memcmp (back->note.namedata, ++ pnote->note.namedata, pnote->note.namesz) != 0) ++ break; ++ ++ if (back->start == pnote->start ++ && back->end == pnote->end) + { +- unsigned char * name; +- unsigned long note_val; +- unsigned long back_val; +- unsigned int shift; +- unsigned int bytes; +- unsigned long byte; +- +- for (shift = 0, note_val = 0, +- bytes = pnote->note.namesz - val_start, +- name = (unsigned char *) pnote->note.namedata + val_start; +- bytes--;) +- { +- byte = (* name ++) & 0xff; +- note_val |= byte << shift; +- shift += 8; +- } +- +- for (shift = 0, back_val = 0, +- bytes = back->note.namesz - val_start, +- name = (unsigned char *) back->note.namedata + val_start; +- bytes--;) +- { +- byte = (* name ++) & 0xff; +- back_val |= byte << shift; +- shift += 8; +- } +- +- back_val += note_val; +- if (num_bytes (back_val) >= back->note.namesz - val_start) +- { +- /* We have a problem - the new value requires more bytes of +- storage in the name field than are available. Currently +- we have no way of fixing this, so we just preserve both +- notes. */ +- continue; +- } +- +- /* Write the new val into back. */ +- name = (unsigned char *) back->note.namedata + val_start; +- while (name < (unsigned char *) back->note.namedata +- + back->note.namesz) +- { +- byte = back_val & 0xff; +- * name ++ = byte; +- if (back_val == 0) +- break; +- back_val >>= 8; +- } +- +- duplicate_found = TRUE; ++ merge_debug ("Delete note at offset %#08lx - duplicate of note at offset %#08lx\n", ++ (pnote->note.namedata - (char *) contents) - 12, ++ (back->note.namedata - (char *) contents) - 12); + pnote->note.type = 0; + break; + } + +- /* Rule 3 - combine identical open notes. */ +- if (back->note.namesz == pnote->note.namesz +- && memcmp (back->note.namedata, +- pnote->note.namedata, back->note.namesz) == 0 +- && ! gap_exists (back, pnote)) ++ /* Rule 2a. */ ++ if (contained_by (pnote, back)) + { +- duplicate_found = TRUE; ++ merge_debug ("Delete note at offset %#08lx - fully contained by note at %#08lx\n", ++ (pnote->note.namedata - (char *) contents) - 12, ++ (back->note.namedata - (char *) contents) - 12); + pnote->note.type = 0; ++ break; ++ } + +- if (pnote->end > back->end) +- back->end = pnote->end; ++#if DEBUG_MERGE ++ /* This should not happen as we have sorted the ++ notes with earlier starting addresses first. */ ++ if (contained_by (back, pnote)) ++ merge_debug ("ERROR: UNEXPECTED CONTAINMENT\n"); ++#endif ++ ++ /* Rule 2b. */ ++ if (overlaps_or_adjoins (back, pnote) ++ && is_func_note (back) == is_func_note (pnote)) ++ { ++ merge_debug ("Delete note at offset %#08lx - merge into note at %#08lx\n", ++ (pnote->note.namedata - (char *) contents) - 12, ++ (back->note.namedata - (char *) contents) - 12); + +- if (version_3_seen) +- back->modified = TRUE; ++ back->end = back->end > pnote->end ? back->end : pnote->end; ++ back->start = back->start < pnote->start ? back->start : pnote->start; ++ pnote->note.type = 0; + break; + } + +- /* Rule 5 - Since we are keeping this note we must check to see +- if its description refers back to an earlier OPEN version +- note that has been scheduled for deletion. If so then we +- must make sure that version note is also preserved. */ +- if (version_3_seen) +- { +- /* As of version 3 we can just +- move the range into the note. */ +- pnote->modified = TRUE; +- pnote->note.type = NT_GNU_BUILD_ATTRIBUTE_FUNC; +- back->modified = TRUE; +- back->note.type = NT_GNU_BUILD_ATTRIBUTE_FUNC; +- } +- else ++ /* Don't scan too far back however. */ ++ if (iter ++ > 16) + { +- if (pnote->note.descsz == 0 +- && prev_open_with_range != NULL +- && prev_open_with_range->note.type == 0) +- prev_open_with_range->note.type = NT_GNU_BUILD_ATTRIBUTE_OPEN; ++ /* FIXME: Not sure if this can ever be triggered. */ ++ merge_debug ("ITERATION LIMIT REACHED\n"); ++ break; + } +- +- /* We have found a similar attribute but the details do not match. +- Stop searching backwards. */ +- break; + } +- } +- +- if (duplicate_found) +- { +- bfd_byte * new_contents; +- bfd_byte * old; +- bfd_byte * new; +- bfd_size_type new_size; +- bfd_vma prev_start = 0; +- bfd_vma prev_end = 0; +- +- /* Eliminate the duplicates. */ +- new = new_contents = xmalloc (size); +- for (pnote = pnotes, old = contents; +- pnote < pnotes_end; +- pnote ++) +- { +- bfd_size_type note_size = 12 + pnote->note.namesz + pnote->note.descsz; +- +- if (pnote->note.type != 0) ++#if DEBUG_MERGE ++ if (! is_deleted_note (pnote)) ++ merge_debug ("Unable to do anything with note at %#08lx\n", ++ (pnote->note.namedata - (char *) contents) - 12); ++#endif ++ } ++ ++ /* Resort the notes. */ ++ merge_debug ("Final sorting of notes\n"); ++ qsort (pnotes, pnotes_end - pnotes, sizeof (* pnotes), sort_gnu_build_notes); ++ ++ /* Reconstruct the ELF notes. */ ++ bfd_byte * new_contents; ++ bfd_byte * old; ++ bfd_byte * new; ++ bfd_size_type new_size; ++ bfd_vma prev_start = 0; ++ bfd_vma prev_end = 0; ++ ++ new = new_contents = xmalloc (size); ++ for (pnote = pnotes, old = contents; ++ pnote < pnotes_end; ++ pnote ++) ++ { ++ bfd_size_type note_size = 12 + pnote->padded_namesz + pnote->note.descsz; ++ ++ if (! is_deleted_note (pnote)) ++ { ++ /* Create the note, potentially using the ++ address range of the previous note. */ ++ if (pnote->start == prev_start && pnote->end == prev_end) ++ { ++ bfd_put_32 (abfd, pnote->note.namesz, new); ++ bfd_put_32 (abfd, 0, new + 4); ++ bfd_put_32 (abfd, pnote->note.type, new + 8); ++ new += 12; ++ memcpy (new, pnote->note.namedata, pnote->note.namesz); ++ if (pnote->note.namesz < pnote->padded_namesz) ++ memset (new + pnote->note.namesz, 0, pnote->padded_namesz - pnote->note.namesz); ++ new += pnote->padded_namesz; ++ } ++ else + { +- if (pnote->modified) ++ bfd_put_32 (abfd, pnote->note.namesz, new); ++ bfd_put_32 (abfd, is_64bit (abfd) ? 16 : 8, new + 4); ++ bfd_put_32 (abfd, pnote->note.type, new + 8); ++ new += 12; ++ memcpy (new, pnote->note.namedata, pnote->note.namesz); ++ if (pnote->note.namesz < pnote->padded_namesz) ++ memset (new + pnote->note.namesz, 0, pnote->padded_namesz - pnote->note.namesz); ++ new += pnote->padded_namesz; ++ if (is_64bit (abfd)) + { +- /* If the note has been modified then we must copy it by +- hand, potentially adding in a new description field. */ +- if (pnote->start == prev_start && pnote->end == prev_end) +- { +- bfd_put_32 (abfd, pnote->note.namesz, new); +- bfd_put_32 (abfd, 0, new + 4); +- bfd_put_32 (abfd, pnote->note.type, new + 8); +- new += 12; +- memcpy (new, pnote->note.namedata, pnote->note.namesz); +- new += pnote->note.namesz; +- } +- else +- { +- bfd_put_32 (abfd, pnote->note.namesz, new); +- bfd_put_32 (abfd, is_64bit (abfd) ? 16 : 8, new + 4); +- bfd_put_32 (abfd, pnote->note.type, new + 8); +- new += 12; +- memcpy (new, pnote->note.namedata, pnote->note.namesz); +- new += pnote->note.namesz; +- if (is_64bit (abfd)) +- { +- bfd_put_64 (abfd, pnote->start, new); +- bfd_put_64 (abfd, pnote->end, new + 8); +- new += 16; +- } +- else +- { +- bfd_put_32 (abfd, pnote->start, new); +- bfd_put_32 (abfd, pnote->end, new + 4); +- new += 8; +- } +- } ++ bfd_put_64 (abfd, pnote->start, new); ++ bfd_put_64 (abfd, pnote->end, new + 8); ++ new += 16; + } + else + { +- memcpy (new, old, note_size); +- new += note_size; ++ bfd_put_32 (abfd, pnote->start, new); ++ bfd_put_32 (abfd, pnote->end, new + 4); ++ new += 8; + } ++ + prev_start = pnote->start; + prev_end = pnote->end; + } +- +- old += note_size; + } + +- new_size = new - new_contents; +- memcpy (contents, new_contents, new_size); +- size = new_size; +- free (new_contents); ++ old += note_size; + } + ++#if DEBUG_MERGE ++ merge_debug ("Results of merge:\n"); ++ for (pnote = pnotes; pnote < pnotes_end; pnote ++) ++ if (! is_deleted_note (pnote)) ++ merge_debug ("offset %#08lx range %#08lx..%#08lx type %ld attribute %d namesz %ld\n", ++ (pnote->note.namedata - (char *) contents) - 12, ++ pnote->start, pnote->end, ++ pnote->note.type, ++ pnote->note.namedata[3], ++ pnote->note.namesz ++ ); ++#endif ++ ++ new_size = new - new_contents; ++ memcpy (contents, new_contents, new_size); ++ size = new_size; ++ free (new_contents); ++ + done: + if (err) + { +@@ -2761,52 +2835,61 @@ copy_object (bfd *ibfd, bfd *obfd, const + } + } + ++ merged_note_section * merged_note_sections = NULL; + if (merge_notes) + { + /* This palaver is necessary because we must set the output + section size first, before its contents are ready. */ +- osec = bfd_get_section_by_name (ibfd, GNU_BUILD_ATTRS_SECTION_NAME); +- if (osec && is_merged_note_section (ibfd, osec)) ++ for (osec = ibfd->sections; osec != NULL; osec = osec->next) + { +- bfd_size_type size; +- +- size = bfd_get_section_size (osec); ++ if (! is_mergeable_note_section (ibfd, osec)) ++ continue; ++ ++ bfd_size_type size = bfd_section_size (obfd, osec); + if (size == 0) + { +- bfd_nonfatal_message (NULL, ibfd, osec, _("warning: note section is empty")); +- merge_notes = FALSE; ++ bfd_nonfatal_message (NULL, ibfd, osec, ++ _("warning: note section is empty")); ++ continue; + } +- else if (! bfd_get_full_section_contents (ibfd, osec, & merged_notes)) ++ ++ merged_note_section * merged = xmalloc (sizeof * merged); ++ merged->contents = NULL; ++ if (! bfd_get_full_section_contents (ibfd, osec, & merged->contents)) + { +- bfd_nonfatal_message (NULL, ibfd, osec, _("warning: could not load note section")); +- free (merged_notes); +- merged_notes = NULL; +- merge_notes = FALSE; ++ bfd_nonfatal_message (NULL, ibfd, osec, ++ _("warning: could not load note section")); ++ free (merged->contents); ++ free (merged); ++ continue; + } +- else ++ ++ merged->size = merge_gnu_build_notes (ibfd, osec, size, ++ merged->contents); ++ if (merged->size == size) ++ { ++ /* Merging achieves nothing. */ ++ merge_debug ("Merge of section %s achieved nothing - skipping\n", ++ bfd_section_name (obfd, osec)); ++ free (merged->contents); ++ free (merged); ++ continue; ++ } ++ ++ if (osec->output_section == NULL ++ || !bfd_set_section_size (obfd, osec->output_section, merged->size)) + { +- merged_size = merge_gnu_build_notes (ibfd, osec, size, merged_notes); +- if (merged_size == size) +- { +- /* Merging achieves nothing. */ +- free (merged_notes); +- merged_notes = NULL; +- merge_notes = FALSE; +- merged_size = 0; +- } +- else +- { +- if (osec->output_section == NULL +- || ! bfd_set_section_size (obfd, osec->output_section, merged_size)) +- { +- bfd_nonfatal_message (NULL, obfd, osec, _("warning: failed to set merged notes size")); +- free (merged_notes); +- merged_notes = NULL; +- merge_notes = FALSE; +- merged_size = 0; +- } +- } ++ bfd_nonfatal_message (NULL, obfd, osec, ++ _("warning: failed to set merged notes size")); ++ free (merged->contents); ++ free (merged); ++ continue; + } ++ ++ /* Add section to list of merged sections. */ ++ merged->sec = osec; ++ merged->next = merged_note_sections; ++ merged_note_sections = merged; + } + } + +@@ -3134,25 +3217,72 @@ copy_object (bfd *ibfd, bfd *obfd, const + } + } + +- if (merge_notes) ++ if (merged_note_sections != NULL) + { +- osec = bfd_get_section_by_name (obfd, GNU_BUILD_ATTRS_SECTION_NAME); +- if (osec && is_merged_note_section (obfd, osec)) ++ merged_note_section * merged = NULL; ++ ++ for (osec = obfd->sections; osec != NULL; osec = osec->next) + { +- if (! bfd_set_section_contents (obfd, osec, merged_notes, 0, merged_size)) ++ if (! is_mergeable_note_section (obfd, osec)) ++ continue; ++ ++ if (merged == NULL) ++ merged = merged_note_sections; ++ ++ /* It is likely that output sections are in the same order ++ as the input sections, but do not assume that this is ++ the case. */ ++ if (strcmp (bfd_section_name (obfd, merged->sec), ++ bfd_section_name (obfd, osec)) != 0) ++ { ++ for (merged = merged_note_sections; ++ merged != NULL; ++ merged = merged->next) ++ if (strcmp (bfd_section_name (obfd, merged->sec), ++ bfd_section_name (obfd, osec)) == 0) ++ break; ++ ++ if (merged == NULL) ++ { ++ bfd_nonfatal_message ++ (NULL, obfd, osec, ++ _("error: failed to copy merged notes into output")); ++ continue; ++ } ++ } ++ ++ if (! is_mergeable_note_section (obfd, osec)) + { +- bfd_nonfatal_message (NULL, obfd, osec, _("error: failed to copy merged notes into output")); +- /* There is a potential resource leak here, but it is not important. */ +- /* coverity[leaked_storage: FALSE] */ ++ bfd_nonfatal_message ++ (NULL, obfd, osec, ++ _("error: failed to copy merged notes into output")); ++ continue; ++ } ++ ++ if (! bfd_set_section_contents (obfd, osec, merged->contents, 0, ++ merged->size)) ++ { ++ bfd_nonfatal_message ++ (NULL, obfd, osec, ++ _("error: failed to copy merged notes into output")); + return FALSE; + } ++ ++ merged = merged->next; ++ } ++ ++ /* Free the memory. */ ++ merged_note_section * next; ++ for (merged = merged_note_sections; merged != NULL; merged = next) ++ { ++ next = merged->next; ++ free (merged->contents); ++ free (merged); + } +- else if (! is_strip) +- bfd_nonfatal_message (NULL, obfd, osec, _("could not find any mergeable note sections")); +- free (merged_notes); +- merged_notes = NULL; +- merge_notes = FALSE; + } ++ else if (merge_notes && ! is_strip) ++ non_fatal (_("%s: Could not find any mergeable note sections"), ++ bfd_get_filename (ibfd)); + + if (gnu_debuglink_filename != NULL) + { +@@ -3915,7 +4045,7 @@ skip_section (bfd *ibfd, sec_ptr isectio + + /* When merging a note section we skip the copying of the contents, + but not the copying of the relocs associated with the contents. */ +- if (skip_copy && is_merged_note_section (ibfd, isection)) ++ if (skip_copy && is_mergeable_note_section (ibfd, isection)) + return TRUE; + + flags = bfd_get_section_flags (ibfd, isection); +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-2-32.d binutils-2.30/binutils/testsuite/binutils-all/note-2-32.d +--- binutils.orig/binutils/testsuite/binutils-all/note-2-32.d 2019-10-28 17:08:43.358324887 +0000 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-2-32.d 2019-10-28 17:16:57.804615900 +0000 +@@ -5,13 +5,12 @@ + #source: note-2-32.s + + #... +- Owner Data size Description +-[ ]+\$1[ ]+0x00000004[ ]+OPEN[ ]+Applies to region from 0x100 \(note1.s\) +-[ ]+\$gcc 7.0.1[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 +-[ ]+\+true[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 +-[ ]+\*static[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 +-[ ]+\*0x0[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 +-[ ]+\$1[ ]+0x00000004[ ]+OPEN[ ]+Applies to region from 0x104 \(note2.s\) +-[ ]+!false[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x104 +-[ ]+\*pic[ ]+0x00000004[ ]+func[ ]+Applies to region from 0x104 \(func1\) ++[ ]+Owner[ ]+Data size[ ]+Description ++[ ]+GA\$3p1[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x100 to 0x10b \(note1.s\) ++[ ]+GA\$gcc 7.0.1[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x10b ++[ ]+GA\*0x0[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x100 to 0x108 \(note1.s\) ++[ ]+GA\+true[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x100 to 0x104 \(note1.s\) ++[ ]+GA\*static[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x104 ++[ ]+GA!false[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x104 to 0x108 \(note2.s\) ++[ ]+GA\*pic[ ]+0x00000008[ ]+func[ ]+Applies to region from 0x104 to 0x106 \(func1\) + #... +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-2-32.s binutils-2.30/binutils/testsuite/binutils-all/note-2-32.s +--- binutils.orig/binutils/testsuite/binutils-all/note-2-32.s 2019-10-28 17:08:43.355324910 +0000 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-2-32.s 2019-10-28 17:09:04.609165478 +0000 +@@ -6,32 +6,37 @@ note1.s: + + .pushsection .gnu.build.attributes, "0x100000", %note + .balign 4 +- .dc.l 4 +- .dc.l 4 ++ .dc.l 8 ++ .dc.l 8 + .dc.l 0x100 +- .asciz "$1" ++ .asciz "GA$3p1" + .dc.l 0x100 ++ .dc.l 0x104 + +- .dc.l 12 ++ .dc.l 14 + .dc.l 0 + .dc.l 0x100 +- .asciz "$gcc 7.0.1" ++ .asciz "GA$gcc 7.0.1" ++ .dc.b 0,0 + +- .dc.l 3 ++ .dc.l 5 + .dc.l 0 + .dc.l 0x100 +- .dc.b 0x2b, 0x2, 0 +- .dc.b 0 ++ .dc.b 0x47, 0x41, 0x2b, 0x2, 0 ++ .dc.b 0,0,0 + +- .dc.l 4 ++ .dc.l 6 + .dc.l 0 + .dc.l 0x100 +- .dc.b 0x2a, 0x7, 0, 0 ++ .dc.b 0x47, 0x41, 0x2a, 0x7, 0, 0 ++ .dc.b 0,0 + +- .dc.l 4 ++ .dc.l 6 + .dc.l 0 + .dc.l 0x100 +- .dc.b 0x2a, 0x6, 0, 0 ++ .dc.b 0x47, 0x41, 0x2a, 0x6, 0, 0 ++ .dc.b 0,0 ++ + .popsection + + +@@ -42,33 +47,38 @@ func1: + .dc.l 0x100 + + .pushsection .gnu.build.attributes, "0x100000", %note +- .dc.l 4 +- .dc.l 4 ++ .dc.l 8 ++ .dc.l 8 + .dc.l 0x100 +- .asciz "$1" ++ .asciz "GA$3p1" + .dc.l 0x104 +- +- .dc.l 12 ++ .dc.l 0x108 ++ ++ .dc.l 14 + .dc.l 0 + .dc.l 0x100 +- .asciz "$gcc 7.0.1" ++ .asciz "GA$gcc 7.0.1" ++ .dc.b 0,0 + +- .dc.l 3 ++ .dc.l 5 + .dc.l 0 + .dc.l 0x100 +- .dc.b 0x21, 0x2, 0 +- .dc.b 0 ++ .dc.b 0x47, 0x41, 0x21, 0x2, 0 ++ .dc.b 0,0,0 + +- .dc.l 4 +- .dc.l 4 ++ .dc.l 6 ++ .dc.l 8 + .dc.l 0x101 +- .dc.b 0x2a, 0x7, 1, 0 +- .dc.l 0x104 ++ .dc.b 0x47, 0x41, 0x2a, 0x7, 1, 0 ++ .dc.b 0,0 ++ .dc.l 0x104 ++ .dc.l 0x106 + +- .dc.l 4 ++ .dc.l 6 + .dc.l 0 + .dc.l 0x100 +- .dc.b 0x2a, 0x6, 0, 0 ++ .dc.b 0x47, 0x41, 0x2a, 0x6, 0, 0 ++ .dc.b 0,0 + .popsection + + +@@ -77,16 +87,18 @@ note3.s: + .dc.l 0x100 + + .pushsection .gnu.build.attributes, "0x100000", %note +- .dc.l 4 +- .dc.l 4 ++ .dc.l 8 ++ .dc.l 8 + .dc.l 0x100 +- .asciz "$1" ++ .asciz "GA$3p1" + .dc.l 0x108 ++ .dc.l 0x10b + +- .dc.l 12 ++ .dc.l 14 + .dc.l 0 + .dc.l 0x100 +- .asciz "$gcc 7.0.1" ++ .asciz "GA$gcc 7.0.1" ++ .dc.b 0,0 + + .popsection + +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-2-64.d binutils-2.30/binutils/testsuite/binutils-all/note-2-64.d +--- binutils.orig/binutils/testsuite/binutils-all/note-2-64.d 2019-10-28 17:08:43.356324902 +0000 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-2-64.d 2019-10-28 17:17:05.724556490 +0000 +@@ -3,19 +3,18 @@ + #objcopy: --merge-notes + #name: merge notes section (64-bits) + #source: note-2-64.s +-#not-target: sparc64-*-* ++#not-target: sparc64-*-* + # Internally the Sparc64 backend uses two relocs for every one reloc visible externally. + # Unfortunately the BFD library does not provide a target specific way to delete individual + # relocs, so the note merging feature fails. + + #... +- Owner Data size Description +-[ ]+\$1[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x100 \(note1.s\) +-[ ]+\$gcc 7.0.1[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 +-[ ]+\+true[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 +-[ ]+\*static[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 +-[ ]+\*0x0[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 +-[ ]+\$1[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x104 \(note2.s\) +-[ ]+!false[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x104 +-[ ]+\*pic[ ]+0x00000008[ ]+func[ ]+Applies to region from 0x104 \(func1\) ++[ ]+Owner[ ]+Data size[ ]+Description ++[ ]+GA\$3p1[ ]+0x00000010[ ]+OPEN[ ]+Applies to region from 0x100 to 0x10b \(note1.s\) ++[ ]+GA\$gcc 7.0.1[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x10b ++[ ]+GA\*0x0[ ]+0x00000010[ ]+OPEN[ ]+Applies to region from 0x100 to 0x108 \(note1.s\) ++[ ]+GA\+true[ ]+0x00000010[ ]+OPEN[ ]+Applies to region from 0x100 to 0x104 \(note1.s\) ++[ ]+GA\*static[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x104 ++[ ]+GA!false[ ]+0x00000010[ ]+OPEN[ ]+Applies to region from 0x104 to 0x108 \(note2.s\) ++[ ]+GA\*pic[ ]+0x00000010[ ]+func[ ]+Applies to region from 0x104 to 0x106 \(func1\) + #... +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-2-64.s binutils-2.30/binutils/testsuite/binutils-all/note-2-64.s +--- binutils.orig/binutils/testsuite/binutils-all/note-2-64.s 2019-10-28 17:08:43.354324917 +0000 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-2-64.s 2019-10-28 17:09:04.609165478 +0000 +@@ -6,32 +6,43 @@ note1.s: + + .pushsection .gnu.build.attributes, "0x100000", %note + .balign 4 +- .dc.l 4 + .dc.l 8 ++ .dc.l 16 + .dc.l 0x100 +- .asciz "$1" ++ .asciz "GA$3p1" + .8byte 0x100 ++ .8byte 0x104 + +- .dc.l 12 ++ .dc.l 14 + .dc.l 0 + .dc.l 0x100 +- .asciz "$gcc 7.0.1" ++ .asciz "GA$gcc 7.0.1" ++ .dc.b 0,0 ++ ++ .dc.l 5 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2b, 0x2, 0 ++ .dc.b 0,0,0 + +- .dc.l 3 ++ .dc.l 6 + .dc.l 0 + .dc.l 0x100 +- .dc.b 0x2b, 0x2, 0 +- .dc.b 0 ++ .dc.b 0x47, 0x41, 0x2a, 0x7, 0, 0 ++ .dc.b 0,0 + +- .dc.l 4 ++ .dc.l 6 + .dc.l 0 + .dc.l 0x100 +- .dc.b 0x2a, 0x7, 0, 0 ++ .dc.b 0x47, 0x41, 0x2a, 0x6, 0, 0 ++ .dc.b 0,0 + +- .dc.l 4 ++ .dc.l 6 + .dc.l 0 + .dc.l 0x100 +- .dc.b 0x2a, 0x6, 0, 0 ++ .dc.b 0x47, 0x41, 0x2a, 0x7, 0, 0 ++ .dc.b 0,0 ++ + .popsection + + +@@ -43,33 +54,38 @@ func1: + .dc.l 0x100 + + .pushsection .gnu.build.attributes, "0x100000", %note +- .dc.l 4 +- .dc.l 8 ++ .dc.l 8 ++ .dc.l 16 + .dc.l 0x100 +- .asciz "$1" ++ .asciz "GA$3p1" + .8byte 0x104 ++ .8byte 0x108 + +- .dc.l 12 ++ .dc.l 14 + .dc.l 0 + .dc.l 0x100 +- .asciz "$gcc 7.0.1" +- +- .dc.l 3 ++ .asciz "GA$gcc 7.0.1" ++ .dc.b 0,0 ++ ++ .dc.l 5 + .dc.l 0 + .dc.l 0x100 +- .dc.b 0x21, 0x2, 0 +- .dc.b 0 ++ .dc.b 0x47, 0x41, 0x21, 0x2, 0 ++ .dc.b 0,0,7 + +- .dc.l 4 +- .dc.l 8 ++ .dc.l 6 ++ .dc.l 16 + .dc.l 0x101 +- .dc.b 0x2a, 0x7, 1, 0 ++ .dc.b 0x47, 0x41, 0x2a, 0x7, 1, 0 ++ .dc.b 0,0 + .8byte 0x104 ++ .8byte 0x106 + +- .dc.l 4 ++ .dc.l 6 + .dc.l 0 + .dc.l 0x100 +- .dc.b 0x2a, 0x6, 0, 0 ++ .dc.b 0x47, 0x41, 0x2a, 0x6, 0, 0 ++ .dc.b 0,0 + .popsection + + +@@ -78,15 +94,17 @@ note3.s: + .dc.l 0x100 + + .pushsection .gnu.build.attributes, "0x100000", %note +- .dc.l 4 +- .dc.l 8 ++ .dc.l 8 ++ .dc.l 16 + .dc.l 0x100 +- .asciz "$1" ++ .asciz "GA$3p1" + .8byte 0x108 ++ .8byte 0x10b + +- .dc.l 12 ++ .dc.l 14 + .dc.l 0 + .dc.l 0x100 +- .asciz "$gcc 7.0.1" ++ .asciz "GA$gcc 7.0.1" ++ .dc.b 0,0 + + .popsection +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-3-32.d binutils-2.30/binutils/testsuite/binutils-all/note-3-32.d +--- binutils.orig/binutils/testsuite/binutils-all/note-3-32.d 2019-10-28 17:08:43.356324902 +0000 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-3-32.d 2019-10-28 17:09:04.609165478 +0000 +@@ -7,12 +7,12 @@ + #... + Displaying notes found in: .gnu.build.attributes + [ ]+Owner[ ]+Data size[ ]+Description +-[ ]+GA\$2p1[ ]+0x0000000.[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 \(note_1.s\) +-[ ]+GA\$gcc 6.3.1 20161221[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 +-[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 ++[ ]+GA\$3p1[ ]+0x0000000.[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 \(note_1.s\) + [ ]+GA\*off[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 +-[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 ++[ ]+GA\$gcc 6.3.1 20161221[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 ++[ ]+GA\*0x[0-9a-f]+[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 + [ ]+GA\*PIC[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 + [ ]+GA\!false[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 +-[ ]+GA\*0x[0-9a-f]+[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 ++[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 ++[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 + #... +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-3-32.s binutils-2.30/binutils/testsuite/binutils-all/note-3-32.s +--- binutils.orig/binutils/testsuite/binutils-all/note-3-32.s 2019-10-28 17:08:43.354324917 +0000 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-3-32.s 2019-10-28 17:09:04.609165478 +0000 +@@ -9,10 +9,11 @@ note_1.s: + .balign 4 + + .dc.l 8 +- .dc.l 4 ++ .dc.l 8 + .dc.l 0x100 +- .asciz "GA$2p1" +- .dc.l note_1.s ++ .asciz "GA$3p1" ++ .dc.l 0x100 /* note_1.s */ ++ .dc.l 0x122 /* note_1.s end */ + + .dc.l 23 + .dc.l 0 +@@ -55,4 +56,12 @@ note_1.s: + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 + .dc.b 0, 0, 0 ++ ++ .dc.l 5 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x21, 0x8, 0 ++ .dc.b 0, 0, 0 ++ ++ + .popsection +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-3-64.d binutils-2.30/binutils/testsuite/binutils-all/note-3-64.d +--- binutils.orig/binutils/testsuite/binutils-all/note-3-64.d 2019-10-28 17:08:43.357324895 +0000 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-3-64.d 2019-10-28 17:09:04.609165478 +0000 +@@ -7,12 +7,12 @@ + #... + Displaying notes found in: .gnu.build.attributes + [ ]+Owner[ ]+Data size[ ]+Description +-[ ]+GA\$2p1[ ]+0x0000000.[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 \(note_1.s\) +-[ ]+GA\$gcc 6.3.1 20161221[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 +-[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 ++[ ]+GA\$3p1[ ]+0x00000010[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 \(note_1.s\) + [ ]+GA\*off[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 +-[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 ++[ ]+GA\$gcc 6.3.1 20161221[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 ++[ ]+GA\*0x[0-9a-f]+[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 + [ ]+GA\*PIC[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 + [ ]+GA\!false[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 +-[ ]+GA\*0x[0-9a-f]+[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 ++[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 ++[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x122 + #... +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-3-64.s binutils-2.30/binutils/testsuite/binutils-all/note-3-64.s +--- binutils.orig/binutils/testsuite/binutils-all/note-3-64.s 2019-10-28 17:08:43.357324895 +0000 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-3-64.s 2019-10-28 17:09:04.609165478 +0000 +@@ -9,10 +9,11 @@ note_1.s: + .balign 4 + + .dc.l 8 +- .dc.l 8 ++ .dc.l 16 + .dc.l 0x100 +- .asciz "GA$2p1" +- .8byte note_1.s ++ .asciz "GA$3p1" ++ .8byte 0x100 /* note_1.s */ ++ .8byte 0x122 /* note_1 end */ + + .dc.l 23 + .dc.l 0 +@@ -55,4 +56,11 @@ note_1.s: + .dc.l 0x100 + .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 + .dc.b 0, 0, 0 ++ ++ .dc.l 6 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 ++ .dc.b 0, 0 ++ + .popsection +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-4-32.d binutils-2.30/binutils/testsuite/binutils-all/note-4-32.d +--- binutils.orig/binutils/testsuite/binutils-all/note-4-32.d 2019-10-28 17:08:43.357324895 +0000 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-4-32.d 2019-10-28 17:17:19.515453041 +0000 +@@ -7,13 +7,13 @@ + #... + Displaying notes found in: .gnu.build.attributes + [ ]+Owner[ ]+Data size[ ]+Description +-[ ]+GA\$3p3[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 \(note_4.s\) +-[ ]+GA\$gcc 7.2.1 20170915[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 +-[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 +-[ ]+GA\*off[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 +-[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 +-[ ]+GA\*PIC[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 +-[ ]+GA\!false[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 +-[ ]+GA\*0x[0-9a-f]+[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 +-[ ]+GA\*strong[ ]+0x00000008[ ]+func[ ]+Applies to region from 0x108 to 0x10c.* ++[ ]+GA\$3p3[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x10. to 0x110 \(note_4.s\) ++[ ]+GA\*off[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x10. to 0x110 ++[ ]+GA\$gcc 7.2.1 20170915[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x10. to 0x110 ++[ ]+GA\*0x[0-9a-f]+[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x10. to 0x110 ++[ ]+GA\*PIC[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x10. to 0x110 ++[ ]+GA\!false[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x10. to 0x110 ++[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x10. to 0x110 ++[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x10. to 0x110 ++[ ]+GA\*strong[ ]+0x00000008[ ]+func[ ]+Applies to region from 0x10. to 0x10c.* + #... +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-4-32.s binutils-2.30/binutils/testsuite/binutils-all/note-4-32.s +--- binutils.orig/binutils/testsuite/binutils-all/note-4-32.s 2019-10-28 17:08:43.355324910 +0000 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-4-32.s 2019-10-28 17:17:23.931419915 +0000 +@@ -1,6 +1,6 @@ + .text + .org 0x100 +-note_4.s: ++ .equiv note_4.s, . + 2 + .dc.l 0 + .dc.l 0 + +@@ -18,8 +18,8 @@ note_4.s_end: + .dc.l 8 + .dc.l 0x100 + .asciz "GA$3p3" +- .dc.l note_4.s +- .dc.l note_4.s_end ++ .dc.l 0x100 /* note_4.s - 2 */ ++ .dc.l 0x110 /* note_4.s_end */ + + .dc.l 23 + .dc.l 0 +@@ -63,12 +63,18 @@ note_4.s_end: + .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 + .dc.b 0, 0, 0 + ++ .dc.l 5 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x21, 0x8, 0 ++ .dc.b 0, 0, 0 ++ + .dc.l 6 + .dc.l 8 + .dc.l 0x101 + .dc.b 0x47, 0x41, 0x2a, 0x2, 0x3, 0 + .dc.b 0, 0 +- .dc.l bar +- .dc.l bar_end ++ .dc.l 0x108 /* bar */ ++ .dc.l 0x10c /* bar_end */ + + .popsection +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-4-64.d binutils-2.30/binutils/testsuite/binutils-all/note-4-64.d +--- binutils.orig/binutils/testsuite/binutils-all/note-4-64.d 2019-10-28 17:08:43.356324902 +0000 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-4-64.d 2019-10-28 17:09:04.609165478 +0000 +@@ -8,13 +8,13 @@ + #... + Displaying notes found in: .gnu.build.attributes + [ ]+Owner[ ]+Data size[ ]+Description +-[ ]+GA\$3p3[ ]+0x00000010[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 \(note_4.s\) ++[ ]+GA\$3p3[ ]+0x00000010[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120.* +-[ ]+GA\$gcc 7.2.1 20170915[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 +-[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 + [ ]+GA\*off[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 +-[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 ++[ ]+GA\$gcc 7.2.1 20170915[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 ++[ ]+GA\*0x[0-9a-f]+[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 + [ ]+GA\*PIC[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 + [ ]+GA\!false[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 +-[ ]+GA\*0x[0-9a-f]+[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 +-[ ]+GA\*strong[ ]+0x00000010[ ]+func[ ]+Applies to region from 0x110 to 0x11c.* ++[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 ++[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 ++[ ]+GA\*strong[ ]+0x00000010[ ]+func[ ]+Applies to region from 0x110 to 0x120.* + #... +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-4-64.s binutils-2.30/binutils/testsuite/binutils-all/note-4-64.s +--- binutils.orig/binutils/testsuite/binutils-all/note-4-64.s 2019-10-28 17:08:43.356324902 +0000 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-4-64.s 2019-10-28 17:17:29.355379229 +0000 +@@ -1,6 +1,6 @@ + .text + .org 0x100 +-note_4.s: ++ .equiv note_4.s, . + 2 + .dc.l 0 + .dc.l 0 + .dc.l 0 +@@ -22,8 +22,8 @@ note_4.s_end: + .dc.l 16 + .dc.l 0x100 + .asciz "GA$3p3" +- .8byte note_4.s +- .8byte note_4.s_end ++ .8byte 0x100 /* note_4.s - 2 */ ++ .8byte 0x120 /* note_4.s_end */ + + .dc.l 23 + .dc.l 0 +@@ -68,11 +68,17 @@ note_4.s_end: + .dc.b 0, 0, 0 + + .dc.l 6 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 ++ .dc.b 0, 0 ++ ++ .dc.l 6 + .dc.l 16 + .dc.l 0x101 + .dc.b 0x47, 0x41, 0x2a, 0x2, 0x3, 0 + .dc.b 0, 0 +- .8byte bar +- .8byte bar_end ++ .8byte 0x110 /* bar */ ++ .8byte 0x120 /* bar_end */ + + .popsection +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-6-32.d binutils-2.30/binutils/testsuite/binutils-all/note-6-32.d +--- binutils.orig/binutils/testsuite/binutils-all/note-6-32.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-6-32.d 2019-10-28 17:17:38.955307217 +0000 +@@ -0,0 +1,20 @@ ++#PROG: objcopy ++#readelf: --notes --wide ++#objcopy: --merge-notes ++#name: v3 gnu build attribute note merging (32-bit) ++#source: note-6-32.s ++ ++#... ++Displaying notes found in: .gnu.build.attributes ++[ ]+Owner[ ]+Data size[ ]+Description ++[ ]+GA\$3p1[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 \(note_test\) ++[ ]+GA\*off[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\$gcc 8.3.1 20190507[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\*0x[0-9a-f]+[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\*PIC[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\!false[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\$3p1[ ]+0x00000008[ ]+func[ ]+Applies to region from 0x102 to 0x106 ++[ ]+GA\$hello world[ ]+0x00000000[ ]+func[ ]+Applies to region from 0x102 to 0x106 ++#... +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-6-32.s binutils-2.30/binutils/testsuite/binutils-all/note-6-32.s +--- binutils.orig/binutils/testsuite/binutils-all/note-6-32.s 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-6-32.s 2019-10-28 17:17:38.955307217 +0000 +@@ -0,0 +1,145 @@ ++ .text ++ .org 0x100 ++ .global note_test ++note_test: ++note_1_start: ++ .word 0 ++note_1_end: ++note_2_start: ++ .word 0 ++note_2_end: ++note_3_start: ++ .word 0 ++note_3_end: ++note_test_end: ++ .size note_test, note_test_end - note_test ++ ++ .pushsection .gnu.build.attributes, "", %note ++ .balign 4 ++ ++ .dc.l 8 ++ .dc.l 8 ++ .dc.l 0x100 ++ .asciz "GA$3p1" ++ .4byte 0x100 /* note_1_start */ ++ .4byte 0x102 /* note_1_end */ ++ ++ .dc.l 23 ++ .dc.l 0 ++ .dc.l 0x100 ++ .asciz "GA$gcc 8.3.1 20190507" ++ .dc.b 0 ++ ++ .dc.l 10 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x47, 0x4f, 0x57, 0, 0, 0x7, 0 ++ .dc.b 0, 0 ++ ++ .dc.l 6 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 ++ .dc.b 0, 0 ++ ++ .dc.l 13 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x46, 0x4f, 0x52, 0x54, 0x49, 0x46, 0x59, 0, 0xff, 0 ++ .dc.b 0, 0, 0 ++ ++ .dc.l 6 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 ++ .dc.b 0, 0 ++ ++ .dc.l 5 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x21, 0x8, 0 ++ .dc.b 0, 0, 0 ++ ++ .dc.l 13 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 ++ .dc.b 0, 0, 0 ++ ++ ++ .dc.l 8 ++ .dc.l 8 ++ .dc.l 0x100 ++ .asciz "GA$3p1" ++ .4byte 0x102 /* note_2_start */ ++ .4byte 0x106 /* note_3_end */ ++ ++ .dc.l 23 ++ .dc.l 0 ++ .dc.l 0x100 ++ .asciz "GA$gcc 8.3.1 20190507" ++ .dc.b 0 ++ ++ .dc.l 10 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x47, 0x4f, 0x57, 0, 0, 0x7, 0 ++ .dc.b 0, 0 ++ ++ .dc.l 6 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 ++ .dc.b 0, 0 ++ ++ .dc.l 13 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x46, 0x4f, 0x52, 0x54, 0x49, 0x46, 0x59, 0, 0xff, 0 ++ .dc.b 0, 0, 0 ++ ++ .dc.l 6 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 ++ .dc.b 0, 0 ++ ++ .dc.l 5 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x21, 0x8, 0 ++ .dc.b 0, 0, 0 ++ ++ .dc.l 13 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 ++ .dc.b 0, 0, 0 ++ ++ ++ .dc.l 8 ++ .dc.l 8 ++ .dc.l 0x101 ++ .asciz "GA$3p1" ++ .4byte 0x102 /* note_2_start */ ++ .4byte 0x104 /* note_2_end */ ++ ++ .dc.l 16 ++ .dc.l 0 ++ .dc.l 0x101 ++ .asciz "GA$hello world" ++ ++ ++ .dc.l 8 ++ .dc.l 8 ++ .dc.l 0x101 ++ .asciz "GA$3p1" ++ .4byte 0x104 /* note_3_start */ ++ .4byte 0x106 /* note_3_end */ ++ ++ .dc.l 16 ++ .dc.l 0 ++ .dc.l 0x101 ++ .asciz "GA$hello world" ++ ++ .popsection +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-6-64.d binutils-2.30/binutils/testsuite/binutils-all/note-6-64.d +--- binutils.orig/binutils/testsuite/binutils-all/note-6-64.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-6-64.d 2019-10-28 17:17:43.659271931 +0000 +@@ -0,0 +1,20 @@ ++#PROG: objcopy ++#readelf: --notes --wide ++#objcopy: --merge-notes ++#name: v3 gnu build attribute note merging (64-bit) ++#source: note-6-64.s ++ ++#... ++Displaying notes found in: .gnu.build.attributes ++[ ]+Owner[ ]+Data size[ ]+Description ++[ ]+GA\$3p1[ ]+0x00000010[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 \(note_test\) ++[ ]+GA\*off[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\$gcc 8.3.1 20190507[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\*0x[0-9a-f]+[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\*PIC[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\!false[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x106 ++[ ]+GA\$3p1[ ]+0x00000010[ ]+func[ ]+Applies to region from 0x102 to 0x106 ++[ ]+GA\$hello world[ ]+0x00000000[ ]+func[ ]+Applies to region from 0x102 to 0x106 ++#... +diff -rupN binutils.orig/binutils/testsuite/binutils-all/note-6-64.s binutils-2.30/binutils/testsuite/binutils-all/note-6-64.s +--- binutils.orig/binutils/testsuite/binutils-all/note-6-64.s 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/binutils/testsuite/binutils-all/note-6-64.s 2019-10-28 17:17:43.659271931 +0000 +@@ -0,0 +1,145 @@ ++ .text ++ .org 0x100 ++ .global note_test ++note_test: ++note_1_start: ++ .word 0 ++note_1_end: ++note_2_start: ++ .word 0 ++note_2_end: ++note_3_start: ++ .word 0 ++note_3_end: ++note_test_end: ++ .size note_test, note_test_end - note_test ++ ++ .pushsection .gnu.build.attributes, "", %note ++ .balign 4 ++ ++ .dc.l 8 ++ .dc.l 16 ++ .dc.l 0x100 ++ .asciz "GA$3p1" ++ .8byte 0x100 /* note_1_start */ ++ .8byte 0x102 /* note_1_end */ ++ ++ .dc.l 23 ++ .dc.l 0 ++ .dc.l 0x100 ++ .asciz "GA$gcc 8.3.1 20190507" ++ .dc.b 0 ++ ++ .dc.l 10 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x47, 0x4f, 0x57, 0, 0, 0x7, 0 ++ .dc.b 0, 0 ++ ++ .dc.l 6 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 ++ .dc.b 0, 0 ++ ++ .dc.l 13 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x46, 0x4f, 0x52, 0x54, 0x49, 0x46, 0x59, 0, 0xff, 0 ++ .dc.b 0, 0, 0 ++ ++ .dc.l 6 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 ++ .dc.b 0, 0 ++ ++ .dc.l 5 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x21, 0x8, 0 ++ .dc.b 0, 0, 0 ++ ++ .dc.l 13 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 ++ .dc.b 0, 0, 0 ++ ++ ++ .dc.l 8 ++ .dc.l 16 ++ .dc.l 0x100 ++ .asciz "GA$3p1" ++ .8byte 0x102 /* note_2_start */ ++ .8byte 0x106 /* note_3_end */ ++ ++ .dc.l 23 ++ .dc.l 0 ++ .dc.l 0x100 ++ .asciz "GA$gcc 8.3.1 20190507" ++ .dc.b 0 ++ ++ .dc.l 10 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x47, 0x4f, 0x57, 0, 0, 0x7, 0 ++ .dc.b 0, 0 ++ ++ .dc.l 6 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 ++ .dc.b 0, 0 ++ ++ .dc.l 13 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x46, 0x4f, 0x52, 0x54, 0x49, 0x46, 0x59, 0, 0xff, 0 ++ .dc.b 0, 0, 0 ++ ++ .dc.l 6 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 ++ .dc.b 0, 0 ++ ++ .dc.l 5 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x21, 0x8, 0 ++ .dc.b 0, 0, 0 ++ ++ .dc.l 13 ++ .dc.l 0 ++ .dc.l 0x100 ++ .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 ++ .dc.b 0, 0, 0 ++ ++ ++ .dc.l 8 ++ .dc.l 16 ++ .dc.l 0x101 ++ .asciz "GA$3p1" ++ .8byte 0x102 /* note_2_start */ ++ .8byte 0x104 /* note_2_end */ ++ ++ .dc.l 16 ++ .dc.l 0 ++ .dc.l 0x101 ++ .asciz "GA$hello world" ++ ++ ++ .dc.l 8 ++ .dc.l 16 ++ .dc.l 0x101 ++ .asciz "GA$3p1" ++ .8byte 0x104 /* note_3_start */ ++ .8byte 0x106 /* note_3_end */ ++ ++ .dc.l 16 ++ .dc.l 0 ++ .dc.l 0x101 ++ .asciz "GA$hello world" ++ ++ .popsection +diff -rupN binutils.orig/binutils/testsuite/binutils-all/objcopy.exp binutils-2.30/binutils/testsuite/binutils-all/objcopy.exp +--- binutils.orig/binutils/testsuite/binutils-all/objcopy.exp 2019-10-28 17:08:43.353324925 +0000 ++++ binutils-2.30/binutils/testsuite/binutils-all/objcopy.exp 2019-10-28 17:09:04.610165471 +0000 +@@ -1057,10 +1057,12 @@ if [is_elf_format] { + run_dump_test "note-2-64" + run_dump_test "note-3-64" + run_dump_test "note-4-64" ++ run_dump_test "note-6-64" + } else { + run_dump_test "note-2-32" + run_dump_test "note-3-32" + run_dump_test "note-4-32" ++ run_dump_test "note-6-32" + } + run_dump_test "note-5" + } +--- binutils.orig/binutils/objcopy.c 2019-11-06 10:21:47.933091869 +0000 ++++ binutils-2.30/binutils/objcopy.c 2019-11-06 15:12:26.964599817 +0000 +@@ -2502,7 +2502,7 @@ merge_gnu_build_notes (bfd * ab + { + bfd_set_error (bfd_error_bad_value); + bfd_nonfatal_message (NULL, abfd, sec, err); +- status = 1; ++ /* status = 1; */ + } + + free (pnotes); +@@ -2859,7 +2859,7 @@ copy_object (bfd *ibfd, bfd *obfd, const + { + bfd_nonfatal_message (NULL, ibfd, osec, + _("warning: could not load note section")); +- free (merged->contents); ++ /* Do NOT free merged->contents - it is cached and might be used elsewhere. */ + free (merged); + continue; + } +@@ -2871,7 +2871,7 @@ copy_object (bfd *ibfd, bfd *obfd, const + /* Merging achieves nothing. */ + merge_debug ("Merge of section %s achieved nothing - skipping\n", + bfd_section_name (obfd, osec)); +- free (merged->contents); ++ /* Do NOT free merged->contents - it is cached and might be used elsewhere. */ + free (merged); + continue; + } +@@ -2881,7 +2881,7 @@ copy_object (bfd *ibfd, bfd *obfd, const + { + bfd_nonfatal_message (NULL, obfd, osec, + _("warning: failed to set merged notes size")); +- free (merged->contents); ++ /* Do NOT free merged->contents - it is cached and might be used elsewhere. */ + free (merged); + continue; + } +--- binutils.orig/binutils/objcopy.c 2019-11-06 16:37:57.018843494 +0000 ++++ binutils-2.30/binutils/objcopy.c 2019-11-06 16:40:52.669564222 +0000 +@@ -2845,7 +2845,13 @@ copy_object (bfd *ibfd, bfd *obfd, const + if (! is_mergeable_note_section (ibfd, osec)) + continue; + ++ /* If the section is going to be completly deleted then ++ do not bother to merge it. */ ++ if (osec->output_section == NULL) ++ continue; ++ + bfd_size_type size = bfd_section_size (obfd, osec); ++ + if (size == 0) + { + bfd_nonfatal_message (NULL, ibfd, osec, +@@ -2859,29 +2865,22 @@ copy_object (bfd *ibfd, bfd *obfd, const + { + bfd_nonfatal_message (NULL, ibfd, osec, + _("warning: could not load note section")); +- /* Do NOT free merged->contents - it is cached and might be used elsewhere. */ + free (merged); + continue; + } + + merged->size = merge_gnu_build_notes (ibfd, osec, size, + merged->contents); +- if (merged->size == size) +- { +- /* Merging achieves nothing. */ +- merge_debug ("Merge of section %s achieved nothing - skipping\n", +- bfd_section_name (obfd, osec)); +- /* Do NOT free merged->contents - it is cached and might be used elsewhere. */ +- free (merged); +- continue; +- } ++ /* FIXME: Once we have read the contents in, we must write ++ them out again. So even if the mergeing has achieved ++ nothing we still add this entry to the merge list. */ + +- if (osec->output_section == NULL +- || !bfd_set_section_size (obfd, osec->output_section, merged->size)) ++ if (size != merged->size ++ && !bfd_set_section_size (obfd, osec->output_section, merged->size)) + { + bfd_nonfatal_message (NULL, obfd, osec, + _("warning: failed to set merged notes size")); +- /* Do NOT free merged->contents - it is cached and might be used elsewhere. */ ++ free (merged->contents); + free (merged); + continue; + } +@@ -3246,16 +3245,16 @@ copy_object (bfd *ibfd, bfd *obfd, const + { + bfd_nonfatal_message + (NULL, obfd, osec, +- _("error: failed to copy merged notes into output")); ++ _("error: failed to locate merged notes")); + continue; + } + } + +- if (! is_mergeable_note_section (obfd, osec)) ++ if (merged->contents == NULL) + { + bfd_nonfatal_message + (NULL, obfd, osec, +- _("error: failed to copy merged notes into output")); ++ _("error: failed to merged notes")); + continue; + } + +--- binutils.orig/binutils/objcopy.c 2019-11-20 10:59:20.993888328 +0000 ++++ binutils-2.30/binutils/objcopy.c 2019-11-20 16:59:50.714905419 +0000 +@@ -2292,7 +2292,7 @@ merge_gnu_build_notes (bfd * ab + - it makes things much simpler. */ + if (version_3_seen == 0) + { +- merge_debug ("%s: skipping merge - not using v3 notes", bfd_section_name (sec)); ++ merge_debug ("%s: skipping merge - not using v3 notes", bfd_section_name (abfd, sec)); + goto done; + } + +@@ -2324,7 +2324,7 @@ merge_gnu_build_notes (bfd * ab + other note then if they are both of the same type (open + or func) then they can be merged and one deleted. If + they are of different types then they cannot be merged. */ +- for (pnote = pnotes + 1; pnote < pnotes_end; pnote ++) ++ for (pnote = pnotes; pnote < pnotes_end; pnote ++) + { + /* Skip already deleted notes. + FIXME: Can this happen ? We are scanning forwards and +@@ -2426,7 +2426,9 @@ merge_gnu_build_notes (bfd * ab + bfd_vma prev_start = 0; + bfd_vma prev_end = 0; + +- new = new_contents = xmalloc (size); ++ /* Not sure how, but the notes might grow in size. ++ (eg see PR 1774507). Allow for this here. */ ++ new = new_contents = xmalloc (size * 2); + for (pnote = pnotes, old = contents; + pnote < pnotes_end; + pnote ++) +@@ -2493,8 +2495,11 @@ merge_gnu_build_notes (bfd * ab + #endif + + new_size = new - new_contents; +- memcpy (contents, new_contents, new_size); +- size = new_size; ++ if (new_size < size) ++ { ++ memcpy (contents, new_contents, new_size); ++ size = new_size; ++ } + free (new_contents); + + done: +@@ -2940,6 +2945,7 @@ copy_object (bfd *ibfd, bfd *obfd, const + pdump->filename, + strerror (errno)); + free (contents); ++ fclose (f); + /* There is a potential resource leak here, but it is not important. */ + /* coverity[leaked_storage: FALSE] */ + return FALSE; diff --git a/SOURCES/binutils-special-sections-in-groups.patch b/SOURCES/binutils-special-sections-in-groups.patch deleted file mode 100644 index 7010332..0000000 --- a/SOURCES/binutils-special-sections-in-groups.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- binutils.orig/bfd/elf.c 2018-10-19 11:42:10.107277490 +0100 -+++ binutils-2.31.1/bfd/elf.c 2018-10-19 11:44:33.607105801 +0100 -@@ -828,7 +828,13 @@ setup_group (bfd *abfd, Elf_Internal_Shd - } - } - -- if (elf_group_name (newsect) == NULL) -+ if (elf_group_name (newsect) == NULL -+ /* OS specific sections might be in a group (eg ARM's ARM_EXIDX section) -+ but they will not have been added to the group because they do not -+ have contents that the ELF code in the BFD library knows how to -+ process. This is OK though - we rely upon the target backends to -+ handle these sections for us. */ -+ && hdr->sh_type < SHT_LOOS) - { - /* xgettext:c-format */ - _bfd_error_handler (_("%B: no group info for section '%A'"), -@@ -934,7 +940,8 @@ _bfd_elf_setup_sections (bfd *abfd) - else if (idx->shdr->bfd_section) - elf_sec_group (idx->shdr->bfd_section) = shdr->bfd_section; - else if (idx->shdr->sh_type != SHT_RELA -- && idx->shdr->sh_type != SHT_REL) -+ && idx->shdr->sh_type != SHT_REL -+ && idx->shdr->sh_type < SHT_LOOS) - { - /* There are some unknown sections in the group. */ - _bfd_error_handler diff --git a/SPECS/binutils.spec b/SPECS/binutils.spec index 19574f3..fa871c9 100644 --- a/SPECS/binutils.spec +++ b/SPECS/binutils.spec @@ -28,6 +28,12 @@ # relocations against absolute symbols. %define default_generate_notes 0 +# Enable thread support in the GOLD linker (if it is being built). This is +# particularly important if plugins to the linker intend to use threads +# themselves. See BZ 1636479 for more details. This option is made +# configurable in case there is ever a need to disable thread support. +%define enable_threading 1 + #----End of Configure Options------------------------------------------------ # Default: Not bootstrapping. @@ -63,7 +69,7 @@ Summary: A GNU collection of binary utilities Name: %{?cross}binutils%{?_with_debug:-debug} Version: 2.30 -Release: 58%{?dist}.2 +Release: 73%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -380,17 +386,50 @@ Patch56: binutils-AArch64-gold.patch # Lifetime: Fixed in 2.33 Patch57: binutils-multiple-relocs-for-same-section.patch +# Purpose: Stop the linker from merging groups which have different settings +# of the SHF_EXCLUDE flag. +# Lifetime: Fixed in 2.33 +Patch58: binutils-do-not-merge-differing-SHF_EXCLUDE-groups.patch + +# Purpose: Add support for the SVE variant PCS in AArch64. +# Lifetime: Fixed in 2.33 +Patch59: binutils-aarch64-STO_AARCH64_VARIANT_PCS.patch + +# Purpose: Add fixes and markers for Coverity test failures. +# Lifetime: Permanent. +Patch60: binutils-coverity-fixes.patch + +# Purpose: Improve objcopy's merging of GNU build attribute notes. +# Lifetime: Fixed in 2.33 +Patch61: binutils-improved-note-merging.patch + +# Purpose: Add check to readelf in order to prevent an integer overflow. +# Lifetime: Fixed in 2.33 +Patch62: binutils-CVE-2019-14444.patch + +# Purpose: Fix a seg-fault in gold when linking corrupt input files. +# Lifetime: Fixed in 2.34 (maybe) +Patch63: binutils-CVE-2019-1010204.patch + # Purpose: Add a feature to the x86/64 assembler to create # workarounds for the Intel Jcc Erratum. # Lifetime: Fixed in 2.34 -Patch58: binutils-x86_JCC_Erratum.patch +Patch64: binutils-x86_JCC_Erratum.patch + +# Purpose: Fix a potential seg-fault in the BFD library when parsing +# pathalogical debug_info sections. +# Lifetime: Fixed in 2.34 +Patch65: binutils-CVE-2019-17451.patch + +# Purpose: Fix a memory exhaustion bug in the BFD library when parsing +# corrupt DWARF debug information. +# Lifetime: Fixed in 2.34 +Patch66: binutils-CVE-2019-17450.patch # Purpose: Allow the BFD library to handle the copying of files which # contain secondary reloc sections. # Lifetime: Fixed in 2.35 -Patch59: binutils-copy-multiple-relocs.patch - -Patch9999: binutils-special-sections-in-groups.patch +Patch67: binutils-copy-multiple-relocs.patch #---------------------------------------------------------------------------- @@ -575,10 +614,14 @@ using libelf instead of BFD. %patch57 -p1 %patch58 -p1 %patch59 -p1 - -%ifarch %{arm} -%patch9999 -p1 -%endif +%patch60 -p1 +%patch61 -p1 +%patch62 -p1 +%patch63 -p1 +%patch64 -p1 +%patch65 -p1 +%patch66 -p1 +%patch67 -p1 # We cannot run autotools as there is an exact requirement of autoconf-2.59. # FIXME - this is no longer true. Maybe try reinstating autotool use ? @@ -721,6 +764,11 @@ export LDFLAGS=$RPM_LD_FLAGS %else --enable-generate-build-notes=no \ %endif +%if %{enable_threading} + --enable-threads=yes \ +%else + --enable-threads=no \ +%endif $CARGS \ --enable-plugins \ --with-bugurl=http://bugzilla.redhat.com/bugzilla/ @@ -1011,11 +1059,54 @@ exit 0 #---------------------------------------------------------------------------- %changelog -* Tue Feb 18 2020 Nick Clifton - 2.30-58.2 -- Allow the BFD library to handle the copying of files containing secondary reloc sections. (#1803825) +* Wed Feb 12 2020 Nick Clifton - 2.30-73 +- Remove bogus assertion. (#1801879) + +* Wed Feb 12 2020 Nick Clifton - 2.30-72 +- Allow the BFD library to handle the copying of files containing secondary reloc sections. (#1801879) + +* Tue Dec 03 2019 Nick Clifton - 2.30-71 +- Fix a potential seg-fault in the BFD library when parsing pathalogical debug_info sections. (#1779245) +- Fix a potential memory exhaustion in the BFD library when parsing corrupt DWARF debug information. + +* Mon Dec 02 2019 Nick Clifton - 2.30-70 +- Re-enable strip merging build notes. (#1777760) + +* Mon Dec 02 2019 Nick Clifton - 2.30-69 +- Fix linker testsuite failures triggered by annobin update. + +* Thu Nov 28 2019 Nick Clifton - 2.30-68 +- Backport H.J.Lu's patch to add a workaround for the JCC Errata to the assembler. (#1777002) + +* Thu Nov 21 2019 Nick Clifton - 2.30-67 +- Fix a buffer overrun in the note merging code. (#1774507) + +* Fri Nov 08 2019 Nick Clifton 2.30-66 +- Fix a seg-fault in gold when linking corrupt input files. (#1739254) + +* Thu Nov 07 2019 Nick Clifton 2.30-65 +- NVR bump to allow rebuild with reverted version of glibc in the buildroot. + +* Wed Nov 06 2019 Nick Clifton 2.30-64 +- Stop note merging with no effect from creating null filled note sections. + +* Wed Nov 06 2019 Nick Clifton 2.30-63 +- Stop objcopy from generating a exit failure status when merging corrupt notes. + +* Fri Nov 01 2019 Nick Clifton 2.30-62 +- Fix binutils testsuite failure introduced by -60 patch. (#1767711) + +* Tue Oct 29 2019 Nick Clifton 2.30-61 +- Enable threading in the GOLD linker. (#1729225) +- Add check to readelf in order to prevent an integer overflow. + +* Mon Oct 28 2019 Nick Clifton 2.30-60 +- Add support for SVE Vector PCS on AArch64. (#1726637) +- Add fixes for coverity test failures. +- Improve objcopy's ability to merge GNU build attribute notes. -* Mon Dec 16 2019 Nick Clifton - 2.30-58.1 -- Backport H.J.Lu's patch to add a workaround for the JCC Errata to the assembler. (#1783957) +* Mon Oct 28 2019 Nick Clifton 2.30-59 +- Stop the linker from merging groups with different settings of the SHF_EXCLUDE flag. (#1730906) * Fri Sep 13 2019 Nick Clifton 2.30-58 - Stop the BFD library from complaining about sections with multiple sets of relocations. (#1749084)