diff options
Diffstat (limited to 'ports/sysdeps/mips')
-rw-r--r-- | ports/sysdeps/mips/Makefile | 6 | ||||
-rw-r--r-- | ports/sysdeps/mips/dl-machine.h | 17 | ||||
-rw-r--r-- | ports/sysdeps/mips/dl-procinfo.c | 64 | ||||
-rw-r--r-- | ports/sysdeps/mips/dl-procinfo.h | 68 | ||||
-rw-r--r-- | ports/sysdeps/mips/dl-trampoline.c | 30 | ||||
-rw-r--r-- | ports/sysdeps/mips/fpu/libm-test-ulps | 42 | ||||
-rw-r--r-- | ports/sysdeps/mips/mips32/crti.S | 92 | ||||
-rw-r--r-- | ports/sysdeps/mips/mips32/crtn.S | 56 | ||||
-rw-r--r-- | ports/sysdeps/mips/mips64/n32/crti.S | 92 | ||||
-rw-r--r-- | ports/sysdeps/mips/mips64/n32/crtn.S | 58 | ||||
-rw-r--r-- | ports/sysdeps/mips/mips64/n32/libm-test-ulps | 42 | ||||
-rw-r--r-- | ports/sysdeps/mips/mips64/n64/crti.S | 92 | ||||
-rw-r--r-- | ports/sysdeps/mips/mips64/n64/crtn.S | 58 | ||||
-rw-r--r-- | ports/sysdeps/mips/mips64/n64/libm-test-ulps | 42 | ||||
-rw-r--r-- | ports/sysdeps/mips/sys/tas.h | 70 |
15 files changed, 817 insertions, 12 deletions
diff --git a/ports/sysdeps/mips/Makefile b/ports/sysdeps/mips/Makefile index fdd2c5b50..d87b2c406 100644 --- a/ports/sysdeps/mips/Makefile +++ b/ports/sysdeps/mips/Makefile @@ -21,11 +21,13 @@ CFLAGS-tst-backtrace6.c += -funwind-tables endif ifeq ($(subdir),csu) -CFLAGS-initfini.s += -fno-unwind-tables +CPPFLAGS-crti.S += $(pic-ccflag) +CPPFLAGS-crtn.S += $(pic-ccflag) endif ifeq ($(subdir),nptl) -CFLAGS-pt-initfini.s += -fno-unwind-tables +CPPFLAGS-pt-crti.S += $(pic-ccflag) +CPPFLAGS-crtn.S += $(pic-ccflag) endif ASFLAGS-.os += $(pic-ccflag) diff --git a/ports/sysdeps/mips/dl-machine.h b/ports/sysdeps/mips/dl-machine.h index 836c47f81..eaa385bdb 100644 --- a/ports/sysdeps/mips/dl-machine.h +++ b/ports/sysdeps/mips/dl-machine.h @@ -1,6 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. MIPS version. - Copyright (C) 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2011 - Free Software Foundation, Inc. + Copyright (C) 1996-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>. @@ -209,7 +208,7 @@ do { \ when it is called to store away the arguments passed to it. - 2) That under Linux the entry is named __start + 2) That under Unix the entry is named __start and not just plain _start. */ #define RTLD_START asm (\ @@ -296,6 +295,18 @@ do { \ # define ARCH_LA_PLTEXIT mips_n64_gnu_pltexit # endif +/* We define an initialization function. This is called very early in + _dl_sysdep_start. */ +#define DL_PLATFORM_INIT dl_platform_init () + +static inline void __attribute__ ((unused)) +dl_platform_init (void) +{ + if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0') + /* Avoid an empty string which would disturb us. */ + GLRO(dl_platform) = NULL; +} + /* For a non-writable PLT, rewrite the .got.plt entry at RELOC_ADDR to point at the symbol with address VALUE. For a writable PLT, rewrite the corresponding PLT entry instead. */ diff --git a/ports/sysdeps/mips/dl-procinfo.c b/ports/sysdeps/mips/dl-procinfo.c new file mode 100644 index 000000000..3e8a4fb59 --- /dev/null +++ b/ports/sysdeps/mips/dl-procinfo.c @@ -0,0 +1,64 @@ +/* Data for Mips version of processor capability information. + Copyright (C) 2007-2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Robert Millan <rmh@gnu.org>. + + The GNU C Library is free software; you can redistribute it and/or + 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 + Lesser General Public License for more details. + + 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. */ + +/* This information must be kept in sync with the _DL_PLATFORM_COUNT + definitions in procinfo.h. + + If anything should be added here check whether the size of each string + is still ok with the given array size. + + All the #ifdefs in the definitions are quite irritating but + necessary if we want to avoid duplicating the information. There + are three different modes: + + - PROCINFO_DECL is defined. This means we are only interested in + declarations. + + - PROCINFO_DECL is not defined: + + + if SHARED is defined the file is included in an array + initializer. The .element = { ... } syntax is needed. + + + if SHARED is not defined a normal array initialization is + needed. + */ + +#ifndef PROCINFO_CLASS +#define PROCINFO_CLASS +#endif + +#if !defined PROCINFO_DECL && defined SHARED + ._dl_mips_platforms +#else +PROCINFO_CLASS const char _dl_mips_platforms[4][11] +#endif +#ifndef PROCINFO_DECL += { + "loongson2e", "loongson2f", "octeon", "octeon2" + } +#endif +#if !defined SHARED || defined PROCINFO_DECL +; +#else +, +#endif + +#undef PROCINFO_DECL +#undef PROCINFO_CLASS diff --git a/ports/sysdeps/mips/dl-procinfo.h b/ports/sysdeps/mips/dl-procinfo.h new file mode 100644 index 000000000..3493d81de --- /dev/null +++ b/ports/sysdeps/mips/dl-procinfo.h @@ -0,0 +1,68 @@ +/* Mips version of processor capability information handling macros. + Copyright (C) 2007-2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Robert Millan <rmh@gnu.org>. + + The GNU C Library is free software; you can redistribute it and/or + 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 + Lesser General Public License for more details. + + 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 _DL_PROCINFO_H +#define _DL_PROCINFO_H 1 + +#include <ldsodefs.h> + + +/* Mask to filter out platforms. */ +#define _DL_HWCAP_PLATFORM (-1ULL) + +#define _DL_PLATFORMS_COUNT 4 + +static inline const char * +__attribute__ ((unused)) +_dl_platform_string (int idx) +{ + return GLRO(dl_mips_platforms)[idx]; +}; + +static inline int +__attribute__ ((unused, always_inline)) +_dl_string_platform (const char *str) +{ + int i; + + if (str != NULL) + for (i = 0; i < _DL_PLATFORMS_COUNT; ++i) + { + if (strcmp (str, _dl_platform_string (i)) == 0) + return i; + } + return -1; +}; + +/* We cannot provide a general printing function. */ +#define _dl_procinfo(word) -1 + +/* There are no hardware capabilities defined. */ +#define _dl_hwcap_string(idx) "" + +/* By default there is no important hardware capability. */ +#define HWCAP_IMPORTANT (0) + +/* We don't have any hardware capabilities. */ +#define _DL_HWCAP_COUNT 0 + +#define _dl_string_hwcap(str) (-1) + +#endif /* dl-procinfo.h */ diff --git a/ports/sysdeps/mips/dl-trampoline.c b/ports/sysdeps/mips/dl-trampoline.c index 2c9414035..c4367f7a3 100644 --- a/ports/sysdeps/mips/dl-trampoline.c +++ b/ports/sysdeps/mips/dl-trampoline.c @@ -26,6 +26,7 @@ #include <elf.h> #include <ldsodefs.h> #include <dl-machine.h> +#include <sysdep-cancel.h> /* Get link map for callers object containing STUB_PC. */ static inline struct link_map * @@ -153,17 +154,44 @@ __dl_runtime_resolve (ElfW(Word) sym_index, if (version->hash != 0) { + /* We need to keep the scope around so do some locking. This is + not necessary for objects which cannot be unloaded or when + we are not using any threads (yet). */ + if (!RTLD_SINGLE_THREAD_P) + THREAD_GSCOPE_SET_FLAG (); + sym_map = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym, l->l_scope, version, ELF_RTYPE_CLASS_PLT, 0, 0); + + /* We are done with the global scope. */ + if (!RTLD_SINGLE_THREAD_P) + THREAD_GSCOPE_RESET_FLAG (); + break; } /* Fall through. */ } case 0: + { + /* We need to keep the scope around so do some locking. This is + not necessary for objects which cannot be unloaded or when + we are not using any threads (yet). */ + int flags = DL_LOOKUP_ADD_DEPENDENCY; + if (!RTLD_SINGLE_THREAD_P) + { + THREAD_GSCOPE_SET_FLAG (); + flags |= DL_LOOKUP_GSCOPE_LOCK; + } + sym_map = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym, l->l_scope, 0, ELF_RTYPE_CLASS_PLT, - DL_LOOKUP_ADD_DEPENDENCY, 0); + flags, 0); + + /* We are done with the global scope. */ + if (!RTLD_SINGLE_THREAD_P) + THREAD_GSCOPE_RESET_FLAG (); + } } /* Currently value contains the base load address of the object diff --git a/ports/sysdeps/mips/fpu/libm-test-ulps b/ports/sysdeps/mips/fpu/libm-test-ulps index b51449667..ff24b738c 100644 --- a/ports/sysdeps/mips/fpu/libm-test-ulps +++ b/ports/sysdeps/mips/fpu/libm-test-ulps @@ -429,8 +429,15 @@ float: 3 idouble: 4 ifloat: 3 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6": +double: 1 float: 4 +idouble: 1 ifloat: 4 +Test "jn (2, 2.4048255576957729) == 0.43175480701968038399746111312430703": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4": double: 1 float: 1 @@ -451,6 +458,37 @@ double: 1 float: 2 idouble: 1 ifloat: 2 +Test "jn (3, 2.4048255576957729) == 0.19899990535769083404042146764530813": +double: 3 +idouble: 3 +Test "jn (4, 2.4048255576957729) == 0.647466661641779720084932282551219891E-1": +double: 1 +idouble: 1 +Test "jn (5, 2.4048255576957729) == 0.163892432048058525099230549946147698E-1": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "jn (6, 2.4048255576957729) == 0.34048184720278336646673682895929161E-2": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +Test "jn (7, 2.4048255576957729) == 0.60068836573295394221291569249883076E-3": +double: 3 +float: 5 +idouble: 3 +ifloat: 5 +Test "jn (8, 2.4048255576957729) == 0.92165786705344923232879022467054148E-4": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +Test "jn (9, 2.4048255576957729) == 0.12517270977961513005428966643852564E-4": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 # lgamma Test "lgamma (0.7) == 0.260867246531666514385732417016759578": @@ -833,9 +871,9 @@ ifloat: 2 Function: "jn": double: 4 -float: 4 +float: 5 idouble: 4 -ifloat: 4 +ifloat: 5 Function: "lgamma": double: 1 diff --git a/ports/sysdeps/mips/mips32/crti.S b/ports/sysdeps/mips/mips32/crti.S new file mode 100644 index 000000000..1c7e95d4d --- /dev/null +++ b/ports/sysdeps/mips/mips32/crti.S @@ -0,0 +1,92 @@ +/* Special .init and .fini section support for MIPS (o32). + Copyright (C) 1995-2012 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 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. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + 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 + Lesser General Public License for more details. + + 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. */ + +/* crti.S puts a function prologue at the beginning of the .init and + .fini sections and defines global symbols for those addresses, so + they can be called as functions. The symbols _init and _fini are + magic and cause the linker to emit DT_INIT and DT_FINI. */ + +#include <libc-symbols.h> + +#ifndef PREINIT_FUNCTION +# define PREINIT_FUNCTION __gmon_start__ +#endif + +#ifndef PREINIT_FUNCTION_WEAK +# define PREINIT_FUNCTION_WEAK 1 +#endif + +#if PREINIT_FUNCTION_WEAK + weak_extern (PREINIT_FUNCTION) +#else + .hidden PREINIT_FUNCTION +#endif + + .section .init,"ax",@progbits + .p2align 2 + .globl _init + .type _init, @function +_init: + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-32 + .cprestore 16 + sw $31,28($sp) +#if PREINIT_FUNCTION_WEAK + lw $2,%got(PREINIT_FUNCTION)($28) + beq $2,$0,.Lno_weak_fn + lw $25,%call16(PREINIT_FUNCTION)($28) + .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION +1: jalr $25 +.Lno_weak_fn: +#else + lw $25,%got(PREINIT_FUNCTION)($28) + .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION +1: jalr $25 +#endif + + .section .fini,"ax",@progbits + .p2align 2 + .globl _fini + .type _fini, @function +_fini: + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-32 + .cprestore 16 + sw $31,28($sp) diff --git a/ports/sysdeps/mips/mips32/crtn.S b/ports/sysdeps/mips/mips32/crtn.S new file mode 100644 index 000000000..9fb564d46 --- /dev/null +++ b/ports/sysdeps/mips/mips32/crtn.S @@ -0,0 +1,56 @@ +/* Special .init and .fini section support for MIPS (o32). + Copyright (C) 1995-2012 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 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. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + 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 + Lesser General Public License for more details. + + 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. */ + +/* crtn.S puts function epilogues in the .init and .fini sections + corresponding to the prologues in crti.S. */ + + .section .init,"ax",@progbits + lw $31,28($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + + .section .fini,"ax",@progbits + lw $31,28($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder diff --git a/ports/sysdeps/mips/mips64/n32/crti.S b/ports/sysdeps/mips/mips64/n32/crti.S new file mode 100644 index 000000000..92b00c20e --- /dev/null +++ b/ports/sysdeps/mips/mips64/n32/crti.S @@ -0,0 +1,92 @@ +/* Special .init and .fini section support for MIPS (n32). + Copyright (C) 1995-2012 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 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. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + 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 + Lesser General Public License for more details. + + 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. */ + +/* crti.S puts a function prologue at the beginning of the .init and + .fini sections and defines global symbols for those addresses, so + they can be called as functions. The symbols _init and _fini are + magic and cause the linker to emit DT_INIT and DT_FINI. */ + +#include <libc-symbols.h> + +#ifndef PREINIT_FUNCTION +# define PREINIT_FUNCTION __gmon_start__ +#endif + +#ifndef PREINIT_FUNCTION_WEAK +# define PREINIT_FUNCTION_WEAK 1 +#endif + +#if PREINIT_FUNCTION_WEAK + weak_extern (PREINIT_FUNCTION) +#else + .hidden PREINIT_FUNCTION +#endif + + .section .init,"ax",@progbits + .p2align 2 + .globl _init + .type _init, @function +_init: + addiu $sp,$sp,-16 + sd $28,0($sp) + lui $28,%hi(%neg(%gp_rel(_init))) + addu $28,$28,$25 + sd $31,8($sp) + addiu $28,$28,%lo(%neg(%gp_rel(_init))) +#if PREINIT_FUNCTION_WEAK + lw $2,%got_disp(PREINIT_FUNCTION)($28) + beq $2,$0,.Lno_weak_fn + lw $25,%call16(PREINIT_FUNCTION)($28) + .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION +1: jalr $25 +.Lno_weak_fn: +#else + lw $25,%got_disp(PREINIT_FUNCTION)($28) + .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION +1: jalr $25 +#endif + + .section .fini,"ax",@progbits + .p2align 2 + .globl _fini + .type _fini, @function +_fini: + addiu $sp,$sp,-16 + sd $28,0($sp) + lui $28,%hi(%neg(%gp_rel(_fini))) + addu $28,$28,$25 + sd $31,8($sp) + addiu $28,$28,%lo(%neg(%gp_rel(_fini))) diff --git a/ports/sysdeps/mips/mips64/n32/crtn.S b/ports/sysdeps/mips/mips64/n32/crtn.S new file mode 100644 index 000000000..376582a69 --- /dev/null +++ b/ports/sysdeps/mips/mips64/n32/crtn.S @@ -0,0 +1,58 @@ +/* Special .init and .fini section support for MIPS (n32). + Copyright (C) 1995-2012 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 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. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + 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 + Lesser General Public License for more details. + + 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. */ + +/* crtn.S puts function epilogues in the .init and .fini sections + corresponding to the prologues in crti.S. */ + + .section .init,"ax",@progbits + ld $31,8($sp) + ld $28,0($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,16 + .set macro + .set reorder + + .section .fini,"ax",@progbits + ld $31,8($sp) + ld $28,0($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,16 + .set macro + .set reorder diff --git a/ports/sysdeps/mips/mips64/n32/libm-test-ulps b/ports/sysdeps/mips/mips64/n32/libm-test-ulps index d9df631d7..f66e4cb6b 100644 --- a/ports/sysdeps/mips/mips64/n32/libm-test-ulps +++ b/ports/sysdeps/mips/mips64/n32/libm-test-ulps @@ -612,8 +612,15 @@ ifloat: 3 ildouble: 2 ldouble: 2 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6": +double: 1 float: 4 +idouble: 1 ifloat: 4 +Test "jn (2, 2.4048255576957729) == 0.43175480701968038399746111312430703": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4": double: 1 float: 1 @@ -636,6 +643,37 @@ double: 1 float: 2 idouble: 1 ifloat: 2 +Test "jn (3, 2.4048255576957729) == 0.19899990535769083404042146764530813": +double: 3 +idouble: 3 +Test "jn (4, 2.4048255576957729) == 0.647466661641779720084932282551219891E-1": +double: 1 +idouble: 1 +Test "jn (5, 2.4048255576957729) == 0.163892432048058525099230549946147698E-1": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "jn (6, 2.4048255576957729) == 0.34048184720278336646673682895929161E-2": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +Test "jn (7, 2.4048255576957729) == 0.60068836573295394221291569249883076E-3": +double: 3 +float: 5 +idouble: 3 +ifloat: 5 +Test "jn (8, 2.4048255576957729) == 0.92165786705344923232879022467054148E-4": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +Test "jn (9, 2.4048255576957729) == 0.12517270977961513005428966643852564E-4": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 # lgamma Test "lgamma (-0.5) == log(2*sqrt(pi))": @@ -1158,9 +1196,9 @@ ldouble: 4 Function: "jn": double: 4 -float: 4 +float: 5 idouble: 4 -ifloat: 4 +ifloat: 5 ildouble: 4 ldouble: 4 diff --git a/ports/sysdeps/mips/mips64/n64/crti.S b/ports/sysdeps/mips/mips64/n64/crti.S new file mode 100644 index 000000000..42b26dc2b --- /dev/null +++ b/ports/sysdeps/mips/mips64/n64/crti.S @@ -0,0 +1,92 @@ +/* Special .init and .fini section support for MIPS (n64). + Copyright (C) 1995-2012 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 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. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + 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 + Lesser General Public License for more details. + + 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. */ + +/* crti.S puts a function prologue at the beginning of the .init and + .fini sections and defines global symbols for those addresses, so + they can be called as functions. The symbols _init and _fini are + magic and cause the linker to emit DT_INIT and DT_FINI. */ + +#include <libc-symbols.h> + +#ifndef PREINIT_FUNCTION +# define PREINIT_FUNCTION __gmon_start__ +#endif + +#ifndef PREINIT_FUNCTION_WEAK +# define PREINIT_FUNCTION_WEAK 1 +#endif + +#if PREINIT_FUNCTION_WEAK + weak_extern (PREINIT_FUNCTION) +#else + .hidden PREINIT_FUNCTION +#endif + + .section .init,"ax",@progbits + .p2align 2 + .globl _init + .type _init, @function +_init: + daddiu $sp,$sp,-16 + sd $28,0($sp) + lui $28,%hi(%neg(%gp_rel(_init))) + daddu $28,$28,$25 + sd $31,8($sp) + daddiu $28,$28,%lo(%neg(%gp_rel(_init))) +#if PREINIT_FUNCTION_WEAK + ld $2,%got_disp(PREINIT_FUNCTION)($28) + beq $2,$0,.Lno_weak_fn + ld $25,%call16(PREINIT_FUNCTION)($28) + .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION +1: jalr $25 +.Lno_weak_fn: +#else + ld $25,%got_disp(PREINIT_FUNCTION)($28) + .reloc 1f,R_MIPS_JALR,PREINIT_FUNCTION +1: jalr $25 +#endif + + .section .fini,"ax",@progbits + .p2align 2 + .globl _fini + .type _fini, @function +_fini: + daddiu $sp,$sp,-16 + sd $28,0($sp) + lui $28,%hi(%neg(%gp_rel(_fini))) + daddu $28,$28,$25 + sd $31,8($sp) + daddiu $28,$28,%lo(%neg(%gp_rel(_fini))) diff --git a/ports/sysdeps/mips/mips64/n64/crtn.S b/ports/sysdeps/mips/mips64/n64/crtn.S new file mode 100644 index 000000000..3f901c8c9 --- /dev/null +++ b/ports/sysdeps/mips/mips64/n64/crtn.S @@ -0,0 +1,58 @@ +/* Special .init and .fini section support for MIPS (n64). + Copyright (C) 1995-2012 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 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. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + 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 + Lesser General Public License for more details. + + 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. */ + +/* crtn.S puts function epilogues in the .init and .fini sections + corresponding to the prologues in crti.S. */ + + .section .init,"ax",@progbits + ld $31,8($sp) + ld $28,0($sp) + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,16 + .set macro + .set reorder + + .section .fini,"ax",@progbits + ld $31,8($sp) + ld $28,0($sp) + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,16 + .set macro + .set reorder diff --git a/ports/sysdeps/mips/mips64/n64/libm-test-ulps b/ports/sysdeps/mips/mips64/n64/libm-test-ulps index d9df631d7..f66e4cb6b 100644 --- a/ports/sysdeps/mips/mips64/n64/libm-test-ulps +++ b/ports/sysdeps/mips/mips64/n64/libm-test-ulps @@ -612,8 +612,15 @@ ifloat: 3 ildouble: 2 ldouble: 2 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6": +double: 1 float: 4 +idouble: 1 ifloat: 4 +Test "jn (2, 2.4048255576957729) == 0.43175480701968038399746111312430703": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4": double: 1 float: 1 @@ -636,6 +643,37 @@ double: 1 float: 2 idouble: 1 ifloat: 2 +Test "jn (3, 2.4048255576957729) == 0.19899990535769083404042146764530813": +double: 3 +idouble: 3 +Test "jn (4, 2.4048255576957729) == 0.647466661641779720084932282551219891E-1": +double: 1 +idouble: 1 +Test "jn (5, 2.4048255576957729) == 0.163892432048058525099230549946147698E-1": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "jn (6, 2.4048255576957729) == 0.34048184720278336646673682895929161E-2": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +Test "jn (7, 2.4048255576957729) == 0.60068836573295394221291569249883076E-3": +double: 3 +float: 5 +idouble: 3 +ifloat: 5 +Test "jn (8, 2.4048255576957729) == 0.92165786705344923232879022467054148E-4": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +Test "jn (9, 2.4048255576957729) == 0.12517270977961513005428966643852564E-4": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 # lgamma Test "lgamma (-0.5) == log(2*sqrt(pi))": @@ -1158,9 +1196,9 @@ ldouble: 4 Function: "jn": double: 4 -float: 4 +float: 5 idouble: 4 -ifloat: 4 +ifloat: 5 ildouble: 4 ldouble: 4 diff --git a/ports/sysdeps/mips/sys/tas.h b/ports/sysdeps/mips/sys/tas.h new file mode 100644 index 000000000..c5c80550e --- /dev/null +++ b/ports/sysdeps/mips/sys/tas.h @@ -0,0 +1,70 @@ +/* Copyright (C) 2000, 2002, 2003, 2004, 2007, 2009 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Maciej W. Rozycki <macro@ds2.pg.gda.pl>, 2000. + + The GNU C Library is free software; you can redistribute it and/or + 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 + Lesser General Public License for more details. + + 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 _SYS_TAS_H +#define _SYS_TAS_H 1 + +#include <features.h> +#include <sgidefs.h> + +__BEGIN_DECLS + +extern int _test_and_set (int *__p, int __v) __THROW; + +#ifdef __USE_EXTERN_INLINES + +# ifndef _EXTERN_INLINE +# define _EXTERN_INLINE __extern_inline +# endif + +_EXTERN_INLINE int +__NTH (_test_and_set (int *__p, int __v)) +{ + int __r, __t; + + __asm__ __volatile__ + ("/* Inline test and set */\n" + ".set push\n\t" +#if _MIPS_SIM == _ABIO32 + ".set mips2\n\t" +#endif + "sync\n\t" + "1:\n\t" + "ll %0,%3\n\t" + "move %1,%4\n\t" + "beq %0,%4,2f\n\t" + "sc %1,%2\n\t" + "beqz %1,1b\n" + "sync\n\t" + ".set pop\n\t" + "2:\n\t" + "/* End test and set */" + : "=&r" (__r), "=&r" (__t), "=m" (*__p) + : "m" (*__p), "r" (__v) + : "memory"); + + return __r; +} + +#endif /* __USE_EXTERN_INLINES */ + +__END_DECLS + +#endif /* sys/tas.h */ |