Commit 25f23ffa authored by mcgrathr@chromium.org's avatar mcgrathr@chromium.org

nacl_helper_bootstrap: Reserve correct address space size for ARM, none for x86-64

The address space reservation has only been thoroughly used and tested on
x86-32.  It's also necessary on ARM, but it needs a different exact amount
reserved.  For x86-64, the reserved space is not used, so it's a waste of
address space to consume a gigabyte for it.

BUG= none
TEST= nacl_integration

R=mseaborn@chromium.org,bradchen@google.com

Review URL: http://codereview.chromium.org/8588046

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110739 0039d316-1c4b-4281-b951-d872f2087c98
parent 8f55ef5f
...@@ -127,6 +127,27 @@ ...@@ -127,6 +127,27 @@
], ],
}], }],
['OS=="linux" and coverage==0', { ['OS=="linux" and coverage==0', {
'conditions': [
['target_arch=="x64"', {
'variables': {
# No extra reservation.
'nacl_reserve_top': [],
}
}],
['target_arch=="ia32"', {
'variables': {
# 1G address space.
'nacl_reserve_top': ['--defsym', 'RESERVE_TOP=0x40000000'],
}
}],
['target_arch=="arm"', {
'variables': {
# 1G address space, plus 4K guard area above because
# immediate offsets are 12 bits.
'nacl_reserve_top': ['--defsym', 'RESERVE_TOP=0x40001000'],
}
}],
],
'targets': [ 'targets': [
{ {
'target_name': 'nacl_helper', 'target_name': 'nacl_helper',
...@@ -274,8 +295,8 @@ ...@@ -274,8 +295,8 @@
['target_arch=="arm"', { ['target_arch=="arm"', {
'variables': { 'variables': {
'linker_emulation': 'armelf_linux_eabi', 'linker_emulation': 'armelf_linux_eabi',
# ARM requires linking against libc due to ABI dependencies on # ARM requires linking against libc due to ABI
# memset # dependencies on memset.
'bootstrap_extra_lib' : "${SYSROOT}/usr/lib/libc.a", 'bootstrap_extra_lib' : "${SYSROOT}/usr/lib/libc.a",
} }
}], }],
...@@ -283,13 +304,16 @@ ...@@ -283,13 +304,16 @@
'action': ['../tools/ld_bfd/ld', 'action': ['../tools/ld_bfd/ld',
'-m', '<(linker_emulation)', '-m', '<(linker_emulation)',
'--build-id', '--build-id',
# This program is (almost) entirely standalone. It # This program is (almost) entirely
# has its own startup code, so no crt1.o for it. It is # standalone. It has its own startup code, so
# statically linked, and on x86 it does not use # no crt1.o for it. It is statically linked,
# libc at all. However, on ARM it needs a few (safe) # and on x86 it does not use libc at all.
# things from libc. # However, on ARM it needs a few (safe) things
# from libc.
'-static', '-static',
# Link with custom linker script for special layout. # Link with custom linker script for special
# layout. The script uses the symbol RESERVE_TOP.
'<@(nacl_reserve_top)',
'--script=<(linker_script)', '--script=<(linker_script)',
'-o', '<@(_outputs)', '-o', '<@(_outputs)',
# On x86-64, the default page size with some # On x86-64, the default page size with some
......
...@@ -33,11 +33,11 @@ ENTRY(_start) ...@@ -33,11 +33,11 @@ ENTRY(_start)
TEXT_START = 0x10000; TEXT_START = 0x10000;
/* /*
* This is the top of the range we are trying to reserve, which is 1G * The symbol RESERVE_TOP is the top of the range we are trying to reserve.
* for x86-32 and ARM. For an x86-64 zero-based sandbox, this really * This is set via --defsym on the linker command line, because the correct
* needs to be 36G. * value differs for each machine. It's not defined at all if we do not
* actually need any space reserved for this configuration.
*/ */
RESERVE_TOP = 1 << 30;
/* /*
* We specify the program headers we want explicitly, to get the layout * We specify the program headers we want explicitly, to get the layout
...@@ -109,7 +109,7 @@ SECTIONS { ...@@ -109,7 +109,7 @@ SECTIONS {
. = ALIGN(CONSTANT(COMMONPAGESIZE)); . = ALIGN(CONSTANT(COMMONPAGESIZE));
RESERVE_START = .; RESERVE_START = .;
.reserve : { .reserve : {
. = RESERVE_TOP - RESERVE_START; . += DEFINED(RESERVE_TOP) ? (RESERVE_TOP - RESERVE_START) : 0;
} :reserve } :reserve
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment