aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Lapshin <alexey.lapshin@espressif.com>2024-08-30 09:35:24 +0000
committerCorinna Vinschen <corinna@vinschen.de>2024-09-02 22:16:59 +0200
commit48f1655c955c154b3165692e02aa66699212453c (patch)
tree77202441d11fbca54008a01ddcc3da8857b12855
parentf78009cb1ccf84cc343cf2441c76196461d87532 (diff)
downloadnewlib-48f1655c955c154b3165692e02aa66699212453c.zip
newlib-48f1655c955c154b3165692e02aa66699212453c.tar.gz
newlib-48f1655c955c154b3165692e02aa66699212453c.tar.bz2
newlib: xtensa: remove sys/xtensa. use machine/xtensa
Remove sys/xtensa that is actually duplicate newlib's code. Move used code to machine/xtensa or to libgloss
-rw-r--r--libgloss/xtensa/Makefile.inc1
-rw-r--r--libgloss/xtensa/clibrary_init.c (renamed from newlib/libc/sys/xtensa/clibrary_init.c)6
-rw-r--r--newlib/Makefile.am6
-rwxr-xr-xnewlib/configure13
-rw-r--r--newlib/libc/acinclude.m41
-rw-r--r--newlib/libc/machine/xtensa/include/xtensa/config/core-isa.h (renamed from newlib/libc/sys/xtensa/include/xtensa/config/core-isa.h)0
-rw-r--r--newlib/libc/machine/xtensa/sys/fenv.h (renamed from newlib/libc/sys/xtensa/include/fenv.h)6
-rw-r--r--newlib/libc/sys/Makefile.inc3
-rw-r--r--newlib/libc/sys/xtensa/Makefile.inc1
-rw-r--r--newlib/libc/sys/xtensa/creat.c9
-rw-r--r--newlib/libc/sys/xtensa/crt0.c16
-rw-r--r--newlib/libc/sys/xtensa/include/unistd.h13
-rw-r--r--newlib/libc/sys/xtensa/isatty.c18
-rw-r--r--newlib/libc/sys/xtensa/sys/file.h33
-rw-r--r--newlib/libm/machine/xtensa/acinclude.m42
15 files changed, 13 insertions, 115 deletions
diff --git a/libgloss/xtensa/Makefile.inc b/libgloss/xtensa/Makefile.inc
index b4c8187..5cdb4ef 100644
--- a/libgloss/xtensa/Makefile.inc
+++ b/libgloss/xtensa/Makefile.inc
@@ -22,6 +22,7 @@ multilibtool_DATA += \
%D%/crt1-boards.o
%C%_libgloss_a_SOURCES = \
+ %D%/clibrary_init.c \
%D%/sleep.S \
%D%/syscalls.c \
%D%/window-vectors.S
diff --git a/newlib/libc/sys/xtensa/clibrary_init.c b/libgloss/xtensa/clibrary_init.c
index 24d4cf9..b8c7d3a 100644
--- a/newlib/libc/sys/xtensa/clibrary_init.c
+++ b/libgloss/xtensa/clibrary_init.c
@@ -1,6 +1,6 @@
/* Copyright (c) 2003-2006 Tensilica Inc. ALL RIGHTS RESERVED.
- Redistribution and use in source and binary forms, with or without
+ Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
@@ -29,8 +29,8 @@ const char * __progname = 0;
void
__clibrary_init (int argc, char **argv, char **envp,
- void (*init)(void),
- void (*fini)(void))
+ void (*init)(void),
+ void (*fini)(void))
{
if (argv != 0)
__progname = *argv;
diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index 4ab36b8..87a7f85 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -233,7 +233,11 @@ stmp-targ-include: config.status
fi
$(AM_V_at)s=machine/$(machine_dir)/machine d=machine $(TARG_INCLUDE_CP_DIR)
$(AM_V_at)s=machine/$(machine_dir)/sys d=sys $(TARG_INCLUDE_CP_DIR)
- $(AM_V_at)s=machine/$(machine_dir)/include d= $(TARG_INCLUDE_CP_DIR)
+ $(AM_V_at)for i in $(call rwildcard,$(srcdir)/libc/machine/$(machine_dir)/include/,*.h); do \
+ f=`echo $$i | sed s:^$(srcdir)/libc/machine/$(machine_dir)/include/::`; \
+ $(MKDIR_P) targ-include/`dirname $$f`; \
+ cp $$i targ-include/$$f; \
+ done
$(AM_V_at)s=sys/$(sys_dir)/include d= $(TARG_INCLUDE_CP_DIR)
$(AM_V_at)for i in $(call rwildcard,$(srcdir)/libc/sys/$(sys_dir)/include/,*.h); do \
f=`echo $$i | sed s:^$(srcdir)/libc/sys/$(sys_dir)/include/::`; \
diff --git a/newlib/configure b/newlib/configure
index 14ed85e..cb47478 100755
--- a/newlib/configure
+++ b/newlib/configure
@@ -777,8 +777,6 @@ HAVE_LONG_DOUBLE_FALSE
HAVE_LONG_DOUBLE_TRUE
HAVE_LIBC_SYS_Z8KSIM_DIR_FALSE
HAVE_LIBC_SYS_Z8KSIM_DIR_TRUE
-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_TIRTOS_DIR_FALSE
@@ -5514,13 +5512,6 @@ else
HAVE_LIBC_SYS_W65_DIR_TRUE='#'
HAVE_LIBC_SYS_W65_DIR_FALSE=
fi
- if test "${sys_dir}" = xtensa; then
- HAVE_LIBC_SYS_XTENSA_DIR_TRUE=
- HAVE_LIBC_SYS_XTENSA_DIR_FALSE='#'
-else
- HAVE_LIBC_SYS_XTENSA_DIR_TRUE='#'
- HAVE_LIBC_SYS_XTENSA_DIR_FALSE=
-fi
if test "${sys_dir}" = z8ksim; then
HAVE_LIBC_SYS_Z8KSIM_DIR_TRUE=
HAVE_LIBC_SYS_Z8KSIM_DIR_FALSE='#'
@@ -7708,10 +7699,6 @@ 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_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
-fi
if test -z "${HAVE_LIBC_SYS_Z8KSIM_DIR_TRUE}" && test -z "${HAVE_LIBC_SYS_Z8KSIM_DIR_FALSE}"; then
as_fn_error $? "conditional \"HAVE_LIBC_SYS_Z8KSIM_DIR\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/newlib/libc/acinclude.m4 b/newlib/libc/acinclude.m4
index 48a7dee..52a6c57 100644
--- a/newlib/libc/acinclude.m4
+++ b/newlib/libc/acinclude.m4
@@ -23,7 +23,6 @@ m4_foreach_w([SYS_DIR], [
sh sysmec sysnec810 sysnecv850 sysvi386 sysvnecv70
tic80 tirtos
w65
- xtensa
z8ksim
], [AM_CONDITIONAL([HAVE_LIBC_SYS_]m4_toupper(SYS_DIR)[_DIR], test "${sys_dir}" = SYS_DIR)])
diff --git a/newlib/libc/sys/xtensa/include/xtensa/config/core-isa.h b/newlib/libc/machine/xtensa/include/xtensa/config/core-isa.h
index 2accd41..2accd41 100644
--- a/newlib/libc/sys/xtensa/include/xtensa/config/core-isa.h
+++ b/newlib/libc/machine/xtensa/include/xtensa/config/core-isa.h
diff --git a/newlib/libc/sys/xtensa/include/fenv.h b/newlib/libc/machine/xtensa/sys/fenv.h
index 2fa76f7..69c94f0 100644
--- a/newlib/libc/sys/xtensa/include/fenv.h
+++ b/newlib/libc/machine/xtensa/sys/fenv.h
@@ -26,8 +26,8 @@
OF THE POSSIBILITY OF SUCH DAMAGE. */
-#ifndef _FENV_H
-#define _FENV_H
+#ifndef _SYS_FENV_H
+#define _SYS_FENV_H
#ifdef __cplusplus
extern "C" {
@@ -85,4 +85,4 @@ int fegetexcept(void);
}
#endif
-#endif
+#endif // _SYS_FENV_H
diff --git a/newlib/libc/sys/Makefile.inc b/newlib/libc/sys/Makefile.inc
index 24d8407..9f87589 100644
--- a/newlib/libc/sys/Makefile.inc
+++ b/newlib/libc/sys/Makefile.inc
@@ -64,9 +64,6 @@ endif
if HAVE_LIBC_SYS_W65_DIR
include %D%/w65/Makefile.inc
endif
-if HAVE_LIBC_SYS_XTENSA_DIR
-include %D%/xtensa/Makefile.inc
-endif
if HAVE_LIBC_SYS_Z8KSIM_DIR
include %D%/z8ksim/Makefile.inc
endif
diff --git a/newlib/libc/sys/xtensa/Makefile.inc b/newlib/libc/sys/xtensa/Makefile.inc
deleted file mode 100644
index ddee58a..0000000
--- a/newlib/libc/sys/xtensa/Makefile.inc
+++ /dev/null
@@ -1 +0,0 @@
-libc_a_SOURCES += %D%/creat.c %D%/isatty.c %D%/clibrary_init.c
diff --git a/newlib/libc/sys/xtensa/creat.c b/newlib/libc/sys/xtensa/creat.c
deleted file mode 100644
index 21e6a18..0000000
--- a/newlib/libc/sys/xtensa/creat.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* creat() "system call" (copied from libc/posix/creat.c) */
-
-#include <fcntl.h>
-
-int
-creat (const char *path, mode_t mode)
-{
- return open (path, O_WRONLY | O_CREAT | O_TRUNC, mode);
-}
diff --git a/newlib/libc/sys/xtensa/crt0.c b/newlib/libc/sys/xtensa/crt0.c
deleted file mode 100644
index 11725dc..0000000
--- a/newlib/libc/sys/xtensa/crt0.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Dummy crt0 code. */
-
-/* Copyright (c) 2003 by Tensilica Inc. ALL RIGHTS RESERVED.
- These coded instructions, statements, and computer programs are the
- copyrighted works and confidential proprietary information of Tensilica Inc.
- They may not be modified, copied, reproduced, distributed, or disclosed to
- third parties in any manner, medium, or form, in whole or in part, without
- the prior written consent of Tensilica Inc. */
-
-/* Xtensa systems normally use a crt1 file associated with a particular
- linker support package (LSP). There is no need for this crt0 file,
- except that the newlib makefiles require it to exist if there is a
- sys/xtensa directory. The directory exists only to hold the header
- files for the Xtensa ISS semihosting "platform". */
-
-void crt0_unused (void) {}
diff --git a/newlib/libc/sys/xtensa/include/unistd.h b/newlib/libc/sys/xtensa/include/unistd.h
deleted file mode 100644
index 4f6fd29..0000000
--- a/newlib/libc/sys/xtensa/include/unistd.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _UNISTD_H_
-#define _UNISTD_H_
-
-# include <sys/unistd.h>
-
-#ifndef L_SET
-/* Old BSD names for the same constants; just for compatibility. */
-#define L_SET SEEK_SET
-#define L_INCR SEEK_CUR
-#define L_XTND SEEK_END
-#endif
-
-#endif /* _UNISTD_H_ */
diff --git a/newlib/libc/sys/xtensa/isatty.c b/newlib/libc/sys/xtensa/isatty.c
deleted file mode 100644
index fe64209..0000000
--- a/newlib/libc/sys/xtensa/isatty.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* isatty.c */
-
-/* Dumb implementation so programs will at least run. */
-
-#include <sys/stat.h>
-#include <reent.h>
-
-int
-_isatty_r (struct _reent *ptr, int fd)
-{
- struct stat buf;
-
- if (_fstat_r (ptr, fd, &buf) < 0)
- return 0;
- if (S_ISCHR (buf.st_mode))
- return 1;
- return 0;
-}
diff --git a/newlib/libc/sys/xtensa/sys/file.h b/newlib/libc/sys/xtensa/sys/file.h
deleted file mode 100644
index 48a2ca0..0000000
--- a/newlib/libc/sys/xtensa/sys/file.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (c) 2005-2006 Tensilica Inc. ALL RIGHTS RESERVED.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TENSILICA
- INCORPORATED BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-#include <sys/fcntl.h>
-
-/* Alternate names for values for the WHENCE argument to `lseek'.
- These are the same as SEEK_SET, SEEK_CUR, and SEEK_END, respectively. */
-#ifndef L_SET
-#define L_SET 0 /* Seek from beginning of file. */
-#define L_INCR 1 /* Seek from current position. */
-#define L_XTND 2 /* Seek from end of file. */
-#endif
diff --git a/newlib/libm/machine/xtensa/acinclude.m4 b/newlib/libm/machine/xtensa/acinclude.m4
index 4d242e0..fc5001d 100644
--- a/newlib/libm/machine/xtensa/acinclude.m4
+++ b/newlib/libm/machine/xtensa/acinclude.m4
@@ -2,7 +2,7 @@ AC_CACHE_CHECK([for XCHAL_HAVE_FP_SQRT], newlib_cv_xchal_have_fp_sqrt, [dnl
AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
[[#define _LIBM
// targ-include does not exist yet, use relative path
-#include "../sys/xtensa/include/xtensa/config/core-isa.h"
+#include "../machine/xtensa/include/xtensa/config/core-isa.h"
#if (!XCHAL_HAVE_FP_SQRT)
# error "Have not XCHAL_HAVE_FP_SQRT"
#endif