This won't drop symbols that are marked as used.

The static, relocateable inmate library lib.a is created by ar. When
linking executables, unreferenced symbols may be dropped, even if they
are attributed as used.

--whole-archive ensures that those symbols will be linked.

Whereas on x86, we need --gc-sections.

Signed-off-by: Ralf Ramsauer <[email protected]>
---
 inmates/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/inmates/Makefile b/inmates/Makefile
index 595338d5..a8bcf7aa 100644
--- a/inmates/Makefile
+++ b/inmates/Makefile
@@ -21,6 +21,9 @@ INCLUDES := -I$(INMATES_LIB) \
 
 ifeq ($(subst arm64,arm,$(SRCARCH)),arm)
 INCLUDES += -I$(src)/../hypervisor/arch/arm-common/include
+LDFLAGS += --whole-archive
+else
+LDFLAGS += --gc-sections
 endif
 
 LINUXINCLUDE  := $(INCLUDES)
@@ -34,7 +37,7 @@ KBUILD_CFLAGS += -include $(INC_CONFIG_H)
 endif
 
 OBJCOPYFLAGS := -O binary
-LDFLAGS += --gc-sections -T
+LDFLAGS += -T
 
 subdir-y := lib/$(SRCARCH) demos/$(SRCARCH) tests/$(SRCARCH) tools/$(SRCARCH)
 
-- 
2.17.0

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to