On 11.08.2023 16:59, Anthony PERARD wrote:
> On Wed, Jul 26, 2023 at 12:34:15PM +0200, Jan Beulich wrote:
>> --- a/xen/arch/x86/arch.mk
>> +++ b/xen/arch/x86/arch.mk
>> @@ -36,6 +36,29 @@ CFLAGS += -mno-red-zone -fpic
>>  # the SSE setup for variadic function calls.
>>  CFLAGS += -mno-mmx -mno-sse $(call cc-option,$(CC),-mskip-rax-setup)
>>  
>> +# Enable the selected baseline ABI, if supported by the compiler.
>> +x86-64-$(CONFIG_X86_64_BASELINE) :=
>> +x86-64-$(CONFIG_X86_64_V2) := x86-64-v2
>> +x86-64-$(CONFIG_X86_64_V3) := x86-64-v3
>> +
>> +ifneq ($(x86-64-y),)
>> +CFLAGS-psabi := $(call cc-option,$(CC),-march=$(x86-64-y))
>> +
>> +ifeq ($(CFLAGS-psabi),)
>> +# Fall back to using the subset of -m... options that are of interest.
>> +x86-64-v2 := -mpopcnt -mcx16
>> +x86-64-v3 := $(x86-64-v2) -mbmi -mbmi2 -mlzcnt -mmovbe -mxsave
>> +$(call cc-options-add,CFLAGS-psabi,CC,$($(x86-64-y)))
>> +
>> +ifneq ($(strip $(CFLAGS-psabi)),$($(x86-64-y)))
>> +$(warning Options not recognized by $(CC): $(filter-out 
>> $(CFLAGS-psabi),$($(x86-64-y))))
>> +XEN_CONFIG_UNSATISFIED += X86_64_Vn
> 
> I think I understand Andrew's point on the previous version of this
> patch. Here, we barely just print a warning if the compiler isn't
> capable to do what we ask, then do the build and maybe print something
> after the fact. So we can end up with a build of Xen with an embedded
> .config which says X86_64_V3 where in fact it's only a build with the
> baseline ABI.

Which isn't really a problem, is it? Even if passed the respective
option, the compiler may equally choose to use none of the thus
available insns. (It won't typically, but it still could.)

> Can't we just fail the build right here instead?

Whether to do so is not the user's choice (see patch 2). See also
both post-commit-message remarks there.

> I don't see any need to let Kconfig know if the compiler can do
> x86-64-vX or not, beside only presenting actual available options in
> `make *config`, and it would override options selected by editing
> .config directly.

I'm afraid I don't understand what you're suggesting here that I do
differently.

Jan

Reply via email to