Author: dim
Date: Mon Mar  7 07:49:01 2016
New Revision: 296437
URL: https://svnweb.freebsd.org/changeset/base/296437

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

Modified:
  stable/9/contrib/binutils/bfd/elf.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/binutils/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/binutils/bfd/elf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/9/contrib/binutils/bfd/elf.c
==============================================================================
--- stable/9/contrib/binutils/bfd/elf.c Mon Mar  7 07:46:17 2016        
(r296436)
+++ stable/9/contrib/binutils/bfd/elf.c Mon Mar  7 07:49:01 2016        
(r296437)
@@ -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;
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to