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

Unified Diff: nacl/dyn-link/ldscripts/elf_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/elf_nacl.xs
diff --git a/nacl/dyn-link/ldscripts/elf_nacl.xs b/nacl/dyn-link/ldscripts/elf_nacl.xs
index 9de54d9238a251f1f45e3ef29575fb659b974ccf..c407c88c8963a67741a35af2de011f67dc464326 100644
--- a/nacl/dyn-link/ldscripts/elf_nacl.xs
+++ b/nacl/dyn-link/ldscripts/elf_nacl.xs
@@ -10,6 +10,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) ;
@@ -164,6 +165,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 (MAXPAGESIZE));
+
__bss_start = .;
.bss :
{
@@ -176,11 +190,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) }
« nacl/dyn-link/ldscripts/elf64_nacl.xs ('K') | « nacl/dyn-link/ldscripts/elf64_nacl.xs ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698