From ea69b89d83d980ec4bb5f40f3dc5eefff8978517 Mon Sep 17 00:00:00 2001 From: Waldemar Kozaczuk Date: Sat, 13 Oct 2018 00:26:43 -0400 Subject: [PATCH] Disable linking libgcc.a with --whole-archive option This patch disables linking libgcc.a library with --whole-archive in order to make resulting loader-stripped.elf 2.5 MB smaller. The libgcc.a contains number of functions and huge tables of numbers that are part of Decimal Float Library (https://gcc.gnu.org/onlinedocs/gccint/Decimal-float-library-routines.html#Decimal-float-library-routines), which are not used by OSv kernel. Any potential side-effects caused by this patch have been tested against almost 20 different apps including java, python, golang, rust, MySQL and redis and no issues have been found. Size of kernel (ROFS version) before this patch: 9.2M loader-stripped.elf 6.2M lzloader.elf (33% reduction) Size of kernel (ROFS version) after this patch: 6.7M loader-stripped.elf 3.9M lzloader.elf (42% reduction) These are related patches: c9e61d4a45d88d8c8e79cd52fbcd38b91b291d5e be565320c082c00069614c850d29b42831b3dea6 Signed-off-by: Waldemar Kozaczuk Message-Id: <20181013042643.21313-1-jwkozaczuk@gmail.com> --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 44a86c014a..2270206b39 100644 --- a/Makefile +++ b/Makefile @@ -1869,9 +1869,9 @@ $(out)/loader.elf: $(stage1_targets) arch/$(arch)/loader.ld $(out)/bootfs.o -Bdynamic --export-dynamic --eh-frame-hdr --enable-new-dtags \ $(^:%.ld=-T %.ld) \ --whole-archive \ - $(libstdc++.a) $(libgcc.a) $(libgcc_eh.a) \ + $(libstdc++.a) $(libgcc_eh.a) \ $(boost-libs) \ - --no-whole-archive, \ + --no-whole-archive $(libgcc.a), \ LINK loader.elf) @# Build libosv.so matching this loader.elf. This is not a separate @# rule because that caused bug #545.