|
|
381f6c |
diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c
|
|
|
381f6c |
--- binutils.orig/bfd/elf.c 2018-06-01 09:10:37.866552789 +0100
|
|
|
381f6c |
+++ binutils-2.30/bfd/elf.c 2018-06-01 09:16:23.159605609 +0100
|
|
|
381f6c |
@@ -707,11 +707,23 @@ setup_group (bfd *abfd, Elf_Internal_Shd
|
|
|
381f6c |
|= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
|
|
|
381f6c |
break;
|
|
|
381f6c |
}
|
|
|
381f6c |
- if (idx >= shnum)
|
|
|
381f6c |
+ if (idx < shnum)
|
|
|
381f6c |
+ {
|
|
|
381f6c |
+ dest->shdr = elf_elfsections (abfd)[idx];
|
|
|
381f6c |
+ /* PR binutils/23199: All sections in a
|
|
|
381f6c |
+ section group should be marked with
|
|
|
381f6c |
+ SHF_GROUP. But some tools generate
|
|
|
381f6c |
+ broken objects without SHF_GROUP. Fix
|
|
|
381f6c |
+ them up here. */
|
|
|
381f6c |
+ dest->shdr->sh_flags |= SHF_GROUP;
|
|
|
381f6c |
+ }
|
|
|
381f6c |
+ if (idx >= shnum
|
|
|
381f6c |
+ || dest->shdr->sh_type == SHT_GROUP)
|
|
|
381f6c |
{
|
|
|
381f6c |
_bfd_error_handler
|
|
|
381f6c |
- (_("%B: invalid SHT_GROUP entry"), abfd);
|
|
|
381f6c |
- idx = 0;
|
|
|
381f6c |
+ (_("%B: invalid entry in SHT_GROUP section [%u]"),
|
|
|
381f6c |
+ abfd, i);
|
|
|
381f6c |
+ dest->shdr = NULL;
|
|
|
381f6c |
}
|
|
|
381f6c |
dest->shdr = elf_elfsections (abfd)[idx];
|
|
|
381f6c |
}
|
|
|
381f6c |
@@ -779,7 +791,8 @@ setup_group (bfd *abfd, Elf_Internal_Shd
|
|
|
381f6c |
idx = (Elf_Internal_Group *) shdr->contents;
|
|
|
381f6c |
n_elt = shdr->sh_size / 4;
|
|
|
381f6c |
while (--n_elt != 0)
|
|
|
381f6c |
- if ((s = (++idx)->shdr->bfd_section) != NULL
|
|
|
381f6c |
+ if ((++idx)->shdr != NULL
|
|
|
381f6c |
+ && (s = idx->shdr->bfd_section) != NULL
|
|
|
381f6c |
&& elf_next_in_group (s) != NULL)
|
|
|
381f6c |
break;
|
|
|
381f6c |
if (n_elt != 0)
|
|
|
381f6c |
diff -rup binutils.orig/bfd/elfxx-x86.c binutils-2.30/bfd/elfxx-x86.c
|
|
|
381f6c |
--- binutils.orig/bfd/elfxx-x86.c 2018-06-01 09:10:37.854552926 +0100
|
|
|
381f6c |
+++ binutils-2.30/bfd/elfxx-x86.c 2018-06-01 09:21:10.570323575 +0100
|
|
|
381f6c |
@@ -1976,7 +1976,13 @@ _bfd_x86_elf_link_symbol_references_loca
|
|
|
381f6c |
return TRUE;
|
|
|
381f6c |
}
|
|
|
381f6c |
|
|
|
381f6c |
- eh->local_ref = 1;
|
|
|
381f6c |
+ /* Symbols created by HIDDEN and PROVIDE_HIDDEN assignments in linker
|
|
|
381f6c |
+ script aren't forced local here yet. bfd_hide_sym_by_version
|
|
|
381f6c |
+ can't be used to check if a versioned symbol is hidden. It has to
|
|
|
381f6c |
+ be syncd with _bfd_elf_link_assign_sym_version to get the correct
|
|
|
381f6c |
+ answer. */
|
|
|
381f6c |
+ if (!h->root.ldscript_def && h->versioned == unversioned)
|
|
|
381f6c |
+ eh->local_ref = 1;
|
|
|
381f6c |
return FALSE;
|
|
|
381f6c |
}
|
|
|
381f6c |
|