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

Unified Diff: nacl/dyn-link/ldscripts/elf_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/elf_nacl.x ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: nacl/dyn-link/ldscripts/elf_nacl.xs
diff --git a/nacl/dyn-link/ldscripts/elf_nacl.xs b/nacl/dyn-link/ldscripts/elf_nacl.xs
index 57303bac88570e8e4b3063b166eaa8bcaee5c942..71f8b14dd994d7b3a0a77245390e7d5c07948bed 100644
--- a/nacl/dyn-link/ldscripts/elf_nacl.xs
+++ b/nacl/dyn-link/ldscripts/elf_nacl.xs
@@ -17,12 +17,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.
@@ -44,21 +41,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) }
@@ -96,7 +85,7 @@ SECTIONS
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
.eh_frame_hdr : { *(.eh_frame_hdr) }
- .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+ .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
« no previous file with comments | « nacl/dyn-link/ldscripts/elf_nacl.x ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698