-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
newlib-3.1.0.patch
10588 lines (10502 loc) · 294 KB
/
newlib-3.1.0.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/libgloss/configure b/libgloss/configure
index 1a4033dce..ba7aea7b0 100755
--- a/libgloss/configure
+++ b/libgloss/configure
@@ -2599,6 +2599,8 @@ if test "${config_libnosys}" = "true"; then
fi
+subdirs="$subdirs libsysbase"
+
DEPDIR="${am__leading_dot}deps"
ac_config_commands="$ac_config_commands depfiles"
diff --git a/libgloss/configure.in b/libgloss/configure.in
index 41843eed1..dc0e2a5fd 100644
--- a/libgloss/configure.in
+++ b/libgloss/configure.in
@@ -2,6 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([libgloss],[LIBGLOSS_VERSION])
AC_CONFIG_SRCDIR([libnosys])
+AC_CONFIG_SRCDIR([libsysbase])
if test "${enable_shared}" = "yes" ; then
echo "Shared libraries not supported for cross compiling, ignored"
@@ -190,6 +191,7 @@ dnl fi
if test "${config_libnosys}" = "true"; then
AC_CONFIG_SUBDIRS([libnosys])
fi
+AC_CONFIG_SUBDIRS(libsysbase)
LIB_AC_PROG_CC
AS=${AS-as}
diff --git a/libgloss/libsysbase/Makefile.in b/libgloss/libsysbase/Makefile.in
new file mode 100644
index 000000000..3db0c08bc
--- /dev/null
+++ b/libgloss/libsysbase/Makefile.in
@@ -0,0 +1,151 @@
+# Copyright (c) 1998 Cygnus Support
+#
+# The authors hereby grant permission to use, copy, modify, distribute,
+# and license this software and its documentation for any purpose, provided
+# that existing copyright notices are retained in all copies and that this
+# notice is included verbatim in any distributions. No written agreement,
+# license, or royalty fee is required for any of the authorized uses.
+# Modifications to this software may be copyrighted by their authors
+# and need not follow the licensing terms described here, provided that
+# the new terms are clearly indicated on the first page of each file where
+# they apply.
+
+DESTDIR =
+VPATH = @srcdir@
+srcdir = @srcdir@
+objdir = .
+srcroot = $(srcdir)/../..
+objroot = $(objdir)/../..
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+host_alias = @host_alias@
+target_alias = @target_alias@
+program_transform_name = @program_transform_name@
+
+bindir = @bindir@
+libdir = @libdir@
+tooldir = $(exec_prefix)/$(target_alias)
+
+# Multilib support variables.
+# TOP is used instead of MULTI{BUILD,SRC}TOP.
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+SHELL = /bin/sh
+
+CC = @CC@
+
+#AS = @AS@
+AS = `if [ -f ${objroot}/../gas/as.new ] ; \
+ then echo ${objroot}/../gas/as.new ; \
+ else echo as ; fi`
+
+AR = @AR@
+
+#LD = @LD@
+LD = `if [ -f ${objroot}/../ld/ld.new ] ; \
+ then echo ${objroot}/../ld/ld.new ; \
+ else echo ld ; fi`
+
+RANLIB = @RANLIB@
+
+OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
+ then echo ${objroot}/../binutils/objdump ; \
+ else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
+OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
+ then echo ${objroot}/../binutils/objcopy ; \
+ else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
+
+# object files needed
+OBJS = abort.o iosupport.o clocks.o close.o environ.o execve.o fork.o fstat.o getpid.o gettod.o \
+ isatty.o kill.o link.o lseek.o lstat.o nanosleep.o open.o read.o sbrk.o sleep.o stat.o usleep.o times.o \
+ unlink.o wait.o write.o _exit.o malloc_vars.o \
+ chdir.o mkdir.o rename.o statvfs.o \
+ flock.o locks.o handle_manager.o truncate.o ftruncate.o dirent.o fsync.o \
+ fchmod.o chmod.o getreent.o rmdir.o utime.o scandir.o fnmatch.o pthread.o
+
+# Object files specific to particular targets.
+EVALOBJS = ${OBJS}
+
+GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \
+ then echo -L${objroot}/../gcc ; fi`
+
+OUTPUTS = libsysbase.a libpthread.a
+
+NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi`
+NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi`
+
+INCLUDES = -I. -I$(srcdir)/..
+# Note that when building the library, ${MULTILIB} is not the way multilib
+# options are passed; they're passed in $(CFLAGS).
+CFLAGS_FOR_TARGET = ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS}
+LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS}
+AR_FLAGS = qc
+
+.c.o:
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 -D_BUILDING_LIBSYSBASE $(INCLUDES) -c $(CFLAGS) $<
+
+.C.o:
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 -D_BUILDING_LIBSYSBASE $(INCLUDES) -c $(CFLAGS) $<
+.s.o:
+ $(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
+
+#
+# GCC knows to run the preprocessor on .S files before it assembles them.
+#
+.S.o:
+ $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
+
+#
+# this is a bogus target that'll produce an assembler from the
+# C source with the right compiler options. this is so we can
+# track down code generation or debug symbol bugs.
+#
+.c.s:
+ $(CC) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $(CFLAGS) $<
+
+all: ${OUTPUTS}
+
+#
+# here's where we build the library for each target
+#
+
+libsysbase.a: $(EVALOBJS)
+ ${AR} ${ARFLAGS} $@ $(EVALOBJS)
+ ${RANLIB} $@
+
+libpthread.a:
+ ${AR} rc $@
+
+doc:
+
+clean mostlyclean:
+ rm -f $(OUTPUTS) *.i *~ *.o *-test *.srec *.dis *.map *.x
+
+distclean maintainer-clean realclean: clean
+ rm -f Makefile config.status $(OUTPUTS)
+
+.PHONY: install info install-info clean-info
+install:
+ @for outputs in ${OUTPUTS}; do\
+ mkdir -p $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}; \
+ $(INSTALL_PROGRAM) $${outputs} $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}; \
+ done
+
+info:
+install-info:
+clean-info:
+
+Makefile: Makefile.in config.status @host_makefile_frag_path@
+ $(SHELL) config.status
+
+config.status: configure
+ $(SHELL) config.status --recheck
diff --git a/libgloss/libsysbase/_exit.c b/libgloss/libsysbase/_exit.c
new file mode 100644
index 000000000..6effb1105
--- /dev/null
+++ b/libgloss/libsysbase/_exit.c
@@ -0,0 +1,17 @@
+/* Stub version of _exit. */
+
+#include <limits.h>
+#include "config.h"
+#include <_ansi.h>
+#include <_syslist.h>
+#include <sys/iosupport.h>
+
+void _exit(int rc)
+{
+
+ if ( __has_syscall(exit) ) {
+ __syscall_exit(rc);
+ }
+
+ while(1);
+}
diff --git a/libgloss/libsysbase/abort.c b/libgloss/libsysbase/abort.c
new file mode 100644
index 000000000..9272e22c9
--- /dev/null
+++ b/libgloss/libsysbase/abort.c
@@ -0,0 +1,8 @@
+#include <stdlib.h>
+#include <unistd.h>
+
+void abort(void) {
+ write (2, "Abort called.\n", sizeof("Abort called.\n")-1);
+ _exit (1);
+}
+
diff --git a/libgloss/libsysbase/acconfig.h b/libgloss/libsysbase/acconfig.h
new file mode 100644
index 000000000..200ea7873
--- /dev/null
+++ b/libgloss/libsysbase/acconfig.h
@@ -0,0 +1,29 @@
+/* Name of package. */
+#undef PACKAGE
+
+/* Version of package. */
+#undef VERSION
+
+/* Missing syscall names */
+#undef MISSING_SYSCALL_NAMES
+
+/* Reentrant syscalls */
+#undef REENTRANT_SYSCALLS_PROVIDED
+
+/* Using ELF format */
+#undef HAVE_ELF
+
+/* Using GNU LD */
+#undef HAVE_GNU_LD
+
+/* .previous directive allowed */
+#undef HAVE_ASM_PREVIOUS_DIRECTIVE
+
+/* .pushsection/.popsection directives allowed */
+#undef HAVE_ASM_POPSECTION_DIRECTIVE
+
+/* support for section attributes */
+#undef HAVE_SECTION_ATTRIBUTES
+
+/* symbol prefix */
+#undef __SYMBOL_PREFIX
diff --git a/libgloss/libsysbase/aclocal.m4 b/libgloss/libsysbase/aclocal.m4
new file mode 100644
index 000000000..b6cdfaeb8
--- /dev/null
+++ b/libgloss/libsysbase/aclocal.m4
@@ -0,0 +1,344 @@
+# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+m4_include([../acinclude.m4])
diff --git a/libgloss/libsysbase/chdir.c b/libgloss/libsysbase/chdir.c
new file mode 100644
index 000000000..b94f6a8b4
--- /dev/null
+++ b/libgloss/libsysbase/chdir.c
@@ -0,0 +1,200 @@
+#include <unistd.h>
+#include <limits.h>
+#include <reent.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/iosupport.h>
+#include <sys/param.h>
+
+/* CWD always start with "/" */
+static char _current_working_directory [PATH_MAX] = "/";
+static char temp_cwd [PATH_MAX];
+
+#define DIRECTORY_SEPARATOR_CHAR '/'
+const char DIRECTORY_SEPARATOR[] = "/";
+const char DIRECTORY_THIS[] = ".";
+const char DIRECTORY_PARENT[] = "..";
+
+int _concatenate_path (struct _reent *r, char *path, const char *extra, int maxLength) {
+ char *pathEnd;
+ int pathLength;
+ const char *extraEnd;
+ int extraSize;
+
+ pathLength = strnlen (path, maxLength);
+
+ /* assumes path ends in a directory separator */
+ if (pathLength >= maxLength) {
+ r->_errno = ENAMETOOLONG;
+ return -1;
+ }
+ pathEnd = path + pathLength;
+ if (pathEnd[-1] != DIRECTORY_SEPARATOR_CHAR) {
+ pathEnd[0] = DIRECTORY_SEPARATOR_CHAR;
+ pathEnd += 1;
+ }
+
+ extraEnd = extra;
+
+ /* If the extra bit starts with a slash, start at root */
+ if (extra[0] == DIRECTORY_SEPARATOR_CHAR) {
+ pathEnd = strchr (path, DIRECTORY_SEPARATOR_CHAR) + 1;
+ pathEnd[0] = '\0';
+ }
+ do {
+ /* Advance past any separators in extra */
+ while (extra[0] == DIRECTORY_SEPARATOR_CHAR) {
+ extra += 1;
+ }
+
+ /* Grab the next directory name from extra */
+ extraEnd = strchr (extra, DIRECTORY_SEPARATOR_CHAR);
+ if (extraEnd == NULL) {
+ extraEnd = strrchr (extra, '\0');
+ } else {
+ extraEnd += 1;
+ }
+
+ extraSize = (extraEnd - extra);
+ if (extraSize == 0) {
+ break;
+ }
+
+ if ((strncmp (extra, DIRECTORY_THIS, sizeof(DIRECTORY_THIS) - 1) == 0)
+ && ((extra[sizeof(DIRECTORY_THIS)-1] == DIRECTORY_SEPARATOR_CHAR)
+ ||(extra[sizeof(DIRECTORY_THIS)-1] == '\0')))
+ {
+ /* Don't copy anything */
+ } else if ((strncmp (extra, DIRECTORY_PARENT, sizeof(DIRECTORY_PARENT) - 1) == 0)
+ && ((extra[sizeof(DIRECTORY_PARENT)-1] == DIRECTORY_SEPARATOR_CHAR)
+ ||(extra[sizeof(DIRECTORY_PARENT)-1] == '\0')))
+ {
+ /* Go up one level of in the path */
+ if (pathEnd[-1] == DIRECTORY_SEPARATOR_CHAR) {
+ // Remove trailing separator
+ pathEnd[-1] = '\0';
+ }
+ pathEnd = strrchr (path, DIRECTORY_SEPARATOR_CHAR);
+ if (pathEnd == NULL) {
+ /* Can't go up any higher, return false */
+ r->_errno = ENOENT;
+ return -1;
+ }
+ pathLength = pathEnd - path;
+ pathEnd += 1;
+ } else {
+ pathLength += extraSize;
+ if (pathLength >= maxLength) {
+ r->_errno = ENAMETOOLONG;
+ return -1;
+ }
+ /* Copy the next part over */
+ strncpy (pathEnd, extra, extraSize);
+ pathEnd += extraSize;
+ }
+ pathEnd[0] = '\0';
+ extra += extraSize;
+ } while (extraSize != 0);
+
+ if (strlen(path) > 2 ) {
+ if (pathEnd[-1] == DIRECTORY_SEPARATOR_CHAR && pathEnd[-2] != ':')
+ pathEnd[-1] = '\0';
+ }
+
+ return 0;
+}
+
+int chdir (const char *path) {
+ struct _reent *r = _REENT;
+
+ int dev;
+ const char *pathPosition;
+
+ /* Make sure the path is short enough */
+ if (strnlen (path, PATH_MAX) >= PATH_MAX) {
+ r->_errno = ENAMETOOLONG;
+ return -1;
+ }
+
+ if (strchr (path, ':') != NULL) {
+ strncpy (temp_cwd, path, PATH_MAX);
+ /* Move path past device name */
+ path = strchr (path, ':') + 1;
+ } else {
+ strncpy (temp_cwd, _current_working_directory, PATH_MAX);
+ }
+
+ pathPosition = strchr (temp_cwd , ':');
+
+ if (pathPosition == NULL) {
+ pathPosition = temp_cwd;
+ } else {
+ pathPosition++;
+ }
+
+ /* Make sure the path starts in the root directory */
+ if (pathPosition[0] != DIRECTORY_SEPARATOR_CHAR) {
+ r->_errno = ENOENT;
+ return -1;
+ }
+
+ /* Concatenate the path to the CWD */
+ if (_concatenate_path (r, temp_cwd, path, PATH_MAX) == -1) {
+ return -1;
+ }
+
+ /* Get device from path name */
+ dev = FindDevice(temp_cwd);
+
+ if (dev < 0) {
+ r->_errno = ENODEV;
+ return -1;
+ }
+
+ r->deviceData = devoptab_list[dev]->deviceData;
+
+ if ( devoptab_list[dev]->chdir_r == NULL) {
+ r->_errno = ENOSYS;
+ return -1;
+ }
+
+ /* Try changing directories on the device */
+ if (devoptab_list[dev]->chdir_r (r, temp_cwd) == -1) {
+ return -1;
+ }
+
+ /* Since it worked, set the new CWD and default device */
+ setDefaultDevice(dev);
+ strncpy (_current_working_directory, temp_cwd, PATH_MAX);
+
+ return 0;
+}
+
+char *getcwd(char *buf, size_t size) {
+
+ struct _reent *r = _REENT;
+
+ if (size == 0) {
+ if (buf != NULL) {
+ r->_errno = EINVAL;
+ return NULL;
+ }
+ buf = malloc(PATH_MAX);
+ size = PATH_MAX;
+ }
+
+ if (buf == NULL) {
+ r->_errno = EINVAL;
+ return NULL;
+ }
+
+ if ( size < (strnlen (_current_working_directory, PATH_MAX) + 1)) {
+ r->_errno = ERANGE;
+ return NULL;
+ }
+
+ strncpy (buf, _current_working_directory, size);
+
+ return buf;
+}
diff --git a/libgloss/libsysbase/chmod.c b/libgloss/libsysbase/chmod.c
new file mode 100644
index 000000000..3668b5801
--- /dev/null
+++ b/libgloss/libsysbase/chmod.c
@@ -0,0 +1,30 @@
+#include "config.h"
+#include <_ansi.h>
+#include <_syslist.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/iosupport.h>
+#include <errno.h>
+
+int chmod(const char *path, mode_t mode) {
+ int ret,dev;
+ struct _reent *r = _REENT;
+
+ /* Get device from path name */
+ dev = FindDevice(path);
+
+ if (dev < 0) {
+ r->_errno = ENODEV;
+ ret = -1;
+ } else {
+ if (devoptab_list[dev]->chmod_r == NULL) {
+ r->_errno=ENOSYS;
+ } else {
+ r->deviceData = devoptab_list[dev]->deviceData;
+ ret = devoptab_list[dev]->chmod_r(r,path,mode);
+ }
+ }
+
+ return ret;
+}
+
diff --git a/libgloss/libsysbase/clocks.c b/libgloss/libsysbase/clocks.c
new file mode 100644
index 000000000..b36b5c079
--- /dev/null
+++ b/libgloss/libsysbase/clocks.c
@@ -0,0 +1,34 @@
+#include <errno.h>
+#include <time.h>
+#include <sys/iosupport.h>
+
+int clock_gettime(clockid_t clock_id, struct timespec *tp)
+{
+ if ( __has_syscall(clock_gettime) ) {
+ return __syscall_clock_gettime(clock_id, tp);
+ } else {
+ errno = ENOSYS;
+ return -1;
+ }
+}
+
+int clock_settime(clockid_t clock_id, const struct timespec *tp)
+{
+ if ( __has_syscall(clock_settime) ) {
+ return __syscall_clock_settime(clock_id, tp);
+ } else {
+ errno = ENOSYS;
+ return -1;
+ }
+}
+
+int clock_getres (clockid_t clock_id, struct timespec *res)
+{
+ if ( __has_syscall(clock_getres) ) {
+ return __syscall_clock_getres(clock_id, res);
+ } else {
+ errno = ENOSYS;
+ return -1;
+ }
+}
+
diff --git a/libgloss/libsysbase/close.c b/libgloss/libsysbase/close.c
new file mode 100644
index 000000000..931ad07b1
--- /dev/null
+++ b/libgloss/libsysbase/close.c
@@ -0,0 +1,46 @@
+#include "config.h"
+#include <_ansi.h>
+#include <_syslist.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <sys/iosupport.h>
+
+#ifdef REENTRANT_SYSCALLS_PROVIDED
+//---------------------------------------------------------------------------------
+int _close_r(struct _reent *ptr, int fileDesc) {
+//---------------------------------------------------------------------------------
+#else
+//---------------------------------------------------------------------------------
+int _close(int fileDesc) {
+//---------------------------------------------------------------------------------
+ struct _reent *ptr = _REENT;
+#endif
+ int ret = -1;
+ unsigned int dev = 0;
+
+ if(fileDesc!=-1) {
+
+ __handle *handle = __get_handle(fileDesc);
+
+ if ( handle != NULL) {
+ dev = handle->device;
+ handle->refcount--;
+ if (handle->refcount == 0 ) {
+
+ if(devoptab_list[dev]->close_r) {
+ ptr->deviceData = devoptab_list[dev]->deviceData;
+ ret = devoptab_list[dev]->close_r(ptr,handle->fileStruct);
+ }
+ else
+ ret = 0;
+
+ __release_handle(fileDesc);
+ } else {
+ ret = 0;
+ }
+
+ }
+ }
+ return ret;
+}
diff --git a/libgloss/libsysbase/config.h.in b/libgloss/libsysbase/config.h.in
new file mode 100644
index 000000000..48ce950b4
--- /dev/null
+++ b/libgloss/libsysbase/config.h.in
@@ -0,0 +1,25 @@
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Missing syscall names */
+#undef MISSING_SYSCALL_NAMES
+
+/* Reentrant syscalls */
+#undef REENTRANT_SYSCALLS_PROVIDED
+
+/* Using ELF format */
+#undef HAVE_ELF
+
+/* Using GNU LD */
+#undef HAVE_GNU_LD
+
+/* .previous directive allowed */
+#undef HAVE_ASM_PREVIOUS_DIRECTIVE
+
+/* .pushsection/.popsection directives allowed */
+#undef HAVE_ASM_POPSECTION_DIRECTIVE
+
+/* support for section attributes */
+#undef HAVE_SECTION_ATTRIBUTES
+
+/* symbol prefix */
+#undef __SYMBOL_PREFIX
diff --git a/libgloss/libsysbase/configure b/libgloss/libsysbase/configure
new file mode 100644
index 000000000..aa653c235
--- /dev/null
+++ b/libgloss/libsysbase/configure
@@ -0,0 +1,4160 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :