From 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 12 Jul 2007 18:26:36 +0000 Subject: 2.5-18.1 --- sysdeps/sh/Dist | 2 - sysdeps/sh/_mcount.S | 14 +- sysdeps/sh/bits/link.h | 75 ++++++- sysdeps/sh/bits/linkmap.h | 5 + sysdeps/sh/bits/setjmp.h | 11 +- sysdeps/sh/dl-machine.h | 299 ++------------------------ sysdeps/sh/dl-trampoline.S | 431 ++++++++++++++++++++++++++++++++++++++ sysdeps/sh/elf/configure | 2 +- sysdeps/sh/jmpbuf-offsets.h | 20 ++ sysdeps/sh/jmpbuf-unwind.h | 47 +++++ sysdeps/sh/memset.S | 1 + sysdeps/sh/sh3/__longjmp.S | 23 +- sysdeps/sh/sh3/setjmp.S | 29 ++- sysdeps/sh/sh4/Versions | 5 + sysdeps/sh/sh4/__longjmp.S | 23 +- sysdeps/sh/sh4/bits/mathdef.h | 69 ++++++ sysdeps/sh/sh4/dl-machine.h | 2 - sysdeps/sh/sh4/dl-trampoline.S | 2 + sysdeps/sh/sh4/fpu/bits/mathdef.h | 69 ------ sysdeps/sh/sh4/fpu/feholdexcpt.c | 3 +- sysdeps/sh/sh4/fpu/fesetround.c | 3 +- sysdeps/sh/sh4/fpu/libm-test-ulps | 4 +- sysdeps/sh/sh4/setjmp.S | 29 ++- sysdeps/sh/sysdep.h | 11 +- 24 files changed, 779 insertions(+), 400 deletions(-) delete mode 100644 sysdeps/sh/Dist create mode 100644 sysdeps/sh/bits/linkmap.h create mode 100644 sysdeps/sh/dl-trampoline.S create mode 100644 sysdeps/sh/jmpbuf-offsets.h create mode 100644 sysdeps/sh/jmpbuf-unwind.h create mode 100644 sysdeps/sh/sh4/Versions create mode 100644 sysdeps/sh/sh4/bits/mathdef.h delete mode 100644 sysdeps/sh/sh4/dl-machine.h create mode 100644 sysdeps/sh/sh4/dl-trampoline.S delete mode 100644 sysdeps/sh/sh4/fpu/bits/mathdef.h (limited to 'sysdeps/sh') diff --git a/sysdeps/sh/Dist b/sysdeps/sh/Dist deleted file mode 100644 index a6bf2ff..0000000 --- a/sysdeps/sh/Dist +++ /dev/null @@ -1,2 +0,0 @@ -_mcount.S -bits/link.h diff --git a/sysdeps/sh/_mcount.S b/sysdeps/sh/_mcount.S index 1e7a1d9..069da13 100644 --- a/sysdeps/sh/_mcount.S +++ b/sysdeps/sh/_mcount.S @@ -1,5 +1,5 @@ /* Machine-specific calling sequence for `mcount' profiling function. SuperH - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2005 Free Software Foundation, Inc. Contributed by NIIBE Yutaka This file is part of the GNU C Library. @@ -22,14 +22,25 @@ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(_mcount) ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(_mcount),function) + cfi_startproc .align 5 C_LABEL(_mcount) /* Save registers. */ mov.l r4,@-r15 + cfi_adjust_cfa_offset (4) + cfi_rel_offset (r4, 0) mov.l r5,@-r15 + cfi_adjust_cfa_offset (4) + cfi_rel_offset (r5, 0) mov.l r6,@-r15 + cfi_adjust_cfa_offset (4) + cfi_rel_offset (r6, 0) mov.l r7,@-r15 + cfi_adjust_cfa_offset (4) + cfi_rel_offset (r7, 0) sts.l pr,@-r15 + cfi_adjust_cfa_offset (4) + cfi_rel_offset (pr, 0) mov.l @(20,r15),r4 sts pr,r5 @@ -61,6 +72,7 @@ C_LABEL(_mcount) #else 1: .long C_SYMBOL_NAME(__mcount_internal) #endif + cfi_endproc ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount)) #undef mcount diff --git a/sysdeps/sh/bits/link.h b/sysdeps/sh/bits/link.h index bb2fbb5..2826677 100644 --- a/sysdeps/sh/bits/link.h +++ b/sysdeps/sh/bits/link.h @@ -1,5 +1,70 @@ -struct link_map_machine - { - Elf32_Addr plt; /* Address of .plt + 36 */ - Elf32_Addr gotplt; /* Address of .got + 0x0c */ - }; +/* Copyright (C) 2005 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. + + 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 _LINK_H +# error "Never include directly; use instead." +#endif + + +/* Registers for entry into PLT on SH. */ +typedef struct La_sh_regs +{ + uint32_t lr_r2; + uint32_t lr_r3; + uint32_t lr_r4; + uint32_t lr_r5; + uint32_t lr_r6; + uint32_t lr_r7; + uint32_t lr_fpscr; + float lr_fr4; + float lr_fr5; + float lr_fr6; + float lr_fr7; + float lr_fr8; + float lr_fr9; + float lr_fr10; + float lr_fr11; +} La_sh_regs; + +/* Return values for calls from PLT on SH. */ +typedef struct La_sh_retval +{ + uint32_t lrv_r0; + uint32_t lrv_r1; + float lrv_fr0; + float lrv_fr1; +} La_sh_retval; + + +__BEGIN_DECLS + +extern Elf32_Addr la_sh_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_sh_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_sh_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + const La_sh_regs *__inregs, + La_sh_retval *__outregs, + const char *symname); + +__END_DECLS diff --git a/sysdeps/sh/bits/linkmap.h b/sysdeps/sh/bits/linkmap.h new file mode 100644 index 0000000..bb2fbb5 --- /dev/null +++ b/sysdeps/sh/bits/linkmap.h @@ -0,0 +1,5 @@ +struct link_map_machine + { + Elf32_Addr plt; /* Address of .plt + 36 */ + Elf32_Addr gotplt; /* Address of .got + 0x0c */ + }; diff --git a/sysdeps/sh/bits/setjmp.h b/sysdeps/sh/bits/setjmp.h index 2249770..7e3fbd3 100644 --- a/sysdeps/sh/bits/setjmp.h +++ b/sysdeps/sh/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1999,2000,2003,2005,2006 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 @@ -44,13 +44,4 @@ typedef struct } __jmp_buf[1]; #endif -#if defined __USE_MISC || defined _ASM -# define JB_SIZE (4 * 15) -#endif - -/* Test if longjmp to JMPBUF would unwind the frame - containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < &(jmpbuf)[0].__regs[7]) - #endif /* bits/setjmp.h */ diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index 271666a..e73c6d7 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. SH version. - Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 + Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -21,8 +21,6 @@ #ifndef dl_machine_h #define dl_machine_h -/* Only dummy. This doesn't work. */ - #define ELF_MACHINE_NAME "SH" #include @@ -106,7 +104,9 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf32_Addr) &_dl_runtime_profile; /* Say that we really want profiling and the timers are started. */ - GL(dl_profile_map) = l; + if (GLRO(dl_profile) != NULL + && _dl_name_match_p (GLRO(dl_profile), l)) + GL(dl_profile_map) = l; } else /* This function will get called to fix up the GOT entry indicated by @@ -116,273 +116,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) return lazy; } -/* This code is used in dl-runtime.c to call the `fixup' function - and then redirect to the address it returns. */ - #define ELF_MACHINE_RUNTIME_FIXUP_ARGS int plt_type -#ifdef SHARED -#define FUN_ADDR "\ - mov.l 1f,r2\n\ - mova 1f,r0\n\ - bra 2f\n\ - add r0,r2 ! Get GOT address in r2\n\ -0: .align 2\n\ -1: .long _GLOBAL_OFFSET_TABLE_\n\ -2: mov.l 3f,r0\n\ - add r2,r0" -#define GOTJMP(x) #x "@GOTOFF" -#else -#define FUN_ADDR "\ - mov.l 3f,r0" -#define GOTJMP(x) #x -#endif - -#ifdef HAVE_FPU -#define FGR_SAVE "\ - sts.l fpscr, @-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov #8,r3\n\ - swap.w r3, r3\n\ - lds r3, fpscr\n\ - fmov.s fr11, @-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - fmov.s fr10, @-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - fmov.s fr9, @-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - fmov.s fr8, @-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - fmov.s fr7, @-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - fmov.s fr6, @-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - fmov.s fr5, @-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - fmov.s fr4, @-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) -#define FGR_LOAD "\ - fmov.s @r15+, fr4\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - fmov.s @r15+, fr5\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - fmov.s @r15+, fr6\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - fmov.s @r15+, fr7\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - fmov.s @r15+, fr8\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - fmov.s @r15+, fr9\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - fmov.s @r15+, fr10\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - fmov.s @r15+, fr11\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - lds.l @r15+, fpscr\n\ - " CFI_ADJUST_CFA_OFFSET (-4) -#else -#define FGR_SAVE "" -#define FGR_LOAD "" -#endif - -#ifndef PROF -# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\ - .text\n\ - .globl _dl_runtime_resolve\n\ - .type _dl_runtime_resolve, @function\n\ - " CFI_STARTPROC "\n\ - .align 5\n\ -_dl_runtime_resolve:\n\ - mov.l r2,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r3,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r4,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r5,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r6,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r7,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r12,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - movt r3 ! Save T flag.\n\ - mov.l r3,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - " FGR_SAVE "\n\ - sts.l pr,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - tst r0,r0\n\ - bt 1f\n\ - mov r0,r2\n\ -1:\n\ - mov r0,r4 ! PLT type\n\ - mov r2,r5 ! link map address\n\ - " FUN_ADDR "\n\ - jsr @r0 ! Call resolver.\n\ - mov r1,r6 ! reloc offset\n\ - lds.l @r15+,pr ! Get register content back.\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - " FGR_LOAD "\n\ - mov.l @r15+,r3\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - shal r3 ! Lode T flag.\n\ - mov.l @r15+,r12\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r7\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r6\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r5\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r4\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r3\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - jmp @r0 ! Jump to function address.\n\ - mov.l @r15+,r2\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - .align 2\n\ -3:\n\ - .long " GOTJMP (fixup) "\n\ - " CFI_ENDPROC "\n\ - .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ -\n\ - .globl _dl_runtime_profile\n\ - .type _dl_runtime_profile, @function\n\ - " CFI_STARTPROC "\n\ - .align 5\n\ -_dl_runtime_profile:\n\ - mov.l r2,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r3,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r4,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r5,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r6,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r7,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r12,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - movt r3 ! Save T flag.\n\ - mov.l r3,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - " FGR_SAVE "\n\ - sts.l pr,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - tst r0,r0\n\ - bt 1f\n\ - mov r0,r2\n\ -1:\n\ - mov r0,r4 ! PLT type\n\ - mov r2,r5 ! link map address\n\ - sts pr,r7 ! return address\n\ - " FUN_ADDR "\n\ - jsr @r0 ! Call resolver.\n\ - mov r1,r6 ! reloc offset\n\ - lds.l @r15+,pr ! Get register content back.\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - " FGR_LOAD "\n\ - mov.l @r15+,r3\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - shal r3 ! Lode T flag.\n\ - mov.l @r15+,r12\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r7\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r6\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r5\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r4\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r3\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - jmp @r0 ! Jump to function address.\n\ - mov.l @r15+,r2\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - .align 2\n\ -3:\n\ - .long " GOTJMP (profile_fixup) "\n\ - " CFI_ENDPROC "\n\ - .size _dl_runtime_profile, .-_dl_runtime_profile\n\ - .previous\n\ -"); -#else -# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\ - .text\n\ - .globl _dl_runtime_resolve\n\ - .globl _dl_runtime_profile\n\ - .type _dl_runtime_resolve, @function\n\ - .type _dl_runtime_profile, @function\n\ - .align 5\n\ -_dl_runtime_resolve:\n\ -_dl_runtime_profile:\n\ - mov.l r2,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r3,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r4,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r5,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r6,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r7,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - mov.l r12,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - movt r3 ! Save T flag.\n\ - mov.l r3,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - " FGR_SAVE "\n\ - sts.l pr,@-r15\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - tst r0,r0\n\ - bt 1f\n\ - mov r0,r2\n\ -1:\n\ - mov r0,r4 ! PLT type\n\ - mov r2,r5 ! link map address\n\ - sts pr,r7 ! return address\n\ - " FUN_ADDR "\n\ - jsr @r0 ! Call resolver.\n\ - mov r1,r6 ! reloc offset\n\ - lds.l @r15+,pr ! Get register content back.\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - " FGR_LOAD "\n\ - mov.l @r15+,r3\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - shal r3 ! Lode T flag.\n\ - mov.l @r15+,r12\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r7\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r6\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r5\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r4\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - mov.l @r15+,r3\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - jmp @r0 ! Jump to function address.\n\ - mov.l @r15+,r2\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - .align 2\n\ -3:\n\ - .long " GOTJMP (fixup) "\n\ - " CFI_ENDPROC "\n\ - .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ - .size _dl_runtime_profile, .-_dl_runtime_profile\n\ - .previous\n\ -"); -#endif - /* Mask identifying addresses reserved for the user program, where the dynamic linker should not map anything. */ #define ELF_MACHINE_USER_ADDRESS_MASK 0x80000000UL @@ -459,6 +194,12 @@ _dl_start_user:\n\ .long _rtld_local@GOT\n\ .L_dl_fini:\n\ .long _dl_fini@GOT\n\ + .type __fpscr_values,@object\n\ + .global __fpscr_values\n\ +__fpscr_values:\n\ + .long 0\n\ + .long 0x80000\n\ + .weak __fpscr_values\n\ .previous\n\ "); @@ -510,13 +251,16 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, return value + reloc->r_addend; } -#endif /* !dl_machine_h */ +#define ARCH_LA_PLTENTER sh_gnu_pltenter +#define ARCH_LA_PLTEXIT sh_gnu_pltexit -#ifdef RESOLVE +#endif /* !dl_machine_h */ /* SH never uses Elf32_Rel relocations. */ #define ELF_MACHINE_NO_REL 1 +#ifdef RESOLVE_MAP + /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ @@ -579,18 +323,9 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, else { const Elf32_Sym *const refsym = sym; -#if defined USE_TLS && !defined RTLD_BOOTSTRAP struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; -#else - - value = RESOLVE (&sym, version, r_type); -# ifndef RTLD_BOOTSTRAP - if (sym != NULL) -# endif - value += sym->st_value; -#endif + value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; value += reloc->r_addend; switch (r_type) @@ -736,4 +471,4 @@ elf_machine_lazy_rel (struct link_map *map, _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 1); } -#endif /* RESOLVE */ +#endif /* RESOLVE_MAP */ diff --git a/sysdeps/sh/dl-trampoline.S b/sysdeps/sh/dl-trampoline.S new file mode 100644 index 0000000..79493d5 --- /dev/null +++ b/sysdeps/sh/dl-trampoline.S @@ -0,0 +1,431 @@ +/* PLT trampolines. SH version. + Copyright (C) 2005 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. + + 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. */ + +#include + + .text + .globl _dl_runtime_resolve + .type _dl_runtime_resolve, @function + cfi_startproc + .align 5 +_dl_runtime_resolve: + mov.l r2,@-r15 + cfi_adjust_cfa_offset (4) + mov.l r3,@-r15 + cfi_adjust_cfa_offset (4) + mov.l r4,@-r15 + cfi_adjust_cfa_offset (4) + mov.l r5,@-r15 + cfi_adjust_cfa_offset (4) + mov.l r6,@-r15 + cfi_adjust_cfa_offset (4) + mov.l r7,@-r15 + cfi_adjust_cfa_offset (4) + mov.l r12,@-r15 + cfi_adjust_cfa_offset (4) + sts.l macl,@-r15 + cfi_adjust_cfa_offset (4) + sts.l mach,@-r15 + cfi_adjust_cfa_offset (4) + movt r3 ! Save T flag. + mov.l r3,@-r15 + cfi_adjust_cfa_offset (4) +#ifdef HAVE_FPU + sts.l fpscr,@-r15 + cfi_adjust_cfa_offset (4) + mov #8,r3 + swap.w r3,r3 + lds r3,fpscr + fmov.s fr11,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr10,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr9,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr8,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr7,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr6,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr5,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr4,@-r15 + cfi_adjust_cfa_offset (4) +#endif + sts.l pr,@-r15 + cfi_adjust_cfa_offset (4) + tst r0,r0 + bt 1f + mov r0,r2 +1: + mov r0,r4 ! PLT type + mov r2,r5 ! link map address +#ifdef SHARED + mov.l 2f,r2 + mova 2f,r0 + add r0,r2 ! Get GOT address in r2 + mov.l 3f,r0 + add r2,r0 +#else + mov.l 3f,r0 +#endif + jsr @r0 ! Call resolver. + mov r1,r6 ! reloc offset + lds.l @r15+,pr ! Get register content back. + cfi_adjust_cfa_offset (-4) +#ifdef HAVE_FPU + fmov.s @r15+,fr4 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr5 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr6 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr7 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr8 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr9 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr10 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr11 + cfi_adjust_cfa_offset (-4) + lds.l @r15+,fpscr + cfi_adjust_cfa_offset (-4) +#endif + mov.l @r15+,r3 + cfi_adjust_cfa_offset (-4) + shal r3 ! Lode T flag. + lds.l @r15+,mach + cfi_adjust_cfa_offset (-4) + lds.l @r15+,macl + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r12 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r7 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r6 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r5 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r4 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r3 + cfi_adjust_cfa_offset (-4) + jmp @r0 ! Jump to function address. + mov.l @r15+,r2 + cfi_adjust_cfa_offset (-4) + .align 2 +#ifdef SHARED +2: .long _GLOBAL_OFFSET_TABLE_ +3: .long _dl_fixup@GOTOFF +#else +3: .long _dl_fixup +#endif + cfi_endproc + .size _dl_runtime_resolve, .-_dl_runtime_resolve + + + .globl _dl_runtime_profile + .type _dl_runtime_profile,@function + cfi_startproc + .align 5 +_dl_runtime_profile: + mov.l r12,@-r15 + cfi_adjust_cfa_offset (4) +#ifdef HAVE_FPU + sts.l fpscr,@-r15 + cfi_adjust_cfa_offset (4) + mov #8,r12 + swap.w r12,r12 + lds r12,fpscr + fmov.s fr11,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr10,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr9,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr8,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr7,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr6,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr5,@-r15 + cfi_adjust_cfa_offset (4) + fmov.s fr4,@-r15 + cfi_adjust_cfa_offset (4) +#else + add #-36,r15 + cfi_adjust_cfa_offset (36) +#endif + mov.l r7,@-r15 + cfi_adjust_cfa_offset (4) + mov.l r6,@-r15 + cfi_adjust_cfa_offset (4) + mov.l r5,@-r15 + cfi_adjust_cfa_offset (4) + mov.l r4,@-r15 + cfi_adjust_cfa_offset (4) + mov.l r3,@-r15 + cfi_adjust_cfa_offset (4) + mov.l r2,@-r15 + cfi_adjust_cfa_offset (4) + sts.l macl,@-r15 + cfi_adjust_cfa_offset (4) + sts.l mach,@-r15 + cfi_adjust_cfa_offset (4) + movt r3 ! Save T flag. + mov.l r3,@-r15 + cfi_adjust_cfa_offset (4) + sts.l pr,@-r15 + cfi_adjust_cfa_offset (4) + tst r0,r0 + bt 1f + mov r0,r2 +1: + mov r0,r4 ! PLT type + mov r2,r5 ! link map address + sts pr,r7 ! return address + add #-24,r15 + cfi_adjust_cfa_offset (24) + mov #40,r0 + add r15,r0 + mov.l r0,@r15 ! Address of the register structure + mov #-1,r0 + mov.l r0,@(8,r15) + mov #8,r0 + add r15,r0 + mov.l r0,@(4,r15) + mov.l r5,@(12,r15) + mov.l r1,@(16,r15) +#ifdef SHARED + mov.l 2f,r12 + mova 2f,r0 + add r0,r12 ! Get GOT address in r12 + mov.l 3f,r0 + add r12,r0 +#else + mov.l 3f,r0 +#endif + jsr @r0 ! Call resolver. + mov r1,r6 ! reloc offset + mov.l @(8,r15),r1 + cmp/pz r1 + bt 4f + add #24,r15 + cfi_adjust_cfa_offset (-24) + lds.l @r15+,pr ! Get register content back. + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r3 + cfi_adjust_cfa_offset (-4) + shal r3 ! Lode T flag. + lds.l @r15+,mach + cfi_adjust_cfa_offset (-4) + lds.l @r15+,macl + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r2 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r3 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r4 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r5 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r6 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r7 + cfi_adjust_cfa_offset (-4) +#ifdef HAVE_FPU + fmov.s @r15+,fr4 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr5 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr6 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr7 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr8 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr9 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr10 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr11 + cfi_adjust_cfa_offset (-4) + lds.l @r15+,fpscr + cfi_adjust_cfa_offset (-4) +#else + add #36,r15 + cfi_adjust_cfa_offset (-36) +#endif + jmp @r0 ! Jump to function address. + mov.l @r15+,r12 + cfi_adjust_cfa_offset (-4) + .align 2 +#ifdef SHARED +2: .long _GLOBAL_OFFSET_TABLE_ +3: .long _dl_profile_fixup@GOTOFF +#else +3: .long _dl_profile_fixup +#endif + + cfi_adjust_cfa_offset (104) +4: + mov #104,r3 + add r15,r3 ! Original stack + mov.l r8,@(20,r15) + cfi_rel_offset (r8, 20) + mov r15,r8 + sub r1,r15 + shlr2 r15 + shll2 r15 + mov r15,r4 + shlr2 r1 + tst r1,r1 +5: + bt/s 6f + dt r1 + mov.l @r3+,r2 + mov.l r2,@r4 + bra 5b + add #4,r4 +6: + mov.l @r8,r12 + mov.l @r12+,r2 + mov.l @r12+,r3 + mov.l @r12+,r4 + mov.l @r12+,r5 + mov.l @r12+,r6 + mov.l @r12+,r7 +#ifdef HAVE_FPU + fmov.s @r12+,fr4 + fmov.s @r12+,fr5 + fmov.s @r12+,fr6 + fmov.s @r12+,fr7 + fmov.s @r12+,fr8 + fmov.s @r12+,fr9 + fmov.s @r12+,fr10 + fmov.s @r12+,fr11 + lds.l @r12+,fpscr +#else + add #36,r2 +#endif + jsr @r0 ! Call function. + nop + mov r8,r15 + mov.l @(12,r15),r4 ! link map address + mov.l @(16,r15),r5 ! reloc offset + mov.l @r15,r6 ! input registers +#ifdef HAVE_FPU + mov #16,r8 + add r15,r8 + fmov.s fr1,@-r8 + fmov.s fr0,@-r8 +#else + mov #8,r8 + add r15,r8 +#endif + mov.l r1,@-r8 + mov.l r0,@-r8 + mov.l @(20,r15),r8 + cfi_restore (r8) +#ifdef SHARED + mov.l 7f,r12 + mova 7f,r0 + add r0,r12 ! Get GOT address in r12 + mov.l 8f,r0 + add r12,r0 +#else + mov.l 8f,r0 +#endif + jsr @r0 + mov r15,r7 ! output registers + mov.l @r15+,r0 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r1 + cfi_adjust_cfa_offset (-4) +#ifdef HAVE_FPU + fmov.s @r15+,fr0 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr1 + cfi_adjust_cfa_offset (-4) + add #8,r15 + cfi_adjust_cfa_offset (-8) +#else + add #16,r15 + cfi_adjust_cfa_offset (-16) +#endif + lds.l @r15+,pr ! Get register content back. + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r3 + cfi_adjust_cfa_offset (-4) + shal r3 ! Lode T flag. + lds.l @r15+,mach + cfi_adjust_cfa_offset (-4) + lds.l @r15+,macl + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r2 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r3 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r4 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r5 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r6 + cfi_adjust_cfa_offset (-4) + mov.l @r15+,r7 + cfi_adjust_cfa_offset (-4) +#ifdef HAVE_FPU + fmov.s @r15+,fr4 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr5 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr6 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr7 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr8 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr9 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr10 + cfi_adjust_cfa_offset (-4) + fmov.s @r15+,fr11 + cfi_adjust_cfa_offset (-4) + lds.l @r15+,fpscr + cfi_adjust_cfa_offset (-4) +#else + add #36,r15 + cfi_adjust_cfa_offset (-36) +#endif + rts ! Jump to function address. + mov.l @r15+,r12 + cfi_adjust_cfa_offset (-4) + cfi_endproc + .align 2 +#ifdef SHARED +7: .long _GLOBAL_OFFSET_TABLE_ +8: .long _dl_call_pltexit@GOTOFF +#else +8: .long _dl_call_pltexit +#endif + .size _dl_runtime_profile, .-_dl_runtime_profile diff --git a/sysdeps/sh/elf/configure b/sysdeps/sh/elf/configure index df45f2c..d38b0ec 100644 --- a/sysdeps/sh/elf/configure +++ b/sysdeps/sh/elf/configure @@ -5,7 +5,7 @@ if test "$usetls" != no; then # Check for support of thread-local storage handling in assembler and # linker. echo "$as_me:$LINENO: checking for SH TLS support" >&5 -echo $ECHO_N "checking for sh TLS support... $ECHO_C" >&6 +echo $ECHO_N "checking for SH TLS support... $ECHO_C" >&6 if test "${libc_cv_sh_tls+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else diff --git a/sysdeps/sh/jmpbuf-offsets.h b/sysdeps/sh/jmpbuf-offsets.h new file mode 100644 index 0000000..312051e --- /dev/null +++ b/sysdeps/sh/jmpbuf-offsets.h @@ -0,0 +1,20 @@ +/* Private macros for accessing __jmp_buf contents. SH version. + Copyright (C) 2006 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. + + 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. */ + +#define JB_SIZE (4 * 15) diff --git a/sysdeps/sh/jmpbuf-unwind.h b/sysdeps/sh/jmpbuf-unwind.h new file mode 100644 index 0000000..a69a465 --- /dev/null +++ b/sysdeps/sh/jmpbuf-unwind.h @@ -0,0 +1,47 @@ +/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2003. + + 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. */ + +#include +#include +#include +#include + +/* Test if longjmp to JMPBUF would unwind the frame + containing a local variable at ADDRESS. */ +#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ + ((void *) (address) < (void *) demangle ((jmpbuf)[0].__regs[7])) + +#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ + _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) + +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[0].__regs[7]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + +#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) + +/* We use the normal longjmp for unwinding. */ +#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/sysdeps/sh/memset.S b/sysdeps/sh/memset.S index ca23449..9a8e2ef 100644 --- a/sysdeps/sh/memset.S +++ b/sysdeps/sh/memset.S @@ -28,6 +28,7 @@ ENTRY(memset) bt.s L_byte_loop_init mov r4,r7 + extu.b r5,r5 swap.b r5,r1 or r1,r5 swap.w r5,r1 diff --git a/sysdeps/sh/sh3/__longjmp.S b/sysdeps/sh/sh3/__longjmp.S index cd78cfe..c6d8a32 100644 --- a/sysdeps/sh/sh3/__longjmp.S +++ b/sysdeps/sh/sh3/__longjmp.S @@ -1,5 +1,5 @@ /* longjmp for SH. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2005, 2006 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 @@ -30,15 +30,28 @@ ENTRY (__longjmp) mov.l @r4+, r10 mov.l @r4+, r11 mov.l @r4+, r12 - mov.l @r4+, r13 - mov.l @r4+, r14 - mov.l @r4+, r15 mov r5, r0 /* get the return value in place */ tst r0, r0 bf.s 1f - lds.l @r4+, pr + mov.l @r4+, r13 mov #1,r0 /* can't let setjmp() return zero! */ 1: +#ifdef PTR_DEMANGLE + mov.l @r4+, r2 + PTR_DEMANGLE (r2, r1) + mov r2, r14 + mov.l @r4+, r2 + PTR_DEMANGLE2 (r2, r1) + mov r2, r15 + mov.l @r4+, r2 + PTR_DEMANGLE2 (r2, r1) + lds r2, pr + mov #0, r1 +#else + mov.l @r4+, r14 + mov.l @r4+, r15 + lds.l @r4+, pr +#endif rts ldc.l @r4+, gbr END (__longjmp) diff --git a/sysdeps/sh/sh3/setjmp.S b/sysdeps/sh/sh3/setjmp.S index 819543a..d04e4b8 100644 --- a/sysdeps/sh/sh3/setjmp.S +++ b/sysdeps/sh/sh3/setjmp.S @@ -1,5 +1,5 @@ /* setjmp for SH3. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2005, 2006 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 @@ -18,17 +18,28 @@ 02111-1307 USA. */ #include -#define _SETJMP_H -#define _ASM -#include +#include ENTRY (__sigsetjmp) /* Save registers */ add #(JB_SIZE - 4 * 5), r4 stc.l gbr, @-r4 +#ifdef PTR_MANGLE + sts pr, r2 + PTR_MANGLE (r2, r1) + mov.l r2, @-r4 + mov r15, r2 + PTR_MANGLE2 (r2, r1) + mov.l r2, @-r4 + mov r14, r2 + PTR_MANGLE2 (r2, r1) + mov.l r2, @-r4 + mov #0, r1 +#else sts.l pr, @-r4 mov.l r15, @-r4 mov.l r14, @-r4 +#endif mov.l r13, @-r4 mov.l r12, @-r4 mov.l r11, @-r4 @@ -36,8 +47,13 @@ ENTRY (__sigsetjmp) mov.l r9, @-r4 mov.l r8, @-r4 +#if defined NOT_IN_libc && defined IS_IN_rtld + /* In ld.so we never save the signal mask. */ + rts + mov #0, r0 +#else /* Make a tail call to __sigjmp_save; it takes the same args. */ -#ifdef SHARED +# ifdef SHARED mov.l 1f, r1 mova 1f, r0 bra 2f @@ -53,12 +69,13 @@ ENTRY (__sigsetjmp) .align 2 .L1: .long C_SYMBOL_NAME(__sigjmp_save@GOT) -#else +# else mov.l .L1, r1 jmp @r1 nop .align 2 .L1: .long C_SYMBOL_NAME(__sigjmp_save) +# endif #endif END (__sigsetjmp) diff --git a/sysdeps/sh/sh4/Versions b/sysdeps/sh/sh4/Versions new file mode 100644 index 0000000..8cc1c7b --- /dev/null +++ b/sysdeps/sh/sh4/Versions @@ -0,0 +1,5 @@ +ld { + GLIBC_PRIVATE { + __fpscr_values; + } +} diff --git a/sysdeps/sh/sh4/__longjmp.S b/sysdeps/sh/sh4/__longjmp.S index 7cd83bf..320a7d1 100644 --- a/sysdeps/sh/sh4/__longjmp.S +++ b/sysdeps/sh/sh4/__longjmp.S @@ -1,5 +1,5 @@ /* longjmp for SH. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2005, 2006 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 @@ -30,15 +30,28 @@ ENTRY (__longjmp) mov.l @r4+, r10 mov.l @r4+, r11 mov.l @r4+, r12 - mov.l @r4+, r13 - mov.l @r4+, r14 - mov.l @r4+, r15 mov r5, r0 /* get the return value in place */ tst r0, r0 bf.s 1f - lds.l @r4+, pr + mov.l @r4+, r13 mov #1,r0 /* can't let setjmp() return zero! */ 1: +#ifdef PTR_DEMANGLE + mov.l @r4+, r2 + PTR_DEMANGLE (r2, r1) + mov r2, r14 + mov.l @r4+, r2 + PTR_DEMANGLE2 (r2, r1) + mov r2, r15 + mov.l @r4+, r2 + PTR_DEMANGLE2 (r2, r1) + lds r2, pr + mov #0, r1 +#else + mov.l @r4+, r14 + mov.l @r4+, r15 + lds.l @r4+, pr +#endif ldc.l @r4+, gbr lds.l @r4+, fpscr fmov.s @r4+, fr12 diff --git a/sysdeps/sh/sh4/bits/mathdef.h b/sysdeps/sh/sh4/bits/mathdef.h new file mode 100644 index 0000000..2b8caf1 --- /dev/null +++ b/sysdeps/sh/sh4/bits/mathdef.h @@ -0,0 +1,69 @@ +/* Copyright (C) 1997, 1998, 1999, 2000, 2004 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. + + 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. */ + +#if !defined _MATH_H && !defined _COMPLEX_H +# error "Never use directly; include instead" +#endif + + +/* FIXME! This file describes properties of the compiler, not the machine; + it should not be part of libc! + + FIXME! This file does not deal with the -fshort-double option of + gcc! */ + +#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF +# define _MATH_H_MATHDEF 1 + +# ifdef __GNUC__ +# if __STDC__ == 1 + +/* In GNU or ANSI mode, gcc leaves `float' expressions as-is. */ +typedef float float_t; /* `float' expressions are evaluated as + `float'. */ +typedef double double_t; /* `double' expressions are evaluated as + `double'. */ + +# else + +/* For `gcc -traditional', `float' expressions are evaluated as `double'. */ +typedef double float_t; /* `float' expressions are evaluated as + `double'. */ +typedef double double_t; /* `double' expressions are evaluated as + `double'. */ + +# endif +# else + +/* Wild guess at types for float_t and double_t. */ +typedef double float_t; +typedef double double_t; + +# endif + +/* The values returned by `ilogb' for 0 and NaN respectively. */ +# define FP_ILOGB0 0x80000001 +# define FP_ILOGBNAN 0x7fffffff + +#endif /* ISO C99 */ + +#ifndef __NO_LONG_DOUBLE_MATH +/* Signal that we do not really have a `long double'. The disables the + declaration of all the `long double' function variants. */ +# define __NO_LONG_DOUBLE_MATH 1 +#endif diff --git a/sysdeps/sh/sh4/dl-machine.h b/sysdeps/sh/sh4/dl-machine.h deleted file mode 100644 index ec9f6f7..0000000 --- a/sysdeps/sh/sh4/dl-machine.h +++ /dev/null @@ -1,2 +0,0 @@ -#define HAVE_FPU -#include diff --git a/sysdeps/sh/sh4/dl-trampoline.S b/sysdeps/sh/sh4/dl-trampoline.S new file mode 100644 index 0000000..f952985 --- /dev/null +++ b/sysdeps/sh/sh4/dl-trampoline.S @@ -0,0 +1,2 @@ +#define HAVE_FPU +#include diff --git a/sysdeps/sh/sh4/fpu/bits/mathdef.h b/sysdeps/sh/sh4/fpu/bits/mathdef.h deleted file mode 100644 index 2b8caf1..0000000 --- a/sysdeps/sh/sh4/fpu/bits/mathdef.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2004 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. - - 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. */ - -#if !defined _MATH_H && !defined _COMPLEX_H -# error "Never use directly; include instead" -#endif - - -/* FIXME! This file describes properties of the compiler, not the machine; - it should not be part of libc! - - FIXME! This file does not deal with the -fshort-double option of - gcc! */ - -#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF -# define _MATH_H_MATHDEF 1 - -# ifdef __GNUC__ -# if __STDC__ == 1 - -/* In GNU or ANSI mode, gcc leaves `float' expressions as-is. */ -typedef float float_t; /* `float' expressions are evaluated as - `float'. */ -typedef double double_t; /* `double' expressions are evaluated as - `double'. */ - -# else - -/* For `gcc -traditional', `float' expressions are evaluated as `double'. */ -typedef double float_t; /* `float' expressions are evaluated as - `double'. */ -typedef double double_t; /* `double' expressions are evaluated as - `double'. */ - -# endif -# else - -/* Wild guess at types for float_t and double_t. */ -typedef double float_t; -typedef double double_t; - -# endif - -/* The values returned by `ilogb' for 0 and NaN respectively. */ -# define FP_ILOGB0 0x80000001 -# define FP_ILOGBNAN 0x7fffffff - -#endif /* ISO C99 */ - -#ifndef __NO_LONG_DOUBLE_MATH -/* Signal that we do not really have a `long double'. The disables the - declaration of all the `long double' function variants. */ -# define __NO_LONG_DOUBLE_MATH 1 -#endif diff --git a/sysdeps/sh/sh4/fpu/feholdexcpt.c b/sysdeps/sh/sh4/fpu/feholdexcpt.c index dafb4f7..7aac5a0 100644 --- a/sysdeps/sh/sh4/fpu/feholdexcpt.c +++ b/sysdeps/sh/sh4/fpu/feholdexcpt.c @@ -1,5 +1,5 @@ /* Store current floating-point environment and clear exceptions. - Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000, 2005 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 @@ -35,3 +35,4 @@ feholdexcept (fenv_t *envp) return 1; } +libm_hidden_def (feholdexcept) diff --git a/sysdeps/sh/sh4/fpu/fesetround.c b/sysdeps/sh/sh4/fpu/fesetround.c index 9966838..cf43490 100644 --- a/sysdeps/sh/sh4/fpu/fesetround.c +++ b/sysdeps/sh/sh4/fpu/fesetround.c @@ -1,5 +1,5 @@ /* Set current rounding direction. - Copyright (C) 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 1998. @@ -41,3 +41,4 @@ fesetround (int round) return 1; } +libm_hidden_def (fesetround) diff --git a/sysdeps/sh/sh4/fpu/libm-test-ulps b/sysdeps/sh/sh4/fpu/libm-test-ulps index 3dd37f1..4831f48 100644 --- a/sysdeps/sh/sh4/fpu/libm-test-ulps +++ b/sysdeps/sh/sh4/fpu/libm-test-ulps @@ -60,12 +60,12 @@ float: 1 ifloat: 1 # cacosh -Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i": +Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": double: 1 float: 7 idouble: 1 ifloat: 7 -Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i": +Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": double: 1 float: 3 idouble: 1 diff --git a/sysdeps/sh/sh4/setjmp.S b/sysdeps/sh/sh4/setjmp.S index c7b0aed..f9a4f0a 100644 --- a/sysdeps/sh/sh4/setjmp.S +++ b/sysdeps/sh/sh4/setjmp.S @@ -1,5 +1,5 @@ /* setjmp for SH4. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2005, 2006 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 @@ -18,9 +18,7 @@ 02111-1307 USA. */ #include -#define _SETJMP_H -#define _ASM -#include +#include ENTRY (__sigsetjmp) /* Save registers */ @@ -31,9 +29,22 @@ ENTRY (__sigsetjmp) fmov.s fr12, @-r4 sts.l fpscr, @-r4 stc.l gbr, @-r4 +#ifdef PTR_MANGLE + sts pr, r2 + PTR_MANGLE (r2, r1) + mov.l r2, @-r4 + mov r15, r2 + PTR_MANGLE2 (r2, r1) + mov.l r2, @-r4 + mov r14, r2 + PTR_MANGLE2 (r2, r1) + mov.l r2, @-r4 + mov #0, r1 +#else sts.l pr, @-r4 mov.l r15, @-r4 mov.l r14, @-r4 +#endif mov.l r13, @-r4 mov.l r12, @-r4 mov.l r11, @-r4 @@ -41,8 +52,13 @@ ENTRY (__sigsetjmp) mov.l r9, @-r4 mov.l r8, @-r4 +#if defined NOT_IN_libc && defined IS_IN_rtld + /* In ld.so we never save the signal mask. */ + rts + mov #0, r0 +#else /* Make a tail call to __sigjmp_save; it takes the same args. */ -#ifdef SHARED +# ifdef SHARED mov.l 1f, r1 mova 1f, r0 bra 2f @@ -58,12 +74,13 @@ ENTRY (__sigsetjmp) .align 2 .L1: .long C_SYMBOL_NAME(__sigjmp_save@GOT) -#else +# else mov.l .L1, r1 jmp @r1 nop .align 2 .L1: .long C_SYMBOL_NAME(__sigjmp_save) +# endif #endif END (__sigsetjmp) diff --git a/sysdeps/sh/sysdep.h b/sysdeps/sh/sysdep.h index 202c701..743631a 100644 --- a/sysdeps/sh/sysdep.h +++ b/sysdeps/sh/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for SH. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2005 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 @@ -52,10 +52,12 @@ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),function) \ .align ALIGNARG(5); \ C_LABEL(name) \ + cfi_startproc; \ CALL_MCOUNT #undef END #define END(name) \ + cfi_endproc; \ ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(name)) /* If compiled for profiling, call `mcount' at the start of each function. */ @@ -63,12 +65,17 @@ #define CALL_MCOUNT \ mov.l 1f,r1; \ sts.l pr,@-r15; \ + cfi_adjust_cfa_offset (4); \ + cfi_rel_offset (pr, 0); \ mova 2f,r0; \ jmp @r1; \ lds r0,pr; \ .align 2; \ 1: .long mcount; \ -2: lds.l @r15+,pr +2: lds.l @r15+,pr; \ + cfi_adjust_cfa_offset (-4); \ + cfi_restore (pr) + #else #define CALL_MCOUNT /* Do nothing. */ #endif -- cgit v1.1