cleanup newlib a little

This commit is contained in:
2024-03-29 20:42:51 +01:00
parent 1e18b5f245
commit 1556f5f2cb
13 changed files with 379 additions and 267 deletions

View File

@@ -35,9 +35,10 @@ make install-target-libgcc
cd ../../
cd newlib
rm -rf build
mkdir build
cd build
../newlib-4.4.0.20231231/configure --prefix=/usr --target=$TARGET
../newlib-4.4.0.20231231/configure --enable-newlib-supplied-syscalls --prefix=/usr --target=$TARGET
make -j$(nproc) all
make DESTDIR="$OS2_ROOT/sysroot" install
cp -r "$OS2_ROOT/sysroot/usr"/x86_64-os3/* "$OS2_ROOT/sysroot/usr"

View File

@@ -5,7 +5,7 @@
/* Default arguments you want when running your
i686-os3-gcc/x86_64-os3-gcc toolchain */
#undef LIB_SPEC
#define LIB_SPEC "-lc -lg -lm -lnosys" /* link against C standard library */
#define LIB_SPEC "-lc -lg -lm" /* link against C standard library */
/* Files that are linked before user code.
The %s tells GCC to look for these files in the library directory. */
@@ -25,4 +25,4 @@
builtin_assert ("system=myos"); \
builtin_assert ("system=unix"); \
builtin_assert ("system=posix"); \
} while(0);
} while(0);

View File

@@ -1725,7 +1725,7 @@ case $os in
| skyos* | haiku* | rdos* | toppers* | drops* | es* \
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*)
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | os3*)
;;
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)

View File

@@ -2972,6 +2972,9 @@ case "${target}" in
config_testsuite=false
config_libnosys=false
;;
*-*-os3*)
config_libnosys=false
;;
tic6x-*-*)
ac_config_files="$ac_config_files tic6x/Makefile"

View File

@@ -225,6 +225,9 @@ case "${target}" in
config_testsuite=false
config_libnosys=false
;;
*-*-os3*)
config_libnosys=false
;;
tic6x-*-*)
AC_CONFIG_FILES([tic6x/Makefile])
subdirs="$subdirs tic6x"

File diff suppressed because one or more lines are too long

View File

@@ -779,6 +779,8 @@ HAVE_LIBC_SYS_XTENSA_DIR_FALSE
HAVE_LIBC_SYS_XTENSA_DIR_TRUE
HAVE_LIBC_SYS_W65_DIR_FALSE
HAVE_LIBC_SYS_W65_DIR_TRUE
HAVE_LIBC_SYS_OS3_DIR_FALSE
HAVE_LIBC_SYS_OS3_DIR_TRUE
HAVE_LIBC_SYS_TIRTOS_DIR_FALSE
HAVE_LIBC_SYS_TIRTOS_DIR_TRUE
HAVE_LIBC_SYS_TIC80_DIR_FALSE
@@ -5511,6 +5513,13 @@ fi
else
HAVE_LIBC_SYS_W65_DIR_TRUE='#'
HAVE_LIBC_SYS_W65_DIR_FALSE=
fi
if test "${sys_dir}" = os3; then
HAVE_LIBC_SYS_OS3_DIR_TRUE=
HAVE_LIBC_SYS_OS3_DIR_FALSE='#'
else
HAVE_LIBC_SYS_OS3_DIR_TRUE='#'
HAVE_LIBC_SYS_OS3_DIR_FALSE=
fi
if test "${sys_dir}" = xtensa; then
HAVE_LIBC_SYS_XTENSA_DIR_TRUE=
@@ -7699,6 +7708,10 @@ if test -z "${HAVE_LIBC_SYS_W65_DIR_TRUE}" && test -z "${HAVE_LIBC_SYS_W65_DIR_F
as_fn_error $? "conditional \"HAVE_LIBC_SYS_W65_DIR\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${HAVE_LIBC_SYS_OS3_DIR_TRUE}" && test -z "${HAVE_LIBC_SYS_OS3_DIR_FALSE}"; then
as_fn_error $? "conditional \"HAVE_LIBC_SYS_OS#_DIR\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${HAVE_LIBC_SYS_XTENSA_DIR_TRUE}" && test -z "${HAVE_LIBC_SYS_XTENSA_DIR_FALSE}"; then
as_fn_error $? "conditional \"HAVE_LIBC_SYS_XTENSA_DIR\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5

View File

@@ -426,6 +426,9 @@ fi
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
case "${host}" in
*-*-os3*)
sys_dir=os3
;;
*-*-cygwin*)
posix_dir=posix
xdr_dir=xdr

View File

@@ -25,6 +25,7 @@ m4_foreach_w([SYS_DIR], [
w65
xtensa
z8ksim
os3
], [AM_CONDITIONAL([HAVE_LIBC_SYS_]m4_toupper(SYS_DIR)[_DIR], test "${sys_dir}" = SYS_DIR)])
AC_TYPE_LONG_DOUBLE

View File

@@ -70,3 +70,6 @@ endif
if HAVE_LIBC_SYS_Z8KSIM_DIR
include %D%/z8ksim/Makefile.inc
endif
if HAVE_LIBC_SYS_OS3_DIR
include %D%/os3/Makefile.inc
endif

View File

@@ -0,0 +1 @@
libc_a_SOURCES += %D%/crt0.c %D%/syscalls.c

View File

@@ -0,0 +1,9 @@
#include <fcntl.h>
extern void exit(int code);
extern int main ();
void _start() {
int ex = main();
exit(ex);
}

View File

@@ -0,0 +1,29 @@
/* note these headers are all provided by newlib - you don't need to provide them */
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/fcntl.h>
#include <sys/times.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <stdio.h>
void _exit(){}
int close(int file){}
char **environ; /* pointer to array of char * strings that define the current environment variables */
int execve(char *name, char **argv, char **env){}
int fork(){}
int fstat(int file, struct stat *st){}
int getpid(){}
int isatty(int file){}
int kill(int pid, int sig){}
int link(char *old, char *new){}
int lseek(int file, int ptr, int dir){}
int open(const char *name, int flags, ...){}
int read(int file, char *ptr, int len){}
caddr_t sbrk(int incr){}
int stat(const char *file, struct stat *st){}
clock_t times(struct tms *buf){}
int unlink(char *name){}
int wait(int *status){}
int write(int file, char *ptr, int len){}
int gettimeofday(struct timeval * restrict p, void * restrict z){}