Block remapping or unmapping code mappings
[nativeclient.git] / tools / patches / glibc-2.9.patch
blobed28c5c0253b7108d210d7dbfdce975f0d6880da
1 diff --git a/configure b/configure
2 index a2a792c..71ae623 100755
3 --- a/configure
4 +++ b/configure
5 @@ -580,42 +580,6 @@ PACKAGE_STRING='GNU C Library (see version.h)'
6 PACKAGE_BUGREPORT='glibc'
8 ac_unique_file="include/features.h"
9 -# Factoring default headers for most tests.
10 -ac_includes_default="\
11 -#include <stdio.h>
12 -#ifdef HAVE_SYS_TYPES_H
13 -# include <sys/types.h>
14 -#endif
15 -#ifdef HAVE_SYS_STAT_H
16 -# include <sys/stat.h>
17 -#endif
18 -#ifdef STDC_HEADERS
19 -# include <stdlib.h>
20 -# include <stddef.h>
21 -#else
22 -# ifdef HAVE_STDLIB_H
23 -# include <stdlib.h>
24 -# endif
25 -#endif
26 -#ifdef HAVE_STRING_H
27 -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
28 -# include <memory.h>
29 -# endif
30 -# include <string.h>
31 -#endif
32 -#ifdef HAVE_STRINGS_H
33 -# include <strings.h>
34 -#endif
35 -#ifdef HAVE_INTTYPES_H
36 -# include <inttypes.h>
37 -#endif
38 -#ifdef HAVE_STDINT_H
39 -# include <stdint.h>
40 -#endif
41 -#ifdef HAVE_UNISTD_H
42 -# include <unistd.h>
43 -#endif"
45 ac_subst_vars='SHELL
46 PATH_SEPARATOR
47 PACKAGE_NAME
48 @@ -735,8 +699,6 @@ LIBGD
49 have_libaudit
50 have_libcap
51 have_selinux
52 -GREP
53 -EGREP
54 sizeof_long_double
55 libc_cv_gcc_unwind_find_fde
56 uname_sysname
57 @@ -2621,7 +2583,7 @@ done
59 # Find what sysdep directories exist.
60 sysnames_add_ons=
61 -sysnames=
62 +sysnames="sysdeps/nacl "
63 for b in $base ''; do
64 for m0 in $mach ''; do
65 for v in /$vendor ''; do
66 @@ -7486,818 +7448,8 @@ _ACEOF
71 -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
72 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
73 -if test "${ac_cv_path_GREP+set}" = set; then
74 - echo $ECHO_N "(cached) $ECHO_C" >&6
75 -else
76 - # Extract the first word of "grep ggrep" to use in msg output
77 -if test -z "$GREP"; then
78 -set dummy grep ggrep; ac_prog_name=$2
79 -if test "${ac_cv_path_GREP+set}" = set; then
80 - echo $ECHO_N "(cached) $ECHO_C" >&6
81 -else
82 - ac_path_GREP_found=false
83 -# Loop through the user's path and test for each of PROGNAME-LIST
84 -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
85 -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
86 -do
87 - IFS=$as_save_IFS
88 - test -z "$as_dir" && as_dir=.
89 - for ac_prog in grep ggrep; do
90 - for ac_exec_ext in '' $ac_executable_extensions; do
91 - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
92 - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
93 - # Check for GNU ac_path_GREP and select it if it is found.
94 - # Check for GNU $ac_path_GREP
95 -case `"$ac_path_GREP" --version 2>&1` in
96 -*GNU*)
97 - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
98 -*)
99 - ac_count=0
100 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
101 - while :
102 - do
103 - cat "conftest.in" "conftest.in" >"conftest.tmp"
104 - mv "conftest.tmp" "conftest.in"
105 - cp "conftest.in" "conftest.nl"
106 - echo 'GREP' >> "conftest.nl"
107 - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
108 - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
109 - ac_count=`expr $ac_count + 1`
110 - if test $ac_count -gt ${ac_path_GREP_max-0}; then
111 - # Best one so far, save it but keep looking for a better one
112 - ac_cv_path_GREP="$ac_path_GREP"
113 - ac_path_GREP_max=$ac_count
114 - fi
115 - # 10*(2^10) chars as input seems more than enough
116 - test $ac_count -gt 10 && break
117 - done
118 - rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
119 -esac
122 - $ac_path_GREP_found && break 3
123 - done
124 -done
126 -done
127 -IFS=$as_save_IFS
132 -GREP="$ac_cv_path_GREP"
133 -if test -z "$GREP"; then
134 - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
135 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
136 - { (exit 1); exit 1; }; }
139 -else
140 - ac_cv_path_GREP=$GREP
145 -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
146 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
147 - GREP="$ac_cv_path_GREP"
150 -{ echo "$as_me:$LINENO: checking for egrep" >&5
151 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
152 -if test "${ac_cv_path_EGREP+set}" = set; then
153 - echo $ECHO_N "(cached) $ECHO_C" >&6
154 -else
155 - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
156 - then ac_cv_path_EGREP="$GREP -E"
157 - else
158 - # Extract the first word of "egrep" to use in msg output
159 -if test -z "$EGREP"; then
160 -set dummy egrep; ac_prog_name=$2
161 -if test "${ac_cv_path_EGREP+set}" = set; then
162 - echo $ECHO_N "(cached) $ECHO_C" >&6
163 -else
164 - ac_path_EGREP_found=false
165 -# Loop through the user's path and test for each of PROGNAME-LIST
166 -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
167 -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
169 - IFS=$as_save_IFS
170 - test -z "$as_dir" && as_dir=.
171 - for ac_prog in egrep; do
172 - for ac_exec_ext in '' $ac_executable_extensions; do
173 - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
174 - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
175 - # Check for GNU ac_path_EGREP and select it if it is found.
176 - # Check for GNU $ac_path_EGREP
177 -case `"$ac_path_EGREP" --version 2>&1` in
178 -*GNU*)
179 - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
181 - ac_count=0
182 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
183 - while :
184 - do
185 - cat "conftest.in" "conftest.in" >"conftest.tmp"
186 - mv "conftest.tmp" "conftest.in"
187 - cp "conftest.in" "conftest.nl"
188 - echo 'EGREP' >> "conftest.nl"
189 - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
190 - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
191 - ac_count=`expr $ac_count + 1`
192 - if test $ac_count -gt ${ac_path_EGREP_max-0}; then
193 - # Best one so far, save it but keep looking for a better one
194 - ac_cv_path_EGREP="$ac_path_EGREP"
195 - ac_path_EGREP_max=$ac_count
196 - fi
197 - # 10*(2^10) chars as input seems more than enough
198 - test $ac_count -gt 10 && break
199 - done
200 - rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
201 -esac
204 - $ac_path_EGREP_found && break 3
205 - done
206 -done
208 -done
209 -IFS=$as_save_IFS
214 -EGREP="$ac_cv_path_EGREP"
215 -if test -z "$EGREP"; then
216 - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
217 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
218 - { (exit 1); exit 1; }; }
221 -else
222 - ac_cv_path_EGREP=$EGREP
226 - fi
228 -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
229 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
230 - EGREP="$ac_cv_path_EGREP"
233 -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
234 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
235 -if test "${ac_cv_header_stdc+set}" = set; then
236 - echo $ECHO_N "(cached) $ECHO_C" >&6
237 -else
238 - cat >conftest.$ac_ext <<_ACEOF
239 -/* confdefs.h. */
240 -_ACEOF
241 -cat confdefs.h >>conftest.$ac_ext
242 -cat >>conftest.$ac_ext <<_ACEOF
243 -/* end confdefs.h. */
244 -#include <stdlib.h>
245 -#include <stdarg.h>
246 -#include <string.h>
247 -#include <float.h>
249 -int
250 -main ()
254 - return 0;
256 -_ACEOF
257 -rm -f conftest.$ac_objext
258 -if { (ac_try="$ac_compile"
259 -case "(($ac_try" in
260 - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
261 - *) ac_try_echo=$ac_try;;
262 -esac
263 -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
264 - (eval "$ac_compile") 2>conftest.er1
265 - ac_status=$?
266 - grep -v '^ *+' conftest.er1 >conftest.err
267 - rm -f conftest.er1
268 - cat conftest.err >&5
269 - echo "$as_me:$LINENO: \$? = $ac_status" >&5
270 - (exit $ac_status); } && {
271 - test -z "$ac_c_werror_flag" ||
272 - test ! -s conftest.err
273 - } && test -s conftest.$ac_objext; then
274 - ac_cv_header_stdc=yes
275 -else
276 - echo "$as_me: failed program was:" >&5
277 -sed 's/^/| /' conftest.$ac_ext >&5
279 - ac_cv_header_stdc=no
282 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
284 -if test $ac_cv_header_stdc = yes; then
285 - # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
286 - cat >conftest.$ac_ext <<_ACEOF
287 -/* confdefs.h. */
288 -_ACEOF
289 -cat confdefs.h >>conftest.$ac_ext
290 -cat >>conftest.$ac_ext <<_ACEOF
291 -/* end confdefs.h. */
292 -#include <string.h>
294 -_ACEOF
295 -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
296 - $EGREP "memchr" >/dev/null 2>&1; then
298 -else
299 - ac_cv_header_stdc=no
301 -rm -f conftest*
305 -if test $ac_cv_header_stdc = yes; then
306 - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
307 - cat >conftest.$ac_ext <<_ACEOF
308 -/* confdefs.h. */
309 -_ACEOF
310 -cat confdefs.h >>conftest.$ac_ext
311 -cat >>conftest.$ac_ext <<_ACEOF
312 -/* end confdefs.h. */
313 -#include <stdlib.h>
315 -_ACEOF
316 -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
317 - $EGREP "free" >/dev/null 2>&1; then
319 -else
320 - ac_cv_header_stdc=no
322 -rm -f conftest*
326 -if test $ac_cv_header_stdc = yes; then
327 - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
328 - if test "$cross_compiling" = yes; then
330 -else
331 - cat >conftest.$ac_ext <<_ACEOF
332 -/* confdefs.h. */
333 -_ACEOF
334 -cat confdefs.h >>conftest.$ac_ext
335 -cat >>conftest.$ac_ext <<_ACEOF
336 -/* end confdefs.h. */
337 -#include <ctype.h>
338 -#include <stdlib.h>
339 -#if ((' ' & 0x0FF) == 0x020)
340 -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
341 -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
342 -#else
343 -# define ISLOWER(c) \
344 - (('a' <= (c) && (c) <= 'i') \
345 - || ('j' <= (c) && (c) <= 'r') \
346 - || ('s' <= (c) && (c) <= 'z'))
347 -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
348 -#endif
350 -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
351 -int
352 -main ()
354 - int i;
355 - for (i = 0; i < 256; i++)
356 - if (XOR (islower (i), ISLOWER (i))
357 - || toupper (i) != TOUPPER (i))
358 - return 2;
359 - return 0;
361 -_ACEOF
362 -rm -f conftest$ac_exeext
363 -if { (ac_try="$ac_link"
364 -case "(($ac_try" in
365 - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
366 - *) ac_try_echo=$ac_try;;
367 -esac
368 -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
369 - (eval "$ac_link") 2>&5
370 - ac_status=$?
371 - echo "$as_me:$LINENO: \$? = $ac_status" >&5
372 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
373 - { (case "(($ac_try" in
374 - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
375 - *) ac_try_echo=$ac_try;;
376 -esac
377 -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
378 - (eval "$ac_try") 2>&5
379 - ac_status=$?
380 - echo "$as_me:$LINENO: \$? = $ac_status" >&5
381 - (exit $ac_status); }; }; then
383 -else
384 - echo "$as_me: program exited with status $ac_status" >&5
385 -echo "$as_me: failed program was:" >&5
386 -sed 's/^/| /' conftest.$ac_ext >&5
388 -( exit $ac_status )
389 -ac_cv_header_stdc=no
391 -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
397 -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
398 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
399 -if test $ac_cv_header_stdc = yes; then
401 -cat >>confdefs.h <<\_ACEOF
402 -#define STDC_HEADERS 1
403 -_ACEOF
407 -# On IRIX 5.3, sys/types and inttypes.h are conflicting.
417 -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
418 - inttypes.h stdint.h unistd.h
420 -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
421 -{ echo "$as_me:$LINENO: checking for $ac_header" >&5
422 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
423 -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
424 - echo $ECHO_N "(cached) $ECHO_C" >&6
425 -else
426 - cat >conftest.$ac_ext <<_ACEOF
427 -/* confdefs.h. */
428 -_ACEOF
429 -cat confdefs.h >>conftest.$ac_ext
430 -cat >>conftest.$ac_ext <<_ACEOF
431 -/* end confdefs.h. */
432 -$ac_includes_default
434 -#include <$ac_header>
435 -_ACEOF
436 -rm -f conftest.$ac_objext
437 -if { (ac_try="$ac_compile"
438 -case "(($ac_try" in
439 - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
440 - *) ac_try_echo=$ac_try;;
441 -esac
442 -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
443 - (eval "$ac_compile") 2>conftest.er1
444 - ac_status=$?
445 - grep -v '^ *+' conftest.er1 >conftest.err
446 - rm -f conftest.er1
447 - cat conftest.err >&5
448 - echo "$as_me:$LINENO: \$? = $ac_status" >&5
449 - (exit $ac_status); } && {
450 - test -z "$ac_c_werror_flag" ||
451 - test ! -s conftest.err
452 - } && test -s conftest.$ac_objext; then
453 - eval "$as_ac_Header=yes"
454 -else
455 - echo "$as_me: failed program was:" >&5
456 -sed 's/^/| /' conftest.$ac_ext >&5
458 - eval "$as_ac_Header=no"
461 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
463 -ac_res=`eval echo '${'$as_ac_Header'}'`
464 - { echo "$as_me:$LINENO: result: $ac_res" >&5
465 -echo "${ECHO_T}$ac_res" >&6; }
466 -if test `eval echo '${'$as_ac_Header'}'` = yes; then
467 - cat >>confdefs.h <<_ACEOF
468 -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
469 -_ACEOF
473 -done
476 -{ echo "$as_me:$LINENO: checking for long double" >&5
477 -echo $ECHO_N "checking for long double... $ECHO_C" >&6; }
478 -if test "${ac_cv_type_long_double+set}" = set; then
479 - echo $ECHO_N "(cached) $ECHO_C" >&6
480 -else
481 - cat >conftest.$ac_ext <<_ACEOF
482 -/* confdefs.h. */
483 -_ACEOF
484 -cat confdefs.h >>conftest.$ac_ext
485 -cat >>conftest.$ac_ext <<_ACEOF
486 -/* end confdefs.h. */
487 -$ac_includes_default
488 -typedef long double ac__type_new_;
489 -int
490 -main ()
492 -if ((ac__type_new_ *) 0)
493 - return 0;
494 -if (sizeof (ac__type_new_))
495 - return 0;
497 - return 0;
499 -_ACEOF
500 -rm -f conftest.$ac_objext
501 -if { (ac_try="$ac_compile"
502 -case "(($ac_try" in
503 - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
504 - *) ac_try_echo=$ac_try;;
505 -esac
506 -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
507 - (eval "$ac_compile") 2>conftest.er1
508 - ac_status=$?
509 - grep -v '^ *+' conftest.er1 >conftest.err
510 - rm -f conftest.er1
511 - cat conftest.err >&5
512 - echo "$as_me:$LINENO: \$? = $ac_status" >&5
513 - (exit $ac_status); } && {
514 - test -z "$ac_c_werror_flag" ||
515 - test ! -s conftest.err
516 - } && test -s conftest.$ac_objext; then
517 - ac_cv_type_long_double=yes
518 -else
519 - echo "$as_me: failed program was:" >&5
520 -sed 's/^/| /' conftest.$ac_ext >&5
522 - ac_cv_type_long_double=no
525 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
527 -{ echo "$as_me:$LINENO: result: $ac_cv_type_long_double" >&5
528 -echo "${ECHO_T}$ac_cv_type_long_double" >&6; }
530 -# The cast to long int works around a bug in the HP C Compiler
531 -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
532 -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
533 -# This bug is HP SR number 8606223364.
534 -{ echo "$as_me:$LINENO: checking size of long double" >&5
535 -echo $ECHO_N "checking size of long double... $ECHO_C" >&6; }
536 -if test "${ac_cv_sizeof_long_double+set}" = set; then
537 - echo $ECHO_N "(cached) $ECHO_C" >&6
538 -else
539 - if test "$cross_compiling" = yes; then
540 - # Depending upon the size, compute the lo and hi bounds.
541 -cat >conftest.$ac_ext <<_ACEOF
542 -/* confdefs.h. */
543 -_ACEOF
544 -cat confdefs.h >>conftest.$ac_ext
545 -cat >>conftest.$ac_ext <<_ACEOF
546 -/* end confdefs.h. */
547 -$ac_includes_default
548 - typedef long double ac__type_sizeof_;
549 -int
550 -main ()
552 -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
553 -test_array [0] = 0
556 - return 0;
558 -_ACEOF
559 -rm -f conftest.$ac_objext
560 -if { (ac_try="$ac_compile"
561 -case "(($ac_try" in
562 - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
563 - *) ac_try_echo=$ac_try;;
564 -esac
565 -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
566 - (eval "$ac_compile") 2>conftest.er1
567 - ac_status=$?
568 - grep -v '^ *+' conftest.er1 >conftest.err
569 - rm -f conftest.er1
570 - cat conftest.err >&5
571 - echo "$as_me:$LINENO: \$? = $ac_status" >&5
572 - (exit $ac_status); } && {
573 - test -z "$ac_c_werror_flag" ||
574 - test ! -s conftest.err
575 - } && test -s conftest.$ac_objext; then
576 - ac_lo=0 ac_mid=0
577 - while :; do
578 - cat >conftest.$ac_ext <<_ACEOF
579 -/* confdefs.h. */
580 -_ACEOF
581 -cat confdefs.h >>conftest.$ac_ext
582 -cat >>conftest.$ac_ext <<_ACEOF
583 -/* end confdefs.h. */
584 -$ac_includes_default
585 - typedef long double ac__type_sizeof_;
586 -int
587 -main ()
589 -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
590 -test_array [0] = 0
593 - return 0;
595 -_ACEOF
596 -rm -f conftest.$ac_objext
597 -if { (ac_try="$ac_compile"
598 -case "(($ac_try" in
599 - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
600 - *) ac_try_echo=$ac_try;;
601 -esac
602 -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
603 - (eval "$ac_compile") 2>conftest.er1
604 - ac_status=$?
605 - grep -v '^ *+' conftest.er1 >conftest.err
606 - rm -f conftest.er1
607 - cat conftest.err >&5
608 - echo "$as_me:$LINENO: \$? = $ac_status" >&5
609 - (exit $ac_status); } && {
610 - test -z "$ac_c_werror_flag" ||
611 - test ! -s conftest.err
612 - } && test -s conftest.$ac_objext; then
613 - ac_hi=$ac_mid; break
614 -else
615 - echo "$as_me: failed program was:" >&5
616 -sed 's/^/| /' conftest.$ac_ext >&5
618 - ac_lo=`expr $ac_mid + 1`
619 - if test $ac_lo -le $ac_mid; then
620 - ac_lo= ac_hi=
621 - break
622 - fi
623 - ac_mid=`expr 2 '*' $ac_mid + 1`
626 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
627 - done
628 -else
629 - echo "$as_me: failed program was:" >&5
630 -sed 's/^/| /' conftest.$ac_ext >&5
632 - cat >conftest.$ac_ext <<_ACEOF
633 -/* confdefs.h. */
634 -_ACEOF
635 -cat confdefs.h >>conftest.$ac_ext
636 -cat >>conftest.$ac_ext <<_ACEOF
637 -/* end confdefs.h. */
638 -$ac_includes_default
639 - typedef long double ac__type_sizeof_;
640 -int
641 -main ()
643 -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
644 -test_array [0] = 0
647 - return 0;
649 -_ACEOF
650 -rm -f conftest.$ac_objext
651 -if { (ac_try="$ac_compile"
652 -case "(($ac_try" in
653 - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
654 - *) ac_try_echo=$ac_try;;
655 -esac
656 -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
657 - (eval "$ac_compile") 2>conftest.er1
658 - ac_status=$?
659 - grep -v '^ *+' conftest.er1 >conftest.err
660 - rm -f conftest.er1
661 - cat conftest.err >&5
662 - echo "$as_me:$LINENO: \$? = $ac_status" >&5
663 - (exit $ac_status); } && {
664 - test -z "$ac_c_werror_flag" ||
665 - test ! -s conftest.err
666 - } && test -s conftest.$ac_objext; then
667 - ac_hi=-1 ac_mid=-1
668 - while :; do
669 - cat >conftest.$ac_ext <<_ACEOF
670 -/* confdefs.h. */
671 -_ACEOF
672 -cat confdefs.h >>conftest.$ac_ext
673 -cat >>conftest.$ac_ext <<_ACEOF
674 -/* end confdefs.h. */
675 -$ac_includes_default
676 - typedef long double ac__type_sizeof_;
677 -int
678 -main ()
680 -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
681 -test_array [0] = 0
684 - return 0;
686 -_ACEOF
687 -rm -f conftest.$ac_objext
688 -if { (ac_try="$ac_compile"
689 -case "(($ac_try" in
690 - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
691 - *) ac_try_echo=$ac_try;;
692 -esac
693 -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
694 - (eval "$ac_compile") 2>conftest.er1
695 - ac_status=$?
696 - grep -v '^ *+' conftest.er1 >conftest.err
697 - rm -f conftest.er1
698 - cat conftest.err >&5
699 - echo "$as_me:$LINENO: \$? = $ac_status" >&5
700 - (exit $ac_status); } && {
701 - test -z "$ac_c_werror_flag" ||
702 - test ! -s conftest.err
703 - } && test -s conftest.$ac_objext; then
704 - ac_lo=$ac_mid; break
705 -else
706 - echo "$as_me: failed program was:" >&5
707 -sed 's/^/| /' conftest.$ac_ext >&5
709 - ac_hi=`expr '(' $ac_mid ')' - 1`
710 - if test $ac_mid -le $ac_hi; then
711 - ac_lo= ac_hi=
712 - break
713 - fi
714 - ac_mid=`expr 2 '*' $ac_mid`
717 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
718 - done
719 -else
720 - echo "$as_me: failed program was:" >&5
721 -sed 's/^/| /' conftest.$ac_ext >&5
723 - ac_lo= ac_hi=
726 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
729 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
730 -# Binary search between lo and hi bounds.
731 -while test "x$ac_lo" != "x$ac_hi"; do
732 - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
733 - cat >conftest.$ac_ext <<_ACEOF
734 -/* confdefs.h. */
735 -_ACEOF
736 -cat confdefs.h >>conftest.$ac_ext
737 -cat >>conftest.$ac_ext <<_ACEOF
738 -/* end confdefs.h. */
739 -$ac_includes_default
740 - typedef long double ac__type_sizeof_;
741 -int
742 -main ()
744 -static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
745 -test_array [0] = 0
748 - return 0;
750 -_ACEOF
751 -rm -f conftest.$ac_objext
752 -if { (ac_try="$ac_compile"
753 -case "(($ac_try" in
754 - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
755 - *) ac_try_echo=$ac_try;;
756 -esac
757 -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
758 - (eval "$ac_compile") 2>conftest.er1
759 - ac_status=$?
760 - grep -v '^ *+' conftest.er1 >conftest.err
761 - rm -f conftest.er1
762 - cat conftest.err >&5
763 - echo "$as_me:$LINENO: \$? = $ac_status" >&5
764 - (exit $ac_status); } && {
765 - test -z "$ac_c_werror_flag" ||
766 - test ! -s conftest.err
767 - } && test -s conftest.$ac_objext; then
768 - ac_hi=$ac_mid
769 -else
770 - echo "$as_me: failed program was:" >&5
771 -sed 's/^/| /' conftest.$ac_ext >&5
773 - ac_lo=`expr '(' $ac_mid ')' + 1`
776 -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
777 -done
778 -case $ac_lo in
779 -?*) ac_cv_sizeof_long_double=$ac_lo;;
780 -'') if test "$ac_cv_type_long_double" = yes; then
781 - { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double)
782 -See \`config.log' for more details." >&5
783 -echo "$as_me: error: cannot compute sizeof (long double)
784 -See \`config.log' for more details." >&2;}
785 - { (exit 77); exit 77; }; }
786 - else
787 - ac_cv_sizeof_long_double=0
788 - fi ;;
789 -esac
790 -else
791 - cat >conftest.$ac_ext <<_ACEOF
792 -/* confdefs.h. */
793 -_ACEOF
794 -cat confdefs.h >>conftest.$ac_ext
795 -cat >>conftest.$ac_ext <<_ACEOF
796 -/* end confdefs.h. */
797 -$ac_includes_default
798 - typedef long double ac__type_sizeof_;
799 -static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
800 -static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
801 -#include <stdio.h>
802 -#include <stdlib.h>
803 -int
804 -main ()
807 - FILE *f = fopen ("conftest.val", "w");
808 - if (! f)
809 - return 1;
810 - if (((long int) (sizeof (ac__type_sizeof_))) < 0)
812 - long int i = longval ();
813 - if (i != ((long int) (sizeof (ac__type_sizeof_))))
814 - return 1;
815 - fprintf (f, "%ld\n", i);
817 - else
819 - unsigned long int i = ulongval ();
820 - if (i != ((long int) (sizeof (ac__type_sizeof_))))
821 - return 1;
822 - fprintf (f, "%lu\n", i);
824 - return ferror (f) || fclose (f) != 0;
827 - return 0;
829 -_ACEOF
830 -rm -f conftest$ac_exeext
831 -if { (ac_try="$ac_link"
832 -case "(($ac_try" in
833 - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
834 - *) ac_try_echo=$ac_try;;
835 -esac
836 -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
837 - (eval "$ac_link") 2>&5
838 - ac_status=$?
839 - echo "$as_me:$LINENO: \$? = $ac_status" >&5
840 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
841 - { (case "(($ac_try" in
842 - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
843 - *) ac_try_echo=$ac_try;;
844 -esac
845 -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
846 - (eval "$ac_try") 2>&5
847 - ac_status=$?
848 - echo "$as_me:$LINENO: \$? = $ac_status" >&5
849 - (exit $ac_status); }; }; then
850 - ac_cv_sizeof_long_double=`cat conftest.val`
851 -else
852 - echo "$as_me: program exited with status $ac_status" >&5
853 -echo "$as_me: failed program was:" >&5
854 -sed 's/^/| /' conftest.$ac_ext >&5
856 -( exit $ac_status )
857 -if test "$ac_cv_type_long_double" = yes; then
858 - { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double)
859 -See \`config.log' for more details." >&5
860 -echo "$as_me: error: cannot compute sizeof (long double)
861 -See \`config.log' for more details." >&2;}
862 - { (exit 77); exit 77; }; }
863 - else
864 - ac_cv_sizeof_long_double=0
865 - fi
867 -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
869 -rm -f conftest.val
871 -{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_double" >&5
872 -echo "${ECHO_T}$ac_cv_sizeof_long_double" >&6; }
876 -cat >>confdefs.h <<_ACEOF
877 -#define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double
878 -_ACEOF
881 -sizeof_long_double=$ac_cv_sizeof_long_double
882 +#AC_CHECK_SIZEOF(long double, 0)
883 +#sizeof_long_double=$ac_cv_sizeof_long_double
886 ### End of automated tests.
887 @@ -9301,8 +8453,6 @@ LIBGD!$LIBGD$ac_delim
888 have_libaudit!$have_libaudit$ac_delim
889 have_libcap!$have_libcap$ac_delim
890 have_selinux!$have_selinux$ac_delim
891 -GREP!$GREP$ac_delim
892 -EGREP!$EGREP$ac_delim
893 sizeof_long_double!$sizeof_long_double$ac_delim
894 libc_cv_gcc_unwind_find_fde!$libc_cv_gcc_unwind_find_fde$ac_delim
895 uname_sysname!$uname_sysname$ac_delim
896 @@ -9335,7 +8485,7 @@ LIBOBJS!$LIBOBJS$ac_delim
897 LTLIBOBJS!$LTLIBOBJS$ac_delim
898 _ACEOF
900 - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 54; then
901 + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 52; then
902 break
903 elif $ac_last_try; then
904 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
905 diff --git a/configure.in b/configure.in
906 index 4a2b546..a8da9ff 100644
907 --- a/configure.in
908 +++ b/configure.in
909 @@ -602,7 +602,7 @@ changequote([,])dnl
911 # Find what sysdep directories exist.
912 sysnames_add_ons=
913 -sysnames=
914 +sysnames="sysdeps/nacl "
915 for b in $base ''; do
916 for m0 in $mach ''; do
917 for v in /$vendor ''; do
918 @@ -2055,8 +2055,8 @@ fi
919 AC_SUBST(have_selinux)
921 dnl check for the size of 'long double'.
922 -AC_CHECK_SIZEOF(long double, 0)
923 -sizeof_long_double=$ac_cv_sizeof_long_double
924 +#AC_CHECK_SIZEOF(long double, 0)
925 +#sizeof_long_double=$ac_cv_sizeof_long_double
926 AC_SUBST(sizeof_long_double)
928 ### End of automated tests.
929 diff --git a/csu/libc-start.c b/csu/libc-start.c
930 index a14ed71..7c046e3 100644
931 --- a/csu/libc-start.c
932 +++ b/csu/libc-start.c
933 @@ -125,6 +125,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
934 # endif
935 _dl_aux_init (auxvec);
936 # endif
937 +#if 0
938 # ifdef DL_SYSDEP_OSCHECK
939 if (!__libc_multiple_libcs)
941 @@ -133,6 +134,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
942 DL_SYSDEP_OSCHECK (__libc_fatal);
944 # endif
945 +#endif
947 /* Initialize the thread library at least a bit since the libgcc
948 functions are using thread functions if these are available and
949 diff --git a/csu/libc-tls.c b/csu/libc-tls.c
950 index 0d240cc..8de3f8e 100644
951 --- a/csu/libc-tls.c
952 +++ b/csu/libc-tls.c
953 @@ -106,6 +106,13 @@ init_static_tls (size_t memsz, size_t align)
954 GL(dl_tls_static_nelem) = GL(dl_tls_max_dtv_idx);
957 +void *__tls_template_start;
958 +void *__tls_template_tdata_end;
959 +void *__tls_template_end;
961 +__asm__(".global __gnacl_tls_init; __gnacl_tls_init = 0x1a40 ");
962 +int __gnacl_tls_init(void const *buf, size_t size);
964 void
965 __libc_setup_tls (size_t tcbsize, size_t tcbalign)
967 @@ -118,6 +125,7 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
968 size_t tcb_offset;
969 ElfW(Phdr) *phdr;
971 +#if 0
972 /* Look through the TLS segment if there is any. */
973 if (_dl_phdr != NULL)
974 for (phdr = _dl_phdr; phdr < &_dl_phdr[_dl_phnum]; ++phdr)
975 @@ -132,6 +140,11 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
976 max_align = phdr->p_align;
977 break;
979 +#endif
980 + initimage = (void *) &__tls_template_start;
981 + memsz = (size_t) &__tls_template_end - (size_t) &__tls_template_start;
982 + filesz = (size_t) &__tls_template_tdata_end - (size_t) &__tls_template_start;
983 + align = 4;
985 /* We have to set up the TCB block which also (possibly) contains
986 'errno'. Therefore we avoid 'malloc' which might touch 'errno'.
987 @@ -185,8 +198,14 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
988 #if TLS_TCB_AT_TP
989 INSTALL_DTV ((char *) tlsblock + tcb_offset, static_dtv);
991 - const char *lossage = TLS_INIT_TP ((char *) tlsblock + tcb_offset, 0);
992 + //const char *lossage = TLS_INIT_TP ((char *) tlsblock + tcb_offset, 0);
993 + __gnacl_tls_init (tlsblock + tcb_offset, 100);
994 + tcbhead_t *head = (void *) tlsblock + tcb_offset;
995 + head->tcb = head;
996 + head->self = head;
997 + const char *lossage = NULL;
998 #elif TLS_DTV_AT_TP
999 +# error "not supported"
1000 INSTALL_DTV (tlsblock, static_dtv);
1001 const char *lossage = TLS_INIT_TP (tlsblock, 0);
1002 #else
1003 diff --git a/elf/dl-support.c b/elf/dl-support.c
1004 index 6bd573e..e278c1d 100644
1005 --- a/elf/dl-support.c
1006 +++ b/elf/dl-support.c
1007 @@ -289,6 +289,7 @@ _dl_non_dynamic_init (void)
1008 _dl_platformlen = strlen (_dl_platform);
1010 /* Scan for a program header telling us the stack is nonexecutable. */
1011 +#if 0
1012 if (_dl_phdr != NULL)
1013 for (uint_fast16_t i = 0; i < _dl_phnum; ++i)
1014 if (_dl_phdr[i].p_type == PT_GNU_STACK)
1015 @@ -296,6 +297,7 @@ _dl_non_dynamic_init (void)
1016 _dl_stack_flags = _dl_phdr[i].p_flags;
1017 break;
1019 +#endif
1023 diff --git a/elf_i386.x b/elf_i386.x
1024 new file mode 100644
1025 index 0000000..1efd8a4
1026 --- /dev/null
1027 +++ b/elf_i386.x
1028 @@ -0,0 +1,216 @@
1029 +/* Default linker script, for normal executables */
1030 +OUTPUT_FORMAT("elf32-nacl", "elf32-nacl",
1031 + "elf32-nacl")
1032 +/* OUTPUT_FORMAT("elf32-i386", "elf32-i386", */
1033 +/* "elf32-i386") */
1034 +OUTPUT_ARCH(i386)
1035 +ENTRY(_start)
1036 +/* SEARCH_DIR("/usr/i486-linux-gnu/lib32"); SEARCH_DIR("/usr/local/lib32"); SEARCH_DIR("/lib32"); SEARCH_DIR("/usr/lib32"); SEARCH_DIR("/usr/i486-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); */
1037 +PHDRS
1039 + headers PT_PHDR FILEHDR PHDRS ; /* put the headers in a non-loadable seg */
1040 + segtext PT_LOAD FLAGS(5) ; /* read + execute */
1041 + segrodata PT_LOAD FLAGS(4) ; /* read */
1042 + segdata PT_LOAD FLAGS(6) ; /* read + write */
1043 + /* TODO: do we need a stack? */
1045 +SECTIONS
1047 + /* Read-only sections, merged into text segment: */
1048 + PROVIDE (__executable_start = 0x10000); . = 0x10000;
1049 + .interp : { *(.interp) }
1050 + .note.gnu.build-id : { *(.note.gnu.build-id) }
1051 + .hash : { *(.hash) }
1052 + .gnu.hash : { *(.gnu.hash) }
1053 + .dynsym : { *(.dynsym) }
1054 + .dynstr : { *(.dynstr) }
1055 + .gnu.version : { *(.gnu.version) }
1056 + .gnu.version_d : { *(.gnu.version_d) }
1057 + .gnu.version_r : { *(.gnu.version_r) }
1058 + .rel.init : { *(.rel.init) }
1059 + .rela.init : { *(.rela.init) }
1060 + .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
1061 + .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
1062 + .rel.fini : { *(.rel.fini) }
1063 + .rela.fini : { *(.rela.fini) }
1064 + .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
1065 + .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
1066 + .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
1067 + .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
1068 + .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
1069 + .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
1070 + .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
1071 + .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
1072 + .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
1073 + .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
1074 + .rel.ctors : { *(.rel.ctors) }
1075 + .rela.ctors : { *(.rela.ctors) }
1076 + .rel.dtors : { *(.rel.dtors) }
1077 + .rela.dtors : { *(.rela.dtors) }
1078 + .rel.got : { *(.rel.got) }
1079 + .rela.got : { *(.rela.got) }
1080 + .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
1081 + .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
1082 + .rel.plt : { *(.rel.plt) }
1083 + .rela.plt : { *(.rela.plt) }
1084 + .init :
1086 + KEEP (*(.init))
1087 + } :segtext =0x90909090
1088 + .plt : { *(.plt) }
1089 + .text : SUBALIGN(32)
1091 + *(.text .stub .text.* .gnu.linkonce.t.*)
1092 + KEEP (*(.text.*personality*))
1093 + /* .gnu.warning sections are handled specially by elf32.em. */
1094 + *(.gnu.warning)
1095 + } =0x90909090
1096 + .fini : SUBALIGN(32)
1098 + KEEP (*(.fini))
1099 + KEEP (*(__libc_freeres_fn))
1100 + } =0x90909090
1101 + PROVIDE (__etext = .);
1102 + PROVIDE (_etext = .);
1103 + PROVIDE (etext = .);
1104 + . = ALIGN(CONSTANT (MAXPAGESIZE)); /* nacl wants page alignment */
1105 + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } :segrodata
1106 + .rodata1 : { *(.rodata1) }
1107 + .eh_frame_hdr : { *(.eh_frame_hdr) }
1108 + .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
1109 + .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
1110 + /* Adjust the address for the data segment. We want to adjust up to
1111 + the same address within the page on the next page up. */
1112 + . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
1113 + /* Exception handling */
1114 + .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
1115 + .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
1116 + /* Thread Local Storage sections */
1117 + .tdata : {
1118 + PROVIDE (__tls_template_start = .);
1119 + *(.tdata .tdata.* .gnu.linkonce.td.*)
1120 + PROVIDE (__tls_template_tdata_end = .);
1122 + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
1123 + PROVIDE (__tls_template_end = .);
1124 + .preinit_array :
1126 + PROVIDE_HIDDEN (__preinit_array_start = .);
1127 + KEEP (*(.preinit_array))
1128 + PROVIDE_HIDDEN (__preinit_array_end = .);
1129 + } :segdata
1130 + .init_array :
1132 + PROVIDE_HIDDEN (__init_array_start = .);
1133 + KEEP (*(SORT(.init_array.*)))
1134 + KEEP (*(.init_array))
1135 + PROVIDE_HIDDEN (__init_array_end = .);
1137 + .fini_array :
1139 + PROVIDE_HIDDEN (__fini_array_start = .);
1140 + KEEP (*(.fini_array))
1141 + KEEP (*(SORT(.fini_array.*)))
1142 + PROVIDE_HIDDEN (__fini_array_end = .);
1144 + .ctors :
1146 + /* gcc uses crtbegin.o to find the start of
1147 + the constructors, so we make sure it is
1148 + first. Because this is a wildcard, it
1149 + doesn't matter if the user does not
1150 + actually link against crtbegin.o; the
1151 + linker won't look for a file to match a
1152 + wildcard. The wildcard also means that it
1153 + doesn't matter which directory crtbegin.o
1154 + is in. */
1155 + KEEP (*crtbegin.o(.ctors))
1156 + KEEP (*crtbegin?.o(.ctors))
1157 + /* We don't want to include the .ctor section from
1158 + the crtend.o file until after the sorted ctors.
1159 + The .ctor section from the crtend file contains the
1160 + end of ctors marker and it must be last */
1161 + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
1162 + KEEP (*(SORT(.ctors.*)))
1163 + KEEP (*(.ctors))
1165 + .dtors :
1167 + KEEP (*crtbegin.o(.dtors))
1168 + KEEP (*crtbegin?.o(.dtors))
1169 + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
1170 + KEEP (*(SORT(.dtors.*)))
1171 + KEEP (*(.dtors))
1173 + .jcr : { KEEP (*(.jcr)) }
1174 + .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
1175 + .dynamic : { *(.dynamic) }
1176 + .got : { *(.got) }
1177 + . = DATA_SEGMENT_RELRO_END (12, .);
1178 + .got.plt : { *(.got.plt) }
1179 + . = ALIGN(CONSTANT (MAXPAGESIZE)); /* nacl wants page alignment */
1180 + .data :
1182 + *(.data .data.* .gnu.linkonce.d.*)
1183 + KEEP (*(.gnu.linkonce.d.*personality*))
1184 + SORT(CONSTRUCTORS)
1186 + .data1 : { *(.data1) }
1187 + _edata = .; PROVIDE (edata = .);
1188 + __bss_start = .;
1189 + .bss :
1191 + *(.dynbss)
1192 + *(.bss .bss.* .gnu.linkonce.b.*)
1193 + *(COMMON)
1194 + /* Align here to ensure that the .bss section occupies space up to
1195 + _end. Align after .bss to ensure correct alignment even if the
1196 + .bss section disappears because there are no input sections.
1197 + FIXME: Why do we need it? When there is no .bss section, we don't
1198 + pad the .data section. */
1199 + . = ALIGN(. != 0 ? 32 / 8 : 1);
1201 + . = ALIGN(32 / 8);
1202 + . = ALIGN(32 / 8);
1203 + _end = .; PROVIDE (end = .);
1204 + . = DATA_SEGMENT_END (.);
1205 + /* Stabs debugging sections. */
1206 + .stab 0 : { *(.stab) }
1207 + .stabstr 0 : { *(.stabstr) }
1208 + .stab.excl 0 : { *(.stab.excl) }
1209 + .stab.exclstr 0 : { *(.stab.exclstr) }
1210 + .stab.index 0 : { *(.stab.index) }
1211 + .stab.indexstr 0 : { *(.stab.indexstr) }
1212 + .comment 0 : { *(.comment) }
1213 + /* DWARF debug sections.
1214 + Symbols in the DWARF debugging sections are relative to the beginning
1215 + of the section so we begin them at 0. */
1216 + /* DWARF 1 */
1217 + .debug 0 : { *(.debug) }
1218 + .line 0 : { *(.line) }
1219 + /* GNU DWARF 1 extensions */
1220 + .debug_srcinfo 0 : { *(.debug_srcinfo) }
1221 + .debug_sfnames 0 : { *(.debug_sfnames) }
1222 + /* DWARF 1.1 and DWARF 2 */
1223 + .debug_aranges 0 : { *(.debug_aranges) }
1224 + .debug_pubnames 0 : { *(.debug_pubnames) }
1225 + /* DWARF 2 */
1226 + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
1227 + .debug_abbrev 0 : { *(.debug_abbrev) }
1228 + .debug_line 0 : { *(.debug_line) }
1229 + .debug_frame 0 : { *(.debug_frame) }
1230 + .debug_str 0 : { *(.debug_str) }
1231 + .debug_loc 0 : { *(.debug_loc) }
1232 + .debug_macinfo 0 : { *(.debug_macinfo) }
1233 + /* SGI/MIPS DWARF 2 extensions */
1234 + .debug_weaknames 0 : { *(.debug_weaknames) }
1235 + .debug_funcnames 0 : { *(.debug_funcnames) }
1236 + .debug_typenames 0 : { *(.debug_typenames) }
1237 + .debug_varnames 0 : { *(.debug_varnames) }
1238 + /* DWARF 3 */
1239 + .debug_pubtypes 0 : { *(.debug_pubtypes) }
1240 + .debug_ranges 0 : { *(.debug_ranges) }
1241 + .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
1242 + /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
1243 + /DISCARD/ : { *(.note.ABI-tag) }
1245 diff --git a/hellow.c b/hellow.c
1246 new file mode 100644
1247 index 0000000..cc230a4
1248 --- /dev/null
1249 +++ b/hellow.c
1250 @@ -0,0 +1,9 @@
1252 +#include <stdio.h>
1254 +int main()
1256 + write(1, "Hello (via write())\n", 20);
1257 + printf("Hello world (%s)\n", "via printf()");
1258 + return 0;
1260 diff --git a/libidn/idn-stub.c b/libidn/idn-stub.c
1261 index 3c69bbc..c2944b1 100644
1262 --- a/libidn/idn-stub.c
1263 +++ b/libidn/idn-stub.c
1264 @@ -23,7 +23,7 @@
1265 #include <stdio.h>
1266 #include <string.h>
1267 #include <dlfcn.h>
1268 -#include <gnu/lib-names.h>
1269 +//#include <gnu/lib-names.h>
1270 #include <bits/libc-lock.h>
1272 /* Get specification for idna_to_ascii_lz. */
1273 @@ -48,7 +48,7 @@ load_dso (void)
1274 /* Retest in case some other thread arrived here at the same time. */
1275 if (h == NULL)
1277 - h = __libc_dlopen (LIBCIDN_SO);
1278 + h = NULL; // __libc_dlopen (LIBCIDN_SO);
1280 if (h == NULL)
1281 h = (void *) 1l;
1282 diff --git a/make-example.sh b/make-example.sh
1283 new file mode 100755
1284 index 0000000..0bd9d06
1285 --- /dev/null
1286 +++ b/make-example.sh
1287 @@ -0,0 +1,7 @@
1288 +#!/bin/bash
1290 +BUILDDIR=build
1291 +../tools_bin/linux/sdk/nacl-sdk/bin/nacl-gcc \
1292 + -B$BUILDDIR/csu/ -L$BUILDDIR -static -Wl,-T,elf_i386.x \
1293 + -g hellow.c -o hellow \
1294 + -Wl,-print-map > hellow.map
1295 diff --git a/misc/vm86.c b/misc/vm86.c
1296 new file mode 100644
1297 index 0000000..7bee874
1298 --- /dev/null
1299 +++ b/misc/vm86.c
1300 @@ -0,0 +1,10 @@
1302 +#include <errno.h>
1303 +#include <sys/vm86.h>
1305 +int vm86 (unsigned long int __subfunction,
1306 + struct vm86plus_struct *__info)
1308 + errno = ENOSYS;
1309 + return -1;
1311 diff --git a/myconfig.sh b/myconfig.sh
1312 new file mode 100755
1313 index 0000000..a7e3b2a
1314 --- /dev/null
1315 +++ b/myconfig.sh
1316 @@ -0,0 +1,11 @@
1317 +#!/bin/bash
1319 +set -e
1321 +mkdir -p build
1322 +cd build
1323 +../configure --prefix=/usr --host=i486-linux-gnu \
1324 + CC="`pwd`/../../tools_bin/linux/sdk/nacl-sdk/bin/nacl-gcc" \
1325 + CFLAGS="-march=i486 -pipe -fstrict-aliasing -O2 -g -mno-tls-direct-seg-refs" \
1326 + --with-headers=`pwd`/../kernel-headers \
1327 + --disable-shared
1328 diff --git a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
1329 index d53559c..3792b58 100644
1330 --- a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
1331 +++ b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
1332 @@ -236,7 +236,7 @@ LLL_STUB_UNWIND_INFO_END
1333 value is zero. In case the operation failed, the cmpxchg instruction
1334 has loaded the current value of the memory work which is guaranteed
1335 to be nonzero. */
1336 -#if defined NOT_IN_libc || defined UP
1337 +#if defined NOT_IN_libc || defined UP || 1
1338 # define __lll_trylock_asm LOCK_INSTR "cmpxchgl %2, %1"
1339 #else
1340 # define __lll_trylock_asm "cmpl $0, %%gs:%P5\n\t" \
1341 @@ -274,7 +274,7 @@ LLL_STUB_UNWIND_INFO_END
1342 : "memory"); \
1343 ret; })
1345 -#if defined NOT_IN_libc || defined UP
1346 +#if defined NOT_IN_libc || defined UP || 1
1347 # define __lll_lock_asm_start LOCK_INSTR "cmpxchgl %1, %2\n\t"
1348 #else
1349 # define __lll_lock_asm_start "cmpl $0, %%gs:%P6\n\t" \
1350 @@ -443,7 +443,7 @@ LLL_STUB_UNWIND_INFO_END
1351 : "memory"); \
1352 result; })
1354 -#if defined NOT_IN_libc || defined UP
1355 +#if defined NOT_IN_libc || defined UP || 1
1356 # define __lll_unlock_asm LOCK_INSTR "subl $1, %0\n\t"
1357 #else
1358 # define __lll_unlock_asm "cmpl $0, %%gs:%P3\n\t" \
1359 diff --git a/sysdeps/i386/elf/start.S b/sysdeps/i386/elf/start.S
1360 index d2275a3..930a86f 100644
1361 --- a/sysdeps/i386/elf/start.S
1362 +++ b/sysdeps/i386/elf/start.S
1363 @@ -82,6 +82,7 @@ _start:
1364 which grow downwards). */
1365 pushl %esp
1367 + movl $0, %edx
1368 pushl %edx /* Push address of the shared library
1369 termination function. */
1371 diff --git a/sysdeps/i386/i486/bits/atomic.h b/sysdeps/i386/i486/bits/atomic.h
1372 index 21eea71..e6c4696 100644
1373 --- a/sysdeps/i386/i486/bits/atomic.h
1374 +++ b/sysdeps/i386/i486/bits/atomic.h
1375 @@ -107,6 +107,14 @@ typedef uintmax_t uatomic_max_t;
1376 "i" (offsetof (tcbhead_t, multiple_threads))); \
1377 ret; })
1379 +#if 1
1380 +#define __arch_c_compare_and_exchange_val_32_acq(mem, newval, oldval) \
1381 + ({ __typeof (*mem) ret; \
1382 + __asm __volatile (LOCK_PREFIX "cmpxchgl %2, %1" \
1383 + : "=a" (ret), "=m" (*mem) \
1384 + : "r" (newval), "m" (*mem), "0" (oldval)); \
1385 + ret; })
1386 +#else
1387 #define __arch_c_compare_and_exchange_val_32_acq(mem, newval, oldval) \
1388 ({ __typeof (*mem) ret; \
1389 __asm __volatile ("cmpl $0, %%gs:%P5\n\t" \
1390 @@ -117,6 +125,7 @@ typedef uintmax_t uatomic_max_t;
1391 : "r" (newval), "m" (*mem), "0" (oldval), \
1392 "i" (offsetof (tcbhead_t, multiple_threads))); \
1393 ret; })
1394 +#endif
1396 /* XXX We do not really need 64-bit compare-and-exchange. At least
1397 not in the moment. Using it would mean causing portability
1398 @@ -255,8 +264,13 @@ typedef uintmax_t uatomic_max_t;
1399 __arch_exchange_and_add_body (LOCK_PREFIX, __arch, mem, value)
1400 #endif
1402 +#if 1
1403 +#define __arch_exchange_and_add_cprefix \
1404 + "lock\n"
1405 +#else
1406 #define __arch_exchange_and_add_cprefix \
1407 "cmpl $0, %%gs:%P4\n\tje 0f\n\tlock\n0:\t"
1408 +#endif
1410 #define catomic_exchange_and_add(mem, value) \
1411 __arch_exchange_and_add_body (__arch_exchange_and_add_cprefix, __arch_c, \
1412 @@ -300,8 +314,9 @@ typedef uintmax_t uatomic_max_t;
1413 #define atomic_add(mem, value) \
1414 __arch_add_body (LOCK_PREFIX, __arch, mem, value)
1416 -#define __arch_add_cprefix \
1417 - "cmpl $0, %%gs:%P3\n\tje 0f\n\tlock\n0:\t"
1418 +/* #define __arch_add_cprefix \ */
1419 +/* "cmpl $0, %%gs:%P3\n\tje 0f\n\tlock\n0:\t" */
1420 +#define __arch_add_cprefix LOCK_PREFIX
1422 #define catomic_add(mem, value) \
1423 __arch_add_body (__arch_add_cprefix, __arch_c, mem, value)
1424 @@ -376,8 +391,9 @@ typedef uintmax_t uatomic_max_t;
1426 #define atomic_increment(mem) __arch_increment_body (LOCK_PREFIX, __arch, mem)
1428 -#define __arch_increment_cprefix \
1429 - "cmpl $0, %%gs:%P2\n\tje 0f\n\tlock\n0:\t"
1430 +/* #define __arch_increment_cprefix \ */
1431 +/* "cmpl $0, %%gs:%P2\n\tje 0f\n\tlock\n0:\t" */
1432 +#define __arch_increment_cprefix LOCK_PREFIX
1434 #define catomic_increment(mem) \
1435 __arch_increment_body (__arch_increment_cprefix, __arch_c, mem)
1436 @@ -433,8 +449,9 @@ typedef uintmax_t uatomic_max_t;
1438 #define atomic_decrement(mem) __arch_decrement_body (LOCK_PREFIX, __arch, mem)
1440 -#define __arch_decrement_cprefix \
1441 - "cmpl $0, %%gs:%P2\n\tje 0f\n\tlock\n0:\t"
1442 +/* #define __arch_decrement_cprefix \ */
1443 +/* "cmpl $0, %%gs:%P2\n\tje 0f\n\tlock\n0:\t" */
1444 +#define __arch_decrement_cprefix LOCK_PREFIX
1446 #define catomic_decrement(mem) \
1447 __arch_decrement_body (__arch_decrement_cprefix, __arch_c, mem)
1448 @@ -542,7 +559,8 @@ typedef uintmax_t uatomic_max_t;
1450 #define atomic_or(mem, mask) __arch_or_body (LOCK_PREFIX, mem, mask)
1452 -#define __arch_or_cprefix \
1453 - "cmpl $0, %%gs:%P3\n\tje 0f\n\tlock\n0:\t"
1454 +/* #define __arch_or_cprefix \ */
1455 +/* "cmpl $0, %%gs:%P3\n\tje 0f\n\tlock\n0:\t" */
1456 +#define __arch_or_cprefix LOCK_PREFIX
1458 #define catomic_or(mem, mask) __arch_or_body (__arch_or_cprefix, mem, mask)
1459 diff --git a/sysdeps/nacl/brk.c b/sysdeps/nacl/brk.c
1460 new file mode 100644
1461 index 0000000..96437ee
1462 --- /dev/null
1463 +++ b/sysdeps/nacl/brk.c
1464 @@ -0,0 +1,18 @@
1466 +#include <errno.h>
1467 +#include <unistd.h>
1468 +#include <sysdep.h>
1470 +void *__curbrk = 0;
1471 +weak_alias (__curbrk, ___brk_addr)
1473 +__asm__(".global __NaClSysBrk; __NaClSysBrk = 0x1280");
1475 +void *__NaClSysBrk(void *addr);
1477 +int __brk (void *addr)
1479 + __curbrk = __NaClSysBrk(addr);
1480 + return 0;
1482 +weak_alias (__brk, brk)
1483 diff --git a/sysdeps/nacl/write.c b/sysdeps/nacl/write.c
1484 new file mode 100644
1485 index 0000000..3e7c894
1486 --- /dev/null
1487 +++ b/sysdeps/nacl/write.c
1488 @@ -0,0 +1,19 @@
1490 +#include <errno.h>
1491 +#include <unistd.h>
1492 +#include <sysdep.h>
1494 +__asm__(".global __gnacl_write; __gnacl_write = 0x11a0 ");
1496 +int __gnacl_write(int desc, void const *buf, size_t count);
1498 +int __write(int desc, void const *buf, size_t count)
1500 + int result = __gnacl_write(desc, buf, count);
1501 + if (result < 0)
1502 + errno = -result;
1503 + return result;
1505 +weak_alias (__write, write)
1506 +strong_alias (__write, __libc_write)
1507 +strong_alias (__write, __write_nocancel)
1508 diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
1509 index 04ed63c..48ef960 100644
1510 --- a/sysdeps/unix/syscalls.list
1511 +++ b/sysdeps/unix/syscalls.list
1512 @@ -62,5 +62,4 @@ umask - umask Ei:i __umask umask
1513 uname - uname i:p __uname uname
1514 unlink - unlink i:s __unlink unlink
1515 utimes - utimes i:sp __utimes utimes
1516 -write - write Ci:ibn __libc_write __write write
1517 writev - writev Ci:ipi __writev writev
1518 diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c
1519 index 08ae9aa..346d90c 100644
1520 --- a/sysdeps/unix/sysv/linux/dl-sysdep.c
1521 +++ b/sysdeps/unix/sysv/linux/dl-sysdep.c
1522 @@ -65,6 +65,7 @@ int
1523 attribute_hidden
1524 _dl_discover_osversion (void)
1526 +#if 0
1527 #if (defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO) && defined SHARED
1528 if (GLRO(dl_sysinfo_map) != NULL)
1530 @@ -151,4 +152,6 @@ _dl_discover_osversion (void)
1531 version <<= 8 * (3 - parts);
1533 return version;
1534 +#endif
1535 + return 0;
1537 diff --git a/sysdeps/unix/sysv/linux/i386/clone.S b/sysdeps/unix/sysv/linux/i386/clone.S
1538 index f73a4b5..812e85e 100644
1539 --- a/sysdeps/unix/sysv/linux/i386/clone.S
1540 +++ b/sysdeps/unix/sysv/linux/i386/clone.S
1541 @@ -50,19 +50,19 @@ ENTRY (BP_SYM (__clone))
1542 /* Sanity check arguments. */
1543 movl $-EINVAL,%eax
1544 movl FUNC(%esp),%ecx /* no NULL function pointers */
1545 -#ifdef PIC
1546 +/*#ifdef PIC
1547 jecxz SYSCALL_ERROR_LABEL
1548 -#else
1549 +#else*/
1550 testl %ecx,%ecx
1551 jz SYSCALL_ERROR_LABEL
1552 -#endif
1553 +/*#endif*/
1554 movl STACK(%esp),%ecx /* no NULL stack pointers */
1555 -#ifdef PIC
1556 +/*#ifdef PIC
1557 jecxz SYSCALL_ERROR_LABEL
1558 -#else
1559 +#else*/
1560 testl %ecx,%ecx
1561 jz SYSCALL_ERROR_LABEL
1562 -#endif
1563 +/*#endif*/
1565 /* Insert the argument onto the new stack. Make sure the new
1566 thread is started with an alignment of (mod 16). */