diff options
author | dim <dim@FreeBSD.org> | 2016-02-22 22:16:32 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2016-02-22 22:16:32 +0000 |
commit | a4f5ccb7fc77161a2e775d9061a797a98826c0a8 (patch) | |
tree | b21e13e526c8321f6c2b95c028ecdb395a2b666c | |
parent | 4a5681f2fabaf791cc81e242967bd9d090181bb0 (diff) | |
download | FreeBSD-src-a4f5ccb7fc77161a2e775d9061a797a98826c0a8.zip FreeBSD-src-a4f5ccb7fc77161a2e775d9061a797a98826c0a8.tar.gz |
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.
MFC after: 1 week
-rw-r--r-- | contrib/binutils/bfd/elf.c | 4 |
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; |