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-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-improved-note-merging.patch b/SOURCES/binutils-improved-note-merging.patch new file mode 100644 index 0000000..ec3bee2 --- /dev/null +++ b/SOURCES/binutils-improved-note-merging.patch @@ -0,0 +1,2084 @@ +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; + } +@@ -4519,7 +4519,7 @@ strip_main (int argc, char *argv[]) + int i; + char *output_file = NULL; + +- merge_notes = TRUE; ++ /* merge_notes = TRUE; */ + + while ((c = getopt_long (argc, argv, "I:O:F:K:MN:R:o:sSpdgxXHhVvwDU", + strip_options, (int *) 0)) != EOF) +--- 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-multiple-relocs-for-same-section.patch b/SOURCES/binutils-multiple-relocs-for-same-section.patch new file mode 100644 index 0000000..165c743 --- /dev/null +++ b/SOURCES/binutils-multiple-relocs-for-same-section.patch @@ -0,0 +1,23 @@ +--- binutils.orig/bfd/elf.c 2019-09-10 10:57:33.391081672 +0100 ++++ binutils-2.27/bfd/elf.c 2019-09-10 10:59:55.355010766 +0100 +@@ -2324,9 +2324,18 @@ bfd_section_from_shdr (bfd *abfd, unsign + else + p_hdr = &esdt->rel.hdr; + +- /* PR 17512: file: 0b4f81b7. */ ++ /* PR 17512: file: 0b4f81b7. ++ Also see PR 24456, for a file which deliberately has two reloc ++ sections. */ + if (*p_hdr != NULL) +- goto fail; ++ { ++ _bfd_error_handler ++ /* xgettext:c-format */ ++ (_("%B: warning: multiple relocation sections for section %A \ ++found - ignoring all but the first"), ++ abfd, target_sect); ++ goto success; ++ } + hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, sizeof (*hdr2)); + if (hdr2 == NULL) + goto fail; diff --git a/SOURCES/binutils-x86_JCC_Erratum.patch b/SOURCES/binutils-x86_JCC_Erratum.patch new file mode 100644 index 0000000..3c42d33 --- /dev/null +++ b/SOURCES/binutils-x86_JCC_Erratum.patch @@ -0,0 +1,3733 @@ +diff -rupN binutils.orig/gas/config/tc-i386.c binutils-2.30/gas/config/tc-i386.c +--- binutils.orig/gas/config/tc-i386.c 2019-11-20 10:59:21.586883777 +0000 ++++ binutils-2.30/gas/config/tc-i386.c 2019-11-20 15:25:34.197910787 +0000 +@@ -392,6 +392,9 @@ struct _i386_insn + + /* Error message. */ + enum i386_error error; ++ ++ /* Has GOTPC relocation. */ ++ bfd_boolean has_gotpc_reloc; + }; + + typedef struct _i386_insn i386_insn; +@@ -521,6 +524,8 @@ static enum flag_code flag_code; + static unsigned int object_64bit; + static unsigned int disallow_64bit_reloc; + static int use_rela_relocations = 0; ++/* __tls_get_addr/___tls_get_addr symbol for TLS. */ ++static const char *tls_get_addr; + + #if ((defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)) \ + || defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) \ +@@ -584,6 +589,21 @@ static int omit_lock_prefix = 0; + "lock addl $0, (%{re}sp)". */ + static int avoid_fence = 0; + ++/* Type of the previous instruction. */ ++static struct ++{ ++ segT seg; ++ const char *file; ++ const char *name; ++ unsigned int line; ++ enum last_insn_kind ++ { ++ last_insn_other = 0, ++ last_insn_directive, ++ last_insn_prefix ++ } kind; ++} last_insn; ++ + /* 1 if the assembler should generate relax relocations. */ + + static int generate_relax_relocations +@@ -597,6 +617,31 @@ static enum check_kind + } + sse_check, operand_check = check_warning; + ++/* Non-zero if branches should be aligned within power of 2 boundary. */ ++static int align_branch_power = 0; ++ ++/* Types of branches to align. */ ++enum align_branch_kind ++ { ++ align_branch_none = 0, ++ align_branch_jcc = 1 << 0, ++ align_branch_fused = 1 << 1, ++ align_branch_jmp = 1 << 2, ++ align_branch_call = 1 << 3, ++ align_branch_indirect = 1 << 4, ++ align_branch_ret = 1 << 5 ++ }; ++ ++static unsigned int align_branch = (align_branch_jcc ++ | align_branch_fused ++ | align_branch_jmp); ++ ++/* The maximum padding size for fused jcc. */ ++#define MAX_FUSED_JCC_PADDING_SIZE 20 ++ ++/* The maximum number of prefixes added for an instruction. */ ++static unsigned int align_branch_prefix_size = 5; ++ + /* Register prefix used for error message. */ + static const char *register_prefix = "%"; + +@@ -677,12 +722,19 @@ int x86_cie_data_alignment; + /* Interface to relax_segment. + There are 3 major relax states for 386 jump insns because the + different types of jumps add different sizes to frags when we're +- figuring out what sort of jump to choose to reach a given label. */ ++ figuring out what sort of jump to choose to reach a given label. ++ ++ BRANCH_PADDING, BRANCH_PREFIX and FUSED_JCC_PADDING are used to align ++ branches which are handled by md_estimate_size_before_relax() and ++ i386_generic_table_relax_frag(). */ + + /* Types. */ + #define UNCOND_JUMP 0 + #define COND_JUMP 1 + #define COND_JUMP86 2 ++#define BRANCH_PADDING 3 ++#define BRANCH_PREFIX 4 ++#define FUSED_JCC_PADDING 5 + + /* Sizes. */ + #define CODE16 1 +@@ -1402,7 +1454,9 @@ i386_align_code (fragS *fragP, int count + patt [padding - 1], padding); + } + } +- fragP->fr_var = count; ++ ++ if (fragP->fr_type != rs_machine_dependent) ++ fragP->fr_var = count; + } + + static INLINE int +@@ -2807,6 +2861,11 @@ md_begin (void) + x86_dwarf2_return_column = 8; + x86_cie_data_alignment = -4; + } ++ ++ /* NB: FUSED_JCC_PADDING frag must have sufficient room so that it ++ can be turned into BRANCH_PREFIX frag. */ ++ if (align_branch_prefix_size > MAX_FUSED_JCC_PADDING_SIZE) ++ abort (); + } + + void +@@ -3929,6 +3988,17 @@ md_assemble (char *line) + + /* We are ready to output the insn. */ + output_insn (); ++ ++ last_insn.seg = now_seg; ++ ++ if (i.tm.opcode_modifier.isprefix) ++ { ++ last_insn.kind = last_insn_prefix; ++ last_insn.name = i.tm.name; ++ last_insn.file = as_where (&last_insn.line); ++ } ++ else ++ last_insn.kind = last_insn_other; + } + + static char * +@@ -7162,11 +7232,202 @@ output_interseg_jump (void) + md_number_to_chars (p + size, (valueT) i.op[0].imms->X_add_number, 2); + } + ++/* Return TRUE for test, and, cmp, add, sub, inc and dec which may ++ be macro-fused with conditional jumps. */ ++ ++static bfd_boolean ++maybe_fused_with_jcc_p (void) ++{ ++ /* No RIP address. */ ++ if (i.base_reg && i.base_reg->reg_num == RegRip) ++ return FALSE; ++ ++ /* and, add, sub with destination register. */ ++ if (!strcmp (i.tm.name, "and") ++ || !strcmp (i.tm.name, "add") ++ || !strcmp (i.tm.name, "sub")) ++ return i.types[1].bitfield.reg; ++ ++ /* test, cmp with any register. */ ++ if (!strcmp (i.tm.name, "test") || !strcmp (i.tm.name, "cmp")) ++ return (i.types[0].bitfield.reg ++ || i.types[1].bitfield.reg); ++ ++ /* inc, dec with 16/32/64-bit register. */ ++ if (!strcmp (i.tm.name, "inc") || !strcmp (i.tm.name, "dec")) ++ return i.types[0].bitfield.reg; ++ ++ return FALSE; ++} ++ ++/* Return TRUE if a FUSED_JCC_PADDING frag should be generated. */ ++ ++static bfd_boolean ++add_fused_jcc_padding_frag_p (void) ++{ ++ if (!align_branch_power ++ || now_seg == absolute_section ++ || !cpu_arch_flags.bitfield.cpui386 ++ || !(align_branch & align_branch_fused)) ++ return FALSE; ++ ++ if (maybe_fused_with_jcc_p ()) ++ { ++ if (last_insn.kind != last_insn_other ++ && last_insn.seg == now_seg) ++ { ++ if (flag_debug) ++ as_warn_where (last_insn.file, last_insn.line, ++ _("`%s` skips -malign-branch-boundary on `%s`"), ++ last_insn.name, i.tm.name); ++ return FALSE; ++ } ++ return TRUE; ++ } ++ ++ return FALSE; ++} ++ ++/* Return TRUE if a BRANCH_PREFIX frag should be generated. */ ++ ++static bfd_boolean ++add_branch_prefix_frag_p (void) ++{ ++ if (!align_branch_power ++ || now_seg == absolute_section ++ || i.tm.cpu_flags.bitfield.cpupadlock ++ || !cpu_arch_flags.bitfield.cpui386) ++ return FALSE; ++ ++ /* Don't add prefix if it is a prefix or there is no operand. */ ++ if (!i.operands || i.tm.opcode_modifier.isprefix) ++ return FALSE; ++ ++ if (last_insn.kind != last_insn_other ++ && last_insn.seg == now_seg) ++ { ++ if (flag_debug) ++ as_warn_where (last_insn.file, last_insn.line, ++ _("`%s` skips -malign-branch-boundary on `%s`"), ++ last_insn.name, i.tm.name); ++ return FALSE; ++ } ++ ++ return TRUE; ++} ++ ++/* Return TRUE if a BRANCH_PADDING frag should be generated. */ ++ ++static int ++add_branch_padding_frag_p (enum align_branch_kind *branch_p) ++{ ++ bfd_boolean add_padding; ++ ++ if (!align_branch_power ++ || now_seg == absolute_section ++ || !cpu_arch_flags.bitfield.cpui386) ++ return FALSE; ++ ++ add_padding = FALSE; ++ ++ /* Check for jcc and direct jmp. */ ++ if (i.tm.opcode_modifier.jump) ++ { ++ if (i.tm.base_opcode == JUMP_PC_RELATIVE) ++ { ++ *branch_p = align_branch_jmp; ++ add_padding = align_branch & align_branch_jmp; ++ } ++ else ++ { ++ *branch_p = align_branch_jcc; ++ if ((align_branch & align_branch_jcc)) ++ add_padding = TRUE; ++ } ++ } ++ else if (i.tm.base_opcode == 0xc2 ++ || i.tm.base_opcode == 0xc3 ++ || i.tm.base_opcode == 0xca ++ || i.tm.base_opcode == 0xcb) ++ { ++ *branch_p = align_branch_ret; ++ if ((align_branch & align_branch_ret)) ++ add_padding = TRUE; ++ } ++ else ++ { ++ if (i.tm.base_opcode == 0xe8) ++ { ++ *branch_p = align_branch_call; ++ if ((align_branch & align_branch_call)) ++ add_padding = TRUE; ++ } ++ else if (i.tm.base_opcode == 0xff ++ && (i.rm.reg == 2 || i.rm.reg == 4)) ++ { ++ *branch_p = align_branch_indirect; ++ if ((align_branch & align_branch_indirect)) ++ add_padding = TRUE; ++ } ++ ++ /* Check for indirect jmp, direct and indirect calls. */ ++ if (add_padding ++ && i.disp_operands ++ && tls_get_addr ++ && (i.op[0].disps->X_op == O_symbol ++ || (i.op[0].disps->X_op == O_subtract ++ && i.op[0].disps->X_op_symbol == GOT_symbol))) ++ { ++ symbolS *s = i.op[0].disps->X_add_symbol; ++ /* No padding to call to global or undefined tls_get_addr. */ ++ if ((S_IS_EXTERNAL (s) || !S_IS_DEFINED (s)) ++ && strcmp (S_GET_NAME (s), tls_get_addr) == 0) ++ return FALSE; ++ } ++ } ++ ++ if (add_padding ++ && last_insn.kind != last_insn_other ++ && last_insn.seg == now_seg) ++ { ++ if (flag_debug) ++ as_warn_where (last_insn.file, last_insn.line, ++ _("`%s` skips -malign-branch-boundary on `%s`"), ++ last_insn.name, i.tm.name); ++ return FALSE; ++ } ++ ++ return add_padding; ++} ++ ++static unsigned int ++encoding_length (const fragS *start_frag, offsetT start_off, ++ const char *frag_now_ptr) ++{ ++ unsigned int len = 0; ++ ++ if (start_frag != frag_now) ++ { ++ const fragS *fr = start_frag; ++ ++ do ++ { ++ len += fr->fr_fix; ++ fr = fr->fr_next; ++ } ++ while (fr && fr != frag_now); ++ } ++ ++ return len - start_off + (frag_now_ptr - frag_now->fr_literal); ++} ++ + static void + output_insn (void) + { + fragS *insn_start_frag; + offsetT insn_start_off; ++ fragS *fragP = NULL; ++ enum align_branch_kind branch = align_branch_none; + + /* Tie dwarf2 debug info to the address at the start of the insn. + We can't do this after the insn has been output as the current +@@ -7176,6 +7437,30 @@ output_insn (void) + insn_start_frag = frag_now; + insn_start_off = frag_now_fix (); + ++ if (add_branch_padding_frag_p (&branch)) ++ { ++ char *p; ++ unsigned int max_branch_padding_size = 14; ++ ++ /* Align section to boundary. */ ++ record_alignment (now_seg, align_branch_power); ++ ++ /* Make room for padding. */ ++ frag_grow (max_branch_padding_size); ++ ++ /* Start of the padding. */ ++ p = frag_more (0); ++ ++ fragP = frag_now; ++ ++ frag_var (rs_machine_dependent, max_branch_padding_size, 0, ++ ENCODE_RELAX_STATE (BRANCH_PADDING, 0), ++ NULL, 0, p); ++ ++ fragP->tc_frag_data.branch_type = branch; ++ fragP->tc_frag_data.max_bytes = max_branch_padding_size; ++ } ++ + /* Output jumps. */ + if (i.tm.opcode_modifier.jump) + output_branch (); +@@ -7217,6 +7502,44 @@ output_insn (void) + i.prefix[LOCK_PREFIX] = 0; + } + ++ if (branch) ++ /* Skip if this is a branch. */ ++ ; ++ else if (add_fused_jcc_padding_frag_p ()) ++ { ++ unsigned int max_fused_padding_size ++ = MAX_FUSED_JCC_PADDING_SIZE; ++ ++ /* Make room for padding. */ ++ frag_grow (max_fused_padding_size); ++ p = frag_more (0); ++ ++ fragP = frag_now; ++ ++ frag_var (rs_machine_dependent, max_fused_padding_size, 0, ++ ENCODE_RELAX_STATE (FUSED_JCC_PADDING, 0), ++ NULL, 0, p); ++ ++ fragP->tc_frag_data.branch_type = align_branch_fused; ++ fragP->tc_frag_data.max_bytes = max_fused_padding_size; ++ } ++ else if (add_branch_prefix_frag_p ()) ++ { ++ unsigned int max_prefix_size = align_branch_prefix_size; ++ ++ /* Make room for padding. */ ++ frag_grow (max_prefix_size); ++ p = frag_more (0); ++ ++ fragP = frag_now; ++ ++ frag_var (rs_machine_dependent, max_prefix_size, 0, ++ ENCODE_RELAX_STATE (BRANCH_PREFIX, 0), ++ NULL, 0, p); ++ ++ fragP->tc_frag_data.max_bytes = max_prefix_size; ++ } ++ + /* Since the VEX/EVEX prefix contains the implicit prefix, we + don't need the explicit prefix. */ + if (!i.tm.opcode_modifier.vex && !i.tm.opcode_modifier.evex) +@@ -7358,6 +7681,83 @@ check_prefix: + + if (i.imm_operands) + output_imm (insn_start_frag, insn_start_off); ++ ++ if (now_seg != absolute_section) ++ { ++ j = encoding_length (insn_start_frag, insn_start_off, frag_more (0)); ++ if (fragP) ++ { ++ /* NB: Don't add prefix with GOTPC relocation since ++ output_disp() above depends on the fixed encoding ++ length. */ ++ unsigned int max = i.has_gotpc_reloc ? 0 : 15 - j; ++ /* Prefix count on the current instruction. */ ++ unsigned int count = 0; ++ unsigned int k; ++ for (k = 0; k < ARRAY_SIZE (i.prefix); k++) ++ if (i.prefix[k]) ++ count++; ++ ++ /* NB: prefix count + instruction size must be <= 15. */ ++ if (j > 15) ++ as_fatal (_("instruction length of %u bytes exceeds the limit of 15"), ++ j); ++ ++ if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) ++ == BRANCH_PREFIX) ++ { ++ /* Set the maximum prefix size in BRANCH_PREFIX ++ frag. */ ++ if (fragP->tc_frag_data.max_bytes > max) ++ fragP->tc_frag_data.max_bytes = max; ++ if (fragP->tc_frag_data.max_bytes > count) ++ fragP->tc_frag_data.max_bytes -= count; ++ else ++ fragP->tc_frag_data.max_bytes = 0; ++ } ++ else ++ { ++ /* Remember the maximum prefix size in FUSED_JCC_PADDING ++ frag. */ ++ unsigned int max_prefix_size; ++ if (align_branch_prefix_size > max) ++ max_prefix_size = max; ++ else ++ max_prefix_size = align_branch_prefix_size; ++ if (max_prefix_size > count) ++ fragP->tc_frag_data.max_prefix_length ++ = max_prefix_size - count; ++ } ++ ++ /* Use existing segment prefix if possible. Use CS ++ segment prefix in 64-bit mode. In 32-bit mode, use SS ++ segment prefix with ESP/EBP base register and use DS ++ segment prefix without ESP/EBP base register. */ ++ if (i.prefix[SEG_PREFIX]) ++ fragP->tc_frag_data.default_prefix = i.prefix[SEG_PREFIX]; ++ else if (flag_code == CODE_64BIT) ++ fragP->tc_frag_data.default_prefix = CS_PREFIX_OPCODE; ++ else if (i.base_reg ++ && (i.base_reg->reg_num == 4 ++ || i.base_reg->reg_num == 5)) ++ fragP->tc_frag_data.default_prefix = SS_PREFIX_OPCODE; ++ else ++ fragP->tc_frag_data.default_prefix = DS_PREFIX_OPCODE; ++ } ++ else if (j > 15) ++ as_warn (_("instruction length of %u bytes exceeds the limit of 15"), ++ j); ++ } ++ } ++ ++ if (align_branch_power ++ && now_seg != absolute_section ++ && cpu_arch_flags.bitfield.cpui386) ++ { ++ /* Terminate each frag so that we can add prefix and check for ++ fused jcc. */ ++ frag_wane (frag_now); ++ frag_new (0); + } + + #ifdef DEBUG386 +@@ -7484,6 +7884,7 @@ output_disp (fragS *insn_start_frag, off + { + reloc_type = BFD_RELOC_386_GOTPC; + i.op[n].imms->X_add_number += add; ++ i.has_gotpc_reloc = TRUE; + } + else if (reloc_type == BFD_RELOC_64) + reloc_type = BFD_RELOC_X86_64_GOTPC64; +@@ -7649,6 +8050,7 @@ output_imm (fragS *insn_start_frag, offs + reloc_type = BFD_RELOC_X86_64_GOTPC32; + else if (size == 8) + reloc_type = BFD_RELOC_X86_64_GOTPC64; ++ i.has_gotpc_reloc = TRUE; + i.op[n].imms->X_add_number += add; + } + fix_new_exp (frag_now, p - frag_now->fr_literal, size, +@@ -9264,6 +9666,355 @@ elf_symbol_resolved_in_segment_p (symbol + } + #endif + ++/* Return the next non-empty frag. */ ++ ++static fragS * ++i386_next_non_empty_frag (fragS *fragP) ++{ ++ /* There may be a frag with a ".fill 0" when there is no room in ++ the current frag for frag_grow in output_insn. */ ++ for (fragP = fragP->fr_next; ++ (fragP != NULL ++ && fragP->fr_type == rs_fill ++ && fragP->fr_fix == 0); ++ fragP = fragP->fr_next) ++ ; ++ return fragP; ++} ++ ++/* Return the next jcc frag after BRANCH_PADDING. */ ++ ++static fragS * ++i386_next_jcc_frag (fragS *fragP) ++{ ++ if (!fragP) ++ return NULL; ++ ++ if (fragP->fr_type == rs_machine_dependent ++ && (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) ++ == BRANCH_PADDING)) ++ { ++ fragP = i386_next_non_empty_frag (fragP); ++ if (fragP->fr_type != rs_machine_dependent) ++ return NULL; ++ if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == COND_JUMP) ++ return fragP; ++ } ++ ++ return NULL; ++} ++ ++/* Classify BRANCH_PADDING, BRANCH_PREFIX and FUSED_JCC_PADDING frags. */ ++ ++static void ++i386_classify_machine_dependent_frag (fragS *fragP) ++{ ++ fragS *cmp_fragP; ++ fragS *pad_fragP; ++ fragS *branch_fragP; ++ fragS *next_fragP; ++ unsigned int max_prefix_length; ++ ++ if (fragP->tc_frag_data.classified) ++ return; ++ ++ /* First scan for BRANCH_PADDING and FUSED_JCC_PADDING. Convert ++ FUSED_JCC_PADDING and merge BRANCH_PADDING. */ ++ for (next_fragP = fragP; ++ next_fragP != NULL; ++ next_fragP = next_fragP->fr_next) ++ { ++ next_fragP->tc_frag_data.classified = 1; ++ if (next_fragP->fr_type == rs_machine_dependent) ++ switch (TYPE_FROM_RELAX_STATE (next_fragP->fr_subtype)) ++ { ++ case BRANCH_PADDING: ++ /* The BRANCH_PADDING frag must be followed by a branch ++ frag. */ ++ branch_fragP = i386_next_non_empty_frag (next_fragP); ++ next_fragP->tc_frag_data.u.branch_fragP = branch_fragP; ++ break; ++ case FUSED_JCC_PADDING: ++ /* Check if this is a fused jcc: ++ FUSED_JCC_PADDING ++ CMP ++ BRANCH_PADDING ++ COND_JUMP ++ */ ++ cmp_fragP = i386_next_non_empty_frag (next_fragP); ++ pad_fragP = i386_next_non_empty_frag (cmp_fragP); ++ branch_fragP = i386_next_jcc_frag (pad_fragP); ++ if (branch_fragP) ++ { ++ /* The BRANCH_PADDING frag is merged with the ++ FUSED_JCC_PADDING frag. */ ++ next_fragP->tc_frag_data.u.branch_fragP = branch_fragP; ++ /* CMP instruction size. */ ++ next_fragP->tc_frag_data.cmp_size = cmp_fragP->fr_fix; ++ frag_wane (pad_fragP); ++ /* Skip to branch_fragP. */ ++ next_fragP = branch_fragP; ++ } ++ else if (next_fragP->tc_frag_data.max_prefix_length) ++ { ++ /* Turn FUSED_JCC_PADDING into BRANCH_PREFIX if it isn't ++ a fused jcc. */ ++ next_fragP->fr_subtype ++ = ENCODE_RELAX_STATE (BRANCH_PREFIX, 0); ++ next_fragP->tc_frag_data.max_bytes ++ = next_fragP->tc_frag_data.max_prefix_length; ++ /* This will be updated in the BRANCH_PREFIX scan. */ ++ next_fragP->tc_frag_data.max_prefix_length = 0; ++ } ++ else ++ frag_wane (next_fragP); ++ break; ++ } ++ } ++ ++ /* Scan for BRANCH_PREFIX. */ ++ for (; fragP != NULL; fragP = fragP->fr_next) ++ if (fragP->fr_type == rs_machine_dependent ++ && (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) ++ == BRANCH_PREFIX)) ++ { ++ /* Count all BRANCH_PREFIX frags before BRANCH_PADDING and ++ COND_JUMP_PREFIX. */ ++ max_prefix_length = 0; ++ for (next_fragP = fragP; ++ next_fragP != NULL; ++ next_fragP = next_fragP->fr_next) ++ { ++ if (next_fragP->fr_type == rs_fill) ++ /* Skip rs_fill frags. */ ++ ; ++ else if (next_fragP->fr_type == rs_machine_dependent) ++ { ++ if (TYPE_FROM_RELAX_STATE (next_fragP->fr_subtype) ++ == BRANCH_PREFIX) ++ { ++ /* Count BRANCH_PREFIX frags. */ ++ if (max_prefix_length >= MAX_FUSED_JCC_PADDING_SIZE) ++ { ++ max_prefix_length = MAX_FUSED_JCC_PADDING_SIZE; ++ frag_wane (next_fragP); ++ } ++ else ++ max_prefix_length ++ += next_fragP->tc_frag_data.max_bytes; ++ } ++ else if ((TYPE_FROM_RELAX_STATE (next_fragP->fr_subtype) ++ == BRANCH_PADDING) ++ || (TYPE_FROM_RELAX_STATE (next_fragP->fr_subtype) ++ == FUSED_JCC_PADDING)) ++ { ++ /* Stop at BRANCH_PADDING and FUSED_JCC_PADDING. */ ++ fragP->tc_frag_data.u.padding_fragP = next_fragP; ++ break; ++ } ++ else ++ /* Stop for other rs_machine_dependent frags. */ ++ break; ++ } ++ else ++ /* Stop for all other frags. */ ++ break; ++ } ++ ++ fragP->tc_frag_data.max_prefix_length = max_prefix_length; ++ ++ /* Skip to the next frag. */ ++ fragP = next_fragP; ++ } ++} ++ ++/* Compute padding size for ++ ++ FUSED_JCC_PADDING ++ CMP ++ BRANCH_PADDING ++ COND_JUMP/UNCOND_JUMP ++ ++ or ++ ++ BRANCH_PADDING ++ COND_JUMP/UNCOND_JUMP ++ */ ++ ++static int ++i386_branch_padding_size (fragS *fragP, offsetT address) ++{ ++ unsigned int offset, size, padding_size; ++ fragS *branch_fragP = fragP->tc_frag_data.u.branch_fragP; ++ ++ /* The start address of the BRANCH_PADDING or FUSED_JCC_PADDING frag. */ ++ if (!address) ++ address = fragP->fr_address; ++ address += fragP->fr_fix; ++ ++ /* CMP instrunction size. */ ++ size = fragP->tc_frag_data.cmp_size; ++ ++ /* The base size of the branch frag. */ ++ size += branch_fragP->fr_fix; ++ ++ /* Add opcode and displacement bytes for the rs_machine_dependent ++ branch frag. */ ++ if (branch_fragP->fr_type == rs_machine_dependent) ++ size += md_relax_table[branch_fragP->fr_subtype].rlx_length; ++ ++ /* Check if branch is within boundary and doesn't end at the last ++ byte. */ ++ offset = address & ((1U << align_branch_power) - 1); ++ if ((offset + size) >= (1U << align_branch_power)) ++ /* Padding needed to avoid crossing boundary. */ ++ padding_size = (1 << align_branch_power) - offset; ++ else ++ /* No padding needed. */ ++ padding_size = 0; ++ ++ if (!fits_in_signed_byte (padding_size)) ++ abort (); ++ ++ return padding_size; ++} ++ ++/* i386_generic_table_relax_frag() ++ ++ Handle BRANCH_PADDING, BRANCH_PREFIX and FUSED_JCC_PADDING frags to ++ grow/shrink padding to align branch frags. Hand others to ++ relax_frag(). */ ++ ++long ++i386_generic_table_relax_frag (segT segment, fragS *fragP, long stretch) ++{ ++ if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PADDING ++ || TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == FUSED_JCC_PADDING) ++ { ++ long padding_size = i386_branch_padding_size (fragP, 0); ++ long grow = padding_size - fragP->tc_frag_data.length; ++ ++ /* When the BRANCH_PREFIX frag is used, the computed address ++ must match the actual address and there should be no padding. */ ++ if (fragP->tc_frag_data.padding_address ++ && (fragP->tc_frag_data.padding_address != fragP->fr_address ++ || padding_size)) ++ abort (); ++ ++ /* Update the padding size. */ ++ if (grow) ++ fragP->tc_frag_data.length = padding_size; ++ ++ return grow; ++ } ++ else if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PREFIX) ++ { ++ fragS *padding_fragP, *next_fragP; ++ long padding_size, left_size, last_size; ++ ++ padding_fragP = fragP->tc_frag_data.u.padding_fragP; ++ if (!padding_fragP) ++ /* Use the padding set by the leading BRANCH_PREFIX frag. */ ++ return (fragP->tc_frag_data.length ++ - fragP->tc_frag_data.last_length); ++ ++ /* Compute the relative address of the padding frag in the very ++ first time where the BRANCH_PREFIX frag sizes are zero. */ ++ if (!fragP->tc_frag_data.padding_address) ++ fragP->tc_frag_data.padding_address ++ = padding_fragP->fr_address - (fragP->fr_address - stretch); ++ ++ /* First update the last length from the previous interation. */ ++ left_size = fragP->tc_frag_data.prefix_length; ++ for (next_fragP = fragP; ++ next_fragP != padding_fragP; ++ next_fragP = next_fragP->fr_next) ++ if (next_fragP->fr_type == rs_machine_dependent ++ && (TYPE_FROM_RELAX_STATE (next_fragP->fr_subtype) ++ == BRANCH_PREFIX)) ++ { ++ if (left_size) ++ { ++ int max = next_fragP->tc_frag_data.max_bytes; ++ if (max) ++ { ++ int size; ++ if (max > left_size) ++ size = left_size; ++ else ++ size = max; ++ left_size -= size; ++ next_fragP->tc_frag_data.last_length = size; ++ } ++ } ++ else ++ next_fragP->tc_frag_data.last_length = 0; ++ } ++ ++ /* Check the padding size for the padding frag. */ ++ padding_size = i386_branch_padding_size ++ (padding_fragP, (fragP->fr_address ++ + fragP->tc_frag_data.padding_address)); ++ ++ last_size = fragP->tc_frag_data.prefix_length; ++ /* Check if there is change from the last interation. */ ++ if (padding_size == last_size) ++ { ++ /* Update the expected address of the padding frag. */ ++ padding_fragP->tc_frag_data.padding_address ++ = (fragP->fr_address + padding_size ++ + fragP->tc_frag_data.padding_address); ++ return 0; ++ } ++ ++ if (padding_size > fragP->tc_frag_data.max_prefix_length) ++ { ++ /* No padding if there is no sufficient room. Clear the ++ expected address of the padding frag. */ ++ padding_fragP->tc_frag_data.padding_address = 0; ++ padding_size = 0; ++ } ++ else ++ /* Store the expected address of the padding frag. */ ++ padding_fragP->tc_frag_data.padding_address ++ = (fragP->fr_address + padding_size ++ + fragP->tc_frag_data.padding_address); ++ ++ fragP->tc_frag_data.prefix_length = padding_size; ++ ++ /* Update the length for the current interation. */ ++ left_size = padding_size; ++ for (next_fragP = fragP; ++ next_fragP != padding_fragP; ++ next_fragP = next_fragP->fr_next) ++ if (next_fragP->fr_type == rs_machine_dependent ++ && (TYPE_FROM_RELAX_STATE (next_fragP->fr_subtype) ++ == BRANCH_PREFIX)) ++ { ++ if (left_size) ++ { ++ int max = next_fragP->tc_frag_data.max_bytes; ++ if (max) ++ { ++ int size; ++ if (max > left_size) ++ size = left_size; ++ else ++ size = max; ++ left_size -= size; ++ next_fragP->tc_frag_data.length = size; ++ } ++ } ++ else ++ next_fragP->tc_frag_data.length = 0; ++ } ++ ++ return (fragP->tc_frag_data.length ++ - fragP->tc_frag_data.last_length); ++ } ++ return relax_frag (segment, fragP, stretch); ++} ++ + /* md_estimate_size_before_relax() + + Called just before relax() for rs_machine_dependent frags. The x86 +@@ -9280,6 +10031,14 @@ elf_symbol_resolved_in_segment_p (symbol + int + md_estimate_size_before_relax (fragS *fragP, segT segment) + { ++ if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PADDING ++ || TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PREFIX ++ || TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == FUSED_JCC_PADDING) ++ { ++ i386_classify_machine_dependent_frag (fragP); ++ return fragP->tc_frag_data.length; ++ } ++ + /* We've already got fragP->fr_subtype right; all we have to do is + check for un-relaxable symbols. On an ELF system, we can't relax + an externally visible symbol, because it may be overridden by a +@@ -9409,6 +10168,109 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNU + unsigned int extension = 0; + offsetT displacement_from_opcode_start; + ++ if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PADDING ++ || TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == FUSED_JCC_PADDING ++ || TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PREFIX) ++ { ++ /* Generate nop padding. */ ++ unsigned int size = fragP->tc_frag_data.length; ++ ++ if (size == 0) ++ return; ++ ++ if (size > fragP->tc_frag_data.max_bytes) ++ abort (); ++ ++ if (flag_debug) ++ { ++ const char *msg; ++ const char *branch = "branch"; ++ const char *prefix = ""; ++ fragS *padding_fragP; ++ ++ if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) ++ == BRANCH_PREFIX) ++ { ++ padding_fragP = fragP->tc_frag_data.u.padding_fragP; ++ switch (fragP->tc_frag_data.default_prefix) ++ { ++ default: ++ abort (); ++ break; ++ case CS_PREFIX_OPCODE: ++ prefix = " cs"; ++ break; ++ case DS_PREFIX_OPCODE: ++ prefix = " ds"; ++ break; ++ case ES_PREFIX_OPCODE: ++ prefix = " es"; ++ break; ++ case FS_PREFIX_OPCODE: ++ prefix = " fs"; ++ break; ++ case GS_PREFIX_OPCODE: ++ prefix = " gs"; ++ break; ++ case SS_PREFIX_OPCODE: ++ prefix = " ss"; ++ break; ++ } ++ if (padding_fragP) ++ msg = _("%s:%u: add %d%s at 0x%llx to align " ++ "%s within %d-byte boundary\n"); ++ else ++ msg = _("%s:%u: add additional %d%s at 0x%llx to " ++ "align %s within %d-byte boundary\n"); ++ } ++ else ++ { ++ padding_fragP = fragP; ++ msg = _("%s:%u: add %d%s-byte nop at 0x%llx to align " ++ "%s within %d-byte boundary\n"); ++ } ++ ++ if (padding_fragP) ++ switch (padding_fragP->tc_frag_data.branch_type) ++ { ++ case align_branch_jcc: ++ branch = "jcc"; ++ break; ++ case align_branch_fused: ++ branch = "fused jcc"; ++ break; ++ case align_branch_jmp: ++ branch = "jmp"; ++ break; ++ case align_branch_call: ++ branch = "call"; ++ break; ++ case align_branch_indirect: ++ branch = "indiret branch"; ++ break; ++ case align_branch_ret: ++ branch = "ret"; ++ break; ++ default: ++ break; ++ } ++ ++ fprintf (stdout, msg, ++ fragP->fr_file, fragP->fr_line, size, prefix, ++ (long long) fragP->fr_address, branch, ++ 1 << align_branch_power); ++ } ++ ++ if (TYPE_FROM_RELAX_STATE (fragP->fr_subtype) == BRANCH_PREFIX) ++ memset (fragP->fr_opcode, ++ fragP->tc_frag_data.default_prefix, size); ++ else ++ i386_align_code (fragP, size); ++ fragP->fr_fix += size; ++ ++ return; ++ } ++ + opcode = (unsigned char *) fragP->fr_opcode; + + /* Address we want to reach in file space. */ +@@ -9963,6 +10825,10 @@ const char *md_shortopts = "qn"; + #define OPTION_MINTEL64 (OPTION_MD_BASE + 23) + #define OPTION_MFENCE_AS_LOCK_ADD (OPTION_MD_BASE + 24) + #define OPTION_MRELAX_RELOCATIONS (OPTION_MD_BASE + 25) ++#define OPTION_MALIGN_BRANCH_BOUNDARY (OPTION_MD_BASE + 27) ++#define OPTION_MALIGN_BRANCH_PREFIX_SIZE (OPTION_MD_BASE + 28) ++#define OPTION_MALIGN_BRANCH (OPTION_MD_BASE + 29) ++#define OPTION_MBRANCHES_WITH_32B_BOUNDARIES (OPTION_MD_BASE + 30) + + struct option md_longopts[] = + { +@@ -9997,6 +10863,10 @@ struct option md_longopts[] = + {"mfence-as-lock-add", required_argument, NULL, OPTION_MFENCE_AS_LOCK_ADD}, + {"mrelax-relocations", required_argument, NULL, OPTION_MRELAX_RELOCATIONS}, + {"mevexrcig", required_argument, NULL, OPTION_MEVEXRCIG}, ++ {"malign-branch-boundary", required_argument, NULL, OPTION_MALIGN_BRANCH_BOUNDARY}, ++ {"malign-branch-prefix-size", required_argument, NULL, OPTION_MALIGN_BRANCH_PREFIX_SIZE}, ++ {"malign-branch", required_argument, NULL, OPTION_MALIGN_BRANCH}, ++ {"mbranches-within-32B-boundaries", no_argument, NULL, OPTION_MBRANCHES_WITH_32B_BOUNDARIES}, + {"mamd64", no_argument, NULL, OPTION_MAMD64}, + {"mintel64", no_argument, NULL, OPTION_MINTEL64}, + {NULL, no_argument, NULL, 0} +@@ -10007,7 +10877,7 @@ int + md_parse_option (int c, const char *arg) + { + unsigned int j; +- char *arch, *next, *saved; ++ char *arch, *next, *saved, *type; + + switch (c) + { +@@ -10110,6 +10980,82 @@ md_parse_option (int c, const char *arg) + #endif + break; + ++ case OPTION_MALIGN_BRANCH_BOUNDARY: ++ { ++ char *end; ++ int align = strtoul (arg, &end, 0); ++ ++ if (*end == '\0') ++ { ++ if (align == 0) ++ { ++ align_branch_power = 0; ++ break; ++ } ++ else if (align >= 32) ++ { ++ int align_power; ++ ++ for (align_power = 0; ++ (align & 1) == 0; ++ align >>= 1, align_power++) ++ continue; ++ ++ if (align == 1) ++ { ++ align_branch_power = align_power; ++ break; ++ } ++ } ++ } ++ as_fatal (_("invalid -malign-branch-boundary= value: %s"), arg); ++ } ++ break; ++ ++ case OPTION_MALIGN_BRANCH_PREFIX_SIZE: ++ { ++ char *end; ++ int align = strtoul (arg, &end, 0); ++ ++ if (*end == '\0' && align >= 0 && align < 6) ++ { ++ align_branch_prefix_size = align; ++ break; ++ } ++ as_fatal (_("invalid -malign-branch-prefix-size= value: %s"), ++ arg); ++ } ++ break; ++ ++ case OPTION_MALIGN_BRANCH: ++ align_branch = 0; ++ saved = xstrdup (arg); ++ type = saved; ++ do ++ { ++ next = strchr (type, '+'); ++ if (next) ++ *next++ = '\0'; ++ if (strcasecmp (type, "jcc") == 0) ++ align_branch |= align_branch_jcc; ++ else if (strcasecmp (type, "fused") == 0) ++ align_branch |= align_branch_fused; ++ else if (strcasecmp (type, "jmp") == 0) ++ align_branch |= align_branch_jmp; ++ else if (strcasecmp (type, "call") == 0) ++ align_branch |= align_branch_call; ++ else if (strcasecmp (type, "ret") == 0) ++ align_branch |= align_branch_ret; ++ else if (strcasecmp (type, "indirect") == 0) ++ align_branch |= align_branch_indirect; ++ else ++ as_fatal (_("invalid -malign-branch= option: `%s'"), arg); ++ type = next; ++ } ++ while (next != NULL); ++ free (saved); ++ break; ++ + case OPTION_MARCH: + saved = xstrdup (arg); + arch = saved; +@@ -10363,6 +11309,14 @@ md_parse_option (int c, const char *arg) + as_fatal (_("invalid -mrelax-relocations= option: `%s'"), arg); + break; + ++ case OPTION_MBRANCHES_WITH_32B_BOUNDARIES: ++ align_branch_power = 5; ++ align_branch_prefix_size = 5; ++ align_branch = (align_branch_jcc ++ | align_branch_fused ++ | align_branch_jmp); ++ break; ++ + case OPTION_MAMD64: + intel64 = 0; + break; +@@ -10567,6 +11521,20 @@ md_show_usage (FILE *stream) + -mrelax-relocations=[no|yes]\n\ + generate relax relocations\n")); + fprintf (stream, _("\ ++ -malign-branch-boundary=NUM (default: 0)\n\ ++ align branches within NUM byte boundary\n")); ++ fprintf (stream, _("\ ++ -malign-branch=TYPE[+TYPE...] (default: jcc+fused+jmp)\n\ ++ TYPE is combination of jcc, fused, jmp, call, ret,\n\ ++ indirect\n\ ++ specify types of branches to align\n")); ++ fprintf (stream, _("\ ++ -malign-branch-prefix-size=NUM (default: 5)\n\ ++ align branches with NUM prefixes per instruction\n")); ++ fprintf (stream, _("\ ++ -mbranches-within-32B-boundaries\n\ ++ align branches within 32 byte boundary\n")); ++ fprintf (stream, _("\ + -mamd64 accept only AMD64 ISA\n")); + fprintf (stream, _("\ + -mintel64 accept only Intel64 ISA\n")); +@@ -10650,17 +11618,26 @@ i386_target_format (void) + { + default: + format = ELF_TARGET_FORMAT; ++#ifndef TE_SOLARIS ++ tls_get_addr = "___tls_get_addr"; ++#endif + break; + case X86_64_ABI: + use_rela_relocations = 1; + object_64bit = 1; + format = ELF_TARGET_FORMAT64; ++#ifndef TE_SOLARIS ++ tls_get_addr = "__tls_get_addr"; ++#endif + break; + case X86_64_X32_ABI: + use_rela_relocations = 1; + object_64bit = 1; + disallow_64bit_reloc = 1; + format = ELF_TARGET_FORMAT32; ++#ifndef TE_SOLARIS ++ tls_get_addr = "__tls_get_addr"; ++#endif + break; + } + if (cpu_arch_isa == PROCESSOR_L1OM) +@@ -10775,6 +11752,21 @@ s_bss (int ignore ATTRIBUTE_UNUSED) + + #endif + ++/* Remember constant diretive. */ ++ ++void ++i386_cons_worker (int ignore ATTRIBUTE_UNUSED) ++{ ++ if (last_insn.kind != last_insn_directive ++ && (bfd_get_section_flags (NULL, now_seg) & SEC_CODE)) ++ { ++ last_insn.seg = now_seg; ++ last_insn.kind = last_insn_directive; ++ last_insn.name = "constant diretive"; ++ last_insn.file = as_where (&last_insn.line); ++ } ++} ++ + void + i386_validate_fix (fixS *fixp) + { +diff -rupN binutils.orig/gas/config/tc-i386.h binutils-2.30/gas/config/tc-i386.h +--- binutils.orig/gas/config/tc-i386.h 2019-11-20 10:59:21.585883785 +0000 ++++ binutils-2.30/gas/config/tc-i386.h 2019-11-20 15:24:24.677440688 +0000 +@@ -215,12 +215,19 @@ if (fragP->fr_type == rs_align_code) + - fragP->fr_address \ + - fragP->fr_fix)); + ++extern void i386_cons_worker (int); ++#define md_cons_align(nbytes) i386_cons_worker (nbytes) ++ + void i386_print_statistics (FILE *); + #define tc_print_statistics i386_print_statistics + + extern unsigned int i386_frag_max_var (fragS *); + #define md_frag_max_var i386_frag_max_var + ++extern long i386_generic_table_relax_frag (segT, fragS *, long); ++#define md_generic_table_relax_frag(segment, fragP, stretch) \ ++ i386_generic_table_relax_frag (segment, fragP, stretch) ++ + #define md_number_to_chars number_to_chars_littleendian + + enum processor_type +@@ -255,9 +262,24 @@ extern i386_cpu_flags cpu_arch_isa_flags + + struct i386_tc_frag_data + { ++ union ++ { ++ fragS *padding_fragP; ++ fragS *branch_fragP; ++ } u; ++ addressT padding_address; + enum processor_type isa; + i386_cpu_flags isa_flags; ++ unsigned int max_bytes; + enum processor_type tune; ++ signed char length; ++ signed char last_length; ++ signed char max_prefix_length; ++ signed char prefix_length; ++ signed char default_prefix; ++ signed char cmp_size; ++ unsigned int classified : 1; ++ unsigned int branch_type : 7; + }; + + /* We need to emit the right NOP pattern in .align frags. This is +@@ -268,9 +290,20 @@ struct i386_tc_frag_data + #define TC_FRAG_INIT(FRAGP) \ + do \ + { \ ++ (FRAGP)->tc_frag_data.u.padding_fragP = NULL; \ ++ (FRAGP)->tc_frag_data.padding_address = 0; \ + (FRAGP)->tc_frag_data.isa = cpu_arch_isa; \ + (FRAGP)->tc_frag_data.isa_flags = cpu_arch_isa_flags; \ + (FRAGP)->tc_frag_data.tune = cpu_arch_tune; \ ++ (FRAGP)->tc_frag_data.length = 0; \ ++ (FRAGP)->tc_frag_data.max_bytes = max_chars; \ ++ (FRAGP)->tc_frag_data.last_length = 0; \ ++ (FRAGP)->tc_frag_data.max_prefix_length = 0; \ ++ (FRAGP)->tc_frag_data.prefix_length = 0; \ ++ (FRAGP)->tc_frag_data.default_prefix = 0; \ ++ (FRAGP)->tc_frag_data.cmp_size = 0; \ ++ (FRAGP)->tc_frag_data.classified = 0; \ ++ (FRAGP)->tc_frag_data.branch_type = 0; \ + } \ + while (0) + +diff -rupN binutils.orig/gas/doc/c-i386.texi binutils-2.30/gas/doc/c-i386.texi +--- binutils.orig/gas/doc/c-i386.texi 2019-11-20 10:59:21.590883746 +0000 ++++ binutils-2.30/gas/doc/c-i386.texi 2019-11-20 15:08:24.874736461 +0000 +@@ -389,6 +389,43 @@ R_X86_64_REX_GOTPCRELX, in 64-bit mode. + relocations. The default can be controlled by a configure option + @option{--enable-x86-relax-relocations}. + ++@cindex @samp{-malign-branch-boundary=} option, i386 ++@cindex @samp{-malign-branch-boundary=} option, x86-64 ++@item -malign-branch-boundary=@var{NUM} ++This option controls how the assembler should align branches with segment ++prefixes or NOP. @var{NUM} must be a power of 2. It should be 0 or ++no less than 32. Branches will be aligned within @var{NUM} byte ++boundary. @option{-malign-branch-boundary=0}, which is the default, ++doesn't align branches. ++ ++@cindex @samp{-malign-branch=} option, i386 ++@cindex @samp{-malign-branch=} option, x86-64 ++@item -malign-branch=@var{TYPE}[+@var{TYPE}...] ++This option specifies types of branches to align. @var{TYPE} is ++combination of @samp{jcc}, which aligns conditional jumps, ++@samp{fused}, which aligns fused conditional jumps, @samp{jmp}, ++which aligns unconditional jumps, @samp{call} which aligns calls, ++@samp{ret}, which aligns rets, @samp{indirect}, which aligns indirect ++jumps and calls. The default is @option{-malign-branch=jcc+fused+jmp}. ++ ++@cindex @samp{-malign-branch-prefix-size=} option, i386 ++@cindex @samp{-malign-branch-prefix-size=} option, x86-64 ++@item -malign-branch-prefix-size=@var{NUM} ++This option specifies the maximum number of prefixes on an instruction ++to align branches. @var{NUM} should be between 0 and 5. The default ++@var{NUM} is 5. ++ ++@cindex @samp{-mbranches-within-32B-boundaries} option, i386 ++@cindex @samp{-mbranches-within-32B-boundaries} option, x86-64 ++@item -mbranches-within-32B-boundaries ++This option aligns conditional jumps, fused conditional jumps and ++unconditional jumps within 32 byte boundary with up to 5 segment prefixes ++on an instruction. It is equivalent to ++@option{-malign-branch-boundary=32} ++@option{-malign-branch=jcc+fused+jmp} ++@option{-malign-branch-prefix-size=5}. ++The default doesn't align branches. ++ + @cindex @samp{-mevexrcig=} option, i386 + @cindex @samp{-mevexrcig=} option, x86-64 + @item -mevexrcig=@var{rne} +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1a.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1a.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-1a.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1a.d 2019-11-20 14:09:25.593915106 +0000 +@@ -0,0 +1,77 @@ ++#source: align-branch-1.s ++#as: -malign-branch-boundary=32 ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 65 65 65 a3 01 00 00 00 gs gs mov %eax,%gs:0x1 ++ 8: 55 push %ebp ++ 9: 55 push %ebp ++ a: 55 push %ebp ++ b: 55 push %ebp ++ c: 89 e5 mov %esp,%ebp ++ e: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 11: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 20: 39 c5 cmp %eax,%ebp ++ 22: 74 5e je 82 ++ 24: 3e 89 73 f4 mov %esi,%ds:-0xc\(%ebx\) ++ 28: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 2b: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3d: 5d pop %ebp ++ 3e: 5d pop %ebp ++ 3f: 5d pop %ebp ++ 40: 74 40 je 82 ++ 42: 5d pop %ebp ++ 43: 74 3d je 82 ++ 45: 36 89 44 24 fc mov %eax,%ss:-0x4\(%esp\) ++ 4a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 4d: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 50: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 53: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 56: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 59: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5c: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5f: 5d pop %ebp ++ 60: eb 26 jmp 88 ++ 62: eb 24 jmp 88 ++ 64: eb 22 jmp 88 ++ 66: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 69: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 6c: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 6f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 72: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 75: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 78: 5d pop %ebp ++ 79: 5d pop %ebp ++ 7a: 39 c5 cmp %eax,%ebp ++ 7c: 74 04 je 82 ++ 7e: 66 90 xchg %ax,%ax ++ 80: eb 06 jmp 88 ++ 82: 8b 45 f4 mov -0xc\(%ebp\),%eax ++ 85: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ a0: 89 75 0c mov %esi,0xc\(%ebp\) ++ a3: e9 [0-9a-f ]+ jmp .* ++ a8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ae: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ b4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ba: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ c0: 89 75 00 mov %esi,0x0\(%ebp\) ++ c3: 74 c3 je 88 ++ c5: 74 c1 je 88 ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1b.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1b.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-1b.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1b.d 2019-11-20 14:09:25.593915106 +0000 +@@ -0,0 +1,77 @@ ++#source: align-branch-1.s ++#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 65 65 65 a3 01 00 00 00 gs gs mov %eax,%gs:0x1 ++ 8: 55 push %ebp ++ 9: 55 push %ebp ++ a: 55 push %ebp ++ b: 55 push %ebp ++ c: 89 e5 mov %esp,%ebp ++ e: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 11: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 20: 39 c5 cmp %eax,%ebp ++ 22: 74 5e je 82 ++ 24: 3e 89 73 f4 mov %esi,%ds:-0xc\(%ebx\) ++ 28: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 2b: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3d: 5d pop %ebp ++ 3e: 5d pop %ebp ++ 3f: 5d pop %ebp ++ 40: 74 40 je 82 ++ 42: 5d pop %ebp ++ 43: 74 3d je 82 ++ 45: 36 89 44 24 fc mov %eax,%ss:-0x4\(%esp\) ++ 4a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 4d: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 50: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 53: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 56: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 59: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5c: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5f: 5d pop %ebp ++ 60: eb 26 jmp 88 ++ 62: eb 24 jmp 88 ++ 64: eb 22 jmp 88 ++ 66: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 69: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 6c: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 6f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 72: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 75: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 78: 5d pop %ebp ++ 79: 5d pop %ebp ++ 7a: 39 c5 cmp %eax,%ebp ++ 7c: 74 04 je 82 ++ 7e: 66 90 xchg %ax,%ax ++ 80: eb 06 jmp 88 ++ 82: 8b 45 f4 mov -0xc\(%ebp\),%eax ++ 85: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ a0: 89 75 0c mov %esi,0xc\(%ebp\) ++ a3: e9 [0-9a-f ]+ jmp .* ++ a8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ae: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ b4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ba: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ c0: 89 75 00 mov %esi,0x0\(%ebp\) ++ c3: 74 c3 je 88 ++ c5: 74 c1 je 88 ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1c.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1c.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-1c.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1c.d 2019-11-20 14:09:25.594915098 +0000 +@@ -0,0 +1,77 @@ ++#source: align-branch-1.s ++#as: -malign-branch-boundary=32 -malign-branch-prefix-size=1 ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 65 a3 01 00 00 00 mov %eax,%gs:0x1 ++ 6: 3e 55 ds push %ebp ++ 8: 3e 55 ds push %ebp ++ a: 55 push %ebp ++ b: 55 push %ebp ++ c: 89 e5 mov %esp,%ebp ++ e: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 11: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 20: 39 c5 cmp %eax,%ebp ++ 22: 74 5e je 82 ++ 24: 3e 89 73 f4 mov %esi,%ds:-0xc\(%ebx\) ++ 28: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 2b: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3d: 5d pop %ebp ++ 3e: 5d pop %ebp ++ 3f: 5d pop %ebp ++ 40: 74 40 je 82 ++ 42: 5d pop %ebp ++ 43: 74 3d je 82 ++ 45: 36 89 44 24 fc mov %eax,%ss:-0x4\(%esp\) ++ 4a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 4d: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 50: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 53: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 56: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 59: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5c: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5f: 5d pop %ebp ++ 60: eb 26 jmp 88 ++ 62: eb 24 jmp 88 ++ 64: eb 22 jmp 88 ++ 66: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 69: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 6c: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 6f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 72: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 75: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 78: 5d pop %ebp ++ 79: 5d pop %ebp ++ 7a: 39 c5 cmp %eax,%ebp ++ 7c: 74 04 je 82 ++ 7e: 66 90 xchg %ax,%ax ++ 80: eb 06 jmp 88 ++ 82: 8b 45 f4 mov -0xc\(%ebp\),%eax ++ 85: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ a0: 89 75 0c mov %esi,0xc\(%ebp\) ++ a3: e9 [0-9a-f ]+ jmp .* ++ a8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ae: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ b4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ba: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ c0: 89 75 00 mov %esi,0x0\(%ebp\) ++ c3: 74 c3 je 88 ++ c5: 74 c1 je 88 ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1d.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1d.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-1d.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1d.d 2019-11-20 14:09:25.594915098 +0000 +@@ -0,0 +1,76 @@ ++#source: align-branch-1.s ++#as: -malign-branch-boundary=32 -malign-branch=fused+jcc ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 65 65 65 a3 01 00 00 00 gs gs mov %eax,%gs:0x1 ++ 8: 55 push %ebp ++ 9: 55 push %ebp ++ a: 55 push %ebp ++ b: 55 push %ebp ++ c: 89 e5 mov %esp,%ebp ++ e: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 11: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 20: 39 c5 cmp %eax,%ebp ++ 22: 74 5b je 7f ++ 24: 3e 89 73 f4 mov %esi,%ds:-0xc\(%ebx\) ++ 28: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 2b: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3d: 5d pop %ebp ++ 3e: 5d pop %ebp ++ 3f: 5d pop %ebp ++ 40: 74 3d je 7f ++ 42: 5d pop %ebp ++ 43: 74 3a je 7f ++ 45: 89 44 24 fc mov %eax,-0x4\(%esp\) ++ 49: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 4c: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 4f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 52: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 55: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 58: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5b: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5e: 5d pop %ebp ++ 5f: eb 24 jmp 85 ++ 61: eb 22 jmp 85 ++ 63: eb 20 jmp 85 ++ 65: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 68: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 6b: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 6e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 71: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 74: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 77: 5d pop %ebp ++ 78: 5d pop %ebp ++ 79: 39 c5 cmp %eax,%ebp ++ 7b: 74 02 je 7f ++ 7d: eb 06 jmp 85 ++ 7f: 8b 45 f4 mov -0xc\(%ebp\),%eax ++ 82: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 85: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 8b: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 91: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 97: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 9d: 89 75 0c mov %esi,0xc\(%ebp\) ++ a0: e9 [0-9a-f ]+ jmp .* ++ a5: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ab: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ b1: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ b7: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ bd: 89 75 00 mov %esi,0x0\(%ebp\) ++ c0: 74 c3 je 85 ++ c2: 74 c1 je 85 ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1e.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1e.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-1e.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1e.d 2019-11-20 14:09:25.594915098 +0000 +@@ -0,0 +1,77 @@ ++#source: align-branch-1.s ++#as: -malign-branch-boundary=32 -malign-branch=jcc ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 65 a3 01 00 00 00 mov %eax,%gs:0x1 ++ 6: 55 push %ebp ++ 7: 55 push %ebp ++ 8: 55 push %ebp ++ 9: 55 push %ebp ++ a: 89 e5 mov %esp,%ebp ++ c: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 12: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 15: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 18: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1b: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1e: 39 c5 cmp %eax,%ebp ++ 20: 74 5a je 7c ++ 22: 89 73 f4 mov %esi,-0xc\(%ebx\) ++ 25: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 28: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 2b: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3a: 5d pop %ebp ++ 3b: 5d pop %ebp ++ 3c: 5d pop %ebp ++ 3d: 74 3d je 7c ++ 3f: 5d pop %ebp ++ 40: 74 3a je 7c ++ 42: 89 44 24 fc mov %eax,-0x4\(%esp\) ++ 46: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 49: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 4c: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 4f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 52: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 55: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 58: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5b: 5d pop %ebp ++ 5c: eb 24 jmp 82 ++ 5e: eb 22 jmp 82 ++ 60: eb 20 jmp 82 ++ 62: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 65: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 68: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 6b: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 6e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 71: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 74: 5d pop %ebp ++ 75: 5d pop %ebp ++ 76: 39 c5 cmp %eax,%ebp ++ 78: 74 02 je 7c ++ 7a: eb 06 jmp 82 ++ 7c: 8b 45 f4 mov -0xc\(%ebp\),%eax ++ 7f: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 82: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 9a: 89 75 0c mov %esi,0xc\(%ebp\) ++ 9d: e9 [0-9a-f ]+ jmp .* ++ a2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ a8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ae: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ b4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ba: 89 75 00 mov %esi,0x0\(%ebp\) ++ bd: 74 c3 je 82 ++ bf: 90 nop ++ c0: 74 c0 je 82 ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1f.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1f.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-1f.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1f.d 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,77 @@ ++#source: align-branch-1.s ++#as: -malign-branch-boundary=32 -malign-branch=jcc+jmp ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 65 a3 01 00 00 00 mov %eax,%gs:0x1 ++ 6: 55 push %ebp ++ 7: 55 push %ebp ++ 8: 55 push %ebp ++ 9: 55 push %ebp ++ a: 89 e5 mov %esp,%ebp ++ c: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 12: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 15: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 18: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1b: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1e: 39 c5 cmp %eax,%ebp ++ 20: 74 5c je 7e ++ 22: 89 73 f4 mov %esi,-0xc\(%ebx\) ++ 25: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 28: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 2b: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3a: 5d pop %ebp ++ 3b: 5d pop %ebp ++ 3c: 5d pop %ebp ++ 3d: 74 3f je 7e ++ 3f: 5d pop %ebp ++ 40: 74 3c je 7e ++ 42: 89 44 24 fc mov %eax,-0x4\(%esp\) ++ 46: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 49: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 4c: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 4f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 52: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 55: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 58: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5b: 5d pop %ebp ++ 5c: eb 27 jmp 85 ++ 5e: 66 90 xchg %ax,%ax ++ 60: eb 23 jmp 85 ++ 62: eb 21 jmp 85 ++ 64: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 67: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 6a: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 6d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 70: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 73: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 76: 5d pop %ebp ++ 77: 5d pop %ebp ++ 78: 39 c5 cmp %eax,%ebp ++ 7a: 74 02 je 7e ++ 7c: eb 07 jmp 85 ++ 7e: 36 8b 45 f4 mov %ss:-0xc\(%ebp\),%eax ++ 82: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 85: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 8b: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 91: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 97: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 9d: 89 75 0c mov %esi,0xc\(%ebp\) ++ a0: e9 [0-9a-f ]+ jmp .* ++ a5: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ab: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ b1: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ b7: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ bd: 89 75 00 mov %esi,0x0\(%ebp\) ++ c0: 74 c3 je 85 ++ c2: 74 c1 je 85 ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1g.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1g.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-1g.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1g.d 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,77 @@ ++#source: align-branch-1.s ++#as: -mbranches-within-32B-boundaries ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 65 65 65 a3 01 00 00 00 gs gs mov %eax,%gs:0x1 ++ 8: 55 push %ebp ++ 9: 55 push %ebp ++ a: 55 push %ebp ++ b: 55 push %ebp ++ c: 89 e5 mov %esp,%ebp ++ e: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 11: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 20: 39 c5 cmp %eax,%ebp ++ 22: 74 5e je 82 ++ 24: 3e 89 73 f4 mov %esi,%ds:-0xc\(%ebx\) ++ 28: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 2b: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3d: 5d pop %ebp ++ 3e: 5d pop %ebp ++ 3f: 5d pop %ebp ++ 40: 74 40 je 82 ++ 42: 5d pop %ebp ++ 43: 74 3d je 82 ++ 45: 36 89 44 24 fc mov %eax,%ss:-0x4\(%esp\) ++ 4a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 4d: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 50: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 53: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 56: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 59: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5c: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5f: 5d pop %ebp ++ 60: eb 26 jmp 88 ++ 62: eb 24 jmp 88 ++ 64: eb 22 jmp 88 ++ 66: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 69: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 6c: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 6f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 72: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 75: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 78: 5d pop %ebp ++ 79: 5d pop %ebp ++ 7a: 39 c5 cmp %eax,%ebp ++ 7c: 74 04 je 82 ++ 7e: 66 90 xchg %ax,%ax ++ 80: eb 06 jmp 88 ++ 82: 8b 45 f4 mov -0xc\(%ebp\),%eax ++ 85: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ a0: 89 75 0c mov %esi,0xc\(%ebp\) ++ a3: e9 [0-9a-f ]+ jmp .* ++ a8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ae: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ b4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ba: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ c0: 89 75 00 mov %esi,0x0\(%ebp\) ++ c3: 74 c3 je 88 ++ c5: 74 c1 je 88 ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1h.d binutils-2.30/gas/testsuite/gas/i386/align-branch-1h.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-1h.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1h.d 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,76 @@ ++#source: align-branch-1.s ++#as: -mbranches-within-32B-boundaries -malign-branch-boundary=0 ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 65 a3 01 00 00 00 mov %eax,%gs:0x1 ++ 6: 55 push %ebp ++ 7: 55 push %ebp ++ 8: 55 push %ebp ++ 9: 55 push %ebp ++ a: 89 e5 mov %esp,%ebp ++ c: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 12: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 15: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 18: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1b: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1e: 39 c5 cmp %eax,%ebp ++ 20: 74 5a je 7c ++ 22: 89 73 f4 mov %esi,-0xc\(%ebx\) ++ 25: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 28: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 2b: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3a: 5d pop %ebp ++ 3b: 5d pop %ebp ++ 3c: 5d pop %ebp ++ 3d: 74 3d je 7c ++ 3f: 5d pop %ebp ++ 40: 74 3a je 7c ++ 42: 89 44 24 fc mov %eax,-0x4\(%esp\) ++ 46: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 49: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 4c: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 4f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 52: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 55: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 58: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5b: 5d pop %ebp ++ 5c: eb 24 jmp 82 ++ 5e: eb 22 jmp 82 ++ 60: eb 20 jmp 82 ++ 62: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 65: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 68: 89 7d f8 mov %edi,-0x8\(%ebp\) ++ 6b: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 6e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 71: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 74: 5d pop %ebp ++ 75: 5d pop %ebp ++ 76: 39 c5 cmp %eax,%ebp ++ 78: 74 02 je 7c ++ 7a: eb 06 jmp 82 ++ 7c: 8b 45 f4 mov -0xc\(%ebp\),%eax ++ 7f: 89 45 fc mov %eax,-0x4\(%ebp\) ++ 82: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ 9a: 89 75 0c mov %esi,0xc\(%ebp\) ++ 9d: e9 [0-9a-f ]+ jmp .* ++ a2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ a8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ae: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ b4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%ebp\) ++ ba: 89 75 00 mov %esi,0x0\(%ebp\) ++ bd: 74 c3 je 82 ++ bf: 74 c1 je 82 ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-1.s binutils-2.30/gas/testsuite/gas/i386/align-branch-1.s +--- binutils.orig/gas/testsuite/gas/i386/align-branch-1.s 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-1.s 2019-11-20 14:09:25.592915114 +0000 +@@ -0,0 +1,72 @@ ++ .text ++ .globl foo ++ .p2align 4 ++foo: ++ movl %eax, %gs:0x1 ++ pushl %ebp ++ pushl %ebp ++ pushl %ebp ++ pushl %ebp ++ movl %esp, %ebp ++ movl %edi, -8(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ cmp %eax, %ebp ++ je .L_2 ++ movl %esi, -12(%ebx) ++ movl %esi, -12(%ebp) ++ movl %edi, -8(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ popl %ebp ++ popl %ebp ++ popl %ebp ++ je .L_2 ++ popl %ebp ++ je .L_2 ++ movl %eax, -4(%esp) ++ movl %esi, -12(%ebp) ++ movl %edi, -8(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ popl %ebp ++ jmp .L_3 ++ jmp .L_3 ++ jmp .L_3 ++ movl %eax, -4(%ebp) ++ movl %esi, -12(%ebp) ++ movl %edi, -8(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ popl %ebp ++ popl %ebp ++ cmp %eax, %ebp ++ je .L_2 ++ jmp .L_3 ++.L_2: ++ movl -12(%ebp), %eax ++ movl %eax, -4(%ebp) ++.L_3: ++ movl %esi, -1200(%ebp) ++ movl %esi, -1200(%ebp) ++ movl %esi, -1200(%ebp) ++ movl %esi, -1200(%ebp) ++ movl %esi, 12(%ebp) ++ jmp bar ++ movl %esi, -1200(%ebp) ++ movl %esi, -1200(%ebp) ++ movl %esi, -1200(%ebp) ++ movl %esi, -1200(%ebp) ++ movl %esi, (%ebp) ++ je .L_3 ++ je .L_3 +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-2a.d binutils-2.30/gas/testsuite/gas/i386/align-branch-2a.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-2a.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-2a.d 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,55 @@ ++#source: align-branch-2.s ++#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 6: 55 push %ebp ++ 7: 55 push %ebp ++ 8: 55 push %ebp ++ 9: 55 push %ebp ++ a: 89 e5 mov %esp,%ebp ++ c: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 12: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 15: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 18: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1b: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1e: ff e0 jmp \*%eax ++ 20: 55 push %ebp ++ 21: 55 push %ebp ++ 22: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 28: 89 e5 mov %esp,%ebp ++ 2a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 2d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 30: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 33: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 36: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 39: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3c: ff d0 call \*%eax ++ 3e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 41: 55 push %ebp ++ 42: 55 push %ebp ++ 43: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 49: 89 e5 mov %esp,%ebp ++ 4b: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 4e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 51: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 54: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 57: e8 [0-9a-f ]+ call .* ++ 5c: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5f: 55 push %ebp ++ 60: 55 push %ebp ++ 61: 55 push %ebp ++ 62: 55 push %ebp ++ 63: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 69: 89 e5 mov %esp,%ebp ++ 6b: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 6e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 71: ff 15 00 00 00 00 call \*0x0 ++ 77: 55 push %ebp ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-2b.d binutils-2.30/gas/testsuite/gas/i386/align-branch-2b.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-2b.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-2b.d 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,55 @@ ++#source: align-branch-2.s ++#as: -malign-branch-boundary=32 -malign-branch=indirect ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 64 64 a3 01 00 00 00 fs fs mov %eax,%fs:0x1 ++ 8: 55 push %ebp ++ 9: 55 push %ebp ++ a: 55 push %ebp ++ b: 55 push %ebp ++ c: 89 e5 mov %esp,%ebp ++ e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 11: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 20: ff e0 jmp \*%eax ++ 22: 3e 3e 55 ds ds push %ebp ++ 25: 55 push %ebp ++ 26: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 2c: 89 e5 mov %esp,%ebp ++ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 40: ff d0 call \*%eax ++ 42: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 45: 55 push %ebp ++ 46: 55 push %ebp ++ 47: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 4d: 89 e5 mov %esp,%ebp ++ 4f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 52: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 55: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 58: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5b: e8 [0-9a-f ]+ call .* ++ 60: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 63: 55 push %ebp ++ 64: 55 push %ebp ++ 65: 55 push %ebp ++ 66: 55 push %ebp ++ 67: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 6d: 89 e5 mov %esp,%ebp ++ 6f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 72: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 75: ff 15 00 00 00 00 call \*0x0 ++ 7b: 55 push %ebp ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-2c.d binutils-2.30/gas/testsuite/gas/i386/align-branch-2c.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-2c.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-2c.d 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,55 @@ ++#source: align-branch-2.s ++#as: -malign-branch-boundary=32 -malign-branch=indirect+call ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 64 64 a3 01 00 00 00 fs fs mov %eax,%fs:0x1 ++ 8: 55 push %ebp ++ 9: 55 push %ebp ++ a: 55 push %ebp ++ b: 55 push %ebp ++ c: 89 e5 mov %esp,%ebp ++ e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 11: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 20: ff e0 jmp \*%eax ++ 22: 3e 3e 55 ds ds push %ebp ++ 25: 55 push %ebp ++ 26: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 2c: 89 e5 mov %esp,%ebp ++ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 40: ff d0 call \*%eax ++ 42: 36 36 36 36 36 89 75 f4 ss ss ss ss mov %esi,%ss:-0xc\(%ebp\) ++ 4a: 55 push %ebp ++ 4b: 55 push %ebp ++ 4c: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 52: 89 e5 mov %esp,%ebp ++ 54: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 57: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 5d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 60: e8 [0-9a-f ]+ call .* ++ 65: 36 36 36 36 36 89 75 f4 ss ss ss ss mov %esi,%ss:-0xc\(%ebp\) ++ 6d: 3e 55 ds push %ebp ++ 6f: 55 push %ebp ++ 70: 55 push %ebp ++ 71: 55 push %ebp ++ 72: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 78: 89 e5 mov %esp,%ebp ++ 7a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 7d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 80: ff 15 00 00 00 00 call \*0x0 ++ 86: 55 push %ebp ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-2.s binutils-2.30/gas/testsuite/gas/i386/align-branch-2.s +--- binutils.orig/gas/testsuite/gas/i386/align-branch-2.s 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-2.s 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,49 @@ ++ .text ++ .globl foo ++ .p2align 4 ++foo: ++ movl %eax, %fs:0x1 ++ pushl %ebp ++ pushl %ebp ++ pushl %ebp ++ pushl %ebp ++ movl %esp, %ebp ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ jmp *%eax ++ pushl %ebp ++ pushl %ebp ++ movl %eax, %fs:0x1 ++ movl %esp, %ebp ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ call *%eax ++ movl %esi, -12(%ebp) ++ pushl %ebp ++ pushl %ebp ++ movl %eax, %fs:0x1 ++ movl %esp, %ebp ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ call foo ++ movl %esi, -12(%ebp) ++ pushl %ebp ++ pushl %ebp ++ pushl %ebp ++ pushl %ebp ++ movl %eax, %fs:0x1 ++ movl %esp, %ebp ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ call *foo ++ pushl %ebp +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-3.d binutils-2.30/gas/testsuite/gas/i386/align-branch-3.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-3.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-3.d 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,33 @@ ++#as: -malign-branch-boundary=32 -malign-branch=indirect+call ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 6: 55 push %ebp ++ 7: 55 push %ebp ++ 8: 55 push %ebp ++ 9: 55 push %ebp ++ a: 89 e5 mov %esp,%ebp ++ c: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 12: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 15: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 18: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1b: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1e: e8 fc ff ff ff call 1f ++ 23: 55 push %ebp ++ 24: 55 push %ebp ++ 25: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 2b: 89 e5 mov %esp,%ebp ++ 2d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 30: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 33: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 36: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 39: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3c: ff 91 00 00 00 00 call \*0x0\(%ecx\) ++ 42: 89 75 f4 mov %esi,-0xc\(%ebp\) ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-3.s binutils-2.30/gas/testsuite/gas/i386/align-branch-3.s +--- binutils.orig/gas/testsuite/gas/i386/align-branch-3.s 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-3.s 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,28 @@ ++ .text ++ .globl foo ++ .p2align 4 ++foo: ++ movl %eax, %fs:0x1 ++ pushl %ebp ++ pushl %ebp ++ pushl %ebp ++ pushl %ebp ++ movl %esp, %ebp ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ call ___tls_get_addr ++ pushl %ebp ++ pushl %ebp ++ movl %eax, %fs:0x1 ++ movl %esp, %ebp ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ call *___tls_get_addr@GOT(%ecx) ++ movl %esi, -12(%ebp) +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-4a.d binutils-2.30/gas/testsuite/gas/i386/align-branch-4a.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-4a.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-4a.d 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,36 @@ ++#source: align-branch-4.s ++#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 6: 55 push %ebp ++ 7: 55 push %ebp ++ 8: 55 push %ebp ++ 9: 55 push %ebp ++ a: 55 push %ebp ++ b: 89 e5 mov %esp,%ebp ++ d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 10: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 13: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 16: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 19: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1c: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1f: c3 ret ++ 20: 55 push %ebp ++ 21: 55 push %ebp ++ 22: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 28: 89 e5 mov %esp,%ebp ++ 2a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 2d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 30: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 33: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 36: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 39: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3c: c2 1e 00 ret \$0x1e ++ 3f: 89 75 f4 mov %esi,-0xc\(%ebp\) ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-4b.d binutils-2.30/gas/testsuite/gas/i386/align-branch-4b.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-4b.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-4b.d 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,36 @@ ++#source: align-branch-4.s ++#as: -malign-branch-boundary=32 -malign-branch=ret ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 64 a3 01 00 00 00 fs mov %eax,%fs:0x1 ++ 7: 55 push %ebp ++ 8: 55 push %ebp ++ 9: 55 push %ebp ++ a: 55 push %ebp ++ b: 55 push %ebp ++ c: 89 e5 mov %esp,%ebp ++ e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 11: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 20: c3 ret ++ 21: 3e 3e 3e 55 ds ds ds push %ebp ++ 25: 55 push %ebp ++ 26: 64 a3 01 00 00 00 mov %eax,%fs:0x1 ++ 2c: 89 e5 mov %esp,%ebp ++ 2e: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3a: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 3d: 89 75 f4 mov %esi,-0xc\(%ebp\) ++ 40: c2 1e 00 ret \$0x1e ++ 43: 89 75 f4 mov %esi,-0xc\(%ebp\) ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-4.s binutils-2.30/gas/testsuite/gas/i386/align-branch-4.s +--- binutils.orig/gas/testsuite/gas/i386/align-branch-4.s 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-4.s 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,30 @@ ++ .text ++ .globl foo ++ .p2align 4 ++foo: ++ movl %eax, %fs:0x1 ++ pushl %ebp ++ pushl %ebp ++ pushl %ebp ++ pushl %ebp ++ pushl %ebp ++ movl %esp, %ebp ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ ret ++ pushl %ebp ++ pushl %ebp ++ movl %eax, %fs:0x1 ++ movl %esp, %ebp ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ movl %esi, -12(%ebp) ++ ret $30 ++ movl %esi, -12(%ebp) +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-5.d binutils-2.30/gas/testsuite/gas/i386/align-branch-5.d +--- binutils.orig/gas/testsuite/gas/i386/align-branch-5.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-5.d 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,36 @@ ++#as: -malign-branch-boundary=32 -malign-branch=jcc+fused+jmp ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: c1 e9 02 shr \$0x2,%ecx ++ 3: c1 e9 02 shr \$0x2,%ecx ++ 6: c1 e9 02 shr \$0x2,%ecx ++ 9: 89 d1 mov %edx,%ecx ++ b: 31 c0 xor %eax,%eax ++ d: c1 e9 02 shr \$0x2,%ecx ++ 10: c1 e9 02 shr \$0x2,%ecx ++ 13: c1 e9 02 shr \$0x2,%ecx ++ 16: c1 e9 02 shr \$0x2,%ecx ++ 19: c1 e9 02 shr \$0x2,%ecx ++ 1c: c1 e9 02 shr \$0x2,%ecx ++ 1f: f6 c2 02 test \$0x2,%dl ++ 22: f3 ab rep stos %eax,%es:\(%edi\) ++ 24: 75 dd jne 3 ++ 26: 31 c0 xor %eax,%eax ++ 28: c1 e9 02 shr \$0x2,%ecx ++ 2b: c1 e9 02 shr \$0x2,%ecx ++ 2e: c1 e9 02 shr \$0x2,%ecx ++ 31: 89 d1 mov %edx,%ecx ++ 33: 31 c0 xor %eax,%eax ++ 35: c1 e9 02 shr \$0x2,%ecx ++ 38: c1 e9 02 shr \$0x2,%ecx ++ 3b: c1 e9 02 shr \$0x2,%ecx ++ 3e: f6 c2 02 test \$0x2,%dl ++ 41: e8 [0-9a-f ]+ call .* ++ 46: 75 e3 jne 2b ++ 48: 31 c0 xor %eax,%eax ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/align-branch-5.s binutils-2.30/gas/testsuite/gas/i386/align-branch-5.s +--- binutils.orig/gas/testsuite/gas/i386/align-branch-5.s 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/align-branch-5.s 2019-11-20 14:09:25.595915091 +0000 +@@ -0,0 +1,32 @@ ++ .text ++ .p2align 4,,15 ++foo: ++ shrl $2, %ecx ++.L1: ++ shrl $2, %ecx ++ shrl $2, %ecx ++ movl %edx, %ecx ++ xorl %eax, %eax ++ shrl $2, %ecx ++ shrl $2, %ecx ++ shrl $2, %ecx ++ shrl $2, %ecx ++ shrl $2, %ecx ++ shrl $2, %ecx ++ testb $2, %dl ++ rep stosl ++ jne .L1 ++ xorl %eax, %eax ++ shrl $2, %ecx ++.L2: ++ shrl $2, %ecx ++ shrl $2, %ecx ++ movl %edx, %ecx ++ xorl %eax, %eax ++ shrl $2, %ecx ++ shrl $2, %ecx ++ shrl $2, %ecx ++ testb $2, %dl ++ call bar ++ jne .L2 ++ xorl %eax, %eax +diff -rupN binutils.orig/gas/testsuite/gas/i386/i386.exp binutils-2.30/gas/testsuite/gas/i386/i386.exp +--- binutils.orig/gas/testsuite/gas/i386/i386.exp 2019-11-20 10:59:21.657883233 +0000 ++++ binutils-2.30/gas/testsuite/gas/i386/i386.exp 2019-11-20 14:09:39.865805050 +0000 +@@ -425,6 +425,20 @@ if [expr ([istarget "i*86-*-*"] || [ist + run_dump_test "align-1a" + run_dump_test "align-1b" + run_list_test "inval-pseudo" "-al" ++ run_dump_test "align-branch-1a" ++ run_dump_test "align-branch-1b" ++ run_dump_test "align-branch-1c" ++ run_dump_test "align-branch-1d" ++ run_dump_test "align-branch-1e" ++ run_dump_test "align-branch-1f" ++ run_dump_test "align-branch-1g" ++ run_dump_test "align-branch-1h" ++ run_dump_test "align-branch-2a" ++ run_dump_test "align-branch-2b" ++ run_dump_test "align-branch-2c" ++ run_dump_test "align-branch-4a" ++ run_dump_test "align-branch-4b" ++ run_dump_test "align-branch-5" + + # These tests require support for 8 and 16 bit relocs, + # so we only run them for ELF and COFF targets. +@@ -489,6 +503,10 @@ if [expr ([istarget "i*86-*-*"] || [ist + + run_dump_test "addend" + ++ if {[istarget "*-*-linux*"]} then { ++ run_dump_test "align-branch-3" ++ } ++ + if { [gas_64_check] } then { + run_dump_test "att-regs" + run_dump_test "intel-regs" +@@ -892,6 +910,20 @@ if [expr ([istarget "i*86-*-*"] || [ista + run_list_test "x86-64-notrackbad" "-al" + run_dump_test "x86-64-movd" + run_dump_test "x86-64-movd-intel" ++ run_dump_test "x86-64-align-branch-1a" ++ run_dump_test "x86-64-align-branch-1b" ++ run_dump_test "x86-64-align-branch-1c" ++ run_dump_test "x86-64-align-branch-1d" ++ run_dump_test "x86-64-align-branch-1e" ++ run_dump_test "x86-64-align-branch-1f" ++ run_dump_test "x86-64-align-branch-1g" ++ run_dump_test "x86-64-align-branch-1h" ++ run_dump_test "x86-64-align-branch-2a" ++ run_dump_test "x86-64-align-branch-2b" ++ run_dump_test "x86-64-align-branch-2c" ++ run_dump_test "x86-64-align-branch-4a" ++ run_dump_test "x86-64-align-branch-4b" ++ run_dump_test "x86-64-align-branch-5" + + if { ![istarget "*-*-aix*"] + && ![istarget "*-*-beos*"] +@@ -949,6 +981,10 @@ if [expr ([istarget "i*86-*-*"] || [ista + run_dump_test "x86-64-gotpcrel-no-relax" + + run_dump_test "x86-64-addend" ++ ++ if {[istarget "*-*-linux*"]} then { ++ run_dump_test "x86-64-align-branch-3" ++ } + } + + set ASFLAGS "$old_ASFLAGS" +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1a.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1a.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1a.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1a.d 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,75 @@ ++#source: x86-64-align-branch-1.s ++#as: -malign-branch-boundary=32 ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 64 64 64 89 04 25 01 00 00 00 fs fs fs mov %eax,%fs:0x1 ++ b: 55 push %rbp ++ c: 55 push %rbp ++ d: 55 push %rbp ++ e: 48 89 e5 mov %rsp,%rbp ++ 11: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 20: 48 39 c5 cmp %rax,%rbp ++ 23: 74 5d je 82 ++ 25: 2e 89 75 f4 mov %esi,%cs:-0xc\(%rbp\) ++ 29: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 2c: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 2f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 32: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 35: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 38: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3e: 5d pop %rbp ++ 3f: 5d pop %rbp ++ 40: 74 40 je 82 ++ 42: 5d pop %rbp ++ 43: 74 3d je 82 ++ 45: 2e 89 45 fc mov %eax,%cs:-0x4\(%rbp\) ++ 49: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 4c: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 4f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 52: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 55: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 58: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5e: 5d pop %rbp ++ 5f: 5d pop %rbp ++ 60: eb 26 jmp 88 ++ 62: eb 24 jmp 88 ++ 64: eb 22 jmp 88 ++ 66: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 69: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 6c: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 6f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 72: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 75: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 78: 5d pop %rbp ++ 79: 5d pop %rbp ++ 7a: 48 39 c5 cmp %rax,%rbp ++ 7d: 74 03 je 82 ++ 7f: 90 nop ++ 80: eb 06 jmp 88 ++ 82: 8b 45 f4 mov -0xc\(%rbp\),%eax ++ 85: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a0: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ ac: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ be: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ c4: eb c2 jmp 88 ++ c6: 5d pop %rbp ++ c7: c3 retq ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1b.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1b.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1b.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1b.d 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,75 @@ ++#source: x86-64-align-branch-1.s ++#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 64 64 64 89 04 25 01 00 00 00 fs fs fs mov %eax,%fs:0x1 ++ b: 55 push %rbp ++ c: 55 push %rbp ++ d: 55 push %rbp ++ e: 48 89 e5 mov %rsp,%rbp ++ 11: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 20: 48 39 c5 cmp %rax,%rbp ++ 23: 74 5d je 82 ++ 25: 2e 89 75 f4 mov %esi,%cs:-0xc\(%rbp\) ++ 29: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 2c: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 2f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 32: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 35: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 38: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3e: 5d pop %rbp ++ 3f: 5d pop %rbp ++ 40: 74 40 je 82 ++ 42: 5d pop %rbp ++ 43: 74 3d je 82 ++ 45: 2e 89 45 fc mov %eax,%cs:-0x4\(%rbp\) ++ 49: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 4c: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 4f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 52: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 55: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 58: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5e: 5d pop %rbp ++ 5f: 5d pop %rbp ++ 60: eb 26 jmp 88 ++ 62: eb 24 jmp 88 ++ 64: eb 22 jmp 88 ++ 66: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 69: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 6c: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 6f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 72: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 75: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 78: 5d pop %rbp ++ 79: 5d pop %rbp ++ 7a: 48 39 c5 cmp %rax,%rbp ++ 7d: 74 03 je 82 ++ 7f: 90 nop ++ 80: eb 06 jmp 88 ++ 82: 8b 45 f4 mov -0xc\(%rbp\),%eax ++ 85: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a0: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ ac: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ be: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ c4: eb c2 jmp 88 ++ c6: 5d pop %rbp ++ c7: c3 retq ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1c.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1c.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1c.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1c.d 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,75 @@ ++#source: x86-64-align-branch-1.s ++#as: -malign-branch-boundary=32 -malign-branch-prefix-size=1 ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 8: 2e 55 cs push %rbp ++ a: 2e 55 cs push %rbp ++ c: 2e 55 cs push %rbp ++ e: 48 89 e5 mov %rsp,%rbp ++ 11: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 20: 48 39 c5 cmp %rax,%rbp ++ 23: 74 5d je 82 ++ 25: 2e 89 75 f4 mov %esi,%cs:-0xc\(%rbp\) ++ 29: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 2c: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 2f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 32: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 35: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 38: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3e: 5d pop %rbp ++ 3f: 5d pop %rbp ++ 40: 74 40 je 82 ++ 42: 5d pop %rbp ++ 43: 74 3d je 82 ++ 45: 2e 89 45 fc mov %eax,%cs:-0x4\(%rbp\) ++ 49: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 4c: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 4f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 52: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 55: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 58: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5e: 5d pop %rbp ++ 5f: 5d pop %rbp ++ 60: eb 26 jmp 88 ++ 62: eb 24 jmp 88 ++ 64: eb 22 jmp 88 ++ 66: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 69: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 6c: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 6f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 72: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 75: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 78: 5d pop %rbp ++ 79: 5d pop %rbp ++ 7a: 48 39 c5 cmp %rax,%rbp ++ 7d: 74 03 je 82 ++ 7f: 90 nop ++ 80: eb 06 jmp 88 ++ 82: 8b 45 f4 mov -0xc\(%rbp\),%eax ++ 85: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a0: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ ac: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ be: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ c4: eb c2 jmp 88 ++ c6: 5d pop %rbp ++ c7: c3 retq ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1d.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1d.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1d.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1d.d 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,74 @@ ++#source: x86-64-align-branch-1.s ++#as: -malign-branch-boundary=32 -malign-branch=fused+jcc ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 64 64 64 89 04 25 01 00 00 00 fs fs fs mov %eax,%fs:0x1 ++ b: 55 push %rbp ++ c: 55 push %rbp ++ d: 55 push %rbp ++ e: 48 89 e5 mov %rsp,%rbp ++ 11: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 20: 48 39 c5 cmp %rax,%rbp ++ 23: 74 5b je 80 ++ 25: 2e 89 75 f4 mov %esi,%cs:-0xc\(%rbp\) ++ 29: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 2c: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 2f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 32: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 35: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 38: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3e: 5d pop %rbp ++ 3f: 5d pop %rbp ++ 40: 74 3e je 80 ++ 42: 5d pop %rbp ++ 43: 74 3b je 80 ++ 45: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 48: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 4b: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 4e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 51: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 54: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 57: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5d: 5d pop %rbp ++ 5e: 5d pop %rbp ++ 5f: eb 25 jmp 86 ++ 61: eb 23 jmp 86 ++ 63: eb 21 jmp 86 ++ 65: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 68: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 6b: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 6e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 71: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 74: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 77: 5d pop %rbp ++ 78: 5d pop %rbp ++ 79: 48 39 c5 cmp %rax,%rbp ++ 7c: 74 02 je 80 ++ 7e: eb 06 jmp 86 ++ 80: 8b 45 f4 mov -0xc\(%rbp\),%eax ++ 83: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 86: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 8c: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 92: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 98: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 9e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a4: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ aa: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b0: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ bc: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ c2: eb c2 jmp 86 ++ c4: 5d pop %rbp ++ c5: c3 retq ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1e.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1e.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1e.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1e.d 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,74 @@ ++#source: x86-64-align-branch-1.s ++#as: -malign-branch-boundary=32 -malign-branch=jcc ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 8: 55 push %rbp ++ 9: 55 push %rbp ++ a: 55 push %rbp ++ b: 48 89 e5 mov %rsp,%rbp ++ e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 11: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1d: 48 39 c5 cmp %rax,%rbp ++ 20: 74 5b je 7d ++ 22: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 25: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 28: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 2b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 2e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3a: 5d pop %rbp ++ 3b: 5d pop %rbp ++ 3c: 74 3f je 7d ++ 3e: 2e 5d cs pop %rbp ++ 40: 74 3b je 7d ++ 42: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 45: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 48: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 4b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 4e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 51: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 54: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 57: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5a: 5d pop %rbp ++ 5b: 5d pop %rbp ++ 5c: eb 25 jmp 83 ++ 5e: eb 23 jmp 83 ++ 60: eb 21 jmp 83 ++ 62: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 65: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 68: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 6b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 6e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 71: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 74: 5d pop %rbp ++ 75: 5d pop %rbp ++ 76: 48 39 c5 cmp %rax,%rbp ++ 79: 74 02 je 7d ++ 7b: eb 06 jmp 83 ++ 7d: 8b 45 f4 mov -0xc\(%rbp\),%eax ++ 80: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 83: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 89: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 8f: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 95: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 9b: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a1: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a7: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ ad: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b3: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b9: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ bf: eb c2 jmp 83 ++ c1: 5d pop %rbp ++ c2: c3 retq ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1f.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1f.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1f.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1f.d 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,75 @@ ++#source: x86-64-align-branch-1.s ++#as: -malign-branch-boundary=32 -malign-branch=jcc+jmp ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 8: 55 push %rbp ++ 9: 55 push %rbp ++ a: 55 push %rbp ++ b: 48 89 e5 mov %rsp,%rbp ++ e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 11: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1d: 48 39 c5 cmp %rax,%rbp ++ 20: 74 5d je 7f ++ 22: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 25: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 28: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 2b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 2e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3a: 5d pop %rbp ++ 3b: 5d pop %rbp ++ 3c: 74 41 je 7f ++ 3e: 2e 5d cs pop %rbp ++ 40: 74 3d je 7f ++ 42: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 45: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 48: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 4b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 4e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 51: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 54: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 57: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5a: 5d pop %rbp ++ 5b: 5d pop %rbp ++ 5c: eb 27 jmp 85 ++ 5e: 66 90 xchg %ax,%ax ++ 60: eb 23 jmp 85 ++ 62: eb 21 jmp 85 ++ 64: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 67: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 6a: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 6d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 70: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 73: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 76: 5d pop %rbp ++ 77: 5d pop %rbp ++ 78: 48 39 c5 cmp %rax,%rbp ++ 7b: 74 02 je 7f ++ 7d: eb 06 jmp 85 ++ 7f: 8b 45 f4 mov -0xc\(%rbp\),%eax ++ 82: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 85: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 8b: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 91: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 97: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 9d: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a3: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a9: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ af: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b5: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ bb: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ c1: eb c2 jmp 85 ++ c3: 5d pop %rbp ++ c4: c3 retq ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1g.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1g.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1g.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1g.d 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,75 @@ ++#source: x86-64-align-branch-1.s ++#as: -mbranches-within-32B-boundaries ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 64 64 64 89 04 25 01 00 00 00 fs fs fs mov %eax,%fs:0x1 ++ b: 55 push %rbp ++ c: 55 push %rbp ++ d: 55 push %rbp ++ e: 48 89 e5 mov %rsp,%rbp ++ 11: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 20: 48 39 c5 cmp %rax,%rbp ++ 23: 74 5d je 82 ++ 25: 2e 89 75 f4 mov %esi,%cs:-0xc\(%rbp\) ++ 29: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 2c: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 2f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 32: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 35: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 38: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3e: 5d pop %rbp ++ 3f: 5d pop %rbp ++ 40: 74 40 je 82 ++ 42: 5d pop %rbp ++ 43: 74 3d je 82 ++ 45: 2e 89 45 fc mov %eax,%cs:-0x4\(%rbp\) ++ 49: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 4c: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 4f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 52: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 55: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 58: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5e: 5d pop %rbp ++ 5f: 5d pop %rbp ++ 60: eb 26 jmp 88 ++ 62: eb 24 jmp 88 ++ 64: eb 22 jmp 88 ++ 66: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 69: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 6c: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 6f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 72: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 75: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 78: 5d pop %rbp ++ 79: 5d pop %rbp ++ 7a: 48 39 c5 cmp %rax,%rbp ++ 7d: 74 03 je 82 ++ 7f: 90 nop ++ 80: eb 06 jmp 88 ++ 82: 8b 45 f4 mov -0xc\(%rbp\),%eax ++ 85: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a0: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ ac: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ be: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ c4: eb c2 jmp 88 ++ c6: 5d pop %rbp ++ c7: c3 retq ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1h.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1h.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1h.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1h.d 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,74 @@ ++#source: x86-64-align-branch-1.s ++#as: -mbranches-within-32B-boundaries -malign-branch-boundary=0 ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 8: 55 push %rbp ++ 9: 55 push %rbp ++ a: 55 push %rbp ++ b: 48 89 e5 mov %rsp,%rbp ++ e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 11: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1d: 48 39 c5 cmp %rax,%rbp ++ 20: 74 5a je 7c ++ 22: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 25: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 28: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 2b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 2e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3a: 5d pop %rbp ++ 3b: 5d pop %rbp ++ 3c: 74 3e je 7c ++ 3e: 5d pop %rbp ++ 3f: 74 3b je 7c ++ 41: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 44: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 47: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 4a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 4d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 50: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 53: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 56: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 59: 5d pop %rbp ++ 5a: 5d pop %rbp ++ 5b: eb 25 jmp 82 ++ 5d: eb 23 jmp 82 ++ 5f: eb 21 jmp 82 ++ 61: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 64: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 67: 89 7d f8 mov %edi,-0x8\(%rbp\) ++ 6a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 6d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 70: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 73: 5d pop %rbp ++ 74: 5d pop %rbp ++ 75: 48 39 c5 cmp %rax,%rbp ++ 78: 74 02 je 7c ++ 7a: eb 06 jmp 82 ++ 7c: 8b 45 f4 mov -0xc\(%rbp\),%eax ++ 7f: 89 45 fc mov %eax,-0x4\(%rbp\) ++ 82: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 88: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 8e: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 94: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ 9a: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a0: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ a6: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ ac: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b2: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ b8: 89 b5 50 fb ff ff mov %esi,-0x4b0\(%rbp\) ++ be: eb c2 jmp 82 ++ c0: 5d pop %rbp ++ c1: c3 retq ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1.s binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1.s +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-1.s 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-1.s 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,70 @@ ++ .text ++ .globl foo ++ .p2align 4 ++foo: ++ movl %eax, %fs:0x1 ++ pushq %rbp ++ pushq %rbp ++ pushq %rbp ++ movq %rsp, %rbp ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ cmp %rax, %rbp ++ je .L_2 ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %edi, -8(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ popq %rbp ++ popq %rbp ++ je .L_2 ++ popq %rbp ++ je .L_2 ++ movl %eax, -4(%rbp) ++ movl %esi, -12(%rbp) ++ movl %edi, -8(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ popq %rbp ++ popq %rbp ++ jmp .L_3 ++ jmp .L_3 ++ jmp .L_3 ++ movl %eax, -4(%rbp) ++ movl %esi, -12(%rbp) ++ movl %edi, -8(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ popq %rbp ++ popq %rbp ++ cmp %rax, %rbp ++ je .L_2 ++ jmp .L_3 ++.L_2: ++ movl -12(%rbp), %eax ++ movl %eax, -4(%rbp) ++.L_3: ++ movl %esi, -1200(%rbp) ++ movl %esi, -1200(%rbp) ++ movl %esi, -1200(%rbp) ++ movl %esi, -1200(%rbp) ++ movl %esi, -1200(%rbp) ++ movl %esi, -1200(%rbp) ++ movl %esi, -1200(%rbp) ++ movl %esi, -1200(%rbp) ++ movl %esi, -1200(%rbp) ++ movl %esi, -1200(%rbp) ++ jmp .L_3 ++ popq %rbp ++ retq +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2a.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2a.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2a.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2a.d 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,50 @@ ++#source: x86-64-align-branch-2.s ++#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 8: 55 push %rbp ++ 9: 55 push %rbp ++ a: 55 push %rbp ++ b: 55 push %rbp ++ c: 48 89 e5 mov %rsp,%rbp ++ f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 12: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 15: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 18: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1e: ff e0 jmpq \*%rax ++ 20: 55 push %rbp ++ 21: 55 push %rbp ++ 22: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 2a: 48 89 e5 mov %rsp,%rbp ++ 2d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 30: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 33: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 36: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 39: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3c: ff d0 callq \*%rax ++ 3e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 41: 55 push %rbp ++ 42: 55 push %rbp ++ 43: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 4b: 48 89 e5 mov %rsp,%rbp ++ 4e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 51: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 54: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 57: e8 [0-9a-f ]+ callq .* ++ 5c: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5f: 55 push %rbp ++ 60: 55 push %rbp ++ 61: 55 push %rbp ++ 62: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 6a: 48 89 e5 mov %rsp,%rbp ++ 6d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 70: ff 14 25 00 00 00 00 callq \*0x0 ++ 77: 55 push %rbp ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2b.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2b.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2b.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2b.d 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,50 @@ ++#source: x86-64-align-branch-2.s ++#as: -malign-branch-boundary=32 -malign-branch=indirect ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 64 64 89 04 25 01 00 00 00 fs fs mov %eax,%fs:0x1 ++ a: 55 push %rbp ++ b: 55 push %rbp ++ c: 55 push %rbp ++ d: 55 push %rbp ++ e: 48 89 e5 mov %rsp,%rbp ++ 11: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 20: ff e0 jmpq \*%rax ++ 22: 2e 2e 55 cs cs push %rbp ++ 25: 55 push %rbp ++ 26: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 2e: 48 89 e5 mov %rsp,%rbp ++ 31: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 40: ff d0 callq \*%rax ++ 42: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 45: 55 push %rbp ++ 46: 55 push %rbp ++ 47: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 4f: 48 89 e5 mov %rsp,%rbp ++ 52: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 55: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 58: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5b: e8 [0-9a-f ]+ callq .* ++ 60: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 63: 55 push %rbp ++ 64: 55 push %rbp ++ 65: 55 push %rbp ++ 66: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 6e: 48 89 e5 mov %rsp,%rbp ++ 71: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 74: ff 14 25 00 00 00 00 callq \*0x0 ++ 7b: 55 push %rbp ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2c.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2c.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2c.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2c.d 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,50 @@ ++#source: x86-64-align-branch-2.s ++#as: -malign-branch-boundary=32 -malign-branch=indirect+call ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 64 64 89 04 25 01 00 00 00 fs fs mov %eax,%fs:0x1 ++ a: 55 push %rbp ++ b: 55 push %rbp ++ c: 55 push %rbp ++ d: 55 push %rbp ++ e: 48 89 e5 mov %rsp,%rbp ++ 11: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 20: ff e0 jmpq \*%rax ++ 22: 2e 2e 55 cs cs push %rbp ++ 25: 55 push %rbp ++ 26: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 2e: 48 89 e5 mov %rsp,%rbp ++ 31: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 40: ff d0 callq \*%rax ++ 42: 2e 2e 2e 2e 2e 89 75 f4 cs cs cs cs mov %esi,%cs:-0xc\(%rbp\) ++ 4a: 55 push %rbp ++ 4b: 55 push %rbp ++ 4c: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 54: 48 89 e5 mov %rsp,%rbp ++ 57: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 5d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 60: e8 [0-9a-f ]+ callq .* ++ 65: 2e 2e 2e 2e 2e 89 75 f4 cs cs cs cs mov %esi,%cs:-0xc\(%rbp\) ++ 6d: 2e 2e 55 cs cs push %rbp ++ 70: 55 push %rbp ++ 71: 55 push %rbp ++ 72: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 7a: 48 89 e5 mov %rsp,%rbp ++ 7d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 80: ff 14 25 00 00 00 00 callq \*0x0 ++ 87: 55 push %rbp ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2.s binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2.s +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-2.s 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-2.s 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,44 @@ ++ .text ++ .globl foo ++ .p2align 4 ++foo: ++ movl %eax, %fs:0x1 ++ pushq %rbp ++ pushq %rbp ++ pushq %rbp ++ pushq %rbp ++ movq %rsp, %rbp ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ jmp *%rax ++ pushq %rbp ++ pushq %rbp ++ movl %eax, %fs:0x1 ++ movq %rsp, %rbp ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ call *%rax ++ movl %esi, -12(%rbp) ++ pushq %rbp ++ pushq %rbp ++ movl %eax, %fs:0x1 ++ movq %rsp, %rbp ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ call foo ++ movl %esi, -12(%rbp) ++ pushq %rbp ++ pushq %rbp ++ pushq %rbp ++ movl %eax, %fs:0x1 ++ movq %rsp, %rbp ++ movl %esi, -12(%rbp) ++ call *foo ++ pushq %rbp +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-3.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-3.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-3.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-3.d 2019-11-20 14:09:25.596915083 +0000 +@@ -0,0 +1,32 @@ ++#as: -malign-branch-boundary=32 -malign-branch=indirect+call ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 8: 55 push %rbp ++ 9: 55 push %rbp ++ a: 55 push %rbp ++ b: 55 push %rbp ++ c: 48 89 e5 mov %rsp,%rbp ++ f: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 12: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 15: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 18: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1e: e8 00 00 00 00 callq 23 ++ 23: 55 push %rbp ++ 24: 55 push %rbp ++ 25: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 2d: 48 89 e5 mov %rsp,%rbp ++ 30: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 33: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 36: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 39: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3c: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3f: ff 15 00 00 00 00 callq \*0x0\(%rip\) # 45 ++ 45: 89 75 f4 mov %esi,-0xc\(%rbp\) ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-3.s binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-3.s +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-3.s 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-3.s 2019-11-20 14:09:25.597915075 +0000 +@@ -0,0 +1,27 @@ ++ .text ++ .globl foo ++ .p2align 4 ++foo: ++ movl %eax, %fs:0x1 ++ pushq %rbp ++ pushq %rbp ++ pushq %rbp ++ pushq %rbp ++ movq %rsp, %rbp ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ call __tls_get_addr ++ pushq %rbp ++ pushq %rbp ++ movl %eax, %fs:0x1 ++ movq %rsp, %rbp ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ call *__tls_get_addr@GOTPCREL(%rip) ++ movl %esi, -12(%rbp) +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-4a.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-4a.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-4a.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-4a.d 2019-11-20 14:09:25.597915075 +0000 +@@ -0,0 +1,33 @@ ++#source: x86-64-align-branch-4.s ++#as: -malign-branch-boundary=32 -malign-branch=fused+jcc+jmp ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 8: 55 push %rbp ++ 9: 55 push %rbp ++ a: 48 89 e5 mov %rsp,%rbp ++ d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 10: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 13: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 16: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 19: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1c: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1f: c3 retq ++ 20: 55 push %rbp ++ 21: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 29: 55 push %rbp ++ 2a: 55 push %rbp ++ 2b: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 2e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3d: c2 1e 00 retq \$0x1e ++ 40: 55 push %rbp ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-4b.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-4b.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-4b.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-4b.d 2019-11-20 14:09:25.597915075 +0000 +@@ -0,0 +1,33 @@ ++#source: x86-64-align-branch-4.s ++#as: -malign-branch-boundary=32 -malign-branch=ret ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: 64 64 89 04 25 01 00 00 00 fs mov %eax,%fs:0x1 ++ 9: 55 push %rbp ++ a: 55 push %rbp ++ b: 48 89 e5 mov %rsp,%rbp ++ e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 11: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 14: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 17: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 1d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 20: c3 retq ++ 21: 2e 2e 55 cs cs push %rbp ++ 24: 64 89 04 25 01 00 00 00 mov %eax,%fs:0x1 ++ 2c: 55 push %rbp ++ 2d: 55 push %rbp ++ 2e: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 31: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 34: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 37: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3a: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 3d: 89 75 f4 mov %esi,-0xc\(%rbp\) ++ 40: c2 1e 00 retq \$0x1e ++ 43: 55 push %rbp ++#pass +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-4.s binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-4.s +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-4.s 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-4.s 2019-11-20 14:09:25.597915075 +0000 +@@ -0,0 +1,27 @@ ++ .text ++ .globl foo ++ .p2align 4 ++foo: ++ movl %eax, %fs:0x1 ++ pushq %rbp ++ pushq %rbp ++ movq %rsp, %rbp ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ ret ++ pushq %rbp ++ movl %eax, %fs:0x1 ++ pushq %rbp ++ pushq %rbp ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ movl %esi, -12(%rbp) ++ ret $30 ++ pushq %rbp +diff -rupN binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-5.d binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-5.d +--- binutils.orig/gas/testsuite/gas/i386/x86-64-align-branch-5.d 1970-01-01 01:00:00.000000000 +0100 ++++ binutils-2.30/gas/testsuite/gas/i386/x86-64-align-branch-5.d 2019-11-20 14:09:25.597915075 +0000 +@@ -0,0 +1,37 @@ ++#source: align-branch-5.s ++#as: -malign-branch-boundary=32 -malign-branch=jcc+fused+jmp ++#objdump: -dw ++ ++.*: +file format .* ++ ++Disassembly of section .text: ++ ++0+ : ++ 0: c1 e9 02 shr \$0x2,%ecx ++ 3: c1 e9 02 shr \$0x2,%ecx ++ 6: c1 e9 02 shr \$0x2,%ecx ++ 9: 89 d1 mov %edx,%ecx ++ b: 31 c0 xor %eax,%eax ++ d: c1 e9 02 shr \$0x2,%ecx ++ 10: c1 e9 02 shr \$0x2,%ecx ++ 13: c1 e9 02 shr \$0x2,%ecx ++ 16: c1 e9 02 shr \$0x2,%ecx ++ 19: c1 e9 02 shr \$0x2,%ecx ++ 1c: c1 e9 02 shr \$0x2,%ecx ++ 1f: f6 c2 02 test \$0x2,%dl ++ 22: f3 ab rep stos %eax,%es:\(%rdi\) ++ 24: 75 dd jne 3 ++ 26: 31 c0 xor %eax,%eax ++ 28: c1 e9 02 shr \$0x2,%ecx ++ 2b: c1 e9 02 shr \$0x2,%ecx ++ 2e: c1 e9 02 shr \$0x2,%ecx ++ 31: 89 d1 mov %edx,%ecx ++ 33: 31 c0 xor %eax,%eax ++ 35: c1 e9 02 shr \$0x2,%ecx ++ 38: c1 e9 02 shr \$0x2,%ecx ++ 3b: c1 e9 02 shr \$0x2,%ecx ++ 3e: f6 c2 02 test \$0x2,%dl ++ 41: e8 00 00 00 00 callq 46 ++ 46: 75 e3 jne 2b ++ 48: 31 c0 xor %eax,%eax ++#pass +diff -rupN binutils.orig/gas/write.c binutils-2.30/gas/write.c +--- binutils.orig/gas/write.c 2019-11-20 10:59:21.592883731 +0000 ++++ binutils-2.30/gas/write.c 2019-11-20 14:30:33.613133740 +0000 +@@ -2987,7 +2987,12 @@ relax_segment (struct frag *segment_frag + #ifdef TC_GENERIC_RELAX_TABLE + /* The default way to relax a frag is to look through + TC_GENERIC_RELAX_TABLE. */ ++#ifdef md_generic_table_relax_frag ++ growth = md_generic_table_relax_frag (segment, fragP, ++ stretch); ++#else + growth = relax_frag (segment, fragP, stretch); ++#endif /* md_generic_table_relax_frag */ + #endif /* TC_GENERIC_RELAX_TABLE */ + #endif + break; diff --git a/SPECS/binutils.spec b/SPECS/binutils.spec index 2a0ecb6..b044eb0 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: 57%{?dist} +Release: 68%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -374,6 +380,42 @@ Patch55: binutils-x86-IBT-and-missing-notes.patch # Lifetime: Fixed in 2.32 Patch56: binutils-AArch64-gold.patch +# Purpose: Stop the BFD library from complaining about files with multiple +# relocations against the same section. Allows examination of +# special kernel modules. +# 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 +Patch64: binutils-x86_JCC_Erratum.patch + #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -554,6 +596,14 @@ using libelf instead of BFD. %patch54 -p1 %patch55 -p1 %patch56 -p1 +%patch57 -p1 +%patch58 -p1 +%patch59 -p1 +%patch60 -p1 +%patch61 -p1 +%patch62 -p1 +%patch63 -p1 +%patch64 -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 ? @@ -696,6 +746,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/ @@ -986,6 +1041,42 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Thu Nov 27 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 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) + * Mon May 20 2019 Nick Clifton - 2.30-57 - Fix a thinko in the new gas tests for the s390x arch13 extension. (#1710860)