diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2008-04-15 23:57:48 +0400 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2008-04-15 23:57:48 +0400 |
commit | 45b142890d779ed051bbddef5c7bfb2e4715373e (patch) | |
tree | 27d167bd6a50863c6d5d9cac957ff7b9dbf12302 /newlib/libc/machine/spu | |
parent | e163fe2579e4a46757b208e84b0f73c7bbfb582a (diff) |
2008-04-14 Patrick Mansfield <patmans@us.ibm.com>
* libc/machine/spu/impure.c: New file, supply a non-static _impure_data.
* libc/machine/spu/Makefile.am: Add new file impure.c.
* libc/machine/spu/Makefile.in: Regenerate.
* libc/machine/spu/sys/errno.h: Define errno to be _reent_data._errno.
Diffstat (limited to 'newlib/libc/machine/spu')
-rw-r--r-- | newlib/libc/machine/spu/Makefile.am | 8 | ||||
-rw-r--r-- | newlib/libc/machine/spu/Makefile.in | 74 | ||||
-rw-r--r-- | newlib/libc/machine/spu/impure.c | 14 | ||||
-rw-r--r-- | newlib/libc/machine/spu/sys/errno.h | 10 |
4 files changed, 60 insertions, 46 deletions
diff --git a/newlib/libc/machine/spu/Makefile.am b/newlib/libc/machine/spu/Makefile.am index e542795fa..bd66094c5 100644 --- a/newlib/libc/machine/spu/Makefile.am +++ b/newlib/libc/machine/spu/Makefile.am @@ -12,10 +12,10 @@ lib_a_SOURCES = setjmp.S assert.c clearerr.c creat.c fclose.c feof.c \ ferror.c fflush.c fgetc.c fgetpos.c fgets.c fileno.c fiprintf.S \ fiscanf.S fopen.c fprintf.S fputc.c fputs.c fread.c freopen.c \ fscanf.S fseek.c fsetpos.c ftell.c fwrite.c getc.c getchar.c \ - gets.c iprintf.S iscanf.S memcmp.c memcpy.c memmove.c memset.c \ - perror.c printf.S putc.c putchar.c puts.c remove.c rename.c \ - rewind.c scanf.S setbuf.c setvbuf.c siprintf.S siscanf.S sleep.c \ - sniprintf.S snprintf.S sprintf.S sscanf.S stdio.c strcat.c \ + gets.c impure.c iprintf.S iscanf.S memcmp.c memcpy.c memmove.c \ + memset.c perror.c printf.S putc.c putchar.c puts.c remove.c \ + rename.c rewind.c scanf.S setbuf.c setvbuf.c siprintf.S siscanf.S \ + sleep.c sniprintf.S snprintf.S sprintf.S sscanf.S stdio.c strcat.c \ strchr.c strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c \ strncpy.c strpbrk.c strrchr.c strspn.c strxfrm.c tmpfile.c \ tmpnam.c ungetc.c usleep.c vfiprintf.c vfiscanf.c vfprintf.c \ diff --git a/newlib/libc/machine/spu/Makefile.in b/newlib/libc/machine/spu/Makefile.in index a4007ab2e..73464d5d9 100644 --- a/newlib/libc/machine/spu/Makefile.in +++ b/newlib/libc/machine/spu/Makefile.in @@ -74,7 +74,7 @@ DIST_COMMON = $(srcdir)/../../../../config.guess \ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ - $(srcdir)/../../../../compile + $(srcdir)/../../../../compile $(srcdir)/../../../../compile subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../../../acinclude.m4 \ @@ -103,35 +103,35 @@ am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-assert.$(OBJEXT) \ lib_a-fsetpos.$(OBJEXT) lib_a-ftell.$(OBJEXT) \ lib_a-fwrite.$(OBJEXT) lib_a-getc.$(OBJEXT) \ lib_a-getchar.$(OBJEXT) lib_a-gets.$(OBJEXT) \ - lib_a-iprintf.$(OBJEXT) lib_a-iscanf.$(OBJEXT) \ - lib_a-memcmp.$(OBJEXT) lib_a-memcpy.$(OBJEXT) \ - lib_a-memmove.$(OBJEXT) lib_a-memset.$(OBJEXT) \ - lib_a-perror.$(OBJEXT) lib_a-printf.$(OBJEXT) \ - lib_a-putc.$(OBJEXT) lib_a-putchar.$(OBJEXT) \ - lib_a-puts.$(OBJEXT) lib_a-remove.$(OBJEXT) \ - lib_a-rename.$(OBJEXT) lib_a-rewind.$(OBJEXT) \ - lib_a-scanf.$(OBJEXT) lib_a-setbuf.$(OBJEXT) \ - lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \ - lib_a-siscanf.$(OBJEXT) lib_a-sleep.$(OBJEXT) \ - lib_a-sniprintf.$(OBJEXT) lib_a-snprintf.$(OBJEXT) \ - lib_a-sprintf.$(OBJEXT) lib_a-sscanf.$(OBJEXT) \ - lib_a-stdio.$(OBJEXT) lib_a-strcat.$(OBJEXT) \ - lib_a-strchr.$(OBJEXT) lib_a-strcmp.$(OBJEXT) \ - lib_a-strcpy.$(OBJEXT) lib_a-strcspn.$(OBJEXT) \ - lib_a-strlen.$(OBJEXT) lib_a-strncat.$(OBJEXT) \ - lib_a-strncmp.$(OBJEXT) lib_a-strncpy.$(OBJEXT) \ - lib_a-strpbrk.$(OBJEXT) lib_a-strrchr.$(OBJEXT) \ - lib_a-strspn.$(OBJEXT) lib_a-strxfrm.$(OBJEXT) \ - lib_a-tmpfile.$(OBJEXT) lib_a-tmpnam.$(OBJEXT) \ - lib_a-ungetc.$(OBJEXT) lib_a-usleep.$(OBJEXT) \ - lib_a-vfiprintf.$(OBJEXT) lib_a-vfiscanf.$(OBJEXT) \ - lib_a-vfprintf.$(OBJEXT) lib_a-vfscanf.$(OBJEXT) \ - lib_a-viprintf.$(OBJEXT) lib_a-viscanf.$(OBJEXT) \ - lib_a-vprintf.$(OBJEXT) lib_a-vscanf.$(OBJEXT) \ - lib_a-vsiprintf.$(OBJEXT) lib_a-vsiscanf.$(OBJEXT) \ - lib_a-vsniprintf.$(OBJEXT) lib_a-vsnprintf.$(OBJEXT) \ - lib_a-vsprintf.$(OBJEXT) lib_a-vsscanf.$(OBJEXT) \ - lib_a-stack_reg_va.$(OBJEXT) + lib_a-impure.$(OBJEXT) lib_a-iprintf.$(OBJEXT) \ + lib_a-iscanf.$(OBJEXT) lib_a-memcmp.$(OBJEXT) \ + lib_a-memcpy.$(OBJEXT) lib_a-memmove.$(OBJEXT) \ + lib_a-memset.$(OBJEXT) lib_a-perror.$(OBJEXT) \ + lib_a-printf.$(OBJEXT) lib_a-putc.$(OBJEXT) \ + lib_a-putchar.$(OBJEXT) lib_a-puts.$(OBJEXT) \ + lib_a-remove.$(OBJEXT) lib_a-rename.$(OBJEXT) \ + lib_a-rewind.$(OBJEXT) lib_a-scanf.$(OBJEXT) \ + lib_a-setbuf.$(OBJEXT) lib_a-setvbuf.$(OBJEXT) \ + lib_a-siprintf.$(OBJEXT) lib_a-siscanf.$(OBJEXT) \ + lib_a-sleep.$(OBJEXT) lib_a-sniprintf.$(OBJEXT) \ + lib_a-snprintf.$(OBJEXT) lib_a-sprintf.$(OBJEXT) \ + lib_a-sscanf.$(OBJEXT) lib_a-stdio.$(OBJEXT) \ + lib_a-strcat.$(OBJEXT) lib_a-strchr.$(OBJEXT) \ + lib_a-strcmp.$(OBJEXT) lib_a-strcpy.$(OBJEXT) \ + lib_a-strcspn.$(OBJEXT) lib_a-strlen.$(OBJEXT) \ + lib_a-strncat.$(OBJEXT) lib_a-strncmp.$(OBJEXT) \ + lib_a-strncpy.$(OBJEXT) lib_a-strpbrk.$(OBJEXT) \ + lib_a-strrchr.$(OBJEXT) lib_a-strspn.$(OBJEXT) \ + lib_a-strxfrm.$(OBJEXT) lib_a-tmpfile.$(OBJEXT) \ + lib_a-tmpnam.$(OBJEXT) lib_a-ungetc.$(OBJEXT) \ + lib_a-usleep.$(OBJEXT) lib_a-vfiprintf.$(OBJEXT) \ + lib_a-vfiscanf.$(OBJEXT) lib_a-vfprintf.$(OBJEXT) \ + lib_a-vfscanf.$(OBJEXT) lib_a-viprintf.$(OBJEXT) \ + lib_a-viscanf.$(OBJEXT) lib_a-vprintf.$(OBJEXT) \ + lib_a-vscanf.$(OBJEXT) lib_a-vsiprintf.$(OBJEXT) \ + lib_a-vsiscanf.$(OBJEXT) lib_a-vsniprintf.$(OBJEXT) \ + lib_a-vsnprintf.$(OBJEXT) lib_a-vsprintf.$(OBJEXT) \ + lib_a-vsscanf.$(OBJEXT) lib_a-stack_reg_va.$(OBJEXT) lib_a_OBJECTS = $(am_lib_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) depcomp = @@ -262,10 +262,10 @@ lib_a_SOURCES = setjmp.S assert.c clearerr.c creat.c fclose.c feof.c \ ferror.c fflush.c fgetc.c fgetpos.c fgets.c fileno.c fiprintf.S \ fiscanf.S fopen.c fprintf.S fputc.c fputs.c fread.c freopen.c \ fscanf.S fseek.c fsetpos.c ftell.c fwrite.c getc.c getchar.c \ - gets.c iprintf.S iscanf.S memcmp.c memcpy.c memmove.c memset.c \ - perror.c printf.S putc.c putchar.c puts.c remove.c rename.c \ - rewind.c scanf.S setbuf.c setvbuf.c siprintf.S siscanf.S sleep.c \ - sniprintf.S snprintf.S sprintf.S sscanf.S stdio.c strcat.c \ + gets.c impure.c iprintf.S iscanf.S memcmp.c memcpy.c memmove.c \ + memset.c perror.c printf.S putc.c putchar.c puts.c remove.c \ + rename.c rewind.c scanf.S setbuf.c setvbuf.c siprintf.S siscanf.S \ + sleep.c sniprintf.S snprintf.S sprintf.S sscanf.S stdio.c strcat.c \ strchr.c strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c \ strncpy.c strpbrk.c strrchr.c strspn.c strxfrm.c tmpfile.c \ tmpnam.c ungetc.c usleep.c vfiprintf.c vfiscanf.c vfprintf.c \ @@ -574,6 +574,12 @@ lib_a-gets.o: gets.c lib_a-gets.obj: gets.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gets.obj `if test -f 'gets.c'; then $(CYGPATH_W) 'gets.c'; else $(CYGPATH_W) '$(srcdir)/gets.c'; fi` +lib_a-impure.o: impure.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-impure.o `test -f 'impure.c' || echo '$(srcdir)/'`impure.c + +lib_a-impure.obj: impure.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-impure.obj `if test -f 'impure.c'; then $(CYGPATH_W) 'impure.c'; else $(CYGPATH_W) '$(srcdir)/impure.c'; fi` + lib_a-memcmp.o: memcmp.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcmp.o `test -f 'memcmp.c' || echo '$(srcdir)/'`memcmp.c diff --git a/newlib/libc/machine/spu/impure.c b/newlib/libc/machine/spu/impure.c new file mode 100644 index 000000000..d403ae512 --- /dev/null +++ b/newlib/libc/machine/spu/impure.c @@ -0,0 +1,14 @@ +#include <reent.h> + +/* Note that there is a copy of this in sys/reent.h. */ +#ifndef __ATTRIBUTE_IMPURE_PTR__ +#define __ATTRIBUTE_IMPURE_PTR__ +#endif + +#ifndef __ATTRIBUTE_IMPURE_DATA__ +#define __ATTRIBUTE_IMPURE_DATA__ +#endif + +struct _reent __ATTRIBUTE_IMPURE_DATA__ _impure_data = _REENT_INIT(impure_data); +struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr = &_impure_data; +struct _reent *_CONST __ATTRIBUTE_IMPURE_PTR__ _global_impure_ptr = &_impure_data; diff --git a/newlib/libc/machine/spu/sys/errno.h b/newlib/libc/machine/spu/sys/errno.h index 28a327774..62768126e 100644 --- a/newlib/libc/machine/spu/sys/errno.h +++ b/newlib/libc/machine/spu/sys/errno.h @@ -19,10 +19,6 @@ on which it is based, except values used or returned by syscalls must be those of the Linux ppc. */ -/* errno is not a global variable, because that would make using it - non-reentrant. Instead, its address is returned by the function - __errno. */ - #ifndef _SYS_ERRNO_H_ #ifdef __cplusplus extern "C" { @@ -31,10 +27,8 @@ extern "C" { #include <sys/reent.h> -#ifndef _REENT_ONLY -#define errno (*__errno()) -extern int *__errno _PARAMS ((void)); -#endif +extern struct _reent _reent_data; +#define errno (_reent_data._errno) /* Please don't use these variables directly. Use strerror instead. */ |