Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -2688,6 +2688,8 @@ def MakeGenericLinuxEnv(platform=None):
LINK = '$CXX',
)

linux_env.SetDefault(MAX_PAGE_SIZE='0x1000')

# Prepend so we can disable warnings via Append
linux_env.Prepend(
CPPDEFINES = [['_POSIX_C_SOURCE', '199506'],
Expand All @@ -2710,6 +2712,7 @@ def MakeGenericLinuxEnv(platform=None):
LINKFLAGS = ['-m64'] + sysroot_flags,
)
elif linux_env.Bit('build_arm'):
linux_env.Replace(MAX_PAGE_SIZE='0x10000')
SetUpLinuxEnvArm(linux_env)
elif linux_env.Bit('build_mips32'):
SetUpLinuxEnvMips(linux_env)
Expand All @@ -2735,7 +2738,8 @@ def MakeGenericLinuxEnv(platform=None):
linux_env.Prepend(SHLINKFLAGS=['$COMMON_LINKFLAGS'])
linux_env.Prepend(COMMON_LINKFLAGS=['-Wl,-z,relro',
'-Wl,-z,now',
'-Wl,-z,noexecstack'])
'-Wl,-z,noexecstack',
'-Wl,-z,max-page-size=${MAX_PAGE_SIZE}'])
linux_env.Prepend(LINKFLAGS=['-pie'])
# The ARM toolchain has a linker that doesn't handle the code its
# compiler generates under -fPIE.
Expand Down
2 changes: 1 addition & 1 deletion src/trusted/service_runtime/build.scons
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ if (env.Bit('linux') and not env.Bit('built_elsewhere')):
'nacl_bootstrap_raw',
[bootstrap_obj],
("env CXX='${CXX}' ${PYTHON} %s %s " +
'-m %s --build-id -static -z max-page-size=0x1000 ' +
'-m %s --build-id -static -z max-page-size=${MAX_PAGE_SIZE} ' +
'--defsym RESERVE_TOP=%s --script %s -o ${TARGET} ${SOURCES}') %
(bootstrap_env.File('linux/ld_bfd.py'), compiler_override, ld_emul,
reserve_top, bootstrap_env.File('linux/nacl_bootstrap.x')),
Expand Down
4 changes: 2 additions & 2 deletions src/trusted/service_runtime/linux/nacl_bootstrap.x
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ SECTIONS {
* It just maps it from the file, i.e. way off the end of the file,
* which is perfect for reserving the address space.
*/
. = ALIGN(CONSTANT(COMMONPAGESIZE));
. = ALIGN(CONSTANT(MAXPAGESIZE));
RESERVE_START = .;
.reserve : {
.reserve : ALIGN(CONSTANT(MAXPAGESIZE)) {
. += (RESERVE_TOP > RESERVE_START) ? (RESERVE_TOP - RESERVE_START) : 0;
} :reserve

Expand Down