From f6159cff5d91e5c0810d0c9285a1d2370a38e2b7 Mon Sep 17 00:00:00 2001 From: Nicholas Piggin Date: Sat, 10 Feb 2018 18:42:49 +1000 Subject: build: use thin archives rather than incremental linking This changes to build system to use thin archives rather than incremental linking for built-in.o, similar to recent change to Linux. built-in.o is renamed to built-in.a, and is created as a thin archive with no index, for speed and size. All built-in.a are aggregated into a skiboot.tmp.a which is a thin archive built with an index, making it suitable or linking. This is input into the final link. The advantags of build size and linker code placement flexibility are not as great with skiboot as a bigger project like Linux, but it's a conceptually better way to build, and is more compatible with link time optimisation in toolchains which might be interesting for skiboot particularly for size reductions. Size of build tree before this patch is 34.4MB, afterwards 23.1MB. Signed-off-by: Nicholas Piggin Signed-off-by: Stewart Smith --- Makefile.rules | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Makefile.rules') diff --git a/Makefile.rules b/Makefile.rules index 80121c3..e5f6dfc 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -67,8 +67,9 @@ endif %.i : %.c $(call Q,CC, $(CC) $(call cook_cflags,$@) -E -c $< -o $@, $@) -%built-in.o : - $(call Q,LD, $(LD) $(LDRFLAGS) -r $^ -o $@, $@) +%built-in.a : + @rm -f $@ + $(call Q,AR, $(AR) rcSTPD $@ $^, $@) %.lds : %.lds.S $(call Q,CC, $(CC) $(CPPFLAGS) -P -E $< -o $@, $@) -- cgit v1.1