All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Anthony PERARD <anthony.perard@citrix.com>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	"Julien Grall" <julien@xen.org>, "Wei Liu" <wl@xen.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Ian Jackson" <ian.jackson@eu.citrix.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	xen-devel@lists.xenproject.org,
	"Daniel De Graaf" <dgdegra@tycho.nsa.gov>,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [XEN PATCH v5 04/16] xen/build: have the root Makefile generates the CFLAGS
Date: Thu, 23 Apr 2020 18:40:33 +0200	[thread overview]
Message-ID: <28aeea6d-cd52-d8bf-f114-96ec435363c6@suse.com> (raw)
In-Reply-To: <20200421161208.2429539-5-anthony.perard@citrix.com>

On 21.04.2020 18:11, Anthony PERARD wrote:
> Instead of generating the CFLAGS in Rules.mk everytime we enter a new
> subdirectory, we are going to generate most of them a single time, and
> export the result in the environment so that Rules.mk can use it.  The
> only flags left to be generated are the ones that depend on the
> targets, but the variable $(c_flags) takes care of that.
> 
> Arch specific CFLAGS are generated by a new file "arch/*/arch.mk"
> which is included by the root Makefile.
> 
> We export the *FLAGS via the environment variables XEN_*FLAGS because
> Rules.mk still includes Config.mk and would add duplicated flags to
> CFLAGS.
> 
> When running Rules.mk in the root directory (xen/), the variable
> `root-make-done' is set, so `need-config' will remain undef and so the
> root Makefile will not generate the cflags again.
> 
> We can't use CFLAGS in subdirectories to add flags to particular
> targets, instead start to use CFLAGS-y. Idem for AFLAGS.
> So there are two different CFLAGS-y, the one in xen/Makefile (and
> arch.mk), and the one in subdirs that Rules.mk is going to use.
> We can't add to XEN_CFLAGS because it is exported, so making change to
> it might be propagated to subdirectory which isn't intended.
> 
> Some style change are introduced in this patch:
>     when LDFLAGS_DIRECT is included in LDFLAGS
>     use of CFLAGS-$(CONFIG_INDIRECT_THUNK) instead of ifeq().
> 
> The LTO change hasn't been tested properly, as LTO is marked as
> broken.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
with one further question:

> --- a/xen/arch/x86/Rules.mk
> +++ b/xen/arch/x86/Rules.mk
> @@ -1,89 +1,10 @@
>  ########################################
>  # x86-specific definitions
>  
> -XEN_IMG_OFFSET := 0x200000
> -
> -CFLAGS += -I$(BASEDIR)/include
> -CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
> -CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
> -CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET)
> -CFLAGS += '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst $(BASEDIR)/,,$(CURDIR))/$@))'
> -
> -# Prevent floating-point variables from creeping into Xen.
> -CFLAGS += -msoft-float
> -
> -ifeq ($(CONFIG_CC_IS_CLANG),y)
> -# Note: Any test which adds -no-integrated-as will cause subsequent tests to
> -# succeed, and not trigger further additions.
> -#
> -# The tests to select whether the integrated assembler is usable need to happen
> -# before testing any assembler features, or else the result of the tests would
> -# be stale if the integrated assembler is not used.
> -
> -# Older clang's built-in assembler doesn't understand .skip with labels:
> -# https://bugs.llvm.org/show_bug.cgi?id=27369
> -$(call as-option-add,CFLAGS,CC,".L0: .L1: .skip (.L1 - .L0)",,\
> -                     -no-integrated-as)
> -
> -# Check whether clang asm()-s support .include.
> -$(call as-option-add,CFLAGS,CC,".include \"asm-x86/indirect_thunk_asm.h\"",,\
> -                     -no-integrated-as)
> -
> -# Check whether clang keeps .macro-s between asm()-s:
> -# https://bugs.llvm.org/show_bug.cgi?id=36110
> -$(call as-option-add,CFLAGS,CC,\
> -                     ".macro FOO;.endm"$$(close); asm volatile $$(open)".macro FOO;.endm",\
> -                     -no-integrated-as)
> -endif
> -
> -$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
> -$(call cc-option-add,CFLAGS,CC,-Wnested-externs)
> -$(call as-option-add,CFLAGS,CC,"vmcall",-DHAVE_AS_VMX)
> -$(call as-option-add,CFLAGS,CC,"crc32 %eax$$(comma)%eax",-DHAVE_AS_SSE4_2)
> -$(call as-option-add,CFLAGS,CC,"invept (%rax)$$(comma)%rax",-DHAVE_AS_EPT)
> -$(call as-option-add,CFLAGS,CC,"rdrand %eax",-DHAVE_AS_RDRAND)
> -$(call as-option-add,CFLAGS,CC,"rdfsbase %rax",-DHAVE_AS_FSGSBASE)
> -$(call as-option-add,CFLAGS,CC,"xsaveopt (%rax)",-DHAVE_AS_XSAVEOPT)
> -$(call as-option-add,CFLAGS,CC,"rdseed %eax",-DHAVE_AS_RDSEED)
> -$(call as-option-add,CFLAGS,CC,"clwb (%rax)",-DHAVE_AS_CLWB)
> -$(call as-option-add,CFLAGS,CC,".equ \"x\"$$(comma)1", \
> -                     -U__OBJECT_LABEL__ -DHAVE_AS_QUOTED_SYM \
> -                     '-D__OBJECT_LABEL__=$(subst $(BASEDIR)/,,$(CURDIR))/$$@')
> -$(call as-option-add,CFLAGS,CC,"invpcid (%rax)$$(comma)%rax",-DHAVE_AS_INVPCID)
> -
> -# GAS's idea of true is -1.  Clang's idea is 1
> -$(call as-option-add,CFLAGS,CC,\
> -    ".if ((1 > 0) < 0); .error \"\";.endif",,-DHAVE_AS_NEGATIVE_TRUE)
> -
> -# Check to see whether the assmbler supports the .nop directive.
> -$(call as-option-add,CFLAGS,CC,\
> -    ".L1: .L2: .nops (.L2 - .L1)$$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE)
> -
> -CFLAGS += -mno-red-zone -fpic -fno-asynchronous-unwind-tables
> -
> -# Xen doesn't use SSE interally.  If the compiler supports it, also skip the
> -# SSE setup for variadic function calls.
> -CFLAGS += -mno-sse $(call cc-option,$(CC),-mskip-rax-setup)
> -
> -# Compile with thunk-extern, indirect-branch-register if avaiable.
> -ifeq ($(CONFIG_INDIRECT_THUNK),y)
> -CFLAGS += -mindirect-branch=thunk-extern -mindirect-branch-register
> -CFLAGS += -fno-jump-tables
> +ifneq ($(filter -DHAVE_AS_QUOTED_SYM,$(XEN_CFLAGS)),)
> +object_label_flags = '-D__OBJECT_LABEL__=$(subst $(BASEDIR)/,,$(CURDIR))/$@'
> +else
> +object_label_flags = '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst $(BASEDIR)/,,$(CURDIR))/$@))'
>  endif
> -
> -# If supported by the compiler, reduce stack alignment to 8 bytes. But allow
> -# this to be overridden elsewhere.
> -$(call cc-option-add,CFLAGS-stack-boundary,CC,-mpreferred-stack-boundary=3)
> -CFLAGS += $(CFLAGS-stack-boundary)
> -
> -ifeq ($(CONFIG_UBSAN),y)
> -# Don't enable alignment sanitisation.  x86 has efficient unaligned accesses,
> -# and various things (ACPI tables, hypercall pages, stubs, etc) are wont-fix.
> -# It also causes an as-yet-unidentified crash on native boot before the
> -# console starts.
> -$(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
> -endif
> -
> -# Set up the assembler include path properly for older toolchains.
> -CFLAGS += -Wa,-I$(BASEDIR)/include
> -
> +c_flags += $(object_label_flags) $(CFLAGS-stack-boundary)
> +a_flags += $(object_label_flags) $(CFLAGS-stack-boundary)

Why are you also adding these to a_flags? It probably doesn't hurt,
but I'd prefer if it was removed (could be done while committing if
all acks arrive and other other need for av6 arises) if there's no
clear need.

Jan


  reply	other threads:[~2020-04-23 16:40 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21 16:11 [XEN PATCH v5 00/16] xen: Build system improvements Anthony PERARD
2020-04-21 16:11 ` [XEN PATCH v5 01/16] build,xsm: Fix multiple call Anthony PERARD
2020-04-21 16:11 ` [XEN PATCH v5 02/16] xen/build: include include/config/auto.conf in main Makefile Anthony PERARD
2020-04-21 16:11 ` [XEN PATCH v5 03/16] xen/build: use new $(c_flags) and $(a_flags) instead of $(CFLAGS) Anthony PERARD
2020-04-24  9:20   ` Julien Grall
2020-04-21 16:11 ` [XEN PATCH v5 04/16] xen/build: have the root Makefile generates the CFLAGS Anthony PERARD
2020-04-23 16:40   ` Jan Beulich [this message]
2020-04-24  9:45     ` Anthony PERARD
2020-04-24 11:20       ` Jan Beulich
2020-04-24  9:26   ` Julien Grall
2020-04-24 13:01   ` Jan Beulich
2020-04-24 13:30     ` Anthony PERARD
2020-04-24 14:07       ` Anthony PERARD
2020-04-21 16:11 ` [XEN PATCH v5 05/16] build: Introduce documentation for xen Makefiles Anthony PERARD
2020-04-21 16:11 ` [XEN PATCH v5 06/16] xen/build: introduce if_changed and if_changed_rule Anthony PERARD
2020-04-21 16:11 ` [XEN PATCH v5 07/16] xen/build: Start using if_changed Anthony PERARD
2020-04-24  9:28   ` Julien Grall
2020-04-21 16:12 ` [XEN PATCH v5 08/16] build: Introduce $(cpp_flags) Anthony PERARD
2020-04-23 16:48   ` Jan Beulich
2020-04-28 14:01     ` Anthony PERARD
2020-04-28 14:20       ` Jan Beulich
2020-05-01 14:32         ` Anthony PERARD
2020-05-04  9:09           ` Jan Beulich
2020-04-21 16:12 ` [XEN PATCH v5 09/16] xen/build: use if_changed on built_in.o Anthony PERARD
2020-04-28 13:48   ` Jan Beulich
2020-05-01 14:42     ` Anthony PERARD
2020-05-04  9:11       ` Jan Beulich
2020-04-21 16:12 ` [XEN PATCH v5 10/16] xen/build: Use if_changed_rules with %.o:%.c targets Anthony PERARD
2020-04-21 16:12 ` [XEN PATCH v5 11/16] xen/build: factorise generation of the linker scripts Anthony PERARD
2020-04-24  9:29   ` Julien Grall
2020-04-28 13:50   ` Jan Beulich
2020-04-21 16:12 ` [XEN PATCH v5 12/16] xen/build: Use if_changed for prelink*.o Anthony PERARD
2020-04-21 16:12 ` [XEN PATCH v5 13/16] xen,symbols: rework file symbols selection Anthony PERARD
2020-04-28 14:05   ` Jan Beulich
2020-04-21 16:12 ` [XEN PATCH v5 14/16] build: use if_changed to build mm/*/guest_%.o Anthony PERARD
2020-04-28 14:07   ` Jan Beulich
2020-04-21 16:12 ` [XEN PATCH v5 15/16] build,include: rework compat-build-source.py Anthony PERARD
2020-04-28 14:37   ` [XEN PATCH v5 15/16] build, include: " Jan Beulich
2020-04-21 16:12 ` [XEN PATCH v5 16/16] build,include: rework compat-build-header.py Anthony PERARD
2020-04-28 14:39   ` [XEN PATCH v5 16/16] build, include: " Jan Beulich
2020-04-28 14:54   ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28aeea6d-cd52-d8bf-f114-96ec435363c6@suse.com \
    --to=jbeulich@suse.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=george.dunlap@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=julien@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.