Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: nacl/dyn-link/ldscripts/elf64_nacl.xs

Issue 13638011: Align and pad code segments to 64k (Closed) Base URL: http://git.chromium.org/native_client/nacl-glibc.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « nacl/dyn-link/ldscripts/elf64_nacl.x ('k') | nacl/dyn-link/ldscripts/elf_nacl.x » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: nacl/dyn-link/ldscripts/elf64_nacl.xs
diff --git a/nacl/dyn-link/ldscripts/elf64_nacl.xs b/nacl/dyn-link/ldscripts/elf64_nacl.xs
index 5925cf95c87989d322a053fbedf589b4ba9bfebf..e92865bf1c9858b2c4ce9d53b14e40d841ec527e 100644
--- a/nacl/dyn-link/ldscripts/elf64_nacl.xs
+++ b/nacl/dyn-link/ldscripts/elf64_nacl.xs
@@ -16,12 +16,9 @@ PHDRS
}
SECTIONS
{
- /* NaCl runtime treats ld.so as an executable. NaCl executables must have
- page-aligned code and data segments, so linker script for ld.so is patched
- to remove SIZEOF_HEADERS below and make code segment aligned to page
- boundary. */
- . = SEGMENT_START("text", 0) + SIZEOF_HEADERS;
+ . = SEGMENT_START("text", 0);
_begin = .;
+
/* The ALIGN(32) instructions below are workarounds.
TODO(mseaborn): Get the object files to include the correct
alignments and padding themselves.
@@ -43,21 +40,13 @@ SECTIONS
KEEP (*(.fini))
*(__libc_freeres_fn)
*(__libc_thread_freeres_fn)
- . = ALIGN(32); /* ensure nop padding */
+ . = ALIGN(CONSTANT (MAXPAGESIZE)); /* ensures NOP fill */
} =0x90909090
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
- /* Adjust data segment so that is has the same position within the page as
- the end of code segment. In this case linker can store them without any
- zeros in between.
-
- NaCl runtime treats ld.so as an executable which must have page-aligned
- read-only data segment. So the last term is replaced with 0 while patching
- linker script for ld.so. */
- . = SEGMENT_START("text", 0) + 0x10000000 +
- (. & (CONSTANT (MAXPAGESIZE) - 1));
+ . = ALIGN(SEGMENT_START("text", 0) + 0x10000000, CONSTANT (MAXPAGESIZE));
.note.gnu.build-id : { *(.note.gnu.build-id) } :seg_rodata
.hash : { *(.hash) }
.gnu.hash : { *(.gnu.hash) }
@@ -102,7 +91,7 @@ SECTIONS
. = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
/* Executables loaded by sel_ldr are not required to have seg_rwdata aligned
to page boundary. So we can omit alignment here both for ld.so and normal
- libraries. */
+ libraries. */
/* Exception handling */
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } :seg_rwdata
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
« no previous file with comments | « nacl/dyn-link/ldscripts/elf64_nacl.x ('k') | nacl/dyn-link/ldscripts/elf_nacl.x » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698