diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-12-21 10:14:44 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-12-21 10:14:44 +0000 |
commit | 009bae64cf278be1a49eef73e6756c1fd268da34 (patch) | |
tree | 188e46837c5c275dc2394c5ee51e5f163c5ad6fb | |
parent | cc8008364d4cb269c16b61fb1481dea019cb92c2 (diff) |
A very large patch from Miles Bader <miles@lsi.nec.co.jp> to bring
v850 back into working condition. Thanks Miles!
-Erik
67 files changed, 1742 insertions, 1086 deletions
diff --git a/extra/Configs/Config.v850e b/extra/Configs/Config.v850e index a519f2577..25031dd5e 100644 --- a/extra/Configs/Config.v850e +++ b/extra/Configs/Config.v850e @@ -46,7 +46,7 @@ STRIPTOOL = $(CROSS)strip # Set the following to `true' to make a debuggable build, and `false' for # production builds. -DODEBUG = true +DODEBUG = false # Compiler warnings you want to see WARNINGS=-Wall diff --git a/libc/sysdeps/linux/v850/Makefile b/libc/sysdeps/linux/v850/Makefile index dda7fba59..e571ddad2 100644 --- a/libc/sysdeps/linux/v850/Makefile +++ b/libc/sysdeps/linux/v850/Makefile @@ -24,22 +24,22 @@ TOPDIR=../../../../ include $(TOPDIR)Rules.mak -ASFLAGS=$(CFLAGS) -CFLAGS+= -I../ -D__ASSEMBLER__ -DASM_GLOBAL_DIRECTIVE=.globl +CFLAGS += -I.. +SFLAGS = $(CFLAGS) -D__ASSEMBLER -DASM_GLOBAL_DIRECTIVE=.globl TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine) -CRT0=crt0.S -CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0)) +CRT0 = crt0.S +CRT0_OBJ = $(patsubst %.S,%.o, $(CRT0)) -SSRC=setjmp.S longjmp.S vfork.S -SOBJS=$(patsubst %.S,%.o, $(SSRC)) +SSRC = setjmp.S longjmp.S vfork.S +SOBJS = $(patsubst %.S,%.o, $(SSRC)) -CSRC=_mmap.c -COBJS=$(patsubst %.c,%.o, $(CSRC)) +CSRC = _mmap.c +COBJS = $(patsubst %.c,%.o, $(CSRC)) -OBJS=$(SOBJS) $(MOBJ) $(COBJS) +OBJS = $(SOBJS) $(COBJS) all: $(OBJS) $(LIBC) @@ -51,11 +51,11 @@ ar-target: $(OBJS) $(CRT0_OBJ) cp $(CRT0_OBJ) $(TOPDIR)libc/$(CRT0_OBJ) $(CRT0_OBJ): %.o : %.S - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(SFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o $(SOBJS): %.o : %.S - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(SFLAGS) -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o $(COBJS): %.o : %.c diff --git a/libc/sysdeps/linux/v850/_mmap.c b/libc/sysdeps/linux/v850/_mmap.c index 891e2beb5..a9cb0bcab 100644 --- a/libc/sysdeps/linux/v850/_mmap.c +++ b/libc/sysdeps/linux/v850/_mmap.c @@ -1,8 +1,9 @@ /* Use new style mmap for v850 */ + #include <unistd.h> +#include <errno.h> #include <sys/mman.h> #include <sys/syscall.h> -_syscall6(__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, - int, flags, int, fd, __off_t, offset); - +_syscall6 (__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, + int, flags, int, fd, __off_t, offset); diff --git a/libc/sysdeps/linux/v850/bits/byteswap.h b/libc/sysdeps/linux/v850/bits/byteswap.h index b5b07209f..44fbee488 100644 --- a/libc/sysdeps/linux/v850/bits/byteswap.h +++ b/libc/sysdeps/linux/v850/bits/byteswap.h @@ -16,44 +16,48 @@ #endif /* Swap bytes in 16 bit value. */ +#define __bswap_constant_16(x) \ + ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) + #ifdef __GNUC__ # define __bswap_16(x) \ (__extension__ \ - ({ unsigned short int __bsh_val = (x); \ - __asm__ ("bsh %1, %0" : "=r" (__bsh_val) : "r" (__bsh_val)); \ - __bsh_val; })) + ({ unsigned long int __bswap_16_v; \ + if (__builtin_constant_p (x)) \ + __bswap_16_v = __bswap_constant_16 (x); \ + else \ + __asm__ ("bsh %1, %0" : "=r" (__bswap_16_v) : "r" (x)); \ + __bswap_16_v; })) #else -static __inline unsigned short int -__bswap_16 (unsigned short int __bsx) -{ - return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); -} +# define __bswap_16(x) __bswap_constant_16 (x) #endif /* Swap bytes in 32 bit value. */ +#define __bswap_constant_32(x) \ + ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) + #ifdef __GNUC__ # define __bswap_32(x) \ (__extension__ \ - ({ unsigned short int __bsw_val = (x); \ - __asm__ ("bsw %1, %0" : "=r" (__bsw_val) : "r" (__bsw_val)); \ - __bsw_val; })) + ({ unsigned long int __bswap_32_v; \ + if (__builtin_constant_p (x)) \ + __bswap_32_v = __bswap_constant_32 (x); \ + else \ + __asm__ ("bsw %1, %0" : "=r" (__bswap_32_v) : "r" (x)); \ + __bswap_32_v; })) #else -static __inline unsigned int -__bswap_32 (unsigned int __bsx) -{ - return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | - (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); -} +# define __bswap_32(x) __bswap_constant_32 (x) #endif #if defined __GNUC__ && __GNUC__ >= 2 /* Swap bytes in 64 bit value. */ -# define __bswap_64(x) \ +# define __bswap_64(x) \ (__extension__ \ ({ union { unsigned long long int __ll; \ - unsigned long int __l[2]; } __v, __r; \ - __v.__ll = (x); \ - __r.__l[0] = __bswap_32 (__v.__l[1]); \ - __r.__l[1] = __bswap_32 (__v.__l[0]); \ - __r.__ll; })) + unsigned long int __l[2]; } __bswap_64_v, __bswap_64_r; \ + __bswap_64_v.__ll = (x); \ + __bswap_64_r.__l[0] = __bswap_32 (__bswap_64_v.__l[1]); \ + __bswap_64_r.__l[1] = __bswap_32 (__bswap_64_v.__l[0]); \ + __bswap_64_r.__ll; })) #endif diff --git a/libc/sysdeps/linux/v850/bits/cmathcalls.h b/libc/sysdeps/linux/v850/bits/cmathcalls.h index c1b0781b0..a3c0d3b63 100644 --- a/libc/sysdeps/linux/v850/bits/cmathcalls.h +++ b/libc/sysdeps/linux/v850/bits/cmathcalls.h @@ -1,22 +1,22 @@ /* Prototype declarations for complex math functions; helper file for <complex.h>. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ /* NOTE: Because of the special way this file is used by <complex.h>, this file must NOT be protected from multiple inclusion as header files @@ -47,7 +47,6 @@ #define _Mdouble_complex_ _Mdouble_ _Complex -__BEGIN_DECLS /* Trigonometric functions. */ @@ -130,31 +129,32 @@ __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z)); __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z)); + + /* Now some optimized versions. GCC has handy notations for these - functions. */ -#if defined __GNUC__ && defined __OPTIMIZE__ + functions. Recent GCC handles these as builtin functions so does + not need inlines. */ +#if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__ /* Imaginary part of Z. */ extern __inline _Mdouble_ -__MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) +__MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW { return __imag__ __z; } /* Real part of Z. */ extern __inline _Mdouble_ -__MATH_PRECNAME(creal) (_Mdouble_complex_ __z) +__MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW { return __real__ __z; } /* Complex conjugate of Z. */ extern __inline _Mdouble_complex_ -__MATH_PRECNAME(conj) (_Mdouble_complex_ __z) +__MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW { - return ~__z; + return __extension__ ~__z; } #endif - -__END_DECLS diff --git a/libc/sysdeps/linux/v850/bits/confname.h b/libc/sysdeps/linux/v850/bits/confname.h index 229088d67..ba8868af4 100644 --- a/libc/sysdeps/linux/v850/bits/confname.h +++ b/libc/sysdeps/linux/v850/bits/confname.h @@ -1,21 +1,21 @@ /* `sysconf', `pathconf', and `confstr' NAME values. Generic version. - Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1993, 1995-1998, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ #ifndef _UNISTD_H # error "Never use <bits/confname.h> directly; include <unistd.h> instead." @@ -50,8 +50,20 @@ enum #define _PC_PRIO_IO _PC_PRIO_IO _PC_SOCK_MAXBUF, #define _PC_SOCK_MAXBUF _PC_SOCK_MAXBUF - _PC_FILESIZEBITS + _PC_FILESIZEBITS, #define _PC_FILESIZEBITS _PC_FILESIZEBITS + _PC_REC_INCR_XFER_SIZE, +#define _PC_REC_INCR_XFER_SIZE _PC_REC_INCR_XFER_SIZE + _PC_REC_MAX_XFER_SIZE, +#define _PC_REC_MAX_XFER_SIZE _PC_REC_MAX_XFER_SIZE + _PC_REC_MIN_XFER_SIZE, +#define _PC_REC_MIN_XFER_SIZE _PC_REC_MIN_XFER_SIZE + _PC_REC_XFER_ALIGN, +#define _PC_REC_XFER_ALIGN _PC_REC_XFER_ALIGN + _PC_ALLOC_SIZE_MIN, +#define _PC_ALLOC_SIZE_MIN _PC_ALLOC_SIZE_MIN + _PC_SYMLINK_MAX +#define _PC_SYMLINK_MAX _PC_SYMLINK_MAX }; /* Values for the argument to `sysconf'. */ @@ -185,6 +197,8 @@ enum #define _SC_SELECT _SC_SELECT _SC_UIO_MAXIOV, #define _SC_UIO_MAXIOV _SC_UIO_MAXIOV + _SC_IOV_MAX = _SC_UIO_MAXIOV, +#define _SC_IOV_MAX _SC_IOV_MAX _SC_PII_INTERNET_STREAM, #define _SC_PII_INTERNET_STREAM _SC_PII_INTERNET_STREAM _SC_PII_INTERNET_DGRAM, @@ -335,8 +349,117 @@ enum #define _SC_XOPEN_LEGACY _SC_XOPEN_LEGACY _SC_XOPEN_REALTIME, #define _SC_XOPEN_REALTIME _SC_XOPEN_REALTIME - _SC_XOPEN_REALTIME_THREADS + _SC_XOPEN_REALTIME_THREADS, #define _SC_XOPEN_REALTIME_THREADS _SC_XOPEN_REALTIME_THREADS + + _SC_ADVISORY_INFO, +#define _SC_ADVISORY_INFO _SC_ADVISORY_INFO + _SC_BARRIERS, +#define _SC_BARRIERS _SC_BARRIERS + _SC_BASE, +#define _SC_BASE _SC_BASE + _SC_C_LANG_SUPPORT, +#define _SC_C_LANG_SUPPORT _SC_C_LANG_SUPPORT + _SC_C_LANG_SUPPORT_R, +#define _SC_C_LANG_SUPPORT_R _SC_C_LANG_SUPPORT_R + _SC_CLOCK_SELECTION, +#define _SC_CLOCK_SELECTION _SC_CLOCK_SELECTION + _SC_CPUTIME, +#define _SC_CPUTIME _SC_CPUTIME + _SC_THREAD_CPUTIME, +#define _SC_THREAD_CPUTIME _SC_THREAD_CPUTIME + _SC_DEVICE_IO, +#define _SC_DEVICE_IO _SC_DEVICE_IO + _SC_DEVICE_SPECIFIC, +#define _SC_DEVICE_SPECIFIC _SC_DEVICE_SPECIFIC + _SC_DEVICE_SPECIFIC_R, +#define _SC_DEVICE_SPECIFIC_R _SC_DEVICE_SPECIFIC_R + _SC_FD_MGMT, +#define _SC_FD_MGMT _SC_FD_MGMT + _SC_FIFO, +#define _SC_FIFO _SC_FIFO + _SC_PIPE, +#define _SC_PIPE _SC_PIPE + _SC_FILE_ATTRIBUTES, +#define _SC_FILE_ATTRIBUTES _SC_FILE_ATTRIBUTES + _SC_FILE_LOCKING, +#define _SC_FILE_LOCKING _SC_FILE_LOCKING + _SC_FILE_SYSTEM, +#define _SC_FILE_SYSTEM _SC_FILE_SYSTEM + _SC_MONOTONIC_CLOCK, +#define _SC_MONOTONIC_CLOCK _SC_MONOTONIC_CLOCK + _SC_MULTI_PROCESS, +#define _SC_MULTI_PROCESS _SC_MULTI_PROCESS + _SC_SINGLE_PROCESS, +#define _SC_SINGLE_PROCESS _SC_SINGLE_PROCESS + _SC_NETWORKING, +#define _SC_NETWORKING _SC_NETWORKING + _SC_READER_WRITER_LOCKS, +#define _SC_READER_WRITER_LOCKS _SC_READER_WRITER_LOCKS + _SC_SPIN_LOCKS, +#define _SC_SPIN_LOCKS _SC_SPIN_LOCKS + _SC_REGEXP, +#define _SC_REGEXP _SC_REGEXP + _SC_REGEX_VERSION, +#define _SC_REGEX_VERSION _SC_REGEX_VERSION + _SC_SHELL, +#define _SC_SHELL _SC_SHELL + _SC_SIGNALS, +#define _SC_SIGNALS _SC_SIGNALS + _SC_SPAWN, +#define _SC_SPAWN _SC_SPAWN + _SC_SPORADIC_SERVER, +#define _SC_SPORADIC_SERVER _SC_SPORADIC_SERVER + _SC_THREAD_SPORADIC_SERVER, +#define _SC_THREAD_SPORADIC_SERVER _SC_THREAD_SPORADIC_SERVER + _SC_SYSTEM_DATABASE, +#define _SC_SYSTEM_DATABASE _SC_SYSTEM_DATABASE + _SC_SYSTEM_DATABASE_R, +#define _SC_SYSTEM_DATABASE_R _SC_SYSTEM_DATABASE_R + _SC_TIMEOUTS, +#define _SC_TIMEOUTS _SC_TIMEOUTS + _SC_TYPED_MEMORY_OBJECTS, +#define _SC_TYPED_MEMORY_OBJECTS _SC_TYPED_MEMORY_OBJECTS + _SC_USER_GROUPS, +#define _SC_USER_GROUPS _SC_USER_GROUPS + _SC_USER_GROUPS_R, +#define _SC_USER_GROUPS_R _SC_USER_GROUPS_R + _SC_2_PBS, +#define _SC_2_PBS _SC_2_PBS + _SC_2_PBS_ACCOUNTING, +#define _SC_2_PBS_ACCOUNTING _SC_2_PBS_ACCOUNTING + _SC_2_PBS_LOCATE, +#define _SC_2_PBS_LOCATE _SC_2_PBS_LOCATE + _SC_2_PBS_MESSAGE, +#define _SC_2_PBS_MESSAGE _SC_2_PBS_MESSAGE + _SC_2_PBS_TRACK, +#define _SC_2_PBS_TRACK _SC_2_PBS_TRACK + _SC_SYMLOOP_MAX, +#define _SC_SYMLOOP_MAX _SC_SYMLOOP_MAX + _SC_STREAMS, +#define _SC_STREAMS _SC_STREAMS + _SC_2_PBS_CHECKPOINT, +#define _SC_2_PBS_CHECKPOINT _SC_2_PBS_CHECKPOINT + + _SC_V6_ILP32_OFF32, +#define _SC_V6_ILP32_OFF32 _SC_V6_ILP32_OFF32 + _SC_V6_ILP32_OFFBIG, +#define _SC_V6_ILP32_OFFBIG _SC_V6_ILP32_OFFBIG + _SC_V6_LP64_OFF64, +#define _SC_V6_LP64_OFF64 _SC_V6_LP64_OFF64 + _SC_V6_LPBIG_OFFBIG, +#define _SC_V6_LPBIG_OFFBIG _SC_V6_LPBIG_OFFBIG + + _SC_HOST_NAME_MAX, +#define _SC_HOST_NAME_MAX _SC_HOST_NAME_MAX + _SC_TRACE, +#define _SC_TRACE _SC_TRACE + _SC_TRACE_EVENT_FILTER, +#define _SC_TRACE_EVENT_FILTER _SC_TRACE_EVENT_FILTER + _SC_TRACE_INHERIT, +#define _SC_TRACE_INHERIT _SC_TRACE_INHERIT + _SC_TRACE_LOG +#define _SC_TRACE_LOG _SC_TRACE_LOG }; #if (defined __USE_POSIX2 || defined __USE_UNIX98 \ @@ -345,64 +468,99 @@ enum /* Values for the NAME argument to `confstr'. */ enum { - _CS_PATH /* The default search path. */ + _CS_PATH, /* The default search path. */ #define _CS_PATH _CS_PATH -#if (defined __USE_FILE_OFFSET64 || defined __USE_LARGEFILE64 \ +# if (defined __USE_FILE_OFFSET64 || defined __USE_LARGEFILE64 \ || defined __USE_LARGEFILE) - , _CS_LFS_CFLAGS = 1000, -# define _CS_LFS_CFLAGS _CS_LFS_CFLAGS +# define _CS_LFS_CFLAGS _CS_LFS_CFLAGS _CS_LFS_LDFLAGS, -# define _CS_LFS_LDFLAGS _CS_LFS_LDFLAGS +# define _CS_LFS_LDFLAGS _CS_LFS_LDFLAGS _CS_LFS_LIBS, -# define _CS_LFS_LIBS _CS_LFS_LIBS +# define _CS_LFS_LIBS _CS_LFS_LIBS _CS_LFS_LINTFLAGS, -# define _CS_LFS_LINTFLAGS _CS_LFS_LINTFLAGS +# define _CS_LFS_LINTFLAGS _CS_LFS_LINTFLAGS _CS_LFS64_CFLAGS, -# define _CS_LFS64_CFLAGS _CS_LFS64_CFLAGS +# define _CS_LFS64_CFLAGS _CS_LFS64_CFLAGS _CS_LFS64_LDFLAGS, -# define _CS_LFS64_LDFLAGS _CS_LFS64_LDFLAGS +# define _CS_LFS64_LDFLAGS _CS_LFS64_LDFLAGS _CS_LFS64_LIBS, -# define _CS_LFS64_LIBS _CS_LFS64_LIBS - _CS_LFS64_LINTFLAGS -# define _CS_LFS64_LINTFLAGS _CS_LFS64_LINTFLAGS -#endif +# define _CS_LFS64_LIBS _CS_LFS64_LIBS + _CS_LFS64_LINTFLAGS, +# define _CS_LFS64_LINTFLAGS _CS_LFS64_LINTFLAGS +# endif -#ifdef __USE_UNIX98 - , +# ifdef __USE_UNIX98 _CS_XBS5_ILP32_OFF32_CFLAGS = 1100, -# define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS +# define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS, -# define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS +# define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LIBS, |