From a0d08d4bd13a31561141575a5320878ce67f4c46 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Thu, 31 Mar 2016 19:08:20 +0200 Subject: [PATCH] Noux: workaround for libtool problem Add the prefix '-Wl,' to static library names to keep them before shared library names after libtool's command line reorderings. Fixes #1928 --- repos/ports/mk/noux.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/repos/ports/mk/noux.mk b/repos/ports/mk/noux.mk index 6bab2e8b1e..f3f6692744 100644 --- a/repos/ports/mk/noux.mk +++ b/repos/ports/mk/noux.mk @@ -110,10 +110,18 @@ NOUX_CXXFLAGS += $(NOUX_COMMON_CFLAGS_CXXFLAGS) # Unfortunately, the use of '--start-group' and '--end-group' does not suffice # in all cases because 'libtool' strips those arguments from the 'LIBS' variable. # +# Furthermore, 'libtool' reorders library names on the command line in a way that +# shared libraries appear before static libraries. This has the unfortunate effect +# that the program's entry symbol 'Genode::component_entry_point' in the static +# library 'component_entry_point.lib.a' is not found anymore. Passing the static +# library names as linker arguments (-Wl,...) works around this problem, because +# 'libtool' keeps command line arguments before the shared library names. +# NOUX_LIBS_A = $(filter %.a, $(sort $(LINK_ITEMS)) $(EXT_OBJECTS) $(LIBGCC)) NOUX_LIBS_SO = $(filter %.so,$(sort $(LINK_ITEMS)) $(EXT_OBJECTS) $(LIBGCC)) -NOUX_LIBS += $(NOUX_LIBS_A) $(NOUX_LIBS_SO) $(NOUX_LIBS_A) +comma := , +NOUX_LIBS += $(addprefix -Wl$(comma),$(NOUX_LIBS_A)) $(NOUX_LIBS_SO) $(NOUX_LIBS_A) # # Re-configure the Makefile if the Genode build environment changes