[ipxe-devel] [PATCH] [build] sort objects in blib.a

Olaf Hering olaf at aepfle.de
Mon Feb 2 13:54:12 UTC 2015

When building hvmloader for Xen tools the ipxe 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
hvmloader binary differs when it was built from identical sources but
on different build hosts. To help with creating a reproducible binary
the elements in blib.a must simply be sorted before passing them to

Signed-off-by: Olaf Hering <olaf at aepfle.de>
 src/Makefile.housekeeping | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index 1a75d39..e1cdee6 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -1012,7 +1012,7 @@ BLIB		= $(BIN)/blib.a
 	$(Q)$(RM) $(BLIB)
 	$(QM)$(ECHO) "  [AR] $@"
-	$(Q)$(AR) r $@ $(BLIB_OBJS)
+	$(Q)$(AR) r $@ $(sort $(BLIB_OBJS))
 	$(Q)$(RANLIB) $@
 blib : $(BLIB)

More information about the ipxe-devel mailing list