]> xenbits.xensource.com Git - mini-os.git/commitdiff
mini-os: sort objects in binary archives
authorOlaf Hering <olaf@aepfle.de>
Tue, 3 Feb 2015 11:45:37 +0000 (12:45 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 11 Mar 2015 10:46:31 +0000 (10:46 +0000)
When building stubdom the mini-os objects are also linked into the
binary. Unfortunately the linker will place them in the order found in
the archive. Since this order is random the resulting stubdom binary
differs when it was built from identical sources but on different
build hosts. To help with creating a reproducible binary the elements
in an archive must simply be sorted before passing them to $(AR).

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
[ ijc -- massaged paths to apply to external mini-os tree ]

Makefile
arch/x86/Makefile

index f16520ed42312ddb819da7724294ca3ec6b00647..9482ec07a07304e53bf4f2e1f4c504db38581013 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -146,9 +146,9 @@ arch_lib:
 
 ifeq ($(CONFIG_LWIP),y)
 # lwIP library
-LWC    := $(shell find $(LWIPDIR)/src -type f -name '*.c')
+LWC    := $(sort $(shell find $(LWIPDIR)/src -type f -name '*.c'))
 LWC    := $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
-LWO    := $(patsubst %.c,%.o,$(LWC))
+LWO    := $(patsubst %.c,%.o,$(LWC)
 LWO    += $(OBJ_DIR)/lwip-arch.o
 ifeq ($(CONFIG_NETFRONT),y)
 LWO += $(OBJ_DIR)/lwip-net.o
index 9f04a93a635b4713846b4748d730e515a785287c..a46766c9655a52d573eb31fdea2c8661731c67b5 100644 (file)
@@ -13,7 +13,7 @@ include ../../minios.mk
 
 # Sources here are all *.c *.S without $(MINIOS_TARGET_ARCH).S
 # This is handled in $(HEAD_ARCH_OBJ)
-ARCH_SRCS := $(wildcard *.c)
+ARCH_SRCS := $(sort $(wildcard *.c))
 
 # The objects built from the sources.
 ARCH_OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(ARCH_SRCS))