[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3] tools: detect appropriate debug optimization level



On Sat, Mar 10, 2018 at 11:08:21PM -0600, Doug Goldstein wrote:
> On 3/2/18 6:46 AM, Wei Liu wrote:
> > On Fri, Feb 23, 2018 at 11:26:17PM -0600, Doug Goldstein wrote:
> >> On 4/28/16 12:40 PM, Wei Liu wrote:
> >>> On Tue, Apr 26, 2016 at 09:38:45AM -0500, Doug Goldstein wrote:
> >>>> When building debug use -Og as the optimization level if its available,
> >>>> otherwise retain the use of -O0. -Og has been added by GCC to enable all
> >>>> optimizations that to not affect debugging while retaining full
> >>>> debugability.
> >>>>
> >>>> Signed-off-by: Doug Goldstein <cardoe@xxxxxxxxxx>
> >>>> ---
> >>>> change since v2:
> >>>> - switch back to cc-option-add to not call cc-option on every invocation
> >>>> change since v1:
> >>>> - switch to cc-option to only specify -O0 if -Og isn't supported
> >>>> ---
> >>>>  tools/Rules.mk | 1 +
> >>>>  1 file changed, 1 insertion(+)
> >>>>
> >>>> diff --git a/tools/Rules.mk b/tools/Rules.mk
> >>>> index 9ef0b47..1b79a6e 100644
> >>>> --- a/tools/Rules.mk
> >>>> +++ b/tools/Rules.mk
> >>>> @@ -138,6 +138,7 @@ SHLIB_libxenvchan  = $(SHDEPS_libxenvchan) 
> >>>> -Wl,-rpath-link=$(XEN_LIBVCHAN)
> >>>>  ifeq ($(debug),y)
> >>>>  # Disable optimizations and enable debugging information for macros
> >>>>  CFLAGS += -O0 -g3
> >>>> +$(call cc-option-add,CFLAGS,CC,-Og)
> > 
> > Though -Og will supersede -O0 because it comes later, I would rather you
> > use cc-option to selectively add one of the two, like:
> > 
> > CFLAGS += $(cc-option,CC,-Og,-O0)
> > 
> > Wei.
> > 
> 
> Wei,
> 
> It was like that in v2 but I changed it per Ian's request to this
> version. See:
> https://lists.xenproject.org/archives/html/xen-devel/2016-04/msg02822.html
> for reference.

That's a good point. We certainly want to avoid expanding the same thing
over and over again.

I think you can do with

ifneq ($(call cc-option,$(CC),-Og,n),n)
CFLAGS += -Og
else
CFLAGS += -O0
endif

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.