diff options
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 15 | ||||
-rw-r--r-- | newlib/Makefile.am | 10 | ||||
-rw-r--r-- | newlib/Makefile.in | 11 | ||||
-rwxr-xr-x | newlib/configure | 7 | ||||
-rw-r--r-- | newlib/configure.host | 6 | ||||
-rw-r--r-- | newlib/configure.in | 5 | ||||
-rw-r--r-- | newlib/libc/include/sys/unistd.h | 5 | ||||
-rw-r--r-- | newlib/libc/sys/linux/Makefile.am | 6 | ||||
-rw-r--r-- | newlib/libc/sys/linux/Makefile.in | 13 | ||||
-rw-r--r-- | newlib/libc/sys/linux/crt1.c | 3 | ||||
-rw-r--r-- | newlib/libc/sys/linux/sysconf.c | 383 |
11 files changed, 453 insertions, 11 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index ec810725e..2ad6147f3 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,18 @@ +2002-04-04 Jeff Johnston <jjohnstn@redhat.com> + + * Makefile.am: Add support for installing crt1.o if one exists. + * configure.host: Specify crt1.o for linux. + * configure.in: Expose CRT1 and CRT1_DIR for Makefile.am to use. + * Makefile.in: Regenerated. + * configure: Ditto. + * libc/include/sys/unistd.h (_SC_STREAM_MAX, _SC_PRIORITY_SCHEDULING): + Added for non-Cygwin, non-RTEMS configurations. + * libc/sys/linux/Makefile.am: Add support for crt1 and sysconf. + * libc/sys/linux/Makefile.in: Regenerated. + * libc/sys/linux/crt1.c: New empty file to override one defaulted + by gcc. This fixes problem with reconfiguring linux newlib build. + * libc/sys/linux/sysconf.c: New file. + 2002-04-03 Jeff Johnston <jjohnstn@redhat.com> * configure.host: Add support for machine subdirectory of diff --git a/newlib/Makefile.am b/newlib/Makefile.am index be01388ae..4d0028db1 100644 --- a/newlib/Makefile.am +++ b/newlib/Makefile.am @@ -79,7 +79,7 @@ endif noinst_DATA = stmp-targ-include -toollib_DATA = $(CRT0) +toollib_DATA = $(CRT0) $(CRT1) # The functions ldexp, frexp and modf are traditionally supplied in @@ -169,6 +169,14 @@ crt0.o: $(CRT0_DIR)/$(CRT0) $(CRT0_DIR)/$(CRT0): ; @true +crt1.o: $(CRT1_DIR)/$(CRT1) + rm -f $@ + ln $(CRT0_DIR)/$(CRT0) $@ >/dev/null 2>/dev/null \ + || cp $(CRT0_DIR)/$(CRT0) $@ + +$(CRT1_DIR)/$(CRT1): ; @true + + all-recursive: stmp-targ-include # The targ-include directory just holds the includes files for the diff --git a/newlib/Makefile.in b/newlib/Makefile.in index 6c0845c6d..cafce533c 100644 --- a/newlib/Makefile.in +++ b/newlib/Makefile.in @@ -67,6 +67,8 @@ CC_FOR_BUILD = @CC_FOR_BUILD@ CPP = @CPP@ CRT0 = @CRT0@ CRT0_DIR = @CRT0_DIR@ +CRT1 = @CRT1@ +CRT1_DIR = @CRT1_DIR@ DLLTOOL = @DLLTOOL@ EXEEXT = @EXEEXT@ LDFLAGS = @LDFLAGS@ @@ -164,7 +166,7 @@ AR_FLAGS = rc noinst_DATA = stmp-targ-include -toollib_DATA = $(CRT0) +toollib_DATA = $(CRT0) $(CRT1) # The functions ldexp, frexp and modf are traditionally supplied in # both libc.a and libm.a. We build them in libm.a and copy them over, @@ -678,6 +680,13 @@ crt0.o: $(CRT0_DIR)/$(CRT0) $(CRT0_DIR)/$(CRT0): ; @true +crt1.o: $(CRT1_DIR)/$(CRT1) + rm -f $@ + ln $(CRT0_DIR)/$(CRT0) $@ >/dev/null 2>/dev/null \ + || cp $(CRT0_DIR)/$(CRT0) $@ + +$(CRT1_DIR)/$(CRT1): ; @true + all-recursive: stmp-targ-include # The targ-include directory just holds the includes files for the diff --git a/newlib/configure b/newlib/configure index 359665cf9..a87b42352 100755 --- a/newlib/configure +++ b/newlib/configure @@ -2371,6 +2371,11 @@ fi +CRT1=${crt1} +CRT1_DIR=${crt1_dir} + + + if test -n "${libm_machine_dir}"; then LIBM_MACHINE_OBJECTLIST=libm/machine/${libm_machine_dir}/objectlist.awk.in fi @@ -2623,6 +2628,8 @@ s%@HAVE_DOC_FALSE@%$HAVE_DOC_FALSE%g s%@subdirs@%$subdirs%g s%@CRT0@%$CRT0%g s%@CRT0_DIR@%$CRT0_DIR%g +s%@CRT1@%$CRT1%g +s%@CRT1_DIR@%$CRT1_DIR%g s%@LIBM_MACHINE_OBJECTLIST@%$LIBM_MACHINE_OBJECTLIST%g s%@MACHINE_OBJECTLIST@%$MACHINE_OBJECTLIST%g s%@SYS_OBJECTLIST@%$SYS_OBJECTLIST%g diff --git a/newlib/configure.host b/newlib/configure.host index 9b6cddc3d..264632e5f 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -35,6 +35,8 @@ # use_libtool flag: use libtool to build newlib? # aext library extension - needed for libtool support # oext object file extension - needed for libtool support +# crt1 name of crt1 object if one is provided +# crt1_dir directory where crt1 object is found newlib_cflags= libm_machine_dir= @@ -45,6 +47,8 @@ signal_dir=signal syscall_dir= unix_dir= mach_add_setjmp= +crt1= +crt1_dir= use_libtool=no have_sys_mach_dir=no aext=a @@ -291,6 +295,8 @@ case "${host}" in sys_dir=linux unix_dir=unix posix_dir=posix + crt1=crt1.o + crt1_dir=libc/sys/${sys_dir} gcc_dir=`gcc -print-search-dirs | awk '/^install:/{print $2}'` #newlib_cflags="${newlib_cflags} -Werror" # DEBUGGING ONLY;BREAKS BUILD newlib_cflags="${newlib_cflags} -Wall" diff --git a/newlib/configure.in b/newlib/configure.in index 28c290148..2e21dab22 100644 --- a/newlib/configure.in +++ b/newlib/configure.in @@ -48,6 +48,11 @@ fi AC_SUBST(CRT0) AC_SUBST(CRT0_DIR) +CRT1=${crt1} +CRT1_DIR=${crt1_dir} +AC_SUBST(CRT1) +AC_SUBST(CRT1_DIR) + if test -n "${libm_machine_dir}"; then LIBM_MACHINE_OBJECTLIST=libm/machine/${libm_machine_dir}/objectlist.awk.in fi diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index d7e46a7ec..70682b2e0 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -234,6 +234,11 @@ int _EXFUN(symlink, (const char *__name1, const char *__name2)); #define _SC_GETPW_R_SIZE_MAX 51 #define _SC_LOGIN_NAME_MAX 52 #define _SC_THREAD_DESTRUCTOR_ITERATIONS 53 + +#if !defined(__CYGWIN__) && !defined(__rtems__) +#define _SC_STREAM_MAX 100 +#define _SC_PRIORITY_SCHEDULING 101 +#endif # define _PC_LINK_MAX 0 # define _PC_MAX_CANON 1 diff --git a/newlib/libc/sys/linux/Makefile.am b/newlib/libc/sys/linux/Makefile.am index 7c936a9a4..a3a0bbe89 100644 --- a/newlib/libc/sys/linux/Makefile.am +++ b/newlib/libc/sys/linux/Makefile.am @@ -9,7 +9,7 @@ SUBLIBS = $(LINUX_MACH_LIB) LIB_SOURCES = \ brk.c getoptlong.c ids.c inode.c io.c linux.c process.c realpath.c \ - select.c signal.c socket.c sleep.c stack.c systat.c termios.c time.c \ + select.c signal.c socket.c sleep.c stack.c sysconf.c systat.c termios.c time.c \ usleep.c wait.c # This will handle both /usr/src/linux-2.4/include/asm/signal.h (in Red Hat Linux 7.1) @@ -37,7 +37,7 @@ lib.a: $(LINUX_MACH_LIB) $(lib_a_OBJECTS) cd tmp; \ for i in $(SUBLIBS); do \ $(AR) x ../$$i; \ - done; \ + done; \ $(AR) $(AR_FLAGS) ../$@ *.o $(RANLIB) $@ rm -rf tmp @@ -47,7 +47,7 @@ endif # USE_LIBTOOL include $(srcdir)/../../../Makefile.shared -all: crt0.o +all: crt0.o crt1.o crt0.o: machine/crt0.o rm -f $@ diff --git a/newlib/libc/sys/linux/Makefile.in b/newlib/libc/sys/linux/Makefile.in index 4b59346e9..56efb7cd2 100644 --- a/newlib/libc/sys/linux/Makefile.in +++ b/newlib/libc/sys/linux/Makefile.in @@ -94,7 +94,7 @@ SUBLIBS = $(LINUX_MACH_LIB) LIB_SOURCES = \ brk.c getoptlong.c ids.c inode.c io.c linux.c process.c realpath.c \ - select.c signal.c socket.c sleep.c stack.c systat.c termios.c time.c \ + select.c signal.c socket.c sleep.c stack.c sysconf.c systat.c termios.c time.c \ usleep.c wait.c @@ -127,15 +127,16 @@ CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ @USE_LIBTOOL_FALSE@lib_a_OBJECTS = brk.o getoptlong.o ids.o inode.o \ @USE_LIBTOOL_FALSE@io.o linux.o process.o realpath.o select.o signal.o \ -@USE_LIBTOOL_FALSE@socket.o sleep.o stack.o systat.o termios.o time.o \ -@USE_LIBTOOL_FALSE@usleep.o wait.o +@USE_LIBTOOL_FALSE@socket.o sleep.o stack.o sysconf.o systat.o \ +@USE_LIBTOOL_FALSE@termios.o time.o usleep.o wait.o LTLIBRARIES = $(noinst_LTLIBRARIES) @USE_LIBTOOL_TRUE@liblinux_la_DEPENDENCIES = @USE_LIBTOOL_TRUE@liblinux_la_OBJECTS = brk.lo getoptlong.lo ids.lo \ @USE_LIBTOOL_TRUE@inode.lo io.lo linux.lo process.lo realpath.lo \ @USE_LIBTOOL_TRUE@select.lo signal.lo socket.lo sleep.lo stack.lo \ -@USE_LIBTOOL_TRUE@systat.lo termios.lo time.lo usleep.lo wait.lo +@USE_LIBTOOL_TRUE@sysconf.lo systat.lo termios.lo time.lo usleep.lo \ +@USE_LIBTOOL_TRUE@wait.lo CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -475,7 +476,7 @@ maintainer-clean @USE_LIBTOOL_FALSE@ cd tmp; \ @USE_LIBTOOL_FALSE@ for i in $(SUBLIBS); do \ @USE_LIBTOOL_FALSE@ $(AR) x ../$$i; \ -@USE_LIBTOOL_FALSE@ done; \ +@USE_LIBTOOL_FALSE@ done; \ @USE_LIBTOOL_FALSE@ $(AR) $(AR_FLAGS) ../$@ *.o @USE_LIBTOOL_FALSE@ $(RANLIB) $@ @USE_LIBTOOL_FALSE@ rm -rf tmp @@ -487,7 +488,7 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) echo $$i `pwd`/$$i >> objectlist.awk.in ; \ done -all: crt0.o +all: crt0.o crt1.o crt0.o: machine/crt0.o rm -f $@ diff --git a/newlib/libc/sys/linux/crt1.c b/newlib/libc/sys/linux/crt1.c new file mode 100644 index 000000000..018e9a2d4 --- /dev/null +++ b/newlib/libc/sys/linux/crt1.c @@ -0,0 +1,3 @@ +/* dummy crt1.c file to override the one normally used by + gcc which refers to glibc variables that don't exist in + newlib. */ diff --git a/newlib/libc/sys/linux/sysconf.c b/newlib/libc/sys/linux/sysconf.c new file mode 100644 index 000000000..f953efe5d --- /dev/null +++ b/newlib/libc/sys/linux/sysconf.c @@ -0,0 +1,383 @@ +/* libc/sys/linux/sysconf.c - The sysconf function */ + +/* Copyright 2002, Red Hat Inc. */ + + +#include <unistd.h> +#include <limits.h> +#include <time.h> +#include <errno.h> +#include <sys/types.h> + +long int +sysconf (int name) +{ + switch (name) + { + case _SC_AIO_LISTIO_MAX: +#ifdef AIO_LISTIO_MAX + return AIO_LISTIO_MAX; +#else + return -1; +#endif + + case _SC_AIO_MAX: +#ifdef AIO_MAX + return AIO_MAX; +#else + return -1; +#endif + + case _SC_AIO_PRIO_DELTA_MAX: +#ifdef AIO_PRIO_DELTA_MAX + return AIO_PRIO_DELTA_MAX; +#else + return -1; +#endif + + case _SC_ARG_MAX: +#ifdef ARG_MAX + return ARG_MAX; +#else + return -1; +#endif + + case _SC_CHILD_MAX: +#ifdef CHILD_MAX + return CHILD_MAX; +#else + return -1; +#endif + + case _SC_CLK_TCK: + return CLK_TCK; + + case _SC_DELAYTIMER_MAX: +#ifdef DELAYTIMER_MAX + return DELAYTIMER_MAX; +#else + return -1; +#endif + + case _SC_GETGR_R_SIZE_MAX: +#ifdef _GETGR_R_SIZE_MAX + return _GETGR_R_SIZE_MAX; +#else + return -1; +#endif + + case _SC_GETPW_R_SIZE_MAX: +#ifdef _GETPW_R_SIZE_MAX + return _GETPW_R_SIZE_MAX; +#else + return -1; +#endif + + case _SC_LOGIN_NAME_MAX: +#ifdef LOGIN_NAME_MAX + return LOGIN_NAME_MAX; +#else + return -1; +#endif + + case _SC_MQ_OPEN_MAX: +#ifdef MQ_OPEN_MAX + return MQ_OPEN_MAX; +#else + return -1; +#endif + + case _SC_MQ_PRIO_MAX: +#ifdef MQ_PRIO_MAX + return MQ_PRIO_MAX; +#else + return -1; +#endif + + case _SC_NGROUPS_MAX: +#ifdef NGROUPS_MAX + return NGROUPS_MAX; +#else + return -1; +#endif + + case _SC_OPEN_MAX: +#ifdef OPEN_MAX + return OPEN_MAX; +#else + return -1; +#endif + + case _SC_PAGESIZE: +#ifdef PAGESIZE + return PAGESIZE; +#else + return -1; +#endif + + case _SC_RTSIG_MAX: +#ifdef RTSIG_MAX + return RTSIG_MAX; +#else + return -1; +#endif + + case _SC_SEM_NSEMS_MAX: +#ifdef SEM_NSEMS_MAX + return SEM_NSEMS_MAX; +#else + return -1; +#endif + + case _SC_SEM_VALUE_MAX: +#ifdef SEM_VALUE_MAX + return SEM_VALUE_MAX; +#else + return -1; +#endif + + case _SC_SIGQUEUE_MAX: +#ifdef SIGQUEUE_MAX + return SIGQUEUE_MAX; +#else + return -1; +#endif + + case _SC_STREAM_MAX: +#ifdef STREAM_MAX + return STREAM_MAX; +#else + return -1; +#endif + + case _SC_THREAD_DESTRUCTOR_ITERATIONS: +#ifdef PTHREAD_DESTRUCTOR_ITERATIONS + return PTHREAD_DESTRUCTOR_ITERATIONS; +#else + return -1; +#endif + + case _SC_THREAD_KEYS_MAX: +#ifdef PTHREAD_KEYS_MAX + return PTHREAD_KEYS_MAX; +#else + return -1; +#endif + + case _SC_THREAD_STACK_MIN: +#ifdef PTHREAD_STACK_MIN + return PTHREAD_STACK_MIN; +#else + return -1; +#endif + + case _SC_THREAD_THREADS_MAX: +#ifdef PTHREAD_THREADS_MAX + return PTHREAD_THREADS_MAX; +#else + return -1; +#endif + + case _SC_TIMER_MAX: +#ifdef TIMER_MAX + return TIMER_MAX; +#else + return -1; +#endif + + case _SC_TTY_NAME_MAX: +#ifdef TTY_NAME_MAX + return TTY_NAME_MAX; +#else + return -1; +#endif + + case _SC_TZNAME_MAX: +#ifdef TZNAME_MAX + return TZNAME_MAX; +#else + return -1; +#endif + + case _SC_ASYNCHRONOUS_IO: +#ifdef _POSIX_ASYNCHRONOUS_IO + return 1;TZNAME_MAX; +#else + return -1; +#endif + + case _SC_FSYNC: +#ifdef _POSIX_FSYNC + return 1; +#else + return -1; +#endif + + case _SC_JOB_CONTROL: +#ifdef _POSIX_JOB_CONTROL + return 1; +#else + return -1; +#endif + + case _SC_MAPPED_FILES: +#ifdef _POSIX_MAPPED_FILES + return 1; +#else + return -1; +#endif + + case _SC_MEMLOCK: +#ifdef _POSIX_MEMLOCK + return 1; +#else + return -1; +#endif + + case _SC_MEMLOCK_RANGE: +#ifdef _POSIX_MEMLOCK_RANGE + return _POSIX_MEMLOCK_RANGE; +#else + return -1; +#endif + + case _SC_MEMORY_PROTECTION: +#ifdef _POSIX_MEMORY_PROTECTION + return 1; +#else + return -1; +#endif + + case _SC_MESSAGE_PASSING: +#ifdef _POSIX_MESSAGE_PASSING + return 1; +#else + return -1; +#endif + + case _SC_PRIORITIZED_IO: +#ifdef _POSIX_PRIORITIZED_IO + return 1; +#else + return -1; +#endif + + case _SC_PRIORITY_SCHEDULING: +#ifdef _POSIX_PRIORITY_SCHEDULING + return 1; +#else + return -1; +#endif + + case _SC_REALTIME_SIGNALS: +#ifdef _POSIX_REALTIME_SIGNALS + return 1; +#else + return -1; +#endif + + case _SC_SAVED_IDS: +#ifdef _POSIX_SAVED_IDS + return 1; +#else + return -1; +#endif + + case _SC_SEMAPHORES: +#ifdef _POSIX_SEMAPHORES + return 1; +#else + return -1; +#endif + + case _SC_SHARED_MEMORY_OBJECTS: +#ifdef _POSIX_SHARED_MEMORY_OBJECTS + return 1; +#else + return -1; +#endif + + case _SC_SYNCHRONIZED_IO: +#ifdef _POSIX_SYNCHRONIZED_IO + return 1; +#else + return -1; +#endif + + case _SC_TIMERS: +#ifdef _POSIX_TIMERS + return 1; +#else + return -1; +#endif + + case _SC_THREADS: +#ifdef _POSIX_THREADS + return 1; +#else + return -1; +#endif + + case _SC_THREAD_ATTR_STACKADDR: +#ifdef _POSIX_THREAD_ATTR_STACKADDR + return 1; +#else + return -1; +#endif + + case _SC_THREAD_ATTR_STACKSIZE: +#ifdef _POSIX_THREAD_ATTR_STACKSIZE + return 1; +#else + return -1; +#endif + + case _SC_THREAD_PRIORITY_SCHEDULING: +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING + return 1; +#else + return -1; +#endif + + case _SC_THREAD_PRIO_INHERIT: +#ifdef _POSIX_THREAD_PRIO_INHERIT + return 1; +#else + return -1; +#endif + + case _SC_THREAD_PRIO_PROTECT: +#ifdef _POSIX_THREAD_PRIO_PROTECT + return 1; +#else + return -1; +#endif + + case _SC_THREAD_PROCESS_SHARED: +#ifdef _POSIX_THREAD_PROCESS_SHARED + return 1; +#else + return -1; +#endif + + case _SC_THREAD_SAFE_FUNCTIONS: +#ifdef _POSIX_THREAD_SAFE_FUNCTIONS + return 1; +#else + return -1; +#endif + + case _SC_VERSION: +#ifdef _POSIX_VERSION + return _POSIX_VERSION; +#else + return -1; +#endif + + default: + errno = EINVAL; + return -1; + } + + return -1; /* can't get here */ +} |