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