Skip to content

Commit

Permalink
Disable linking libgcc.a with --whole-archive option
Browse files Browse the repository at this point in the history
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:
c9e61d4
be56532

Signed-off-by: Waldemar Kozaczuk <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
wkozaczuk authored and nyh committed Oct 14, 2018
1 parent 2dac58b commit ea69b89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ea69b89

Please sign in to comment.