build: tool option handling adjustments
cover build: tool option handling adjustments
The first is a fix for a latent issue (which became real with one of my pending changes), while the 2nd is merely cleanup noticed as possible / useful to do in the course of investigating.
1: x86/EFI: correct compiler probing
2: Kbuild: simplify as-insn a little
Jan
PATCH 1/2 x86/EFI: correct compiler probing
Passing in $(CFLAGS) means also requesting inclusion of certain headers (via -include command line options). That's particularly xen/config.h, which in turn requires generated/autoconf.h. This has not caused any problems so far only because arch.mk is processed twice, and the missing header on the 1st pass would be there on the 2nd. Having added an inclusion of asm/asm-macros.h to x86'es asm/config.h, the 2nd pass then also fails on an initial, pristine build.
As per dd40177c1bc8 ("x86-64/EFI: add CFLAGS to check compile") dropping the use of $(CFLAGS) altogether isn't an option, though. Hence remove the problematic options only.
---
This is now the 3rd place where the -include needs dropping. I was half decided to introduce a new lazy-expansion variable, yet it's not consistently $(CFLAGS) that the options need purging from. Thoughts?
There probably ought to be a Fixes: tag here, but it's quite hard to tell which change to actually blame. It's the interaction of various changes which has resulted in the (so far only latent) badness.
xen/arch/x86/arch.mk +2 -1
@@ -87,7 +87,8 @@ efi-check := arch/x86/efi/check $(shell mkdir -p $(dir $(efi-check))) # Check if the compiler supports the MS ABI. -XEN_BUILD_EFI := $(call if-success,$(CC) $(CFLAGS) -c $(srctree)/$(efi-check).c -o $(efi-check).o,y) +XEN_BUILD_EFI := $(call if-success,$(CC) $(filter-out -include %/include/xen/config.h,$(CFLAGS)) \ + -c $(srctree)/$(efi-check).c -o $(efi-check).o,y) # Check if the linker supports PE. EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10
Re: [PATCH 1/2] x86/EFI: correct compiler probing
Quoted 4 lines · Jan Beulich
Passing in $(CFLAGS) means also requesting inclusion of certain headers (via -include command line options). That's particularly
xen/config.h, which in turn requiresgenerated/autoconf.h. This has not caused any problems so far only because arch.mk is processed twice, and the missing
The first pass is ignore because "include/config/auto.conf" is missing, and generating that will also generates "generated/autoconf.h" I think. So result don't matter, and make restart from scratch once "auto.conf" is generated.
Quoted 2 lines
header on the 1st pass would be there on the 2nd. Having added an inclusion of
asm/asm-macros.hto x86'esasm/config.h, the 2nd pass then
I don't see asm-macros.h been included in asm/config.h, is this in a pending patch?
Quoted 7 lines
also fails on an initial, pristine build.
As per
dd40177c1bc8("x86-64/EFI: add CFLAGS to check compile") dropping the use of $(CFLAGS) altogether isn't an option, though. Hence remove the problematic options only.Signed-off-by Jan Beulich <[email protected]>
In any case, patch looks fine:
Quoted 4 lines
---
This is now the 3rd place where the -include needs dropping. I was half decided to introduce a new lazy-expansion variable, yet it's not consistently $(CFLAGS) that the options need purging from. Thoughts?
Something like that I guess, we probably want to avoid the "-include" while testing the compiler. I guess introducing "-include config.h" once we have all CFLAGS might make more sense, that is at about the time where XEN_CFLAGS is currently introduced, but I haven't checked if that's fine to do.
Cheers,
Signature · 1 line
Anthony PERARD
Re: [PATCH 1/2] x86/EFI: correct compiler probing
Quoted 11 lines · Anthony PERARD
Quoted 4 lines · Jan Beulich
Passing in $(CFLAGS) means also requesting inclusion of certain headers (via -include command line options). That's particularly
xen/config.h, which in turn requiresgenerated/autoconf.h. This has not caused any problems so far only because arch.mk is processed twice, and the missingThe first pass is ignore because "
include/config/auto.conf" is missing, and generating that will also generates "generated/autoconf.h" I think. So result don't matter, and make restart from scratch once "auto.conf" is generated.
Quoted 5 lines
Quoted 2 lines
header on the 1st pass would be there on the 2nd. Having added an inclusion of
asm/asm-macros.hto x86'esasm/config.h, the 2nd pass thenI don't see
asm-macros.hbeen included inasm/config.h, is this in a pending patch?
Yes. I hoped to get this across with "Having added ...".
Quoted 10 lines
Quoted 7 lines
also fails on an initial, pristine build.
As per
dd40177c1bc8("x86-64/EFI: add CFLAGS to check compile") dropping the use of $(CFLAGS) altogether isn't an option, though. Hence remove the problematic options only.Signed-off-by Jan Beulich <[email protected]>In any case, patch looks fine:
Reviewed-by Anthony PERARD <[email protected]>
Thanks.
Jan
PATCH 2/2 Kbuild: simplify as-insn a little
In reply to Jan BeulichAs of 732571959f17 ("xen/build: use new $(c_flags) and $(a_flags) instead of $(CFLAGS)") -M options aren't part of CFLAGS anymore, and c_flags isn't supposed to be passed to this macro. Drop the now dead part of filtering.
xen/scripts/Kbuild.include +1 -1
@@ -59,7 +59,7 @@ endef # as-insn: Check whether assembler supports an instruction. # Usage: cflags-y += $(call as-insn,CC FLAGS,"insn",option-yes,option-no) as-insn = $(if $(shell echo 'void _(void) { asm volatile ( $(2) ); }' \ - | $(filter-out -M% %.d -include %/include/xen/config.h,$(1)) \ + | $(filter-out -include %/include/xen/config.h,$(1)) \ -c -x c -o /dev/null - 2>&1),$(4),$(3)) # as-option-add: Conditionally add options to flags
Re: [PATCH 2/2] Kbuild: simplify as-insn a little
Quoted 6 lines · Jan Beulich
As of
732571959f17("xen/build: use new $(c_flags) and $(a_flags) instead of $(CFLAGS)") -M options aren't part of CFLAGS anymore, andc_flagsisn't supposed to be passed to this macro. Drop the now dead part of filtering.Signed-off-by Jan Beulich <[email protected]>
Thanks,
Signature · 1 line
Anthony PERARD