Skip to content

Commit

Permalink
unified: Fix build broblem caused by concurrent make processes in sin…
Browse files Browse the repository at this point in the history
…gle dir

Make sure that kernel/unified, that is included in libs-y does not
built recursively through building kernel/ directory.
Make sure that any lib.a library is not included into libzephyr.a
and thus object modules from those lib.a files are linked only if a
function from that object module is referenced from the application.

Jira: ZEP-1025

Change-Id: Id3a3e96ca0b8abc9aedde0ffb9baa0164e380464
Signed-off-by: Dmitriy Korovkin <[email protected]>
  • Loading branch information
dkorovki authored and Anas Nashif committed Oct 5, 2016
1 parent d846dd1 commit 19f2884
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,6 @@ scripts: scripts_basic include/config/auto.conf include/config/tristate.conf

# arch/ must be last here so that .gnu.linkonce magic for interrupts/exceptions
# works as expected
core-y := lib/ kernel/ misc/ net/ boards/ ext/ usb/ fs/ tests/ arch/
drivers-y := drivers/

ifneq ($(strip $(MAKEFILE_APP_DIR)),)
MAKEFILE_APP := $(realpath $(MAKEFILE_APP_DIR)/Makefile.app)
Expand Down Expand Up @@ -580,7 +578,11 @@ endif # $(dot-config)
# Unified kernel objects are built as a static library
ifeq ($(CONFIG_KERNEL_V2),y)
libs-y := kernel/unified/
core-y := lib/ misc/ net/ boards/ ext/ usb/ fs/ tests/ arch/
else
core-y := lib/ kernel/ misc/ net/ boards/ ext/ usb/ fs/ tests/ arch/
endif
drivers-y := drivers/

ARCH = $(subst $(DQUOTE),,$(CONFIG_ARCH))
export ARCH
Expand Down Expand Up @@ -796,10 +798,10 @@ OUTPUT_FORMAT ?= elf32-i386
OUTPUT_ARCH ?= i386

quiet_cmd_ar_target = AR $@
# Assume that if the directory listed in libs-y contains built-in.o,
# it has been linked into the upper level built-in.o
# Do not put lib.a into libzephyr.a. lib.a files are to be linked separately to
# the final image
cmd_ar_target = rm -f $@; $(AR) rcT$(KBUILD_ARFLAGS) $@ \
$(filter-out $(libs-y), $(KBUILD_ZEPHYR_MAIN))
$(filter-out %/lib.a, $(KBUILD_ZEPHYR_MAIN))
libzephyr.a: $(zephyr-deps)
$(call cmd,ar_target)

Expand All @@ -817,7 +819,7 @@ quiet_cmd_create-lnk = LINK $@
echo "$(app-y)"; \
echo "libzephyr.a"; \
echo "$(LINKFLAGPREFIX)--no-whole-archive"; \
echo "$(filter %/lib.a, $(libs-y))"; \
echo "$(filter %/lib.a, $(KBUILD_ZEPHYR_MAIN))"; \
echo "$(objtree)/arch/$(ARCH)/core/offsets/offsets.o"; \
echo "$(LINKFLAGPREFIX)--end-group"; \
echo "$(LIB_INCLUDE_DIR) $(LINK_LIBS)"; \
Expand Down
4 changes: 1 addition & 3 deletions kernel/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
ifeq ($(CONFIG_KERNEL_V2),y)
obj-y = unified/
else
ifneq ($(CONFIG_KERNEL_V2),y)
obj-y = nanokernel/
obj-$(CONFIG_MICROKERNEL) += microkernel/
endif

0 comments on commit 19f2884

Please sign in to comment.