diff mbox

[Xen-devel,RFC] xen/arm: build: add missed dependency for head.S

Message ID 20160603100713.22378-1-Wei.Chen@linaro.org
State New
Headers show

Commit Message

Wei Chen June 3, 2016, 10:07 a.m. UTC
When we update the header files that had been included in head.S.
The build system would not re-compile the head.S. Because in the
build rules, the dependencies are setting to .*.d (eg. DEPS = .*.d)
files in the same folder as Makefile.

But head.S is very special, it was used by the Makefile in the parent
folder: "ALL_OBJS := $(TARGET_SUBARCH)/head.o".

In this case, the build system could not find the dependency in DEPS.
When we update the header files, the build system is unware of this
update. If we re-build the Xen without doing make clean or touching
the head.S, the build system will not recompile the head.S.

Signed-off-by: Wei Chen <Wei.Chen@linaro.org>
---
In my mind, the better way to fix this bug is converting the DEPS from
ALL_OBJS. But I am afraid of the impact. I am not sure whether there 
are some dependencies are not generated from obj files.
---
xen/Rules.mk          | 3 ++-
 xen/arch/arm/Makefile | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Julien Grall June 6, 2016, 5:08 p.m. UTC | #1
(CC Ian)

Hi,

On 03/06/16 11:07, Wei Chen wrote:
> When we update the header files that had been included in head.S.
> The build system would not re-compile the head.S. Because in the
> build rules, the dependencies are setting to .*.d (eg. DEPS = .*.d)
> files in the same folder as Makefile.
>
> But head.S is very special, it was used by the Makefile in the parent
> folder: "ALL_OBJS := $(TARGET_SUBARCH)/head.o".
>
> In this case, the build system could not find the dependency in DEPS.
> When we update the header files, the build system is unware of this
> update. If we re-build the Xen without doing make clean or touching
> the head.S, the build system will not recompile the head.S.
>
> Signed-off-by: Wei Chen <Wei.Chen@linaro.org>
> ---
> In my mind, the better way to fix this bug is converting the DEPS from
> ALL_OBJS. But I am afraid of the impact. I am not sure whether there
> are some dependencies are not generated from obj files.

My knowledge of the build system is limited. Stefano, Ian, Wei, could 
you give a look?

Regards,

> ---
> xen/Rules.mk          | 3 ++-
>   xen/arch/arm/Makefile | 2 ++
>   2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/xen/Rules.mk b/xen/Rules.mk
> index 961d533..1247b61 100644
> --- a/xen/Rules.mk
> +++ b/xen/Rules.mk
> @@ -92,9 +92,10 @@ LDFLAGS += $(LDFLAGS-y)
>
>   include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
>
> +DEPS = .*.d
> +
>   include Makefile
>
> -DEPS = .*.d
>   define gendep
>       ifneq ($(1),$(subst /,:,$(1)))
>           DEPS += $(dir $(1)).$(notdir $(1)).d
> diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
> index af4d0e1..9e38da3 100644
> --- a/xen/arch/arm/Makefile
> +++ b/xen/arch/arm/Makefile
> @@ -51,6 +51,8 @@ endif
>
>   ALL_OBJS := $(TARGET_SUBARCH)/head.o $(ALL_OBJS)
>
> +DEPS += $(TARGET_SUBARCH)/.head.o.d
> +
>   $(TARGET): $(TARGET)-syms $(TARGET).axf
>   	$(OBJCOPY) -O binary -S $< $@
>   ifeq ($(CONFIG_ARM_64),y)
>
Julien Grall June 7, 2016, 10:07 a.m. UTC | #2
Hi Ian,

On 07/06/16 11:03, Ian Jackson wrote:
> Julien Grall writes ("Re: [RFC] xen/arm: build: add missed dependency for head.S"):
>> On 03/06/16 11:07, Wei Chen wrote:
>>> When we update the header files that had been included in head.S.
>>> The build system would not re-compile the head.S. Because in the
>>> build rules, the dependencies are setting to .*.d (eg. DEPS = .*.d)
>>> files in the same folder as Makefile.
>>>
>>> But head.S is very special, it was used by the Makefile in the parent
>>> folder: "ALL_OBJS := $(TARGET_SUBARCH)/head.o".
>>>
>>> In this case, the build system could not find the dependency in DEPS.
>>> When we update the header files, the build system is unware of this
>>> update. If we re-build the Xen without doing make clean or touching
>>> the head.S, the build system will not recompile the head.S.
>>>
>>> Signed-off-by: Wei Chen <Wei.Chen@linaro.org>
>
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
>
> This should be in 4.7 and is a backport candidate.

Sounds good to me.

>>> In my mind, the better way to fix this bug is converting the DEPS from
>>> ALL_OBJS. But I am afraid of the impact. I am not sure whether there
>>> are some dependencies are not generated from obj files.
>
> I do like this idea but I have the same worry.  It might be possible
> to dump ALL_OBJS out somehow and check this, but it might be
> arch-dependent.

FWIW, Wei sent a new version today [1] which implement his suggestion. 
Although it might be too risky for Xen 4.7.

Regards,

[1] 
http://lists.xenproject.org/archives/html/xen-devel/2016-06/msg00781.html
diff mbox

Patch

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 961d533..1247b61 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -92,9 +92,10 @@  LDFLAGS += $(LDFLAGS-y)
 
 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
 
+DEPS = .*.d
+
 include Makefile
 
-DEPS = .*.d
 define gendep
     ifneq ($(1),$(subst /,:,$(1)))
         DEPS += $(dir $(1)).$(notdir $(1)).d
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index af4d0e1..9e38da3 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -51,6 +51,8 @@  endif
 
 ALL_OBJS := $(TARGET_SUBARCH)/head.o $(ALL_OBJS)
 
+DEPS += $(TARGET_SUBARCH)/.head.o.d
+
 $(TARGET): $(TARGET)-syms $(TARGET).axf
 	$(OBJCOPY) -O binary -S $< $@
 ifeq ($(CONFIG_ARM_64),y)