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

Re: [PATCH v3 1/8] xen: fix build when $(obj-y) consists of just blanks



On 09.12.2020 18:40, Anthony PERARD wrote:
> On Mon, Nov 23, 2020 at 04:20:52PM +0100, Jan Beulich wrote:
>> This case can occur when combining empty lists
>>
>> obj-y :=
>> ...
>> obj-y += $(empty)
>>
>> or
>>
>> obj-y := $(empty) $(empty)
>>
>> where (only) blanks would accumulate. This was only a latent issue until
>> now, but would become an active issue for Arm once lib/ gets populated
>> with all respective objects going into the to be introduced lib.a.
>>
>> Also address a related issue at this occasion: When an empty built_in.o
>> gets created, .built_in.o.d will have its dependencies recorded. If, on
>> a subsequent incremental build, an actual constituent of built_in.o
>> appeared, the $(filter-out ) would leave these recorded dependencies in
>> place. But of course the linker won't know what to do with C header
>> files. (The apparent alternative of avoiding to pass $(c_flags) or
>> $(a_flags) would not be reliable afaict, as among these flags there may
>> be some affecting information conveyed via the object file to the
>> linker. The linker, finding inconsistent flags across object files, may
> 
> How about using $(XEN_CFLAGS) instead of $(c_flags)? That should prevent
> CC from generating the .*.o.d files while keeping the relevant flags.

What does "relevant" cover? For an empty .o it may not be important
right now, but I could see

c_flags = -MMD -MP -MF $(@D)/.$(@F).d $(XEN_CFLAGS) '-D__OBJECT_FILE__="$@"'
a_flags = -MMD -MP -MF $(@D)/.$(@F).d $(XEN_AFLAGS)

include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk

c_flags += $(CFLAGS-y)
a_flags += $(CFLAGS-y) $(AFLAGS-y)

leading to CFLAGS-y / AFLAGS-y which need to be consistent across
_all_ object files (e.g. some recording of ABI used).

> I
> was planing to do that to avoid the issue, see:
> https://lore.kernel.org/xen-devel/20200421161208.2429539-10-anthony.perard@xxxxxxxxxx
> 
>> then error out.) Using just $(obj-y) won't work either: It breaks when
>> the same object file is listed more than once.
> 
> Do we need to worry about having a object file been listed twice?
> Wouldn't that be a mistake?

No. The list approach (obj-$(CONFIG_xyz) += ...) easily allows for
this to happen. See xen/arch/x86/mm/Makefile for an existing example.

Jan



 


Rackspace

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