From 54b375dc43680341cc3bb166a893bdc50b705546 Mon Sep 17 00:00:00 2001 From: liuhaitao Date: Sat, 21 Mar 2020 17:50:43 +0800 Subject: [PATCH] examples: Fix elf/module/posix_spawn sometimes parallel build errors at link time It seems in the time window mksymtab.sh redirect to symtab.c, there is chance symtab.c would also be built meantime. Then if built before symtab.c write done, link errors may occur. So use rename and mv operation to reduce the possibility. Signed-off-by: liuhaitao --- examples/elf/tests/Makefile | 3 ++- examples/module/drivers/Makefile | 6 ++++-- examples/posix_spawn/filesystem/Makefile | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/elf/tests/Makefile b/examples/elf/tests/Makefile index fd9782196..984bc2d65 100644 --- a/examples/elf/tests/Makefile +++ b/examples/elf/tests/Makefile @@ -141,7 +141,8 @@ $(DIRLIST_HDR) : populate # Create the exported symbol table $(SYMTAB_SRC): populate - $(Q) $(TESTS_DIR)/mksymtab.sh $(FSIMG_DIR) >$@ + $(Q) $(TESTS_DIR)/mksymtab.sh $(FSIMG_DIR) >$@.tmp + $(Q) mv $@.tmp $@ # Clean each subdirectory diff --git a/examples/module/drivers/Makefile b/examples/module/drivers/Makefile index 216605198..a336cebf0 100644 --- a/examples/module/drivers/Makefile +++ b/examples/module/drivers/Makefile @@ -123,14 +123,16 @@ endif # Create the exported symbol table $(SYMTAB_SRC): populate - $(Q) $(DRIVER_DIR)/mksymtab.sh $(FSROOT_DIR) >$@ + $(Q) $(DRIVER_DIR)/mksymtab.sh $(FSROOT_DIR) >$@.tmp + $(Q) mv $@.tmp $@ else # Create the exported symbol table $(SYMTAB_SRC): populate - $(Q) $(DRIVER_DIR)/mksymtab.sh $(FSROOT_DIR) >$@ + $(Q) $(DRIVER_DIR)/mksymtab.sh $(FSROOT_DIR) >$@.tmp + $(Q) mv $@.tmp $@ endif diff --git a/examples/posix_spawn/filesystem/Makefile b/examples/posix_spawn/filesystem/Makefile index c9541ef7f..34c3e21ac 100644 --- a/examples/posix_spawn/filesystem/Makefile +++ b/examples/posix_spawn/filesystem/Makefile @@ -78,7 +78,8 @@ $(ROMFS_HDR) : $(ROMFS_IMG) # Create the exported symbol table $(SYMTAB_SRC): $(ROMFS_IMG) - $(Q) $(FILESYSTEM_DIR)$(DELIM)mksymtab.sh $(ROMFS_DIR) >$@ + $(Q) $(FILESYSTEM_DIR)$(DELIM)mksymtab.sh $(ROMFS_DIR) >$@.tmp + $(Q) mv $@.tmp $@ # Clean each subdirectory