[PATCH 4/4] x86 boot: Tell ld the kernel doesn't want 2MB file offset alignment.

From: Eric W. Biederman
Date: Mon Jul 09 2012 - 02:56:18 EST



By default ld uses 2MB pages and aligns our 3 program segments in the
file on 2MB boundaries, creating unnecessarily large uncompressed
vmlinux files.

Solve this by passing -z max-page-size 4096 to ld.

In my test x86_64 SMP test configuration with CONFIG_DEBUG_RODATA
enabled, this reduces the size of vmlinux by roughly 5MB from 15141772
bytes to 10210188 bytes.

Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
---
arch/x86/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 1f25214..b5b31c3 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -120,7 +120,7 @@ avx_instr := $(call as-instr,vxorps %ymm0$(comma)%ymm1$(comma)%ymm2,-DCONFIG_AS_
KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr)
KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr)

-LDFLAGS := -m elf_$(UTS_MACHINE)
+LDFLAGS := -m elf_$(UTS_MACHINE) -z max-page-size=4096

# Speed up the build
KBUILD_CFLAGS += -pipe
--
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/