Rebase to GNU Binutils 2.33.1.

- Retire: binutils-CVE-2019-9073.patch
- Retire: binutils-CVE-2019-9074.patch
- Retire: binutils-CVE-2019-9075.patch
- Retire: binutils-CVE-2019-9077.patch
- Retire: binutils-disassembling-efi-files.patch
- Retire: binutils-CVE-2019-9071.patch
- Retire: binutils-gas-build-note-relocs.patch
- Retire: binutils-do-not-warn-about-debuginfo-files.patch
- Retire: binutils-do-not-merge-differing-SHF_EXCLUDE-groups.patch
- Retire: binutils-rh1736114.patch
- Retire: binutils-objcopy-gnu-build-version-notes.patch
- Retire: binutils-CVE-2019-14250.patch
- Retire: binutils-CVE-2019-14444.patch
- Retire: binutils-gcc-10-fixes.patch
- Retire: binutils-remove-old-formats.patch
- Retire: binutils-aarch64-gold-PLT-for-MOVW_ABS.patch
This commit is contained in:
Nick Clifton 2019-10-14 13:24:26 +01:00
parent 70ab9c2b90
commit 31bd4965ad
20 changed files with 30 additions and 908 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ build-sources
/binutils-2.31.1.tar.xz
/binutils-special-sections-in-groups.patch
/binutils-2.32.tar.xz
/binutils-2.33.1.tar.xz

View File

@ -1,17 +0,0 @@
--- binutils.orig/libiberty/simple-object-elf.c 2019-08-09 14:13:51.677330065 +0100
+++ binutils-2.32/libiberty/simple-object-elf.c 2019-08-09 14:14:31.177076298 +0100
@@ -549,6 +549,14 @@ simple_object_elf_match (unsigned char h
return NULL;
}
+ if (eor->shstrndx == 0)
+ {
+ *errmsg = "invalid ELF shstrndx == 0";
+ *err = 0;
+ XDELETE (eor);
+ return NULL;
+ }
+
return (void *) eor;
}

View File

@ -1,11 +0,0 @@
--- 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,

View File

@ -1,110 +0,0 @@
--- binutils.orig/libiberty/cp-demangle.c 2019-04-10 10:31:27.854997707 +0100
+++ binutils-2.31.1/libiberty/cp-demangle.c 2019-04-10 16:00:35.820350978 +0100
@@ -858,7 +858,7 @@ CP_STATIC_IF_GLIBCPP_V3
int
cplus_demangle_fill_name (struct demangle_component *p, const char *s, int len)
{
- if (p == NULL || s == NULL || len == 0)
+ if (p == NULL || s == NULL || len <= 0)
return 0;
p->d_printing = 0;
p->type = DEMANGLE_COMPONENT_NAME;
@@ -4032,7 +4032,7 @@ d_growable_string_callback_adapter (cons
are larger than the actual numbers encountered. */
static void
-d_count_templates_scopes (int *num_templates, int *num_scopes,
+d_count_templates_scopes (struct d_print_info *dpi,
const struct demangle_component *dc)
{
if (dc == NULL)
@@ -4052,13 +4052,13 @@ d_count_templates_scopes (int *num_templ
break;
case DEMANGLE_COMPONENT_TEMPLATE:
- (*num_templates)++;
+ dpi->num_copy_templates++;
goto recurse_left_right;
case DEMANGLE_COMPONENT_REFERENCE:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE:
if (d_left (dc)->type == DEMANGLE_COMPONENT_TEMPLATE_PARAM)
- (*num_scopes)++;
+ dpi->num_saved_scopes++;
goto recurse_left_right;
case DEMANGLE_COMPONENT_QUAL_NAME:
@@ -4122,42 +4122,42 @@ d_count_templates_scopes (int *num_templ
case DEMANGLE_COMPONENT_TAGGED_NAME:
case DEMANGLE_COMPONENT_CLONE:
recurse_left_right:
- d_count_templates_scopes (num_templates, num_scopes,
- d_left (dc));
- d_count_templates_scopes (num_templates, num_scopes,
- d_right (dc));
+ /* PR 89394 - Check for too much recursion. */
+ if (dpi->recursion > DEMANGLE_RECURSION_LIMIT)
+ /* FIXME: There ought to be a way to report to the
+ user that the recursion limit has been reached. */
+ return;
+
+ ++ dpi->recursion;
+ d_count_templates_scopes (dpi, d_left (dc));
+ d_count_templates_scopes (dpi, d_right (dc));
+ -- dpi->recursion;
break;
case DEMANGLE_COMPONENT_CTOR:
- d_count_templates_scopes (num_templates, num_scopes,
- dc->u.s_ctor.name);
+ d_count_templates_scopes (dpi, dc->u.s_ctor.name);
break;
case DEMANGLE_COMPONENT_DTOR:
- d_count_templates_scopes (num_templates, num_scopes,
- dc->u.s_dtor.name);
+ d_count_templates_scopes (dpi, dc->u.s_dtor.name);
break;
case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
- d_count_templates_scopes (num_templates, num_scopes,
- dc->u.s_extended_operator.name);
+ d_count_templates_scopes (dpi, dc->u.s_extended_operator.name);
break;
case DEMANGLE_COMPONENT_FIXED_TYPE:
- d_count_templates_scopes (num_templates, num_scopes,
- dc->u.s_fixed.length);
+ d_count_templates_scopes (dpi, dc->u.s_fixed.length);
break;
case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS:
case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS:
- d_count_templates_scopes (num_templates, num_scopes,
- d_left (dc));
+ d_count_templates_scopes (dpi, d_left (dc));
break;
case DEMANGLE_COMPONENT_LAMBDA:
case DEMANGLE_COMPONENT_DEFAULT_ARG:
- d_count_templates_scopes (num_templates, num_scopes,
- dc->u.s_unary_num.sub);
+ d_count_templates_scopes (dpi, dc->u.s_unary_num.sub);
break;
}
}
@@ -4192,8 +4192,12 @@ d_print_init (struct d_print_info *dpi,
dpi->next_copy_template = 0;
dpi->num_copy_templates = 0;
- d_count_templates_scopes (&dpi->num_copy_templates,
- &dpi->num_saved_scopes, dc);
+ d_count_templates_scopes (dpi, dc);
+ /* If we did not reach the recursion limit, then reset the
+ current recursion value back to 0, so that we can print
+ the templates. */
+ if (dpi->recursion < DEMANGLE_RECURSION_LIMIT)
+ dpi->recursion = 0;
dpi->num_copy_templates *= dpi->num_saved_scopes;
dpi->current_template = NULL;

View File

@ -1,13 +0,0 @@
--- binutils.orig/binutils/objdump.c 2019-02-25 16:12:30.394056901 +0000
+++ binutils-2.31.1/binutils/objdump.c 2019-02-25 16:13:07.224778005 +0000
@@ -2993,7 +2993,9 @@ dump_bfd_header (bfd *abfd)
static void
dump_bfd_private_header (bfd *abfd)
{
- bfd_print_private_bfd_data (abfd, stdout);
+ if (!bfd_print_private_bfd_data (abfd, stdout))
+ non_fatal (_("warning: private headers incomplete: %s"),
+ bfd_errmsg (bfd_get_error ()));
}
static void

View File

@ -1,32 +0,0 @@
--- binutils.orig/bfd/pei-x86_64.c 2019-02-25 16:12:29.798061414 +0000
+++ binutils-2.31.1/bfd/pei-x86_64.c 2019-02-25 17:09:02.783425236 +0000
@@ -541,7 +541,7 @@ pex64_bfd_print_pdata_section (bfd *abfd
/* virt_size might be zero for objects. */
if (stop == 0 && strcmp (abfd->xvec->name, "pe-x86-64") == 0)
{
- stop = (datasize / onaline) * onaline;
+ stop = datasize;
virt_size_is_zero = TRUE;
}
else if (datasize < stop)
@@ -551,8 +551,8 @@ pex64_bfd_print_pdata_section (bfd *abfd
_("Warning: %s section size (%ld) is smaller than virtual size (%ld)\n"),
pdata_section->name, (unsigned long) datasize,
(unsigned long) stop);
- /* Be sure not to read passed datasize. */
- stop = datasize / onaline;
+ /* Be sure not to read past datasize. */
+ stop = datasize;
}
/* Display functions table. */
@@ -724,8 +724,7 @@ pex64_bfd_print_pdata_section (bfd *abfd
altent += imagebase;
if (altent >= pdata_vma
- && (altent + PDATA_ROW_SIZE <= pdata_vma
- + pei_section_data (abfd, pdata_section)->virt_size))
+ && altent - pdata_vma + PDATA_ROW_SIZE <= stop)
{
pex64_get_runtime_function
(abfd, &arf, &pdata[altent - pdata_vma]);

View File

@ -1,73 +0,0 @@
diff -rup binutils.orig/bfd/archive64.c binutils-2.31.1/bfd/archive64.c
--- binutils.orig/bfd/archive64.c 2019-02-26 11:17:11.882530151 +0000
+++ binutils-2.31.1/bfd/archive64.c 2019-02-26 11:19:18.422488805 +0000
@@ -100,8 +100,6 @@ _bfd_archive_64_bit_slurp_armap (bfd *ab
return FALSE;
carsyms = ardata->symdefs;
stringbase = ((char *) ardata->symdefs) + carsym_size;
- stringbase[stringsize] = 0;
- stringend = stringbase + stringsize;
raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize);
if (raw_armap == NULL)
@@ -115,15 +113,17 @@ _bfd_archive_64_bit_slurp_armap (bfd *ab
goto release_raw_armap;
}
+ stringend = stringbase + stringsize;
+ *stringend = 0;
for (i = 0; i < nsymz; i++)
{
carsyms->file_offset = bfd_getb64 (raw_armap + i * 8);
carsyms->name = stringbase;
- if (stringbase < stringend)
- stringbase += strlen (stringbase) + 1;
+ stringbase += strlen (stringbase);
+ if (stringbase != stringend)
+ ++stringbase;
++carsyms;
}
- *stringbase = '\0';
ardata->symdef_count = nsymz;
ardata->first_file_filepos = bfd_tell (abfd);
diff -rup binutils.orig/bfd/archive.c binutils-2.31.1/bfd/archive.c
--- binutils.orig/bfd/archive.c 2019-02-26 11:17:11.884530134 +0000
+++ binutils-2.31.1/bfd/archive.c 2019-02-26 11:18:33.354859687 +0000
@@ -1014,6 +1014,7 @@ do_slurp_coff_armap (bfd *abfd)
int *raw_armap, *rawptr;
struct artdata *ardata = bfd_ardata (abfd);
char *stringbase;
+ char *stringend;
bfd_size_type stringsize;
bfd_size_type parsed_size;
carsym *carsyms;
@@ -1073,22 +1074,20 @@ do_slurp_coff_armap (bfd *abfd)
}
/* OK, build the carsyms. */
- for (i = 0; i < nsymz && stringsize > 0; i++)
+ stringend = stringbase + stringsize;
+ *stringend = 0;
+ for (i = 0; i < nsymz; i++)
{
bfd_size_type len;
rawptr = raw_armap + i;
carsyms->file_offset = swap ((bfd_byte *) rawptr);
carsyms->name = stringbase;
- /* PR 17512: file: 4a1d50c1. */
- len = strnlen (stringbase, stringsize);
- if (len < stringsize)
- len ++;
- stringbase += len;
- stringsize -= len;
+ stringbase += strlen (stringbase);
+ if (stringbase != stringend)
+ ++stringbase;
carsyms++;
}
- *stringbase = 0;
ardata->symdef_count = nsymz;
ardata->first_file_filepos = bfd_tell (abfd);

View File

@ -1,16 +0,0 @@
--- binutils.orig/binutils/readelf.c 2019-02-26 11:17:12.414525772 +0000
+++ binutils-2.31.1/binutils/readelf.c 2019-02-26 12:11:40.642876742 +0000
@@ -16009,6 +16009,13 @@ process_mips_specific (Filedata * fileda
return FALSE;
}
+ /* PR 24243 */
+ if (sect->sh_size < sizeof (* eopt))
+ {
+ error (_("The MIPS options section is too small.\n"));
+ return FALSE;
+ }
+
eopt = (Elf_External_Options *) get_data (NULL, filedata, options_offset, 1,
sect->sh_size, _("options"));
if (eopt)

View File

@ -1,20 +0,0 @@
--- binutils.orig/gold/aarch64.cc 2019-05-21 11:24:07.642560743 +0100
+++ binutils-2.32/gold/aarch64.cc 2019-05-21 11:25:02.425157682 +0100
@@ -6496,6 +6496,17 @@ Target_aarch64<size, big_endian>::Scan::
gold_error(_("%s: unsupported reloc %u in pos independent link."),
object->name().c_str(), r_type);
}
+ // Make a PLT entry if necessary.
+ if (gsym->needs_plt_entry())
+ {
+ target->make_plt_entry(symtab, layout, gsym);
+ // Since this is not a PC-relative relocation, we may be
+ // taking the address of a function. In that case we need to
+ // set the entry in the dynamic symbol table to the address of
+ // the PLT entry.
+ if (gsym->is_from_dynobj() && !parameters->options().shared())
+ gsym->set_needs_dynsym_value();
+ }
break;
case elfcpp::R_AARCH64_LD_PREL_LO19: // 273

View File

@ -1,39 +0,0 @@
diff -rup binutils.orig/bfd/coffgen.c binutils-2.31.1/bfd/coffgen.c
--- binutils.orig/bfd/coffgen.c 2019-03-06 08:49:19.500586870 +0000
+++ binutils-2.31.1/bfd/coffgen.c 2019-03-06 08:49:45.798394582 +0000
@@ -2289,7 +2289,7 @@ coff_find_nearest_line_with_names (bfd *
information. So try again, using a bias against the address sought. */
if (coff_data (abfd)->dwarf2_find_line_info != NULL)
{
- bfd_signed_vma bias;
+ bfd_signed_vma bias = 0;
/* Create a cache of the result for the next call. */
if (sec_data == NULL && section->owner == abfd)
@@ -2301,10 +2301,11 @@ coff_find_nearest_line_with_names (bfd *
if (sec_data != NULL && sec_data->saved_bias)
bias = sec_data->saved_bias;
- else
+ else if (symbols)
{
bias = _bfd_dwarf2_find_symbol_bias (symbols,
& coff_data (abfd)->dwarf2_find_line_info);
+
if (sec_data)
{
sec_data->saved_bias = TRUE;
Only in binutils-2.31.1/bfd: coffgen.c.orig
diff -rup binutils.orig/bfd/dwarf2.c binutils-2.31.1/bfd/dwarf2.c
--- binutils.orig/bfd/dwarf2.c 2019-03-06 08:49:19.498586884 +0000
+++ binutils-2.31.1/bfd/dwarf2.c 2019-03-06 08:49:45.799394575 +0000
@@ -4463,7 +4463,7 @@ _bfd_dwarf2_find_symbol_bias (asymbol **
stash = (struct dwarf2_debug *) *pinfo;
- if (stash == NULL)
+ if (stash == NULL || symbols == NULL)
return 0;
for (unit = stash->all_comp_units; unit; unit = unit->next_unit)
Only in binutils-2.31.1/bfd: dwarf2.c.orig

View File

@ -1,18 +0,0 @@
--- 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);

View File

@ -1,68 +0,0 @@
diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.32/bfd/elf-bfd.h
--- binutils.orig/bfd/elf-bfd.h 2019-07-02 16:03:41.758007318 +0100
+++ binutils-2.32/bfd/elf-bfd.h 2019-07-02 16:04:02.025862020 +0100
@@ -2749,6 +2749,8 @@ extern bfd_vma elf64_r_sym (bfd_vma);
extern bfd_vma elf32_r_info (bfd_vma, bfd_vma);
extern bfd_vma elf32_r_sym (bfd_vma);
+extern bfd_boolean is_debuginfo_file (bfd *);
+
/* Large common section. */
extern asection _bfd_elf_large_com_section;
Only in binutils-2.32/bfd: elf-bfd.h.orig
diff -rup binutils.orig/bfd/elf.c binutils-2.32/bfd/elf.c
--- binutils.orig/bfd/elf.c 2019-07-02 16:03:42.101004858 +0100
+++ binutils-2.32/bfd/elf.c 2019-07-02 16:04:23.909705141 +0100
@@ -5807,6 +5807,35 @@ assign_file_positions_for_load_sections
return TRUE;
}
+/* Determine if a bfd is a debuginfo file. Unfortunately there
+ is no defined method for detecting such files, so we have to
+ use heuristics instead. */
+
+bfd_boolean
+is_debuginfo_file (bfd *abfd)
+{
+ if (abfd == NULL || bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+ return FALSE;
+
+ Elf_Internal_Shdr **start_headers = elf_elfsections (abfd);
+ Elf_Internal_Shdr **end_headers = start_headers + elf_numsections (abfd);
+ Elf_Internal_Shdr **headerp;
+
+ for (headerp = start_headers; headerp < end_headers; headerp ++)
+ {
+ Elf_Internal_Shdr *header = * headerp;
+
+ /* Debuginfo files do not have any allocated SHT_PROGBITS sections.
+ The only allocated sections are SHT_NOBITS or SHT_NOTES. */
+ if ((header->sh_flags & SHF_ALLOC) == SHF_ALLOC
+ && header->sh_type != SHT_NOBITS
+ && header->sh_type != SHT_NOTE)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/* Assign file positions for the other sections. */
static bfd_boolean
@@ -5840,7 +5869,13 @@ assign_file_positions_for_non_load_secti
BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos);
else if ((hdr->sh_flags & SHF_ALLOC) != 0)
{
- if (hdr->sh_size != 0)
+ if (hdr->sh_size != 0
+ /* PR 24717 - debuginfo files are known to be not strictly
+ compliant with the ELF standard. In particular they often
+ have .note.gnu.property sections that are outside of any
+ loadable segment. This is not a problem for such files,
+ so do not warn about them. */
+ && ! is_debuginfo_file (abfd))
_bfd_error_handler
/* xgettext:c-format */
(_("%pB: warning: allocated section `%s' not in segment"),
Only in binutils-2.32/bfd: elf.c.orig

View File

@ -8,16 +8,6 @@ diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.32/ld
+#...
hook called: cleanup.
#...
diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-12.d binutils-2.32/ld/testsuite/ld-plugin/plugin-12.d
--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-12.d 2019-02-15 13:33:21.976627309 +0000
+++ binutils-2.32/ld/testsuite/ld-plugin/plugin-12.d 2019-02-15 13:47:04.060076132 +0000
@@ -1,5 +1,5 @@
#...
-.*: symbol `func' definition: 0, visibility: 0, resolution: 2
+.*: symbol `func' definition: 0, visibility: 0, resolution: .
.*: symbol `func1' definition: 0, visibility: 1, resolution: 3
.*: symbol `func2' definition: 0, visibility: 2, resolution: 3
.*: symbol `func3' definition: 0, visibility: 3, resolution: 3
diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-13.d binutils-2.32/ld/testsuite/ld-plugin/plugin-13.d
--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-13.d 2019-02-15 13:33:21.980627277 +0000
+++ binutils-2.32/ld/testsuite/ld-plugin/plugin-13.d 2019-02-15 13:41:30.189692800 +0000
@ -289,20 +279,6 @@ diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-11.d binutils-2.32/ld
+#...
hook called: cleanup.
#...
diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-12.d binutils-2.32/ld/testsuite/ld-plugin/plugin-12.d
--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-12.d 2019-02-15 14:10:58.912710532 +0000
+++ binutils-2.32/ld/testsuite/ld-plugin/plugin-12.d 2019-02-15 14:13:18.464583848 +0000
@@ -1,6 +1,6 @@
#...
-.*: symbol `func' definition: 0, visibility: 0, resolution: .
-.*: symbol `func1' definition: 0, visibility: 1, resolution: 3
-.*: symbol `func2' definition: 0, visibility: 2, resolution: 3
-.*: symbol `func3' definition: 0, visibility: 3, resolution: 3
+.*: symbol `_?func' definition: 0, visibility: 0, resolution: .
+.*: symbol `_?func1' definition: 0, visibility: 1, resolution: 3
+.*: symbol `_?func2' definition: 0, visibility: 2, resolution: 3
+.*: symbol `_?func3' definition: 0, visibility: 3, resolution: 3
#pass
diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-18.d binutils-2.32/ld/testsuite/ld-plugin/plugin-18.d
--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-18.d 2019-02-15 14:10:58.942710289 +0000
+++ binutils-2.32/ld/testsuite/ld-plugin/plugin-18.d 2019-02-15 14:15:20.030602369 +0000

View File

@ -1,55 +0,0 @@
--- binutils.orig/gas/write.c 2019-07-01 16:23:28.133707500 +0100
+++ binutils-2.32/gas/write.c 2019-07-01 16:24:50.699130611 +0100
@@ -1891,7 +1891,8 @@ create_obj_attrs_section (void)
static void
create_note_reloc (segT sec,
symbolS * sym,
- bfd_size_type offset,
+ bfd_size_type note_offset,
+ bfd_size_type desc2_offset,
int reloc_type,
bfd_vma addend,
char * note)
@@ -1901,10 +1902,10 @@ create_note_reloc (segT sec,
reloc = XNEW (struct reloc_list);
/* We create a .b type reloc as resolve_reloc_expr_symbols() has already been called. */
- reloc->u.b.sec = sec;
- reloc->u.b.s = symbol_get_bfdsym (sym);
+ reloc->u.b.sec = sec;
+ reloc->u.b.s = symbol_get_bfdsym (sym);
reloc->u.b.r.sym_ptr_ptr = & reloc->u.b.s;
- reloc->u.b.r.address = offset;
+ reloc->u.b.r.address = note_offset + desc2_offset;
reloc->u.b.r.addend = addend;
reloc->u.b.r.howto = bfd_reloc_type_lookup (stdoutput, reloc_type);
@@ -1929,12 +1930,12 @@ create_note_reloc (segT sec,
if (target_big_endian)
{
if (bfd_arch_bits_per_address (stdoutput) <= 32)
- note[offset + 3] = addend;
+ note[desc2_offset + 3] = addend;
else
- note[offset + 7] = addend;
+ note[desc2_offset + 7] = addend;
}
else
- note[offset] = addend;
+ note[desc2_offset] = addend;
}
}
@@ -2037,10 +2038,10 @@ maybe_generate_build_notes (void)
memcpy (note + 12, "GA$3a1", 8);
/* Create a relocation to install the start address of the note... */
- create_note_reloc (sec, sym, total_size + 20, desc_reloc, 0, note);
+ create_note_reloc (sec, sym, total_size, 20, desc_reloc, 0, note);
/* ...and another one to install the end address. */
- create_note_reloc (sec, sym, total_size + desc2_offset, desc_reloc,
+ create_note_reloc (sec, sym, total_size, desc2_offset, desc_reloc,
bfd_get_section_size (bsym->section),
note);

View File

@ -1,10 +0,0 @@
--- binutils.orig/gold/descriptors.cc 2019-09-24 09:43:51.200071784 +0100
+++ binutils-2.32/gold/descriptors.cc 2019-09-24 09:44:24.028874593 +0100
@@ -26,6 +26,7 @@
#include <cstdio>
#include <cstring>
#include <fcntl.h>
+#include <string>
#include <unistd.h>
#include "debug.h"

View File

@ -1,57 +0,0 @@
--- binutils.orig/binutils/objcopy.c 2019-08-05 16:17:56.908552690 +0100
+++ binutils-2.32/binutils/objcopy.c 2019-08-05 16:18:14.985435014 +0100
@@ -1988,7 +1988,6 @@ merge_gnu_build_notes (bfd * abfd, asect
unsigned long previous_open_end = 0;
long relsize;
-
relsize = bfd_get_reloc_upper_bound (abfd, sec);
if (relsize > 0)
{
@@ -2005,7 +2004,8 @@ merge_gnu_build_notes (bfd * abfd, asect
}
/* Make a copy of the notes and convert to our internal format.
- Minimum size of a note is 12 bytes. */
+ 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)
{
@@ -2174,12 +2174,10 @@ merge_gnu_build_notes (bfd * abfd, asect
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)
- {
- err = _("bad GNU build attribute notes: first note not version note");
- goto done;
- }
+ /* We used to require that the first note be a version note,
+ but this is no longer enforced. Due to the problems with
+ linking sections with the same name (eg .gnu.build.note.hot)
+ we cannot guarantee that the first note will be a version note. */
/* Now merge the notes. The rules are:
1. Preserve the ordering of the notes.
@@ -2196,8 +2194,9 @@ merge_gnu_build_notes (bfd * abfd, asect
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. */
- for (pnote = pnotes + 1; pnote < pnotes_end; pnote ++)
+ 6. Notes with the same start and end address can be deleted.
+ 7. FIXME: Elminate duplicate version notes - even function specific ones ? */
+ for (pnote = pnotes; pnote < pnotes_end; pnote ++)
{
int note_type;
objcopy_internal_note * back;
@@ -2225,7 +2224,6 @@ merge_gnu_build_notes (bfd * abfd, asect
&& back->note.namesz == pnote->note.namesz
&& memcmp (back->note.namedata, pnote->note.namedata, pnote->note.namesz) == 0)
{
- fprintf (stderr, "DUP FUNXC\n");
duplicate_found = TRUE;
pnote->note.type = 0;
break;

View File

@ -1,90 +0,0 @@
diff -rup binutils.orig/bfd/Makefile.am binutils-2.32/bfd/Makefile.am
--- binutils.orig/bfd/Makefile.am 2019-10-04 09:38:45.255326417 +0100
+++ binutils-2.32/bfd/Makefile.am 2019-10-04 09:43:18.295336820 +0100
@@ -74,7 +74,7 @@ BFD32_LIBS = \
coff-bfd.lo compress.lo corefile.lo elf-properties.lo format.lo \
hash.lo init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo \
section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo \
- binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
+ binary.lo srec.lo
BFD64_LIBS = archive64.lo
@@ -83,7 +83,7 @@ BFD32_LIBS_CFILES = \
compress.c corefile.c elf-properties.c format.c hash.c \
init.c libbfd.c linker.c merge.c opncls.c reloc.c \
section.c simple.c stab-syms.c stabs.c syms.c targets.c \
- binary.c ihex.c srec.c tekhex.c verilog.c
+ binary.c srec.c
BFD64_LIBS_CFILES = archive64.c
diff -rup binutils.orig/bfd/Makefile.in binutils-2.32/bfd/Makefile.in
--- binutils.orig/bfd/Makefile.in 2019-10-04 09:38:45.262326366 +0100
+++ binutils-2.32/bfd/Makefile.in 2019-10-04 09:44:04.951996839 +0100
@@ -185,8 +185,7 @@ am__objects_1 = archive.lo archures.lo b
cache.lo coff-bfd.lo compress.lo corefile.lo elf-properties.lo \
format.lo hash.lo init.lo libbfd.lo linker.lo merge.lo \
opncls.lo reloc.lo section.lo simple.lo stab-syms.lo stabs.lo \
- syms.lo targets.lo binary.lo ihex.lo srec.lo tekhex.lo \
- verilog.lo
+ syms.lo targets.lo binary.lo srec.lo
am_libbfd_la_OBJECTS = $(am__objects_1)
libbfd_la_OBJECTS = $(am_libbfd_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
@@ -498,7 +497,7 @@ BFD32_LIBS = \
coff-bfd.lo compress.lo corefile.lo elf-properties.lo format.lo \
hash.lo init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo \
section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo \
- binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
+ binary.lo srec.lo
BFD64_LIBS = archive64.lo
BFD32_LIBS_CFILES = \
@@ -506,7 +505,7 @@ BFD32_LIBS_CFILES = \
compress.c corefile.c elf-properties.c format.c hash.c \
init.c libbfd.c linker.c merge.c opncls.c reloc.c \
section.c simple.c stab-syms.c stabs.c syms.c targets.c \
- binary.c ihex.c srec.c tekhex.c verilog.c
+ binary.c srec.c
BFD64_LIBS_CFILES = archive64.c
@@ -1514,7 +1513,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386bsd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386lynx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386msdos.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ihex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irix-core.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbfd.Plo@am__quote@
@@ -1566,11 +1564,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stabs.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syms.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/targets.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tekhex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trad-core.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vax1knetbsd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vaxnetbsd.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verilog.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vms-alpha.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vms-lib.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vms-misc.Plo@am__quote@
diff -rup binutils.orig/bfd/targets.c binutils-2.32/bfd/targets.c
--- binutils.orig/bfd/targets.c 2019-10-04 09:38:45.268326323 +0100
+++ binutils-2.32/bfd/targets.c 2019-10-04 09:42:54.118512989 +0100
@@ -1289,14 +1289,8 @@ static const bfd_target * const _bfd_tar
/* Always support S-records, for convenience. */
&srec_vec,
&symbolsrec_vec,
-/* And verilog. */
- &verilog_vec,
-/* And tekhex */
- &tekhex_vec,
/* Likewise for binary output. */
&binary_vec,
-/* Likewise for ihex. */
- &ihex_vec,
/* Add any required traditional-core-file-handler. */

View File

@ -1,158 +0,0 @@
Backup from binutils-2_32-branch upstream:
commit df010caac3b33b1d38b6d67024091854c3f77c77
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Jun 24 11:08:40 2019 -0700
elf: Remove the property after reporting its removal
commit d2ef37ebd9f771d06edf1fdea37970f60b242b2d
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Dec 7 08:30:30 2018 -0800
elf: Report property change when merging properties
failed to remove the property after reporting it has been removed. This
patch corrects it.
bfd/
PR ld/24721
* elf-properties.c (elf_merge_gnu_property_list): Remove the
property after reporting property removal.
ld/
PR ld/24721
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/24721 tests.
* testsuite/ld-x86-64/pr24721-x32.d: New file.
* testsuite/ld-x86-64/pr24721.d: Likewise.
* testsuite/ld-x86-64/pr24721.map: Likewise.
* testsuite/ld-x86-64/pr24721a.s: Likewise.
* testsuite/ld-x86-64/pr24721b.s: Likewise.
(cherry picked from commit f93ab3a0b8039a1667a666f013cca50b03d67f9b)
Conflicts:
ld/testsuite/ld-x86-64/x86-64.exp
(Missing backports of PR24151, PR24458.)
diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
index 5e48d75faa269453..4a9907ff7edad5e0 100644
--- a/bfd/elf-properties.c
+++ b/bfd/elf-properties.c
@@ -322,12 +322,10 @@ elf_merge_gnu_property_list (struct bfd_link_info *info, bfd *first_pbfd,
(bfd_vma) p->property.pr_type, first_pbfd, abfd);
}
}
- else
- {
- /* Remove this property. */
- *lastp = p->next;
- continue;
- }
+
+ /* Remove this property. */
+ *lastp = p->next;
+ continue;
}
else if (number_p)
{
diff --git a/ld/testsuite/ld-x86-64/pr24721-x32.d b/ld/testsuite/ld-x86-64/pr24721-x32.d
new file mode 100644
index 0000000000000000..9b067efdc11a4824
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24721-x32.d
@@ -0,0 +1,6 @@
+#source: pr24721a.s
+#source: pr24721b.s
+#as: --x32 -mx86-used-note=no
+#ld: -r -m elf32_x86_64 -Map tmpdir/pr24721.map
+#readelf: -n
+#map: pr24721.map
diff --git a/ld/testsuite/ld-x86-64/pr24721.d b/ld/testsuite/ld-x86-64/pr24721.d
new file mode 100644
index 0000000000000000..efa88db2b3c7e9c5
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24721.d
@@ -0,0 +1,6 @@
+#source: pr24721a.s
+#source: pr24721b.s
+#as: --64 -defsym __64_bit__=1 -mx86-used-note=no
+#ld: -r -melf_x86_64 -Map tmpdir/pr24721.map
+#readelf: -n
+#map: pr24721.map
diff --git a/ld/testsuite/ld-x86-64/pr24721.map b/ld/testsuite/ld-x86-64/pr24721.map
new file mode 100644
index 0000000000000000..9e63fff27557b983
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24721.map
@@ -0,0 +1,3 @@
+#...
+Removed property 0xc0000002 to merge tmpdir/pr24721a.o \(0x1\) and tmpdir/pr24721b.o \(not found\)
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr24721a.s b/ld/testsuite/ld-x86-64/pr24721a.s
new file mode 100644
index 0000000000000000..b229d19b02dc9809
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24721a.s
@@ -0,0 +1,34 @@
+ .text
+ .globl foo
+ .type foo,@function
+ .p2align 4
+foo:
+ ret
+
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/ld/testsuite/ld-x86-64/pr24721b.s b/ld/testsuite/ld-x86-64/pr24721b.s
new file mode 100644
index 0000000000000000..3d11691166751bfa
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr24721b.s
@@ -0,0 +1,6 @@
+ .text
+ .globl bar
+ .type bar,@function
+ .p2align 4
+bar:
+ ret
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 0d65801a942dbddd..3e02531e6f90aff9 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -424,6 +424,8 @@ run_dump_test "pr23486d-x32"
run_dump_test "pr23854"
run_dump_test "pr23930"
run_dump_test "pr23930-x32"
+run_dump_test "pr24721"
+run_dump_test "pr24721-x32"
if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
return

View File

@ -1,8 +1,8 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.32
Release: 27%{?dist}
Version: 2.33.1
Release: 1%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
@ -183,97 +183,26 @@ Patch10: binutils-attach-to-group.patch
# Purpose: Stop gold from complaining about relocs in the .gnu.build.attribute
# section that reference symbols in discarded sections.
# Lifetime: Fixed in 2.33 (maybe)
# Lifetime: Fixed in 2.34 (maybe)
Patch11: binutils-gold-ignore-discarded-note-relocs.patch
# Purpose: Allow OS specific sections in section groups.
# Lifetime: Might be fixed in 2.33
# Lifetime: Might be fixed in 2.34 (maybe)
Patch12: binutils-special-sections-in-groups.patch
# Purpose: Fix linker testsuite failures.
# Lifetime: Fixed in 2.33 (possibly)
# Lifetime: Fixed in 2.34 (maybe)
Patch13: binutils-fix-testsuite-failures.patch
# Purpose: Improve objdump's handling of corrupt input files.
# Lifetime: Fixed in 2.33
Patch14: binutils-CVE-2019-9073.patch
# Purpose: Stop illegal memory access parsing corrupt PE files.
# Lifetime: Fixed in 2.33
Patch15: binutils-CVE-2019-9074.patch
# Purpose: Stop illegal memory access parsing corrupt archives.
# Lifetime: Fixed in 2.33
Patch16: binutils-CVE-2019-9075.patch
# Purpose: Stop illegal memory access parsing a corrupt MIPS binary.
# Lifetime: Fixed in 2.33
Patch17: binutils-CVE-2019-9077.patch
# Purpose: Stop a seg-fault when disassembling an EFI binary.
# Lifetime: Fixed in 2.33
Patch18: binutils-disassembling-efi-files.patch
# Purpose: Fix a stack exhaustion problem in libiberty's name demangling code.
# Lifetime: Fixed in 2.33
Patch19: binutils-CVE-2019-9071.patch
# Purpose: Have the GOLD linker for AArch64 generate PLT entries for MOVW_ABS
# relocations if necessary.
# Lifetime: Fixed in 2.33
Patch20: binutils-aarch64-gold-PLT-for-MOVW_ABS.patch
# Purpose: Stop gold from aborting when input sections with the same name
# have different flags.
# Lifetime: Fixed in 2.33 (probably)
Patch21: binutils-gold-mismatched-section-flags.patch
# Purpose: Corrcect a memory corruption when generating relocs for build
# notes in the assembler.
# Lifetime: Fixed in 2.33
Patch22: binutils-gas-build-note-relocs.patch
# Purpose: Stop the BFD library from issueing warning messages about allocated
# sections being found outside of loadable segments, if they are
# found inside debuginfo files.
# Lifetime: Fixed in 2.33
Patch23: binutils-do-not-warn-about-debuginfo-files.patch
# Purpose: Stops the linker from merging section groups with different
# exclusion flags.
# Lifetime: Fixed in 2.33
Patch24: binutils-do-not-merge-differing-SHF_EXCLUDE-groups.patch
# Purpose: Fix -Map and property merging
# Lifetime: Fixed in 2.33
Patch25: binutils-rh1736114.patch
# Purpose: Change objcopy/strip so that they do not complain if the
# first note in a sequence of build notes is not a version note.
# Lifetime: Fixed in 2.33
Patch26: binutils-objcopy-gnu-build-version-notes.patch
# Lifetime: Fixed in 2.34 (maybe)
Patch14: binutils-gold-mismatched-section-flags.patch
# Purpose: Add a check to the GOLD linker for a corrupt input file
# with a fuzzed section offset.
# Lifetime: Fixed in 2.33
Patch27: binutils-CVE-2019-1010204.patch
# Purpose: Add check to libiberty library in order to prevent an integer
# overflow in the gold linker.
# Lifetime: Fixed in 2.33
Patch28: binutils-CVE-2019-14250.patch
# Purpose: Add check to readelf in order to prevent an integer overflow.
# Lifetime: Fixed in 2.33
Patch29: binutils-CVE-2019-14444.patch
# Purpose: Fix for building with gcc-10.
# Lifetime: Fixed in 2.34
Patch30: binutils-gcc-10-fixes.patch
# Purpose: Remove support for old file formats (ihex, tekhex, verilog)
# Lifetime: Permanent.
Patch31: binutils-remove-old-formats.patch
# Lifetime: Fixed in 2.34 (maybe)
Patch15: binutils-CVE-2019-1010204.patch
#----------------------------------------------------------------------------
@ -425,22 +354,6 @@ Conflicts: gcc-c++ < 4.0.0
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -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 ?
@ -846,6 +759,25 @@ exit 0
#----------------------------------------------------------------------------
%changelog
* Mon Oct 14 2019 Nick Clifton <nickc@redhat.com> - 2.33-1
- Rebase to GNU Binutils 2.33.1.
- Retire: binutils-CVE-2019-9073.patch
- Retire: binutils-CVE-2019-9074.patch
- Retire: binutils-CVE-2019-9075.patch
- Retire: binutils-CVE-2019-9077.patch
- Retire: binutils-disassembling-efi-files.patch
- Retire: binutils-CVE-2019-9071.patch
- Retire: binutils-gas-build-note-relocs.patch
- Retire: binutils-do-not-warn-about-debuginfo-files.patch
- Retire: binutils-do-not-merge-differing-SHF_EXCLUDE-groups.patch
- Retire: binutils-rh1736114.patch
- Retire: binutils-objcopy-gnu-build-version-notes.patch
- Retire: binutils-CVE-2019-14250.patch
- Retire: binutils-CVE-2019-14444.patch
- Retire: binutils-gcc-10-fixes.patch
- Retire: binutils-remove-old-formats.patch
- Retire: binutils-aarch64-gold-PLT-for-MOVW_ABS.patch
* Fri Oct 04 2019 Nick Clifton <nickc@redhat.com> - 2.32-27
- Remove support for old file formats (ihex, tekhex, verilog) as they are a constant source of CVEs.

View File

@ -1,2 +1,2 @@
SHA512 (binutils-2.32.tar.xz) = d326408f12a03d9a61a9de56584c2af12f81c2e50d2d7e835d51565df8314df01575724afa1e43bd0db45cfc9916b41519b67dfce03232aa4978704492a6994a
SHA512 (binutils-2.33.1.tar.xz) = b7a6767c6c7ca6b5cafa7080e6820b7bb3a53b7148348c438d99905defbdf0d30c9744a484ee01c9441a8153901808513366b15ba9533e20c9673c262ade36ac
SHA512 (binutils-2.19.50.0.1-output-format.sed) = 2f8686b0c8af13c98cda056824c2820416f6e2d003f70b78ccf5314525b9ee3684d421dfa83e638a2d42d06ea4d4bdaf5226b64d6ec26f7ff59c44ffb2a23dd2