Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Feb 2016 22:16:32 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r295901 - head/contrib/binutils/bfd
Message-ID:  <201602222216.u1MMGW0m023471@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Mon Feb 22 22:16:32 2016
New Revision: 295901
URL: https://svnweb.freebsd.org/changeset/base/295901

Log:
  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

Modified:
  head/contrib/binutils/bfd/elf.c

Modified: head/contrib/binutils/bfd/elf.c
==============================================================================
--- head/contrib/binutils/bfd/elf.c	Mon Feb 22 21:40:53 2016	(r295900)
+++ head/contrib/binutils/bfd/elf.c	Mon Feb 22 22:16:32 2016	(r295901)
@@ -8934,14 +8934,14 @@ elf_create_symbuf (bfd_size_type symcoun
 	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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602222216.u1MMGW0m023471>