diff --git a/dkppc/patches/newlib-3.0.0.patch b/dkppc/patches/newlib-3.0.0.patch index 5372299..0e11ad0 100644 --- a/dkppc/patches/newlib-3.0.0.patch +++ b/dkppc/patches/newlib-3.0.0.patch @@ -1,5 +1,5 @@ diff --git a/libgloss/configure b/libgloss/configure -index aa6f8f8..0e85798 100755 +index aa6f8f834..0e8579890 100755 --- a/libgloss/configure +++ b/libgloss/configure @@ -2594,6 +2594,8 @@ if test "${config_libnosys}" = "true"; then @@ -12,7 +12,7 @@ index aa6f8f8..0e85798 100755 ac_config_commands="$ac_config_commands depfiles" diff --git a/libgloss/configure.in b/libgloss/configure.in -index 6da1643..0375cab 100644 +index 6da164352..0375cabbc 100644 --- a/libgloss/configure.in +++ b/libgloss/configure.in @@ -2,6 +2,7 @@ dnl Process this file with autoconf to produce a configure script. @@ -46,7 +46,7 @@ index 6da1643..0375cab 100644 AC_SUBST(AS) diff --git a/libgloss/libsysbase/Makefile.in b/libgloss/libsysbase/Makefile.in new file mode 100644 -index 0000000..0d17fa9 +index 000000000..183f9acc7 --- /dev/null +++ b/libgloss/libsysbase/Makefile.in @@ -0,0 +1,148 @@ @@ -122,7 +122,7 @@ index 0000000..0d17fa9 + unlink.o wait.o write.o _exit.o malloc_vars.o \ + chdir.o mkdir.o rename.o build_argv.o statvfs.o \ + flock.o syscall_support.o handle_manager.o truncate.o ftruncate.o dirent.o fsync.o \ -+ fchmod.o chmod.o rmdir.o utime.o ++ fchmod.o chmod.o rmdir.o utime.o scandir.o + +# Object files specific to particular targets. +EVALOBJS = ${OBJS} @@ -200,7 +200,7 @@ index 0000000..0d17fa9 + $(SHELL) config.status --recheck diff --git a/libgloss/libsysbase/_exit.c b/libgloss/libsysbase/_exit.c new file mode 100644 -index 0000000..e5cb5a9 +index 000000000..e5cb5a9ed --- /dev/null +++ b/libgloss/libsysbase/_exit.c @@ -0,0 +1,17 @@ @@ -223,7 +223,7 @@ index 0000000..e5cb5a9 +} diff --git a/libgloss/libsysbase/abort.c b/libgloss/libsysbase/abort.c new file mode 100644 -index 0000000..9272e22 +index 000000000..9272e22c9 --- /dev/null +++ b/libgloss/libsysbase/abort.c @@ -0,0 +1,8 @@ @@ -237,7 +237,7 @@ index 0000000..9272e22 + diff --git a/libgloss/libsysbase/acconfig.h b/libgloss/libsysbase/acconfig.h new file mode 100644 -index 0000000..200ea78 +index 000000000..200ea7873 --- /dev/null +++ b/libgloss/libsysbase/acconfig.h @@ -0,0 +1,29 @@ @@ -272,7 +272,7 @@ index 0000000..200ea78 +#undef __SYMBOL_PREFIX diff --git a/libgloss/libsysbase/aclocal.m4 b/libgloss/libsysbase/aclocal.m4 new file mode 100644 -index 0000000..b6cdfae +index 000000000..b6cdfaeb8 --- /dev/null +++ b/libgloss/libsysbase/aclocal.m4 @@ -0,0 +1,344 @@ @@ -622,7 +622,7 @@ index 0000000..b6cdfae +m4_include([../acinclude.m4]) diff --git a/libgloss/libsysbase/build_argv.c b/libgloss/libsysbase/build_argv.c new file mode 100644 -index 0000000..3ca95d5 +index 000000000..3ca95d5b6 --- /dev/null +++ b/libgloss/libsysbase/build_argv.c @@ -0,0 +1,31 @@ @@ -659,7 +659,7 @@ index 0000000..3ca95d5 +} diff --git a/libgloss/libsysbase/chdir.c b/libgloss/libsysbase/chdir.c new file mode 100644 -index 0000000..90d2dc5 +index 000000000..90d2dc5b7 --- /dev/null +++ b/libgloss/libsysbase/chdir.c @@ -0,0 +1,201 @@ @@ -866,7 +866,7 @@ index 0000000..90d2dc5 +} diff --git a/libgloss/libsysbase/chmod.c b/libgloss/libsysbase/chmod.c new file mode 100644 -index 0000000..3668b58 +index 000000000..3668b5801 --- /dev/null +++ b/libgloss/libsysbase/chmod.c @@ -0,0 +1,30 @@ @@ -902,7 +902,7 @@ index 0000000..3668b58 + diff --git a/libgloss/libsysbase/clocks.c b/libgloss/libsysbase/clocks.c new file mode 100644 -index 0000000..01cfee4 +index 000000000..01cfee469 --- /dev/null +++ b/libgloss/libsysbase/clocks.c @@ -0,0 +1,34 @@ @@ -942,7 +942,7 @@ index 0000000..01cfee4 + diff --git a/libgloss/libsysbase/close.c b/libgloss/libsysbase/close.c new file mode 100644 -index 0000000..88dc919 +index 000000000..88dc9195c --- /dev/null +++ b/libgloss/libsysbase/close.c @@ -0,0 +1,46 @@ @@ -994,7 +994,7 @@ index 0000000..88dc919 +} diff --git a/libgloss/libsysbase/config.h.in b/libgloss/libsysbase/config.h.in new file mode 100644 -index 0000000..48ce950 +index 000000000..48ce950b4 --- /dev/null +++ b/libgloss/libsysbase/config.h.in @@ -0,0 +1,25 @@ @@ -1025,7 +1025,7 @@ index 0000000..48ce950 +#undef __SYMBOL_PREFIX diff --git a/libgloss/libsysbase/configure b/libgloss/libsysbase/configure new file mode 100644 -index 0000000..874eec1 +index 000000000..874eec1e2 --- /dev/null +++ b/libgloss/libsysbase/configure @@ -0,0 +1,4158 @@ @@ -5189,7 +5189,7 @@ index 0000000..874eec1 + diff --git a/libgloss/libsysbase/configure.in b/libgloss/libsysbase/configure.in new file mode 100644 -index 0000000..f3b8380 +index 000000000..f3b838072 --- /dev/null +++ b/libgloss/libsysbase/configure.in @@ -0,0 +1,199 @@ @@ -5394,7 +5394,7 @@ index 0000000..f3b8380 + diff --git a/libgloss/libsysbase/dirent.c b/libgloss/libsysbase/dirent.c new file mode 100644 -index 0000000..0ad2902 +index 000000000..0ad29029c --- /dev/null +++ b/libgloss/libsysbase/dirent.c @@ -0,0 +1,255 @@ @@ -5655,7 +5655,7 @@ index 0000000..0ad2902 +} diff --git a/libgloss/libsysbase/environ.c b/libgloss/libsysbase/environ.c new file mode 100644 -index 0000000..1c485b2 +index 000000000..1c485b26f --- /dev/null +++ b/libgloss/libsysbase/environ.c @@ -0,0 +1,6 @@ @@ -5667,7 +5667,7 @@ index 0000000..1c485b2 +char **environ = __env; diff --git a/libgloss/libsysbase/execve.c b/libgloss/libsysbase/execve.c new file mode 100644 -index 0000000..59fecdd +index 000000000..59fecdd44 --- /dev/null +++ b/libgloss/libsysbase/execve.c @@ -0,0 +1,23 @@ @@ -5696,7 +5696,7 @@ index 0000000..59fecdd + diff --git a/libgloss/libsysbase/fchmod.c b/libgloss/libsysbase/fchmod.c new file mode 100644 -index 0000000..5c5831c +index 000000000..5c5831cdf --- /dev/null +++ b/libgloss/libsysbase/fchmod.c @@ -0,0 +1,31 @@ @@ -5733,7 +5733,7 @@ index 0000000..5c5831c +} diff --git a/libgloss/libsysbase/flock.c b/libgloss/libsysbase/flock.c new file mode 100644 -index 0000000..c6b8c92 +index 000000000..c6b8c92ad --- /dev/null +++ b/libgloss/libsysbase/flock.c @@ -0,0 +1,21 @@ @@ -5760,7 +5760,7 @@ index 0000000..c6b8c92 +} diff --git a/libgloss/libsysbase/fork.c b/libgloss/libsysbase/fork.c new file mode 100644 -index 0000000..a0ce1ab +index 000000000..a0ce1abf4 --- /dev/null +++ b/libgloss/libsysbase/fork.c @@ -0,0 +1,21 @@ @@ -5787,7 +5787,7 @@ index 0000000..a0ce1ab +} diff --git a/libgloss/libsysbase/fstat.c b/libgloss/libsysbase/fstat.c new file mode 100644 -index 0000000..788a303 +index 000000000..788a303dc --- /dev/null +++ b/libgloss/libsysbase/fstat.c @@ -0,0 +1,39 @@ @@ -5832,7 +5832,7 @@ index 0000000..788a303 +} diff --git a/libgloss/libsysbase/fsync.c b/libgloss/libsysbase/fsync.c new file mode 100644 -index 0000000..eaabef9 +index 000000000..eaabef98e --- /dev/null +++ b/libgloss/libsysbase/fsync.c @@ -0,0 +1,34 @@ @@ -5872,7 +5872,7 @@ index 0000000..eaabef9 +} diff --git a/libgloss/libsysbase/ftruncate.c b/libgloss/libsysbase/ftruncate.c new file mode 100644 -index 0000000..3f1d920 +index 000000000..3f1d92044 --- /dev/null +++ b/libgloss/libsysbase/ftruncate.c @@ -0,0 +1,34 @@ @@ -5912,7 +5912,7 @@ index 0000000..3f1d920 +} diff --git a/libgloss/libsysbase/getpid.c b/libgloss/libsysbase/getpid.c new file mode 100644 -index 0000000..ec3b840 +index 000000000..ec3b84037 --- /dev/null +++ b/libgloss/libsysbase/getpid.c @@ -0,0 +1,19 @@ @@ -5937,7 +5937,7 @@ index 0000000..ec3b840 + diff --git a/libgloss/libsysbase/gettod.c b/libgloss/libsysbase/gettod.c new file mode 100644 -index 0000000..11dc528 +index 000000000..11dc528fa --- /dev/null +++ b/libgloss/libsysbase/gettod.c @@ -0,0 +1,26 @@ @@ -5969,7 +5969,7 @@ index 0000000..11dc528 + diff --git a/libgloss/libsysbase/handle_manager.c b/libgloss/libsysbase/handle_manager.c new file mode 100644 -index 0000000..f3fcc88 +index 000000000..f3fcc88f7 --- /dev/null +++ b/libgloss/libsysbase/handle_manager.c @@ -0,0 +1,173 @@ @@ -6148,7 +6148,7 @@ index 0000000..f3fcc88 +} diff --git a/libgloss/libsysbase/handle_manager.h b/libgloss/libsysbase/handle_manager.h new file mode 100644 -index 0000000..625cb22 +index 000000000..625cb22d9 --- /dev/null +++ b/libgloss/libsysbase/handle_manager.h @@ -0,0 +1,10 @@ @@ -6164,7 +6164,7 @@ index 0000000..625cb22 +#endif diff --git a/libgloss/libsysbase/iosupport.c b/libgloss/libsysbase/iosupport.c new file mode 100644 -index 0000000..948c6ef +index 000000000..948c6ef93 --- /dev/null +++ b/libgloss/libsysbase/iosupport.c @@ -0,0 +1,140 @@ @@ -6310,7 +6310,7 @@ index 0000000..948c6ef + diff --git a/libgloss/libsysbase/isatty.c b/libgloss/libsysbase/isatty.c new file mode 100644 -index 0000000..280a457 +index 000000000..280a4579a --- /dev/null +++ b/libgloss/libsysbase/isatty.c @@ -0,0 +1,17 @@ @@ -6333,7 +6333,7 @@ index 0000000..280a457 +} diff --git a/libgloss/libsysbase/kill.c b/libgloss/libsysbase/kill.c new file mode 100644 -index 0000000..d13a321 +index 000000000..d13a32155 --- /dev/null +++ b/libgloss/libsysbase/kill.c @@ -0,0 +1,18 @@ @@ -6357,7 +6357,7 @@ index 0000000..d13a321 +} diff --git a/libgloss/libsysbase/link.c b/libgloss/libsysbase/link.c new file mode 100644 -index 0000000..eeeab1a +index 000000000..eeeab1a7b --- /dev/null +++ b/libgloss/libsysbase/link.c @@ -0,0 +1,33 @@ @@ -6396,7 +6396,7 @@ index 0000000..eeeab1a + diff --git a/libgloss/libsysbase/lseek.c b/libgloss/libsysbase/lseek.c new file mode 100644 -index 0000000..eb232c8 +index 000000000..eb232c86b --- /dev/null +++ b/libgloss/libsysbase/lseek.c @@ -0,0 +1,45 @@ @@ -6447,7 +6447,7 @@ index 0000000..eb232c8 +} diff --git a/libgloss/libsysbase/lstat.c b/libgloss/libsysbase/lstat.c new file mode 100644 -index 0000000..fc39343 +index 000000000..fc393430b --- /dev/null +++ b/libgloss/libsysbase/lstat.c @@ -0,0 +1,31 @@ @@ -6484,7 +6484,7 @@ index 0000000..fc39343 + diff --git a/libgloss/libsysbase/malloc_vars.c b/libgloss/libsysbase/malloc_vars.c new file mode 100644 -index 0000000..4565909 +index 000000000..456590956 --- /dev/null +++ b/libgloss/libsysbase/malloc_vars.c @@ -0,0 +1,2 @@ @@ -6492,7 +6492,7 @@ index 0000000..4565909 +char *fake_heap_start = (char*)0; diff --git a/libgloss/libsysbase/mkdir.c b/libgloss/libsysbase/mkdir.c new file mode 100644 -index 0000000..b4fcbd3 +index 000000000..b4fcbd3d7 --- /dev/null +++ b/libgloss/libsysbase/mkdir.c @@ -0,0 +1,19 @@ @@ -6517,7 +6517,7 @@ index 0000000..b4fcbd3 +} diff --git a/libgloss/libsysbase/nanosleep.c b/libgloss/libsysbase/nanosleep.c new file mode 100644 -index 0000000..3c96fc6 +index 000000000..3c96fc61b --- /dev/null +++ b/libgloss/libsysbase/nanosleep.c @@ -0,0 +1,14 @@ @@ -6537,7 +6537,7 @@ index 0000000..3c96fc6 +} diff --git a/libgloss/libsysbase/open.c b/libgloss/libsysbase/open.c new file mode 100644 -index 0000000..877f907 +index 000000000..877f907e1 --- /dev/null +++ b/libgloss/libsysbase/open.c @@ -0,0 +1,53 @@ @@ -6596,7 +6596,7 @@ index 0000000..877f907 +} diff --git a/libgloss/libsysbase/read.c b/libgloss/libsysbase/read.c new file mode 100644 -index 0000000..ac80d56 +index 000000000..ac80d5698 --- /dev/null +++ b/libgloss/libsysbase/read.c @@ -0,0 +1,39 @@ @@ -6641,7 +6641,7 @@ index 0000000..ac80d56 + diff --git a/libgloss/libsysbase/rename.c b/libgloss/libsysbase/rename.c new file mode 100644 -index 0000000..1d7b7e8 +index 000000000..1d7b7e8e7 --- /dev/null +++ b/libgloss/libsysbase/rename.c @@ -0,0 +1,32 @@ @@ -6679,7 +6679,7 @@ index 0000000..1d7b7e8 +} diff --git a/libgloss/libsysbase/rmdir.c b/libgloss/libsysbase/rmdir.c new file mode 100644 -index 0000000..2692a29 +index 000000000..2692a2997 --- /dev/null +++ b/libgloss/libsysbase/rmdir.c @@ -0,0 +1,25 @@ @@ -6710,7 +6710,7 @@ index 0000000..2692a29 +} diff --git a/libgloss/libsysbase/sbrk.c b/libgloss/libsysbase/sbrk.c new file mode 100644 -index 0000000..e2bdb9e +index 000000000..e2bdb9edc --- /dev/null +++ b/libgloss/libsysbase/sbrk.c @@ -0,0 +1,26 @@ @@ -6741,9 +6741,90 @@ index 0000000..e2bdb9e + +} \ No newline at end of file +diff --git a/libgloss/libsysbase/scandir.c b/libgloss/libsysbase/scandir.c +new file mode 100644 +index 000000000..bc18c1781 +--- /dev/null ++++ b/libgloss/libsysbase/scandir.c +@@ -0,0 +1,75 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* ++ * The DIRSIZ macro gives the minimum record length which will hold ++ * the directory entry. This requires the amount of space in struct dirent ++ * without the d_name field, plus enough space for the name with a terminating ++ * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary. ++ */ ++#undef DIRSIZ ++#ifdef _DIRENT_HAVE_D_NAMLEN ++#define DIRSIZ(dp) \ ++ (offsetof (struct dirent, d_name) + (((dp)->d_namlen+1 + 3) &~ 3)) ++#else ++#define DIRSIZ(dp) \ ++ (offsetof (struct dirent, d_name) + ((strlen((dp)->d_name)+1 + 3) &~ 3)) ++#endif ++ ++int ++scandir (const char *dirname, ++ struct dirent ***namelist, ++ int (*filter) __P((const struct dirent *)), ++ int (*compar) __P((const struct dirent **, const struct dirent **))) ++{ ++ DIR *d = opendir(dirname); ++ ++ if (!d) return -1; ++ ++ struct dirent *de, **names = NULL, **tmp; ++ size_t cnt = 0, len = 0; ++ ++ while (de = readdir(d)) { ++ if (filter && ! filter(de)) continue; ++ if (cnt >= len) { ++ len = 2*len+1; ++ if (len > SIZE_MAX/sizeof(*names)) break; ++ tmp = realloc(names, len * sizeof(*names)); ++ if (!tmp) break; ++ names = tmp; ++ } ++ names[cnt] = malloc(DIRSIZ(de)); ++ if (!names[cnt]) break; ++ memcpy(names[cnt++], de, DIRSIZ(de)); ++ } ++ ++ closedir(d); ++ ++ if(errno) { ++ if (names) while(cnt-- > 0) free(names[cnt]); ++ free(names); ++ return -1; ++ } ++ ++ if (compar) qsort(names, cnt, sizeof(*names), (int (*)(const void *, const void *))compar); ++ ++ *namelist = names; ++ return cnt; ++} ++ ++/* ++ * Alphabetic order comparison routine for those who want it. ++ */ ++int ++alphasort (const struct dirent **d1, ++ const struct dirent **d2) ++{ ++ return(strcmp((*d1)->d_name, (*d2)->d_name)); ++} ++ diff --git a/libgloss/libsysbase/sleep.c b/libgloss/libsysbase/sleep.c new file mode 100644 -index 0000000..f3aa979 +index 000000000..f3aa97954 --- /dev/null +++ b/libgloss/libsysbase/sleep.c @@ -0,0 +1,18 @@ @@ -6767,7 +6848,7 @@ index 0000000..f3aa979 +} diff --git a/libgloss/libsysbase/stat.c b/libgloss/libsysbase/stat.c new file mode 100644 -index 0000000..4c2e541 +index 000000000..4c2e5414e --- /dev/null +++ b/libgloss/libsysbase/stat.c @@ -0,0 +1,37 @@ @@ -6810,7 +6891,7 @@ index 0000000..4c2e541 + diff --git a/libgloss/libsysbase/statvfs.c b/libgloss/libsysbase/statvfs.c new file mode 100644 -index 0000000..84e2213 +index 000000000..84e221340 --- /dev/null +++ b/libgloss/libsysbase/statvfs.c @@ -0,0 +1,24 @@ @@ -6840,7 +6921,7 @@ index 0000000..84e2213 +} diff --git a/libgloss/libsysbase/syscall_support.c b/libgloss/libsysbase/syscall_support.c new file mode 100644 -index 0000000..f027147 +index 000000000..f02714764 --- /dev/null +++ b/libgloss/libsysbase/syscall_support.c @@ -0,0 +1,67 @@ @@ -6913,7 +6994,7 @@ index 0000000..f027147 +} diff --git a/libgloss/libsysbase/times.c b/libgloss/libsysbase/times.c new file mode 100644 -index 0000000..79484e7 +index 000000000..79484e7f4 --- /dev/null +++ b/libgloss/libsysbase/times.c @@ -0,0 +1,17 @@ @@ -6936,7 +7017,7 @@ index 0000000..79484e7 + diff --git a/libgloss/libsysbase/truncate.c b/libgloss/libsysbase/truncate.c new file mode 100644 -index 0000000..7935c82 +index 000000000..7935c8200 --- /dev/null +++ b/libgloss/libsysbase/truncate.c @@ -0,0 +1,55 @@ @@ -6997,7 +7078,7 @@ index 0000000..7935c82 +} diff --git a/libgloss/libsysbase/unlink.c b/libgloss/libsysbase/unlink.c new file mode 100644 -index 0000000..55932bc +index 000000000..55932bc25 --- /dev/null +++ b/libgloss/libsysbase/unlink.c @@ -0,0 +1,34 @@ @@ -7037,7 +7118,7 @@ index 0000000..55932bc + diff --git a/libgloss/libsysbase/usleep.c b/libgloss/libsysbase/usleep.c new file mode 100644 -index 0000000..b547147 +index 000000000..b54714775 --- /dev/null +++ b/libgloss/libsysbase/usleep.c @@ -0,0 +1,18 @@ @@ -7061,7 +7142,7 @@ index 0000000..b547147 +} diff --git a/libgloss/libsysbase/utime.c b/libgloss/libsysbase/utime.c new file mode 100644 -index 0000000..f72bf9f +index 000000000..f72bf9fc6 --- /dev/null +++ b/libgloss/libsysbase/utime.c @@ -0,0 +1,45 @@ @@ -7112,7 +7193,7 @@ index 0000000..f72bf9f +} diff --git a/libgloss/libsysbase/wait.c b/libgloss/libsysbase/wait.c new file mode 100644 -index 0000000..b65f903 +index 000000000..b65f9039c --- /dev/null +++ b/libgloss/libsysbase/wait.c @@ -0,0 +1,23 @@ @@ -7141,7 +7222,7 @@ index 0000000..b65f903 + diff --git a/libgloss/libsysbase/warning.h b/libgloss/libsysbase/warning.h new file mode 100644 -index 0000000..2c29982 +index 000000000..2c2998250 --- /dev/null +++ b/libgloss/libsysbase/warning.h @@ -0,0 +1,43 @@ @@ -7190,7 +7271,7 @@ index 0000000..2c29982 +#endif /* __WARNING_H__ */ diff --git a/libgloss/libsysbase/write.c b/libgloss/libsysbase/write.c new file mode 100644 -index 0000000..0e6aa41 +index 000000000..0e6aa41ab --- /dev/null +++ b/libgloss/libsysbase/write.c @@ -0,0 +1,38 @@ @@ -7233,7 +7314,7 @@ index 0000000..0e6aa41 + return ret; +} diff --git a/libgloss/rs6000/Makefile.in b/libgloss/rs6000/Makefile.in -index 51714e5..db82941 100644 +index 51714e59b..db8294105 100644 --- a/libgloss/rs6000/Makefile.in +++ b/libgloss/rs6000/Makefile.in @@ -129,6 +129,9 @@ XIL_OBJS = open.o close.o lseek.o sbrk.o read.o write.o print.o @@ -7285,7 +7366,7 @@ index 51714e5..db82941 100644 install-info: diff --git a/libgloss/rs6000/crtmain.c b/libgloss/rs6000/crtmain.c new file mode 100644 -index 0000000..bd25d77 +index 000000000..bd25d775d --- /dev/null +++ b/libgloss/rs6000/crtmain.c @@ -0,0 +1,18 @@ @@ -7308,7 +7389,7 @@ index 0000000..bd25d77 + exit ( main(__system_argv->argc,__system_argv->argv) ); +} diff --git a/newlib/configure.host b/newlib/configure.host -index eb64586..b9a0064 100644 +index eb645868b..b9a006453 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -797,7 +797,12 @@ newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVID @@ -7326,10 +7407,10 @@ index eb64586..b9a0064 100644 powerpc*-*-linux* | \ powerpc*-*-rtem* | \ diff --git a/newlib/libc/include/sys/dirent.h b/newlib/libc/include/sys/dirent.h -index a3fb5c0..478d1b4 100644 +index a3fb5c02c..8ddd10867 100644 --- a/newlib/libc/include/sys/dirent.h +++ b/newlib/libc/include/sys/dirent.h -@@ -4,10 +4,51 @@ +@@ -4,10 +4,57 @@ not support , we will get this file which uses #error to force an error. */ @@ -7356,19 +7437,19 @@ index a3fb5c0..478d1b4 100644 extern "C" { #endif -#error " not supported" -+ ++ + struct dirent { + ino_t d_ino; + unsigned char d_type; + char d_name[NAME_MAX+1]; + }; -+ ++ + typedef struct { + long int position; + DIR_ITER* dirData; + struct dirent fileData; + } DIR; -+ ++ + int closedir(DIR *dirp); + DIR *opendir(const char *dirname); + struct dirent *readdir(DIR *dirp); @@ -7376,15 +7457,20 @@ index a3fb5c0..478d1b4 100644 + void rewinddir(DIR *dirp); + void seekdir(DIR *dirp, long int loc); + long int telldir(DIR *dirp); -+ ++ ++ int scandir(const char *dirp, struct dirent ***namelist, ++ int (*filter)(const struct dirent *), ++ int (*compar)(const struct dirent **, const struct dirent **)); ++ ++ int alphasort(const struct dirent **a, const struct dirent **b); ++ #ifdef __cplusplus } #endif + +#endif // _dirent_h_ -\ No newline at end of file diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h -index 2900b33..6efb54e 100644 +index 2900b332f..6efb54eb3 100644 --- a/newlib/libc/include/sys/features.h +++ b/newlib/libc/include/sys/features.h @@ -330,6 +330,9 @@ extern "C" { @@ -7399,7 +7485,7 @@ index 2900b33..6efb54e 100644 #ifdef __rtems__ diff --git a/newlib/libc/include/sys/iosupport.h b/newlib/libc/include/sys/iosupport.h new file mode 100644 -index 0000000..649fc26 +index 000000000..649fc2630 --- /dev/null +++ b/newlib/libc/include/sys/iosupport.h @@ -0,0 +1,108 @@ @@ -7512,7 +7598,7 @@ index 0000000..649fc26 +#endif // __iosupp_h__ +//--------------------------------------------------------------------------------- diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h -index 1ef2261..ce3721a 100644 +index 1ef226194..ce3721a14 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -416,6 +416,8 @@ struct _reent @@ -7533,7 +7619,7 @@ index 1ef2261..ce3721a 100644 #ifdef _REENT_GLOBAL_STDIO_STREAMS diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h -index eee98db..aed9c17 100644 +index eee98db64..aed9c1746 100644 --- a/newlib/libc/include/sys/stat.h +++ b/newlib/libc/include/sys/stat.h @@ -152,8 +152,9 @@ int mkfifo (const char *__path, mode_t __mode ); @@ -7549,7 +7635,7 @@ index eee98db..aed9c17 100644 diff --git a/newlib/libc/include/sys/statvfs.h b/newlib/libc/include/sys/statvfs.h new file mode 100644 -index 0000000..380329d +index 000000000..380329d34 --- /dev/null +++ b/newlib/libc/include/sys/statvfs.h @@ -0,0 +1,35 @@ @@ -7590,7 +7676,7 @@ index 0000000..380329d +#endif // _SYS_STATVFS_H \ No newline at end of file diff --git a/newlib/libc/include/sys/syslimits.h b/newlib/libc/include/sys/syslimits.h -index ba9dbd6..93ed11a 100644 +index ba9dbd667..93ed11a42 100644 --- a/newlib/libc/include/sys/syslimits.h +++ b/newlib/libc/include/sys/syslimits.h @@ -44,12 +44,12 @@ @@ -7609,7 +7695,7 @@ index ba9dbd6..93ed11a 100644 #define IOV_MAX 1024 /* max elements in i/o vector */ diff --git a/newlib/libc/include/sys/utime.h b/newlib/libc/include/sys/utime.h -index 5e937f1..635a7a6 100644 +index 5e937f103..635a7a6b8 100644 --- a/newlib/libc/include/sys/utime.h +++ b/newlib/libc/include/sys/utime.h @@ -9,12 +9,19 @@ @@ -7635,7 +7721,7 @@ index 5e937f1..635a7a6 100644 }; #endif diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c -index baa5451..236746f 100644 +index baa5451a6..236746f54 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -165,15 +165,18 @@ No supporting OS subroutines are required. @@ -7738,7 +7824,7 @@ index baa5451..236746f 100644 return __get_current_locale ()->ctype_ptr; } diff --git a/newlib/libc/machine/powerpc/Makefile.am b/newlib/libc/machine/powerpc/Makefile.am -index e86afdf..007bd15 100644 +index e86afdf1c..007bd1567 100644 --- a/newlib/libc/machine/powerpc/Makefile.am +++ b/newlib/libc/machine/powerpc/Makefile.am @@ -10,7 +10,7 @@ noinst_LIBRARIES = lib.a @@ -7751,7 +7837,7 @@ index e86afdf..007bd15 100644 lib_a_CFLAGS=$(AM_CFLAGS) lib_a_LIBADD = @extra_objs@ diff --git a/newlib/libc/machine/powerpc/Makefile.in b/newlib/libc/machine/powerpc/Makefile.in -index 73b0cc4..12044cb 100644 +index 73b0cc471..12044cb8a 100644 --- a/newlib/libc/machine/powerpc/Makefile.in +++ b/newlib/libc/machine/powerpc/Makefile.in @@ -68,7 +68,7 @@ CONFIG_CLEAN_VPATH_FILES = @@ -7787,7 +7873,7 @@ index 73b0cc4..12044cb 100644 diff --git a/newlib/libc/machine/powerpc/access.c b/newlib/libc/machine/powerpc/access.c new file mode 100644 -index 0000000..980682e +index 000000000..980682ef3 --- /dev/null +++ b/newlib/libc/machine/powerpc/access.c @@ -0,0 +1,33 @@ @@ -7826,7 +7912,7 @@ index 0000000..980682e + diff --git a/newlib/libc/machine/powerpc/machine/_types.h b/newlib/libc/machine/powerpc/machine/_types.h new file mode 100644 -index 0000000..a7d63da +index 000000000..a7d63da51 --- /dev/null +++ b/newlib/libc/machine/powerpc/machine/_types.h @@ -0,0 +1,19 @@ @@ -7851,7 +7937,7 @@ index 0000000..a7d63da +#endif // _MACHINE__TYPES_H diff --git a/newlib/libc/machine/powerpc/sys/lock.h b/newlib/libc/machine/powerpc/sys/lock.h new file mode 100644 -index 0000000..d83fda5 +index 000000000..d83fda504 --- /dev/null +++ b/newlib/libc/machine/powerpc/sys/lock.h @@ -0,0 +1,51 @@ @@ -7908,7 +7994,7 @@ index 0000000..d83fda5 +#endif /* __SYS_LOCK_H__ */ diff --git a/newlib/libc/machine/powerpc/sys/stdio.h b/newlib/libc/machine/powerpc/sys/stdio.h new file mode 100644 -index 0000000..04ebd1e +index 000000000..04ebd1ee0 --- /dev/null +++ b/newlib/libc/machine/powerpc/sys/stdio.h @@ -0,0 +1,25 @@ @@ -7938,7 +8024,7 @@ index 0000000..04ebd1e +#endif /* _NEWLIB_STDIO_H */ + diff --git a/newlib/libc/misc/init.c b/newlib/libc/misc/init.c -index c85d602..1beb783 100644 +index c85d6020f..1beb783b8 100644 --- a/newlib/libc/misc/init.c +++ b/newlib/libc/misc/init.c @@ -40,4 +40,8 @@ __libc_init_array (void) @@ -7951,7 +8037,7 @@ index c85d602..1beb783 100644 + #endif diff --git a/newlib/libc/stdio/Makefile.in b/newlib/libc/stdio/Makefile.in -index aa22a0e..93e672b 100644 +index aa22a0e3a..93e672b6a 100644 --- a/newlib/libc/stdio/Makefile.in +++ b/newlib/libc/stdio/Makefile.in @@ -507,6 +507,7 @@ GENERAL_SOURCES = \ @@ -7976,7 +8062,7 @@ index aa22a0e..93e672b 100644 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-scanf.o `test -f 'scanf.c' || echo '$(srcdir)/'`scanf.c diff --git a/newlib/libc/stdio/fopen.c b/newlib/libc/stdio/fopen.c -index 022992b..bdf4c7b 100644 +index 022992b8d..bdf4c7bb0 100644 --- a/newlib/libc/stdio/fopen.c +++ b/newlib/libc/stdio/fopen.c @@ -139,6 +139,9 @@ _fopen_r (struct _reent *ptr, @@ -7990,7 +8076,7 @@ index 022992b..bdf4c7b 100644 fp->_flags = flags; fp->_cookie = (void *) fp; diff --git a/newlib/libc/stdio/fread.c b/newlib/libc/stdio/fread.c -index b358d2b..9cab218 100644 +index b358d2b4a..9cab2180e 100644 --- a/newlib/libc/stdio/fread.c +++ b/newlib/libc/stdio/fread.c @@ -225,7 +225,31 @@ _fread_r (struct _reent * ptr, @@ -8026,8 +8112,40 @@ index b358d2b..9cab218 100644 { /* no more input: return partial result */ #ifdef __SCLE +diff --git a/newlib/libc/stdlib/aligned_alloc.c b/newlib/libc/stdlib/aligned_alloc.c +index 88413ce86..24029a6f7 100644 +--- a/newlib/libc/stdlib/aligned_alloc.c ++++ b/newlib/libc/stdlib/aligned_alloc.c +@@ -1,5 +1,5 @@ + /*- +- * Copyright (c) 2015 embedded brains GmbH ++ * Copyright (c) 2018 Dave Murphy + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without +@@ -25,14 +25,15 @@ + */ + + #include ++#include ++#include + + void * + aligned_alloc(size_t alignment, size_t size) + { +- void *p; +- int error; ++ if ((alignment !=0) && !(alignment & (alignment - 1 )) && !(size & (alignment - 1))) ++ return memalign(alignment,size); + +- error = posix_memalign(&p, alignment, size); +- +- return (error == 0 ? p : NULL); ++ errno = EINVAL; ++ return (void*)NULL; + } diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c -index 920a7ea..ba5ee76 100644 +index 920a7ea3c..ba5ee7652 100644 --- a/newlib/libc/stdlib/mbtowc_r.c +++ b/newlib/libc/stdlib/mbtowc_r.c @@ -7,6 +7,7 @@ @@ -8039,7 +8157,7 @@ index 920a7ea..ba5ee76 100644 _mbtowc_r (struct _reent *r, wchar_t *__restrict pwc, diff --git a/newlib/libc/stdlib/mlock.c b/newlib/libc/stdlib/mlock.c -index 23aa101..6016aa3 100644 +index 23aa10173..6016aa3ee 100644 --- a/newlib/libc/stdlib/mlock.c +++ b/newlib/libc/stdlib/mlock.c @@ -28,7 +28,7 @@ the sequence of calls may go <<__malloc_lock>>, <<__malloc_lock>>,