[Skiboot] [PATCH 02/16] Makefile: Link with libgcc

Michael Neuling mikey at neuling.org
Fri Feb 20 11:37:45 AEDT 2015


Add linking with libgcc so that we can access functions like __builtin_*.

Final size of skiboot remains unchanged with this patch.

Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 Makefile.main | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile.main b/Makefile.main
index b5376fc..665baf4 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -120,6 +120,7 @@ OBJS += $(LIBPORE)
 endif
 OBJS += $(LIBC) $(CCAN) $(DEVSRC_OBJ)
 OBJS_NO_VER = $(OBJS)
+EXTRA_LIBS = -Wl,-lgcc
 ALL_OBJS = $(OBJS) version.o
 
 ALL_OBJS_1 = $(ALL_OBJS) asm/dummy_map.o
@@ -129,12 +130,12 @@ $(TARGET).lid: $(TARGET).elf
 	$(call Q,OBJCOPY, $(OBJCOPY) -O binary -S $^ $@, $@)
 
 $(TARGET).tmp.elf: $(ALL_OBJS_1) $(TARGET).lds $(KERNEL)
-	$(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(ALL_OBJS_1) -o $@, $@)
+	$(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(ALL_OBJS_1) $(EXTRA_LIBS) -o $@, $@)
 
 asm/real_map.o : $(TARGET).tmp.map
 
 $(TARGET).elf: $(ALL_OBJS_2) $(TARGET).lds $(KERNEL)
-	$(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(ALL_OBJS_2) -o $@, $@)
+	$(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(ALL_OBJS_2) $(EXTRA_LIBS) -o $@, $@)
 
 $(SUBDIRS):
 	$(call Q,MKDIR,mkdir $@, $@)
-- 
2.1.0



More information about the Skiboot mailing list