Fix binary size for 64bit

Every 64-bit binary is effectively 4M too big currently [0]. The GNU linker ld
aligns the text section of the binary to the maximum page size. On i386
the default section alignment is fixed typically to 4K.

Avoid wasting mainly 4M on x86_64 by telling the linker the max page size to
be 4K.

[0] http://sourceware.org/ml/binutils/2009-04/msg00099.html
This commit is contained in:
Alexander Boettcher 2012-09-05 14:51:31 +02:00 committed by Norman Feske
parent 83bdfea9b0
commit 6994f6a8c5
1 changed files with 10 additions and 0 deletions

View File

@ -11,4 +11,14 @@ REP_INC_DIR += include/x86_64
CC_MARCH ?= -m64
#
# Avoid wasting almost 4 MiB by telling the linker that the max page size is
# 4K. Otherwise, the linker would align the text segment to a 4M boundary,
# effectively adding 4M of zeros to each binary.
#
# See http://sourceware.org/ml/binutils/2009-04/msg00099.html
#
LD_MARCH ?= -melf_x86_64 -z max-page-size=0x1000
include $(call select_from_repositories,mk/spec-64bit.mk)