added linker script to assure correct order of sections

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4122 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2005-06-22 14:49:34 +00:00
parent 05d2a3a979
commit 5ed1ef2bb8

View file

@ -80,6 +80,32 @@ util_env.Append(LINKFLAGS = '$ALIGN_FLAG') # 512 bytes align
### weird GCC requirements
#
# GCC puts new PE sections, added by code, between other sections.
# This is not good for the .ndata section because makensis changes
# its size dynamically. This is not good if RVAs to sections below
# it are saved in other places. The RVAs will point to garbage.
#
# To fix this, a linker script is provided. The linker script makes
# sure the sections will be written in the correct order.
#
script_path = File('#.sconf_temp/linker_script').path
open(script_path, 'w').write("""
SECTIONS
{
.text : { *(.text) }
.data : { *(.data) }
.rdata : { *(.rdata) }
.bss : { *(.bss) }
.idata : { *(.idata) }
.ndata BLOCK(__section_alignment__) : { [ .ndata ] }
.rsrc : { *(.rsrc) }
}
""")
stub_env.Append(LINKFLAGS = '-Wl,%s' % script_path)
#
# GCC requires some functions from the CRT to be present, if certain
# operations are done. For example, if a small string is assigned to