From: Jaydeep Patil <jaydeep.patil@imgtec.com>
Signed-off-by: Jaydeep Patil <jaydeep.patil@imgtec.com>
Signed-off-by: Aleksandar Rikalo <arikalo@gmail.com>
---
newlib/Makefile.am | 2 +-
newlib/Makefile.in | 2 +-
newlib/configure.host | 1 +
newlib/libc/include/machine/endian.h | 5 +++++
newlib/libc/include/machine/ieeefp.h | 6 ++++++
newlib/libc/include/sys/config.h | 2 +-
newlib/libc/include/sys/stat.h | 4 ++++
newlib/libc/machine/mips/strlen.c | 20 ++++++--------------
8 files changed, 25 insertions(+), 17 deletions(-)
@@ -260,7 +260,7 @@ CLEANFILES += stmp-targ-include
install-data-local: install-toollibLIBRARIES install-multi $(INSTALL_DATA_LOCAL)
rm -f $(DESTDIR)$(toollibdir)/libg.a
ln $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a >/dev/null 2>/dev/null || cp $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a
- -if [ -z "$(MULTISUBDIR)" ]; then \
+ -if [ -z "$(MULTISUBDIR)" -o -n "$(MULTIDIRS)" ]; then \
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include; \
for i in $(srcdir)/libc/include/*.h; do \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/`basename $$i`; \
@@ -51009,7 +51009,7 @@ stmp-targ-include: config.status
install-data-local: install-toollibLIBRARIES install-multi $(INSTALL_DATA_LOCAL)
rm -f $(DESTDIR)$(toollibdir)/libg.a
ln $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a >/dev/null 2>/dev/null || cp $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a
- -if [ -z "$(MULTISUBDIR)" ]; then \
+ -if [ -z "$(MULTISUBDIR)" -o -n "$(MULTIDIRS)" ]; then \
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include; \
for i in $(srcdir)/libc/include/*.h; do \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/`basename $$i`; \
@@ -251,6 +251,7 @@ case "${host_cpu}" in
mips*)
machine_dir=mips
libm_machine_dir=mips
+ newlib_cflags="${newlib_cflags}"
;;
mmix)
;;
@@ -1,8 +1,11 @@
#ifndef __MACHINE_ENDIAN_H__
#define __MACHINE_ENDIAN_H__
+#ifndef __ASSEMBLER__
#include <sys/cdefs.h>
#include <sys/_types.h>
+#endif
+
#include <machine/_endian.h>
#if _BYTE_ORDER == _LITTLE_ENDIAN
@@ -20,6 +23,7 @@
#define BYTE_ORDER _BYTE_ORDER
#endif
+#ifndef __ASSEMBLER__
#ifdef __GNUC__
#define __bswap16(_x) __builtin_bswap16(_x)
#define __bswap32(_x) __builtin_bswap32(_x)
@@ -65,5 +69,6 @@ __bswap64(__uint64_t _x)
#define __ntohs(_x) ((__uint16_t)(_x))
#endif
#endif /* __machine_host_to_from_network_defined */
+#endif /* __ASSEMBLER__ */
#endif /* __MACHINE_ENDIAN_H__ */
@@ -263,9 +263,15 @@
#ifdef __MIPSEL__
#define __IEEE_LITTLE_ENDIAN
+#if __SIZEOF_DOUBLE__ == 4
+#define _DOUBLE_IS_32BITS
+#endif
#endif
#ifdef __MIPSEB__
#define __IEEE_BIG_ENDIAN
+#if __SIZEOF_DOUBLE__ == 4
+#define _DOUBLE_IS_32BITS
+#endif
#endif
#ifdef __MMIX__
@@ -4,7 +4,7 @@
#include <machine/ieeefp.h> /* floating point macros */
#include <sys/features.h> /* POSIX defs */
-#ifdef __aarch64__
+#if defined(__aarch64__) || defined(__mips__)
#define MALLOC_ALIGNMENT 16
#endif
@@ -136,7 +136,11 @@ struct stat
int chmod (const char *__path, mode_t __mode );
int fchmod (int __fd, mode_t __mode);
+#if defined(__mips__) && defined(__mips16)
+int __attribute__((nomips16)) fstat (int __fd, struct stat *__sbuf );
+#else
int fstat (int __fd, struct stat *__sbuf );
+#endif // __mips__
int mkdir (const char *_path, mode_t __mode );
int mkfifo (const char *__path, mode_t __mode );
int stat (const char *__restrict __path, struct stat *__restrict __sbuf );
@@ -33,27 +33,21 @@ strlen (const char *str)
}
#elif defined(__mips64)
__asm__("" /* 64-bit MIPS targets */
- " .set noreorder\n"
- " .set nomacro\n"
" .globl strlen\n"
" .ent strlen\n"
"strlen:\n"
" daddiu $2,$4,1\n"
"\n"
"1: lbu $3,0($4)\n"
- " bnez $3,1b\n"
" daddiu $4,$4,1\n"
+ " bnez $3,1b\n"
"\n"
- " jr $31\n"
" dsubu $2,$4,$2\n"
- " .end strlen\n"
- " .set macro\n"
- " .set reorder\n");
+ " jr $31\n"
+ " .end strlen\n");
#else
__asm__("" /* 32-bit MIPS targets */
- " .set noreorder\n"
- " .set nomacro\n"
" .globl strlen\n"
" .ent strlen\n"
"strlen:\n"
@@ -63,12 +57,10 @@ __asm__("" /* 32-bit MIPS targets */
#if defined(_R3000)
" nop \n"
#endif
- " bnez $3,1b\n"
" addiu $4,$4,1\n"
+ " bnez $3,1b\n"
"\n"
- " jr $31\n"
" subu $2,$4,$2\n"
- " .end strlen\n"
- " .set macro\n"
- " .set reorder\n");
+ " jr $31\n"
+ " .end strlen\n");
#endif