Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Dec 2012 19:02:28 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r244776 - head/contrib/gcc
Message-ID:  <201212281902.qBSJ2SNS083394@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Fri Dec 28 19:02:28 2012
New Revision: 244776
URL: http://svnweb.freebsd.org/changeset/base/244776

Log:
  gcc: avoid generating negative values to DW_AT_byte_size.
  
  There is a bug in gcc (GCC/35998) where dwarf reports
  sizes of unsigned -1 (0xffffffff).
  
  On NetBSD this generated a faulty CTF entry which then
  caused a segfault in ctfmerge. The issue was worked
  around in NetBSD's Dtrace but since the issue originated
  in gcc, it seems reasonable to fix it here.
  
  Upstream gcc has been slow to react to this issue and
  the author that submitted the patch is not interested
  in licensing the change to us, so I did an independent
  workaround for the issue.
  
  MFC after:	1 week

Modified:
  head/contrib/gcc/dwarf2out.c

Modified: head/contrib/gcc/dwarf2out.c
==============================================================================
--- head/contrib/gcc/dwarf2out.c	Fri Dec 28 18:59:10 2012	(r244775)
+++ head/contrib/gcc/dwarf2out.c	Fri Dec 28 19:02:28 2012	(r244776)
@@ -10812,9 +10812,9 @@ add_byte_size_attribute (dw_die_ref die,
 
   /* Note that `size' might be -1 when we get to this point.  If it is, that
      indicates that the byte size of the entity in question is variable.  We
-     have no good way of expressing this fact in Dwarf at the present time,
-     so just let the -1 pass on through.  */
-  add_AT_unsigned (die, DW_AT_byte_size, size);
+     have no good way of expressing this fact in Dwarf at the present time.
+     GCC/35998: Avoid passing negative sizes to Dtrace and gdb.  */
+  add_AT_unsigned (die, DW_AT_byte_size, (size > 0 ? size : 0));
 }
 
 /* For a FIELD_DECL node which represents a bit-field, output an attribute



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