From 638a20994b22595b3f59d5f91c0fa5a438754706 Mon Sep 17 00:00:00 2001 From: Haris Okanovic Date: Fri, 17 May 2019 17:05:10 -0500 Subject: [PATCH] scripts/mod/modpost: Fix cross-build race Define CONFIG_MODPOST_ELFCONFIG macro to specify cross-build elfconfig.h instead of copying header during build. Signed-off-by: Haris Okanovic Acked-by: Julia Cartwright Natinst-ReviewBoard-ID: 292369 --- scripts/mod/Makefile | 3 +-- scripts/mod/modpost.h | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index 8f76d080be5f6..09a8a56c3f494 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile @@ -36,8 +36,7 @@ KBUILD_OUTPUT=$(CURDIR) endif $(patsubst %,$(obj)/$(TGTPRE)%,$(modpost-objs)): $(KBUILD_SRC)/$(src)/$(TGTPRE)elfconfig.h | $(obj)/modpost - $(Q)cp -f $(KBUILD_SRC)/$(src)/$(TGTPRE)elfconfig.h $(KBUILD_OUTPUT)/$(obj)/elfconfig.h - $(Q)$(CC) $(TGT_EXTRACFLAGS) $(CFLAGS) -I$(KBUILD_OUTPUT)/$(obj) -c -o $@ $(KBUILD_SRC)/$(subst $(TGTPRE),,$(subst .o,.c,$@)) + $(Q)$(CC) $(TGT_EXTRACFLAGS) $(CFLAGS) -I$(KBUILD_OUTPUT)/$(obj) -DCONFIG_MODPOST_ELFCONFIG="\"$(TGTPRE)elfconfig.h\"" -c -o $@ $(KBUILD_SRC)/$(subst $(TGTPRE),,$(subst .o,.c,$@)) $(obj)/$(tgtmodpost) : $(patsubst %,$(obj)/$(TGTPRE)%,$(modpost-objs)) $(Q)$(CC) $(TGT_EXTRACFLAGS) $(CFLAGS) -o $@ $^ diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 8453d6ac2f77e..d8c7749c41d7c 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h @@ -10,7 +10,11 @@ #include #include +#if defined(CONFIG_MODPOST_ELFCONFIG) +#include CONFIG_MODPOST_ELFCONFIG +#else #include "elfconfig.h" +#endif /* On BSD-alike OSes elf.h defines these according to host's word size */ #undef ELF_ST_BIND