WITH_CTF vs -g

Andriy Gapon avg at FreeBSD.org
Fri Sep 26 15:59:40 UTC 2014


On 26/09/2014 01:51, Mark Johnston wrote:
> On Wed, Sep 10, 2014 at 08:23:21PM +0300, Andriy Gapon wrote:
>>
>> In my opinion WITH_CTF should imply -g in CFLAGS otherwise, as far as I can see,
>> there is nothing to generate CTF data from.  Forcing an end-user to remember to
>> additionally pass -g is not nice.
>>
>> Also, I think that we can always have -g in CTFFLAGS, because the stripping step
>> takes care of the original DWARF data in any case.  But I am not 100% sure about
>> this.
>>
>> What do you think?
>> Thanks!
> 
> Hi Andriy,
> 
> Are you planning to go through with this? I was just about to post this
> exact question, but then I remembered that you already have. :)
> 
> FWIW, the diff I have in mind is below. It also removes some checks that
> I think are unnecessary from bsd.{lib,prog}.mk. It is not fully tested,
> but seems to work for me. I'm also not sure about unconditionally
> passing -g to ctfconvert and ctfmerge.

Mark,

your change looks like what I was thinking of.
I will it a whirl here.
Thank you!

> diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
> index f0acf16..c6b689d 100644
> --- a/share/mk/bsd.lib.mk
> +++ b/share/mk/bsd.lib.mk
> @@ -36,7 +36,7 @@ NO_WERROR=
>  .if defined(DEBUG_FLAGS)
>  CFLAGS+= ${DEBUG_FLAGS}
>  
> -.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
> +.if ${MK_CTF} != "no"
>  CTFFLAGS+= -g
>  .endif
>  .else
> diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
> index 486914b..32556a1 100644
> --- a/share/mk/bsd.own.mk
> +++ b/share/mk/bsd.own.mk
> @@ -128,6 +128,7 @@ __<bsd.own.mk>__:
>  
>  .if ${MK_CTF} != "no"
>  CTFCONVERT_CMD=	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
> +DEBUG_FLAGS?=	-g
>  .elif defined(.PARSEDIR) || (defined(MAKE_VERSION) && ${MAKE_VERSION} >= 5201111300)
>  CTFCONVERT_CMD=
>  .else
> diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
> index 340950a..e4f7104 100644
> --- a/share/mk/bsd.prog.mk
> +++ b/share/mk/bsd.prog.mk
> @@ -20,7 +20,7 @@ NO_WERROR=
>  CFLAGS+=${DEBUG_FLAGS}
>  CXXFLAGS+=${DEBUG_FLAGS}
>  
> -.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
> +.if ${MK_CTF} != "no"
>  CTFFLAGS+= -g
>  .endif
>  .endif
> 


-- 
Andriy Gapon


More information about the freebsd-toolchain mailing list