Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Mar 2014 14:16:40 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        "Justin T. Gibbs" <gibbs@FreeBSD.org>
Cc:        freebsd-toolchain@freebsd.org
Subject:   Re: ctfconvert broken for C++ objects?
Message-ID:  <FFB0AF4E-BC44-49E5-8272-930668363A52@FreeBSD.org>
In-Reply-To: <81C07491-7E51-4CF0-B257-88ED998EE2A0@FreeBSD.org>
References:  <216B816A-8ADA-438F-B834-8C386C5BC460@FreeBSD.org> <20140220172608.GA85526@freebsd.org> <81C07491-7E51-4CF0-B257-88ED998EE2A0@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On 21 Feb 2014, at 23:47, Justin T. Gibbs <gibbs@FreeBSD.org> wrote:
> On Feb 20, 2014, at 10:26 AM, Roman Divacky <rdivacky@freebsd.org> wrote:
> 
>> The dwarf backend for ctfconvert was completely reimplemented a few weeks ago.
>> It's now based on elftoolchain libdwarf.
>> 
>> Test on current.
> 
> The failures I’ve experienced occur when attempting to ctfconvert the C++ code in the base (e.g. ATF or devd).  You can replicate the failures on head by applying the share/mk patch below (a version of my previous patch rebased on head).

I've just tried your patch, building devd, and it seemed to have worked
just fine (though I had to use DEBUG_FLAGS=-g, otherwise ctfconvert
would complain there was no type data to convert):

$ make WITH_CTF=x DEBUG_FLAGS=-g
c++ -O2 -pipe -I. -I/usr/src/sbin/devd -g -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wpointer-arith -Wno-uninitialized -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -g -Wno-c++11-extensions  -c /usr/src/sbin/devd/devd.cc
cc -O2 -pipe  -I. -I/usr/src/sbin/devd -g -std=gnu99 -Qunused-arguments  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -c token.c
ctfconvert -L VERSION -g token.o
cc -O2 -pipe  -I. -I/usr/src/sbin/devd -g -std=gnu99 -Qunused-arguments  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -c parse.c
ctfconvert -L VERSION -g parse.o
c++ -O2 -pipe -I. -I/usr/src/sbin/devd -g -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wpointer-arith -Wno-uninitialized -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -g -Wno-c++11-extensions   -static -o devd devd.o token.o parse.o -ll -lutil
ctfmerge -L VERSION -g -o devd devd.o token.o parse.o
gzip -cn /usr/src/sbin/devd/devd.8 > devd.8.gz
gzip -cn /usr/src/sbin/devd/devd.conf.5 > devd.conf.5.gz

$ ctfdump -S /usr/obj/usr/src/sbin/devd/devd

- CTF Statistics -------------------------------------------------------------

  total number of data objects        = 627

  total number of functions           = 31
  total number of function arguments  = 25
  maximum argument list length        = 2
  average argument list length        = 0.81

  total number of types               = 97
  total number of integers            = 9
  total number of floats              = 0
  total number of pointers            = 24
  total number of arrays              = 16
  total number of func types          = 6
  total number of structs             = 7
  total number of unions              = 2
  total number of enums               = 0
  total number of forward tags        = 4
  total number of typedefs            = 25
  total number of volatile types      = 0
  total number of const types         = 4
  total number of restrict types      = 0
  total number of unknowns (holes)    = 0

  total number of struct members      = 64
  maximum number of struct members    = 25
  total size of all structs           = 3492
  maximum size of a struct            = 3156
  average number of struct members    = 9.14
  average size of a struct            = 498.86

  total number of union members       = 6
  maximum number of union members     = 4
  total size of all unions            = 132
  maximum size of a union             = 128
  average number of union members     = 3.00
  average size of a union             = 66.00

  total number of enum members        = 0
  maximum number of enum members      = 0

  total number of unique strings      = 112
  bytes of string data                = 1051
  maximum string length               = 26
  average string length               = 9.38


> On a slightly related node, do you know why there is a FreeBSD version ranged exclusion around bootstrapping the dtrace tools?
> 
> From src/Makefile.inc1:
> # dtrace tools are required for older bootstrap env and cross-build              
> .if ${MK_CDDL} != "no" && \                                                      
>    ((${BOOTSTRAPPING} < 1000034 && \                                            
>          !(${BOOTSTRAPPING} >= 901505 && ${BOOTSTRAPPING} < 999999)) \          
>      || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))         
> _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \                  
>    lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge                   
> .endif

This was last changed by Brooks in r251689: "Be more agressive about
bootstrapping ctfmerge and ctfconvert so builds from existing releases
have a chance of working properly".  The range check was modified from:

    ((${BOOTSTRAPPING} < 800038 && !(${BOOTSTRAPPING} >= 700112 && ${BOOTSTRAPPING} < 799999))

to:

    ((${BOOTSTRAPPING} < 1000034 && !(${BOOTSTRAPPING} >= 901505 && ${BOOTSTRAPPING} < 999999))

but maybe the 9.x range check is now too narrow?

-Dimitry


[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)

iEYEARECAAYFAlMTLzwACgkQsF6jCi4glqOr8gCgne9nXvswgZZZexix7Vy/flYn
O2oAoJ1WebZhoDeHna8a+QkYkqFIbKGF
=7shc
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FFB0AF4E-BC44-49E5-8272-930668363A52>