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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* Script for ld --shared: link shared library */ 1 /* Script for ld --shared: link shared library */
2 OUTPUT_FORMAT("elf64-nacl", "elf64-nacl", 2 OUTPUT_FORMAT("elf64-nacl", "elf64-nacl",
3 "elf64-nacl") 3 "elf64-nacl")
4 OUTPUT_ARCH(i386:x86-64) 4 OUTPUT_ARCH(i386:x86-64)
5 ENTRY(_start) 5 ENTRY(_start)
6 SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib"); 6 SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
7 PHDRS 7 PHDRS
8 { 8 {
9 seg_code PT_LOAD FLAGS(5) ; /* read + execute */ 9 seg_code PT_LOAD FLAGS(5) ; /* read + execute */
10 seg_rodata PT_LOAD FLAGS(4) ; /* read */ 10 seg_rodata PT_LOAD FLAGS(4) ; /* read */
11 seg_rwdata PT_LOAD FLAGS(6) ; /* read + write */ 11 seg_rwdata PT_LOAD FLAGS(6) ; /* read + write */
12 seg_bss PT_LOAD FLAGS(6) ; /* read + write */
12 seg_dynamic PT_DYNAMIC FLAGS(6) ; 13 seg_dynamic PT_DYNAMIC FLAGS(6) ;
13 seg_stack PT_GNU_STACK FLAGS(6) ; 14 seg_stack PT_GNU_STACK FLAGS(6) ;
14 seg_tls PT_TLS FLAGS(4) ; 15 seg_tls PT_TLS FLAGS(4) ;
15 } 16 }
16 SECTIONS 17 SECTIONS
17 { 18 {
18 /* ELF headers are not included in any PT_LOAD segment */ 19 /* ELF headers are not included in any PT_LOAD segment */
19 . = SEGMENT_START("text", 0); 20 . = SEGMENT_START("text", 0);
20 _begin = .; 21 _begin = .;
21 /* The ALIGN(32) instructions below are workarounds. 22 /* The ALIGN(32) instructions below are workarounds.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 .got.plt : { *(.got.plt) } 157 .got.plt : { *(.got.plt) }
157 . = ALIGN(CONSTANT (MAXPAGESIZE)); /* nacl wants page alignment */ 158 . = ALIGN(CONSTANT (MAXPAGESIZE)); /* nacl wants page alignment */
158 .data : 159 .data :
159 { 160 {
160 *(.data .data.* .gnu.linkonce.d.*) 161 *(.data .data.* .gnu.linkonce.d.*)
161 KEEP (*(.gnu.linkonce.d.*personality*)) 162 KEEP (*(.gnu.linkonce.d.*personality*))
162 SORT(CONSTRUCTORS) 163 SORT(CONSTRUCTORS)
163 } 164 }
164 .data1 : { *(.data1) } 165 .data1 : { *(.data1) }
165 _edata = .; PROVIDE (edata = .); 166 _edata = .; PROVIDE (edata = .);
167
168 /* We place the BSS in a separate segment as a workaround for the
169 behaviour of NaCl's mmap() on the last page in a file. When using
170 copy-on-write MAP_PRIVATE, we cannot necessarily write beyond the
171 file's extent within the 64k page.
172 See http://code.google.com/p/nativeclient/issues/detail?id=824.
173 TODO(mseaborn): A better fix would be to change the dynamic linker
174 to copy the last page. This would save a page of memory because
175 the BSS could share a page with the data segment. But for now, it
176 is simpler to change the linker script. */
177 . = DATA_SEGMENT_END (.);
178 . = 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
179
166 __bss_start = .; 180 __bss_start = .;
167 .bss : 181 .bss :
168 { 182 {
169 *(.dynbss) 183 *(.dynbss)
170 *(.bss .bss.* .gnu.linkonce.b.*) 184 *(.bss .bss.* .gnu.linkonce.b.*)
171 *(COMMON) 185 *(COMMON)
172 /* Align here to ensure that the .bss section occupies space up to 186 /* Align here to ensure that the .bss section occupies space up to
173 _end. Align after .bss to ensure correct alignment even if the 187 _end. Align after .bss to ensure correct alignment even if the
174 .bss section disappears because there are no input sections. 188 .bss section disappears because there are no input sections.
175 FIXME: Why do we need it? When there is no .bss section, we don't 189 FIXME: Why do we need it? When there is no .bss section, we don't
176 pad the .data section. */ 190 pad the .data section. */
177 . = ALIGN(. != 0 ? 32 / 8 : 1); 191 . = ALIGN(. != 0 ? 32 / 8 : 1);
178 } 192 } :seg_bss
179 . = ALIGN(32 / 8); 193 . = ALIGN(32 / 8);
180 . = ALIGN(32 / 8); 194 . = ALIGN(32 / 8);
181 _end = .; PROVIDE (end = .); 195 _end = .; PROVIDE (end = .);
182 . = DATA_SEGMENT_END (.);
183 /* Stabs debugging sections. */ 196 /* Stabs debugging sections. */
184 .stab 0 : { *(.stab) } 197 .stab 0 : { *(.stab) }
185 .stabstr 0 : { *(.stabstr) } 198 .stabstr 0 : { *(.stabstr) }
186 .stab.excl 0 : { *(.stab.excl) } 199 .stab.excl 0 : { *(.stab.excl) }
187 .stab.exclstr 0 : { *(.stab.exclstr) } 200 .stab.exclstr 0 : { *(.stab.exclstr) }
188 .stab.index 0 : { *(.stab.index) } 201 .stab.index 0 : { *(.stab.index) }
189 .stab.indexstr 0 : { *(.stab.indexstr) } 202 .stab.indexstr 0 : { *(.stab.indexstr) }
190 .comment 0 : { *(.comment) } 203 .comment 0 : { *(.comment) }
191 /* DWARF debug sections. 204 /* DWARF debug sections.
192 Symbols in the DWARF debugging sections are relative to the beginning 205 Symbols in the DWARF debugging sections are relative to the beginning
(...skipping 20 matching lines...) Expand all
213 .debug_funcnames 0 : { *(.debug_funcnames) } 226 .debug_funcnames 0 : { *(.debug_funcnames) }
214 .debug_typenames 0 : { *(.debug_typenames) } 227 .debug_typenames 0 : { *(.debug_typenames) }
215 .debug_varnames 0 : { *(.debug_varnames) } 228 .debug_varnames 0 : { *(.debug_varnames) }
216 /* DWARF 3 */ 229 /* DWARF 3 */
217 .debug_pubtypes 0 : { *(.debug_pubtypes) } 230 .debug_pubtypes 0 : { *(.debug_pubtypes) }
218 .debug_ranges 0 : { *(.debug_ranges) } 231 .debug_ranges 0 : { *(.debug_ranges) }
219 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } 232 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
220 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) } 233 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
221 /DISCARD/ : { *(.note.ABI-tag) } 234 /DISCARD/ : { *(.note.ABI-tag) }
222 } 235 }
OLDNEW
« 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