Skip to content

Commit

Permalink
scripts/mod/modpost: Fix cross-build race
Browse files Browse the repository at this point in the history
Define CONFIG_MODPOST_ELFCONFIG macro to specify cross-build
elfconfig.h instead of copying header during build.

Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Acked-by: Julia Cartwright <julia.cartwright@ni.com>
Natinst-ReviewBoard-ID: 292369
  • Loading branch information
harisokanovic committed May 22, 2019
1 parent c9ffae3 commit 638a209
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions scripts/mod/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@ $^
Expand Down
4 changes: 4 additions & 0 deletions scripts/mod/modpost.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
#include <unistd.h>
#include <elf.h>

#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
Expand Down

0 comments on commit 638a209

Please # to comment.