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

Re: [XEN PATCH v7 39/51] build: rework coverage and ubsan CFLAGS handling


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 11 Oct 2021 18:04:48 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+PXozTFInzsIz15RU/C/L0HiOFmqLlUCFDy+c36U7X0=; b=ju2uEE9sGKARG2wuU/2MsqwxyvZHV+EiAYGNSCOMI8AZjzwRiUwKugYEYELW3HlT2rvphHeJKFxaAQOX1oNwZ8BINK6u7nHa8AvkjTJ4qwuZW5MF2ufhkZfe57fBuLns6jUaVxZd+IvpTIZ5Wt79CW8i2ZCzHUgKxdTWq/jC6/nMO+86593XoS9MI3npF0HLTSevFjgtiJoJKXedDCTNqAXcF425EDRq3h8mGdSpoiuEw8uvvcIcRj8nwMjdqXG3SUk5dXpAxy91jSrdrdLA2hNgzA+tE1kXYj2YwdWHpNqhdYjYI6Js2oDojEhkPx66R63BahUrIQcy+9oqWrTwuA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bpUcyrI/qVOTx9++GQpw3fFzgq9F/W+JE/0fD4KzbVPfh4mSXf0x+lWbCX8ZQZRZRe8smcQadvlx+mEgY7BxYRHv0xK67YQZyAoZ5DtU5aZv5Glkx4m1LB6emk24h+7BXyfNOHhnDj5y1xD+GmYPm9Tjrfryz3IMHNbochR9Luvkz/VTGKPYGEmdaIzd2+3i4ei6XF6RmTkrEP2BjL8D628aVEHMIDrI3/mOtHXzXp3A/tGIFPbd44gWGBiBI5Jw8M1BtyYqtocRpqh9l1dzFbAPqiCeSm0jAnxclqnVS2ky+36J61UswVyStRr+KV95Hdj4ILF6Ek/iHnjqVuxrNA==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 11 Oct 2021 16:05:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 24.08.2021 12:50, Anthony PERARD wrote:
> When assigning a value a target-specific variable, that also affect
> prerequisite of the target. This is mostly fine, but there is one case
> where we will not want the COV_FLAGS added to the CFLAGS.
> 
> In arch/x86/boot, we have "head.o" with "cmdline.S" as prerequisite
> and ultimately "cmdline.o", we don't want COV_FLAGS to that last one.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>

I think I understand what's going on, so
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

It would seem to me though that ...

> --- a/xen/Rules.mk
> +++ b/xen/Rules.mk
> @@ -131,19 +131,31 @@ targets += $(targets-for-builtin)
>  
>  $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS-y += 
> -DINIT_SECTIONS_ONLY
>  
> +non-init-objects = $(filter-out %.init.o, $(obj-y) $(obj-bin-y) $(extra-y))
> +
>  ifeq ($(CONFIG_COVERAGE),y)
>  ifeq ($(CONFIG_CC_IS_CLANG),y)
>      COV_FLAGS := -fprofile-instr-generate -fcoverage-mapping
>  else
>      COV_FLAGS := -fprofile-arcs -ftest-coverage
>  endif
> -$(filter-out %.init.o $(nocov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS-y 
> += $(COV_FLAGS)
> +
> +$(non-init-objects): _c_flags += $(COV_FLAGS)
> +
> +# Reset COV_FLAGS in cases where an objects as another one as prerequisite
> +$(nocov-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(extra-y)): \
> +    COV_FLAGS :=

... pulling this and ...

>  endif
>  
>  ifeq ($(CONFIG_UBSAN),y)
>  # Any -fno-sanitize= options need to come after any -fsanitize= options
> -$(filter-out %.init.o $(noubsan-y),$(obj-y) $(obj-bin-y) $(extra-y)): \
> -CFLAGS-y += $(filter-out -fno-%,$(CFLAGS_UBSAN)) $(filter 
> -fno-%,$(CFLAGS_UBSAN))
> +UBSAN_FLAGS := $(filter-out -fno-%,$(CFLAGS_UBSAN)) $(filter 
> -fno-%,$(CFLAGS_UBSAN))
> +
> +$(non-init-objects): _c_flags += $(UBSAN_FLAGS)
> +
> +# Reset UBSAN_FLAGS in cases where an objects as another one as prerequisite
> +$(noubsan-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(extra-y)): \
> +    UBSAN_FLAGS :=

... this up ahead of their respective _c_flags assignments would be
easier to follow, for being more logical (produce, then consume).

Also, as a nit: In the comments do you mean "... where an object has ..."?

Jan




 


Rackspace

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