mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 08:25:38 +00:00
Prevent silly text-segment alignment on all platforms
We set 'ld -z max-page-size' to 4KiB to prevent the linker from aligning the text segment to any built-in default (e.g., 4MiB on x86_64 or 64KiB on ARM). Otherwise, the padding bytes are wasted at the beginning of the final binary.
This commit is contained in:
parent
463c9bec17
commit
11c31c4432
@ -129,11 +129,15 @@ CC_CXX_OPT += $(CC_CXX_OPT_STD)
|
||||
# Use '-gc-sections' by default but allow a platform to disable this feature by
|
||||
# defining 'LD_GC_SECTIONS' empty. This is needed for older tool chains (gcc
|
||||
# version 4.11 and binutils version 2.16), which happen to produce broken
|
||||
# code when '-gc-sections' is enabled.
|
||||
# code when '-gc-sections' is enabled. Also, set max-page-size to 4KiB to
|
||||
# prevent the linker from aligning the text segment to any built-in default
|
||||
# (e.g., 4MiB on x86_64 or 64KiB on ARM). Otherwise, the padding bytes are
|
||||
# wasted at the beginning of the final binary.
|
||||
#
|
||||
LD_OPT_GC_SECTIONS ?= -gc-sections
|
||||
LD_OPT_ALIGN_SANE = -z max-page-size=0x1000
|
||||
LD_OPT_PREFIX := -Wl,
|
||||
LD_OPT += $(LD_MARCH) $(LD_OPT_GC_SECTIONS)
|
||||
LD_OPT += $(LD_MARCH) $(LD_OPT_GC_SECTIONS) $(LD_OPT_ALIGN_SANE)
|
||||
CXX_LINK_OPT += $(addprefix $(LD_OPT_PREFIX),$(LD_OPT))
|
||||
CXX_LINK_OPT += $(LD_OPT_NOSTDLIB)
|
||||
|
||||
|
@ -19,7 +19,7 @@ CC_MARCH ?= -m64
|
||||
#
|
||||
# See http://sourceware.org/ml/binutils/2009-04/msg00099.html
|
||||
#
|
||||
LD_MARCH ?= -melf_x86_64 -z max-page-size=0x1000
|
||||
LD_MARCH ?= -melf_x86_64
|
||||
|
||||
|
||||
include $(call select_from_repositories,mk/spec-64bit.mk)
|
||||
|
Loading…
x
Reference in New Issue
Block a user