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

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

Issue 7715030: Fix dynamic library linking. (Closed) Base URL: http://git.chromium.org/native_client/nacl-glibc.git@master
Patch Set: Created 9 years, 4 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
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 befc62076bdf2c2bf3ee0f445c4568fab60d4127..3de9663154f0a959fee0caa0f3ca9d4fb8a8d2ba 100644
--- a/nacl/dyn-link/ldscripts/elf64_nacl.xs
+++ b/nacl/dyn-link/ldscripts/elf64_nacl.xs
@@ -9,6 +9,7 @@ PHDRS
seg_code PT_LOAD FLAGS(5) ; /* read + execute */
seg_rodata PT_LOAD FLAGS(4) ; /* read */
seg_rwdata PT_LOAD FLAGS(6) ; /* read + write */
+ seg_bss PT_LOAD FLAGS(6) ; /* read + write */
seg_dynamic PT_DYNAMIC FLAGS(6) ;
seg_stack PT_GNU_STACK FLAGS(6) ;
seg_tls PT_TLS FLAGS(4) ;
@@ -163,6 +164,19 @@ SECTIONS
}
.data1 : { *(.data1) }
_edata = .; PROVIDE (edata = .);
+
+ /* We place the BSS in a separate segment as a workaround for the
+ behaviour of NaCl's mmap() on the last page in a file. When using
+ copy-on-write MAP_PRIVATE, we cannot necessarily write beyond the
+ file's extent within the 64k page.
+ See http://code.google.com/p/nativeclient/issues/detail?id=824.
+ TODO(mseaborn): A better fix would be to change the dynamic linker
+ to copy the last page. This would save a page of memory because
+ the BSS could share a page with the data segment. But for now, it
+ is simpler to change the linker script. */
+ . = DATA_SEGMENT_END (.);
+ . = ALIGN (CONSTANT (COMMONPAGESIZE));
pasko-google - do not use 2011/08/24 16:38:14 please, take a look it it did not significantly in
khim 2011/08/24 17:03:07 It adds few kilobytes to file with debug info (but
+
__bss_start = .;
.bss :
{
@@ -175,11 +189,10 @@ SECTIONS
FIXME: Why do we need it? When there is no .bss section, we don't
pad the .data section. */
. = ALIGN(. != 0 ? 32 / 8 : 1);
- }
+ } :seg_bss
. = ALIGN(32 / 8);
. = ALIGN(32 / 8);
_end = .; PROVIDE (end = .);
- . = DATA_SEGMENT_END (.);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
« elf/Makefile ('K') | « elf/Makefile ('k') | nacl/dyn-link/ldscripts/elf_nacl.xs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698