summaryrefslogtreecommitdiffstats
path: root/contrib/binutils
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-03-07 07:49:01 +0000
committerdim <dim@FreeBSD.org>2016-03-07 07:49:01 +0000
commit677f3cf709d2da38d4643c74bb1934315c32e43c (patch)
tree5c7d7396f4b91462d882defefde51b1667ad2482 /contrib/binutils
parent04c8b89217e2f85c7715441cd76296f9795dff3b (diff)
downloadFreeBSD-src-677f3cf709d2da38d4643c74bb1934315c32e43c.zip
FreeBSD-src-677f3cf709d2da38d4643c74bb1934315c32e43c.tar.gz
MFC r295901:
Fix a problem in ld, causing it to sometimes print messages similar to "invalid string offset 65521 >= 27261 for section `.strtab'". for object files produced by recent versions of clang. In BFD's elf_create_symbuf() function, the size of the symbol buffer ('ssymbuf') is not calculated correctly, and the initial value for the 'ssym' variable is off by one, since 'ssymbuf' has shndx_count + 1 members.
Diffstat (limited to 'contrib/binutils')
-rw-r--r--contrib/binutils/bfd/elf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/binutils/bfd/elf.c b/contrib/binutils/bfd/elf.c
index bbf1617..ed09cb5 100644
--- a/contrib/binutils/bfd/elf.c
+++ b/contrib/binutils/bfd/elf.c
@@ -8934,14 +8934,14 @@ elf_create_symbuf (bfd_size_type symcount, Elf_Internal_Sym *isymbuf)
shndx_count++;
ssymbuf = bfd_malloc ((shndx_count + 1) * sizeof (*ssymbuf)
- + (indbufend - indbuf) * sizeof (*ssymbuf));
+ + (indbufend - indbuf) * sizeof (*ssym));
if (ssymbuf == NULL)
{
free (indbuf);
return NULL;
}
- ssym = (struct elf_symbuf_symbol *) (ssymbuf + shndx_count);
+ ssym = (struct elf_symbuf_symbol *) (ssymbuf + shndx_count + 1);
ssymbuf->ssym = NULL;
ssymbuf->count = shndx_count;
ssymbuf->st_shndx = 0;
OpenPOWER on IntegriCloud