path: root/com32/elflink/ldlinux/Makefile
diff options
authorMatt Fleming <matt.fleming@intel.com>2012-03-20 16:27:17 +0000
committerMatt Fleming <matt.fleming@intel.com>2012-03-23 16:34:41 +0000
commita0ff1769893dc47028694ee51824bf681672876c (patch)
tree8ef42db23b29ac15055cd1eb6c42f9b8871c6335 /com32/elflink/ldlinux/Makefile
parent65377fc66c4e0877a9bcc511cdc92b5a05e23822 (diff)
core: Shrink core/ldlinux.sys to be under 64K bytes
It would seem that running from a btrfs file system has been broken for some time. The reason is that core/ldlinux.sys has grown substantially, resulting in it weighing in at a whopping 88K bytes and no longer fitting within the first 64K segment of a btrfs file system. This huge size stems from the fact that the core links with libcom32min.a because it requires various symbols contained within that archive but it includes and exports *all* the symbols from libcom32min.a. The reasoning behind this design decision is that when a module is loaded any undefined symbols that are defined in libcom32min.a can be resolved at runtime by the core, without the module also needing to statically link against libcom32min.a. Unfortunately doing this has increased the size of the core beyond acceptable limits, such that booting from a btrfs file system no longer works. This commit links ldlinux.c32 against libcom32min.a so that now ldlinux.c32 exports all the symbols contained within the archive. Since we will always load ldlinux.c32 before any other modules, any undefined symbols will now be resolved by ldlinux.c32 instead of the core. ldlinux.c32 isn't subject to same size constraints as the core, e.g. fitting within 64K. Here are the sizes in bytes before and after this commit, Before: 33806 com32/elflink/ldlinux/ldlinux.c32 87749 core/ldlinux.sys After: 393871 com32/elflink/ldlinux/ldlinux.c32 45516 core/ldlinux.sys Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32/elflink/ldlinux/Makefile')
1 files changed, 2 insertions, 1 deletions
diff --git a/com32/elflink/ldlinux/Makefile b/com32/elflink/ldlinux/Makefile
index 5927e500..99602771 100644
--- a/com32/elflink/ldlinux/Makefile
+++ b/com32/elflink/ldlinux/Makefile
@@ -15,13 +15,14 @@ MAKEDIR = $(topdir)/mk
include $(MAKEDIR)/elf.mk
CFLAGS += -I$(topdir)/core/elflink -I$(topdir)/core/include
+LIBS = --whole-archive $(com32)/lib/libcom32min.a
all: ldlinux.c32 ldlinux_lnx.a
ldlinux.c32 : ldlinux.o cli.o readconfig.o refstr.o colors.o getadv.o \
adv.o ipappend.o execute.o kernel.o get_key.o \
advwrite.o setadv.o eprintf.o
- $(LD) $(LDFLAGS) -o $@ $^
+ $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
LNXLIBOBJS = get_key.lo
ldlinux_lnx.a: $(LNXLIBOBJS)