diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
commit | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch) | |
tree | 2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /sysdeps/i386 | |
parent | 7d58530341304d403a6626d7f7a1913165fe2f32 (diff) | |
download | glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.bz2 glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip |
2.5-18.1
Diffstat (limited to 'sysdeps/i386')
134 files changed, 1883 insertions, 1687 deletions
diff --git a/sysdeps/i386/Dist b/sysdeps/i386/Dist deleted file mode 100644 index 34cc8b0fdc..0000000000 --- a/sysdeps/i386/Dist +++ /dev/null @@ -1,4 +0,0 @@ -i386-mcount.S -machine-gmon.h -bp-asm.h -bits/link.h diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile index 52faaa3109..e192b91dbd 100644 --- a/sysdeps/i386/Makefile +++ b/sysdeps/i386/Makefile @@ -8,7 +8,7 @@ long-double-fcts = yes ifeq ($(subdir),csu) # On i686 we must avoid generating the trampoline functions generated # to get the GOT pointer. -CFLAGS-initfini.s += -march=i386 -mcpu=i386 +CFLAGS-initfini.s += -march=i386 -mtune=i386 endif ifeq ($(subdir),gmon) @@ -61,3 +61,15 @@ CFLAGS-dlopenold.c += -mpreferred-stack-boundary=4 CFLAGS-dlclose.c += -mpreferred-stack-boundary=4 CFLAGS-dlerror.c += -mpreferred-stack-boundary=4 endif + +ifneq (,$(filter -mno-tls-direct-seg-refs,$(CFLAGS))) +defines += -DNO_TLS_DIRECT_SEG_REFS +else +# .a libraries are not performance critical and so we +# build them without direct TLS segment references +# always. +CPPFLAGS-.o += -DNO_TLS_DIRECT_SEG_REFS +CFLAGS-.o += -mno-tls-direct-seg-refs +CPPFLAGS-.oS += -DNO_TLS_DIRECT_SEG_REFS +CFLAGS-.oS += -mno-tls-direct-seg-refs +endif diff --git a/sysdeps/i386/Versions b/sysdeps/i386/Versions index b20d7cc027..b0230d31cf 100644 --- a/sysdeps/i386/Versions +++ b/sysdeps/i386/Versions @@ -20,3 +20,10 @@ libc { __strspn_cg; __strspn_g; __strstr_cg; __strstr_g; } } +libm { + GLIBC_2.1 { + # A generic bug got this omitted from other configurations' version + # sets, but we always had it. + exp2l; + } +} diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S index 6b590f7f04..559d56b250 100644 --- a/sysdeps/i386/__longjmp.S +++ b/sysdeps/i386/__longjmp.S @@ -1,5 +1,5 @@ /* longjmp for i386. - Copyright (C) 1995,1996,1997,1998,2000,2002 Free Software Foundation, Inc. + Copyright (C) 1995-1998,2000,2002,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 <sysdep.h> -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> +#include <jmpbuf-offsets.h> #include <asm-syntax.h> #include <bp-sym.h> #include <bp-asm.h> @@ -32,6 +30,36 @@ ENTRY (BP_SYM (__longjmp)) ENTER +#ifdef PTR_DEMANGLE + movl JBUF(%esp), %eax /* User's jmp_buf in %eax. */ + CHECK_BOUNDS_BOTH_WIDE (%eax, JBUF(%esp), $JB_SIZE) + + /* Save the return address now. */ + movl (JB_PC*4)(%eax), %edx + /* Get the stack pointer. */ + movl (JB_SP*4)(%eax), %ecx + PTR_DEMANGLE (%edx) + PTR_DEMANGLE (%ecx) + cfi_def_cfa(%eax, 0) + cfi_register(%eip, %edx) + cfi_register(%esp, %ecx) + cfi_offset(%ebx, JB_BX*4) + cfi_offset(%esi, JB_SI*4) + cfi_offset(%edi, JB_DI*4) + cfi_offset(%ebp, JB_BP*4) + /* Restore registers. */ + movl (JB_BX*4)(%eax), %ebx + movl (JB_SI*4)(%eax), %esi + movl (JB_DI*4)(%eax), %edi + movl (JB_BP*4)(%eax), %ebp + cfi_restore(%ebx) + cfi_restore(%esi) + cfi_restore(%edi) + cfi_restore(%ebp) + + movl VAL(%esp), %eax /* Second argument is return value. */ + movl %ecx, %esp +#else movl JBUF(%esp), %ecx /* User's jmp_buf in %ecx. */ CHECK_BOUNDS_BOTH_WIDE (%ecx, JBUF(%esp), $JB_SIZE) @@ -44,6 +72,7 @@ ENTRY (BP_SYM (__longjmp)) movl (JB_DI*4)(%ecx), %edi movl (JB_BP*4)(%ecx), %ebp movl (JB_SP*4)(%ecx), %esp +#endif /* Jump to saved PC. */ jmp *%edx END (BP_SYM (__longjmp)) diff --git a/sysdeps/i386/add_n.S b/sysdeps/i386/add_n.S index f43a4757b2..c7a5ce721b 100644 --- a/sysdeps/i386/add_n.S +++ b/sysdeps/i386/add_n.S @@ -1,6 +1,6 @@ /* Add two limb vectors of the same length > 0 and store sum in a third limb vector. - Copyright (C) 1992, 94, 95, 97, 98, 2000 Free Software Foundation, Inc. + Copyright (C) 1992,94,95,97,98,2000,2005 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -34,10 +34,14 @@ ENTRY (BP_SYM (__mpn_add_n)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) pushl %esi + cfi_adjust_cfa_offset (4) movl RES(%esp),%edi + cfi_rel_offset (edi, 4) movl S1(%esp),%esi + cfi_rel_offset (esi, 0) movl S2(%esp),%edx movl SIZE(%esp),%ecx #if __BOUNDED_POINTERS__ @@ -62,10 +66,12 @@ ENTRY (BP_SYM (__mpn_add_n)) /* Calculate start address in loop for PIC. Due to limitations in some assemblers, Loop-L0-3 cannot be put into the leal */ call L(0) + cfi_adjust_cfa_offset (4) L(0): leal (%eax,%eax,8),%eax addl (%esp),%eax addl $(L(oop)-L(0)-3),%eax addl $4,%esp + cfi_adjust_cfa_offset (-4) #else /* Calculate start address in loop for non-PIC. */ leal (L(oop) - 3)(%eax,%eax,8),%eax @@ -106,7 +112,11 @@ L(oop): movl (%esi),%eax negl %eax popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret diff --git a/sysdeps/i386/addmul_1.S b/sysdeps/i386/addmul_1.S index fb1042efb8..df501726c5 100644 --- a/sysdeps/i386/addmul_1.S +++ b/sysdeps/i386/addmul_1.S @@ -1,6 +1,6 @@ /* i80386 __mpn_addmul_1 -- Multiply a limb vector with a limb and add the result to a second limb vector. - Copyright (C) 1992, 1994, 1997, 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1992,1994,1997,1998,2000,2005 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -38,15 +38,22 @@ ENTRY (BP_SYM (__mpn_addmul_1)) ENTER - pushl %edi - pushl %esi + pushl %res_ptr + cfi_adjust_cfa_offset (4) + pushl %s1_ptr + cfi_adjust_cfa_offset (4) pushl %ebp - pushl %ebx + cfi_adjust_cfa_offset (4) + pushl %s2_limb + cfi_adjust_cfa_offset (4) movl RES(%esp), %res_ptr + cfi_rel_offset (res_ptr, 12) movl S1(%esp), %s1_ptr + cfi_rel_offset (s1_ptr, 8) movl SIZE(%esp), %sizeP movl S2LIMB(%esp), %s2_limb + cfi_rel_offset (s2_limb, 0) #if __BOUNDED_POINTERS__ shll $2, %sizeP /* convert limbs to bytes */ CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %sizeP) @@ -57,6 +64,7 @@ ENTRY (BP_SYM (__mpn_addmul_1)) leal (%s1_ptr,%sizeP,4), %s1_ptr negl %sizeP xorl %ebp, %ebp + cfi_rel_offset (ebp, 4) ALIGN (3) L(oop): movl (%s1_ptr,%sizeP,4), %eax @@ -71,10 +79,18 @@ L(oop): jnz L(oop) movl %ebp, %eax - popl %ebx + popl %s2_limb + cfi_adjust_cfa_offset (-4) + cfi_restore (s2_limb) popl %ebp - popl %esi - popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) + popl %s1_ptr + cfi_adjust_cfa_offset (-4) + cfi_restore (s1_ptr) + popl %res_ptr + cfi_adjust_cfa_offset (-4) + cfi_restore (res_ptr) LEAVE ret diff --git a/sysdeps/i386/backtrace.c b/sysdeps/i386/backtrace.c index cb7530396b..8b61913dde 100644 --- a/sysdeps/i386/backtrace.c +++ b/sysdeps/i386/backtrace.c @@ -1,5 +1,5 @@ /* Return backtrace of current program state. - Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -141,3 +141,4 @@ __backtrace (array, size) return arg.cnt != -1 ? arg.cnt : 0; } weak_alias (__backtrace, backtrace) +libc_hidden_def (__backtrace) diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h index 33af208888..7f2ddc2dc5 100644 --- a/sysdeps/i386/bits/byteswap.h +++ b/sysdeps/i386/bits/byteswap.h @@ -1,5 +1,6 @@ /* Macros to swap the order of bytes in integer values. - Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007 + 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 @@ -65,7 +66,9 @@ __bswap_16 (unsigned short int __bsx) /* To swap the bytes in a word the i486 processors and up provide the `bswap' opcode. On i386 we have to use three instructions. */ # if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__ \ - && !defined __pentium4__ + && !defined __pentium4__ && !defined __k8__ && !defined __athlon__ \ + && !defined __k6__ && !defined __nocona__ && !defined __core2__ \ + && !defined __geode__ && !defined __amdfam10__ # define __bswap_32(x) \ (__extension__ \ ({ register unsigned int __v, __x = (x); \ diff --git a/sysdeps/i386/bits/link.h b/sysdeps/i386/bits/link.h index 3be9b7eae8..985d040413 100644 --- a/sysdeps/i386/bits/link.h +++ b/sysdeps/i386/bits/link.h @@ -1,5 +1,60 @@ -struct link_map_machine - { - Elf32_Addr plt; /* Address of .plt + 0x16 */ - Elf32_Addr gotplt; /* Address of .got + 0x0c */ - }; +/* Copyright (C) 2004, 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 <bits/link.h> directly; use <link.h> instead." +#endif + + +/* Registers for entry into PLT on IA-32. */ +typedef struct La_i86_regs +{ + uint32_t lr_edx; + uint32_t lr_ecx; + uint32_t lr_eax; + uint32_t lr_ebp; + uint32_t lr_esp; +} La_i86_regs; + +/* Return values for calls from PLT on IA-32. */ +typedef struct La_i86_retval +{ + uint32_t lrv_eax; + uint32_t lrv_edx; + long double lrv_st0; + long double lrv_st1; +} La_i86_retval; + + +__BEGIN_DECLS + +extern Elf32_Addr la_i86_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_i86_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_i86_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + const La_i86_regs *__inregs, + La_i86_retval *__outregs, + const char *symname); + +__END_DECLS diff --git a/sysdeps/i386/bits/linkmap.h b/sysdeps/i386/bits/linkmap.h new file mode 100644 index 0000000000..3be9b7eae8 --- /dev/null +++ b/sysdeps/i386/bits/linkmap.h @@ -0,0 +1,5 @@ +struct link_map_machine + { + Elf32_Addr plt; /* Address of .plt + 0x16 */ + Elf32_Addr gotplt; /* Address of .got + 0x0c */ + }; diff --git a/sysdeps/i386/fpu/bits/mathdef.h b/sysdeps/i386/bits/mathdef.h index ec42ed5df9..ec42ed5df9 100644 --- a/sysdeps/i386/fpu/bits/mathdef.h +++ b/sysdeps/i386/bits/mathdef.h diff --git a/sysdeps/i386/bits/setjmp.h b/sysdeps/i386/bits/setjmp.h index 107fe58b35..0133c40e70 100644 --- a/sysdeps/i386/bits/setjmp.h +++ b/sysdeps/i386/bits/setjmp.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2000,2001,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 @@ -24,23 +25,8 @@ # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif -#if defined __USE_MISC || defined _ASM -# define JB_BX 0 -# define JB_SI 1 -# define JB_DI 2 -# define JB_BP 3 -# define JB_SP 4 -# define JB_PC 5 -# define JB_SIZE 24 -#endif - #ifndef _ASM typedef int __jmp_buf[6]; #endif -/* Test if longjmp to JMPBUF would unwind the frame - containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)[JB_SP]) - #endif /* bits/setjmp.h */ diff --git a/sysdeps/i386/bits/string.h b/sysdeps/i386/bits/string.h deleted file mode 100644 index d181afd48b..0000000000 --- a/sysdeps/i386/bits/string.h +++ /dev/null @@ -1,922 +0,0 @@ -/* Optimized, inlined string functions. i386 version. - Copyright (C) 1997,1998,1999,2000,2003 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 _STRING_H -# error "Never use <bits/string.h> directly; include <string.h> instead." -#endif - -/* The ix86 processors can access unaligned multi-byte variables. */ -#define _STRING_ARCH_unaligned 1 - - -/* We only provide optimizations if the user selects them and if - GNU CC is used. */ -#if !defined __NO_STRING_INLINES && defined __USE_STRING_INLINES \ - && defined __GNUC__ && __GNUC__ >= 2 && !__BOUNDED_POINTERS__ - -#ifndef __STRING_INLINE -# ifdef __cplusplus -# define __STRING_INLINE inline -# else -# define __STRING_INLINE extern __inline -# endif -#endif - - -/* Copy N bytes of SRC to DEST. */ -#define _HAVE_STRING_ARCH_memcpy 1 -#define memcpy(dest, src, n) \ - (__extension__ (__builtin_constant_p (n) \ - ? __memcpy_c ((dest), (src), (n)) \ - : memcpy ((dest), (src), (n)))) -/* This looks horribly ugly, but the compiler can optimize it totally, - as the count is constant. */ -__STRING_INLINE void *__memcpy_c (void *__dest, __const void *__src, - size_t __n); - -__STRING_INLINE void * -__memcpy_c (void *__dest, __const void *__src, size_t __n) -{ - register unsigned long int __d0, __d1, __d2; - union { - unsigned int __ui; - unsigned short int __usi; - unsigned char __uc; - } *__u = __dest; - switch (__n) - { - case 0: - return __dest; - case 1: - __u->__uc = *(const unsigned char *) __src; - return __dest; - case 2: - __u->__usi = *(const unsigned short int *) __src; - return __dest; - case 3: - __u->__usi = *(const unsigned short int *) __src; - __u = (void *) __u + 2; - __u->__uc = *(2 + (const unsigned char *) __src); - return __dest; - case 4: - __u->__ui = *(const unsigned int *) __src; - return __dest; - case 6: - __u->__ui = *(const unsigned int *) __src; - __u = (void *) __u + 4; - __u->__usi = *(2 + (const unsigned short int *) __src); - return __dest; - case 8: - __u->__ui = *(const unsigned int *) __src; - __u = (void *) __u + 4; - __u->__ui = *(1 + (const unsigned int *) __src); - return __dest; - case 12: - __u->__ui = *(const unsigned int *) __src; - __u = (void *) __u + 4; - __u->__ui = *(1 + (const unsigned int *) __src); - __u = (void *) __u + 4; - __u->__ui = *(2 + (const unsigned int *) __src); - return __dest; - case 16: - __u->__ui = *(const unsigned int *) __src; - __u = (void *) __u + 4; - __u->__ui = *(1 + (const unsigned int *) __src); - __u = (void *) __u + 4; - __u->__ui = *(2 + (const unsigned int *) __src); - __u = (void *) __u + 4; - __u->__ui = *(3 + (const unsigned int *) __src); - return __dest; - case 20: - __u->__ui = *(const unsigned int *) __src; - __u = (void *) __u + 4; - __u->__ui = *(1 + (const unsigned int *) __src); - __u = (void *) __u + 4; - __u->__ui = *(2 + (const unsigned int *) __src); - __u = (void *) __u + 4; - __u->__ui = *(3 + (const unsigned int *) __src); - __u = (void *) __u + 4; - __u->__ui = *(4 + (const unsigned int *) __src); - return __dest; - } -#define __COMMON_CODE(x) \ - __asm__ __volatile__ \ - ("cld\n\t" \ - "rep; movsl" \ - x \ - : "=&c" (__d0), "=&D" (__d1), "=&S" (__d2) \ - : "0" (__n / 4), "1" (&__u->__uc), "2" (__src) \ - : "memory"); - - switch (__n % 4) - { - case 0: - __COMMON_CODE (""); - break; - case 1: - __COMMON_CODE ("\n\tmovsb"); - break; - case 2: - __COMMON_CODE ("\n\tmovsw"); - break; - case 3: - __COMMON_CODE ("\n\tmovsw\n\tmovsb"); - break; - } - return __dest; -#undef __COMMON_CODE -} - - -/* Copy N bytes of SRC to DEST, guaranteeing - correct behavior for overlapping strings. */ -#define _HAVE_STRING_ARCH_memmove 1 -#ifndef _FORCE_INLINES -__STRING_INLINE void * -memmove (void *__dest, __const void *__src, size_t __n) -{ - register unsigned long int __d0, __d1, __d2; - if (__dest < __src) - __asm__ __volatile__ - ("cld\n\t" - "rep\n\t" - "movsb" - : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2) - : "0" (__n), "1" (__src), "2" (__dest) - : "memory"); - else - __asm__ __volatile__ - ("std\n\t" - "rep\n\t" - "movsb\n\t" - "cld" - : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2) - : "0" (__n), "1" (__n - 1 + (const char *) __src), - "2" (__n - 1 + (char *) __dest) - : "memory"); - return __dest; -} -#endif - -/* Set N bytes of S to C. */ -#define _HAVE_STRING_ARCH_memset 1 -#define _USE_STRING_ARCH_memset 1 -#define memset(s, c, n) \ - (__extension__ (__builtin_constant_p (c) \ - ? (__builtin_constant_p (n) \ - ? __memset_cc (s, 0x01010101UL * (unsigned char) (c), n) \ - : __memset_cg (s, 0x01010101UL * (unsigned char) (c), n))\ - : __memset_gg (s, c, n))) - -__STRING_INLINE void *__memset_cc (void *__s, unsigned long int __pattern, - size_t __n); - -__STRING_INLINE void * -__memset_cc (void *__s, unsigned long int __pattern, size_t __n) -{ - register unsigned long int __d0, __d1; - union { - unsigned int __ui; - unsigned short int __usi; - unsigned char __uc; - } *__u = __s; - switch (__n) - { - case 0: - return __s; - case 1: - __u->__uc = __pattern; - return __s; - case 2: - __u->__usi = __pattern; - return __s; - case 3: - __u->__usi = __pattern; - __u = __extension__ ((void *) __u + 2); - __u->__uc = __pattern; - return __s; - case 4: - __u->__ui = __pattern; - return __s; - } -#define __COMMON_CODE(x) \ - __asm__ __volatile__ \ - ("cld\n\t" \ - "rep; stosl" \ - x \ - : "=&c" (__d0), "=&D" (__d1) \ - : "a" (__pattern), "0" (__n / 4), "1" (&__u->__uc) \ - : "memory") - - switch (__n % 4) - { - case 0: - __COMMON_CODE (""); - break; - case 1: - __COMMON_CODE ("\n\tstosb"); - break; - case 2: - __COMMON_CODE ("\n\tstosw"); - break; - case 3: - __COMMON_CODE ("\n\tstosw\n\tstosb"); - break; - } - return __s; -#undef __COMMON_CODE -} - -__STRING_INLINE void *__memset_cg (void *__s, unsigned long __c, size_t __n); - -__STRING_INLINE void * -__memset_cg (void *__s, unsigned long __c, size_t __n) -{ - register unsigned long int __d0, __d1; - __asm__ __volatile__ - ("cld\n\t" - "rep; stosl\n\t" - "testb $2,%b3\n\t" - "je 1f\n\t" - "stosw\n" - "1:\n\t" - "testb $1,%b3\n\t" - "je 2f\n\t" - "stosb\n" - "2:" - : "=&c" (__d0), "=&D" (__d1) - : "a" (__c), "q" (__n), "0" (__n / 4), "1" (__s) - : "memory"); - return __s; -} - -__STRING_INLINE void *__memset_gg (void *__s, char __c, size_t __n); - -__STRING_INLINE void * -__memset_gg (void *__s, char __c, size_t __n) -{ - register unsigned long int __d0, __d1; - __asm__ __volatile__ - ("cld\n\t" - "rep; stosb" - : "=&D" (__d0), "=&c" (__d1) - : "a" (__c), "0" (__s), "1" (__n) - : "memory"); - return __s; -} - - - - -/* Search N bytes of S for C. */ -#define _HAVE_STRING_ARCH_memchr 1 -#ifndef _FORCE_INLINES -__STRING_INLINE void * -memchr (__const void *__s, int __c, size_t __n) -{ - register unsigned long int __d0; - register void *__res; - if (__n == 0) - return NULL; - __asm__ __volatile__ - ("cld\n\t" - "repne; scasb\n\t" - "je 1f\n\t" - "movl $1,%0\n" - "1:" - : "=D" (__res), "=&c" (__d0) - : "a" (__c), "0" (__s), "1" (__n), - "m" ( *(struct { __extension__ char __x[__n]; } *)__s) - : "cc"); - return __res - 1; -} -#endif - -#define _HAVE_STRING_ARCH_memrchr 1 -#ifndef _FORCE_INLINES -__STRING_INLINE void * -__memrchr (__const void *__s, int __c, size_t __n) -{ - register unsigned long int __d0; - register void *__res; - if (__n == 0) - return NULL; - __asm__ __volatile__ - ("std\n\t" - "repne; scasb\n\t" - "je 1f\n\t" - "orl $-1,%0\n" - "1:\tcld\n\t" - "incl %0" - : "=D" (__res), "=&c" (__d0) - : "a" (__c), "0" (__s + __n - 1), "1" (__n), - "m" ( *(struct { __extension__ char __x[__n]; } *)__s) - : "cc"); - return __res; -} -# ifdef __USE_GNU -# define memrchr(s, c, n) __memrchr (s, c, n) -# endif -#endif - -/* Return the length of S. */ -#define _HAVE_STRING_ARCH_strlen 1 -#ifndef _FORCE_INLINES -__STRING_INLINE size_t -strlen (__const char *__str) -{ - register unsigned long int __d0; - register size_t __res; - __asm__ __volatile__ - ("cld\n\t" - "repne; scasb\n\t" - "notl %0" - : "=c" (__res), "=&D" (__d0) - : "1" (__str), "a" (0), "0" (0xffffffff), - "m" ( *(struct { char __x[0xfffffff]; } *)__str) - : "cc"); - return __res - 1; -} -#endif - -/* Copy SRC to DEST. */ -#define _HAVE_STRING_ARCH_strcpy 1 -#ifndef _FORCE_INLINES -__STRING_INLINE char * -strcpy (char *__dest, __const char *__src) -{ - register unsigned long int __d0, __d1; - __asm__ __volatile__ - ("cld\n" - "1:\n\t" - "lodsb\n\t" - "stosb\n\t" - "testb %%al,%%al\n\t" - "jne 1b" - : "=&S" (__d0), "=&D" (__d1) - : "0" (__src), "1" (__dest) - : "ax", "memory", "cc"); - return __dest; -} -#endif - -/* Copy no more than N characters of SRC to DEST. */ -#define _HAVE_STRING_ARCH_strncpy 1 -#ifndef _FORCE_INLINES -__STRING_INLINE char * -strncpy (char *__dest, __const char *__src, size_t __n) -{ - register unsigned long int __d0, __d1, __d2; - __asm__ __volatile__ - ("cld\n" - "1:\n\t" - "decl %2\n\t" - "js 2f\n\t" - "lodsb\n\t" - "stosb\n\t" - "testb %%al,%%al\n\t" - "jne 1b\n\t" - "rep; stosb\n" - "2:" - : "=&S" (__d0), "=&D" (__d1), "=&c" (__d2) - : "0" (__src), "1" (__dest), "2" (__n) - : "ax", "memory", "cc"); - return __dest; -} -#endif - -/* Append SRC onto DEST. */ -#define _HAVE_STRING_ARCH_strcat 1 -#ifndef _FORCE_INLINES -__STRING_INLINE char * -strcat (char *__dest, __const char *__src) -{ - register unsigned long int __d0, __d1, __d2, __d3; - __asm__ __volatile__ - ("cld\n\t" - "repne; scasb\n\t" - "decl %1\n" - "1:\n\t" - "lodsb\n\t" - "stosb\n\t" - "testb %%al,%%al\n\t" - "jne 1b" - : "=&S" (__d0), "=&D" (__d1), "=&c" (__d2), "=&a" (__d3) - : "0" (__src), "1" (__dest), "2" (0xffffffff), "3" (0) - : "memory", "cc"); - return __dest; -} -#endif - -/* Append no more than N characters from SRC onto DEST. */ -#define _HAVE_STRING_ARCH_strncat 1 -#ifndef _FORCE_INLINES -__STRING_INLINE char * -strncat (char *__dest, __const char *__src, size_t __n) -{ - register unsigned long int __d0, __d1, __d2, __d3; - __asm__ __volatile__ - ("cld\n\t" - "repne; scasb\n\t" - "decl %1\n\t" - "movl %4,%2\n" - "1:\n\t" - "decl %2\n\t" - "js 2f\n\t" - "lodsb\n\t" - "stosb\n\t" - "testb %%al,%%al\n\t" - "jne 1b\n\t" - "jmp 3f\n" - "2:\n\t" - "xorl %3,%3\n\t" - "stosb\n" - "3:" - : "=&S" (__d0), "=&D" (__d1), "=&c" (__d2), "=&a" (__d3) - : "g" (__n), "0" (__src), "1" (__dest), "2" (0xffffffff), "3" (0) - : "memory", "cc"); - return __dest; -} -#endif - -/* Compare S1 and S2. */ -#define _HAVE_STRING_ARCH_strcmp 1 -#ifndef _FORCE_INLINES -__STRING_INLINE int -strcmp (__const char *__s1, __const char *__s2) -{ - register unsigned long int __d0, __d1; - register int __res; - __asm__ __volatile__ - ("cld\n" - "1:\n\t" - "lodsb\n\t" - "scasb\n\t" - "jne 2f\n\t" - "testb %%al,%%al\n\t" - "jne 1b\n\t" - "xorl %%eax,%%eax\n\t" - "jmp 3f\n" - "2:\n\t" - "sbbl %%eax,%%eax\n\t" - "orb $1,%%al\n" - "3:" - : "=a" (__res), "=&S" (__d0), "=&D" (__d1) - : "1" (__s1), "2" (__s2), - "m" ( *(struct { char __x[0xfffffff]; } *)__s1), - "m" ( *(struct { char __x[0xfffffff]; } *)__s2) - : "cc"); - return __res; -} -#endif - -/* Compare N characters of S1 and S2. */ -#define _HAVE_STRING_ARCH_strncmp 1 -#ifndef _FORCE_INLINES -__STRING_INLINE int -strncmp (__const char *__s1, __const char *__s2, size_t __n) -{ - register unsigned long int __d0, __d1, __d2; - register int __res; - __asm__ __volatile__ - ("cld\n" - "1:\n\t" - "decl %3\n\t" - "js 2f\n\t" - "lodsb\n\t" - "scasb\n\t" - "jne 3f\n\t" - "testb %%al,%%al\n\t" - "jne 1b\n" - "2:\n\t" - "xorl %%eax,%%eax\n\t" - "jmp 4f\n" - "3:\n\t" - "sbbl %%eax,%%eax\n\t" - "orb $1,%%al\n" - "4:" - : "=a" (__res), "=&S" (__d0), "=&D" (__d1), "=&c" (__d2) - : "1" (__s1), "2" (__s2), "3" (__n), - "m" ( *(struct { __extension__ char __x[__n]; } *)__s1), - "m" ( *(struct { __extension__ char __x[__n]; } *)__s2) - : "cc"); - return __res; -} -#endif - -/* Find the first occurrence of C in S. */ -#define _HAVE_STRING_ARCH_strchr 1 -#define _USE_STRING_ARCH_strchr 1 -#define strchr(s, c) \ - (__extension__ (__builtin_constant_p (c) \ - ? __strchr_c (s, ((c) & 0xff) << 8) \ - : __strchr_g (s, c))) - -__STRING_INLINE char *__strchr_g (__const char *__s, int __c); - -__STRING_INLINE char * -__strchr_g (__const char *__s, int __c) -{ - register unsigned long int __d0; - register char *__res; - __asm__ __volatile__ - ("cld\n\t" - "movb %%al,%%ah\n" - "1:\n\t" - "lodsb\n\t" - "cmpb %%ah,%%al\n\t" - "je 2f\n\t" - "testb %%al,%%al\n\t" - "jne 1b\n\t" - "movl $1,%1\n" - "2:\n\t" - "movl %1,%0" - : "=a" (__res), "=&S" (__d0) - : "0" (__c), "1" (__s), - "m" ( *(struct { char __x[0xfffffff]; } *)__s) - : "cc"); - return __res - 1; -} - -__STRING_INLINE char *__strchr_c (__const char *__s, int __c); - -__STRING_INLINE char * -__strchr_c (__const char *__s, int __c) -{ - register unsigned long int __d0; - register char *__res; - __asm__ __volatile__ - ("cld\n\t" - "1:\n\t" - "lodsb\n\t" - "cmpb %%ah,%%al\n\t" - "je 2f\n\t" - "testb %%al,%%al\n\t" - "jne 1b\n\t" - "movl $1,%1\n" - "2:\n\t" - "movl %1,%0" - : "=a" (__res), "=&S" (__d0) - : "0" (__c), "1" (__s), - "m" ( *(struct { char __x[0xfffffff]; } *)__s) - : "cc"); - return __res - 1; -} - - -/* Find the first occurrence of C in S or the final NUL byte. */ -#define _HAVE_STRING_ARCH_strchrnul 1 -#define __strchrnul(s, c) \ - (__extension__ (__builtin_constant_p (c) \ - ? ((c) == '\0' \ - ? (char *) __rawmemchr (s, c) \ - : __strchrnul_c (s, ((c) & 0xff) << 8)) \ - : __strchrnul_g (s, c))) - -__STRING_INLINE char *__strchrnul_g (__const char *__s, int __c); - -__STRING_INLINE char * -__strchrnul_g (__const char *__s, int __c) -{ - register unsigned long int __d0; - register char *__res; - __asm__ __volatile__ - ("cld\n\t" - "movb %%al,%%ah\n" - "1:\n\t" - "lodsb\n\t" - "cmpb %%ah,%%al\n\t" - "je 2f\n\t" - "testb %%al,%%al\n\t" - "jne 1b\n\t" - "2:\n\t" - "movl %1,%0" - : "=a" (__res), "=&S" (__d0) - : "0" (__c), "1" (__s), - "m" ( *(struct { char __x[0xfffffff]; } *)__s) - : "cc"); - return __res - 1; -} - -__STRING_INLINE char *__strchrnul_c (__const char *__s, int __c); - -__STRING_INLINE char * -__strchrnul_c (__const char *__s, int __c) -{ - register unsigned long int __d0; - register char *__res; - __asm__ __volatile__ - ("cld\n\t" - "1:\n\t" - "lodsb\n\t" - "cmpb %%ah,%%al\n\t" - "je 2f\n\t" - "testb %%al,%%al\n\t" - "jne 1b\n\t" - "2:\n\t" - "movl %1,%0" - : "=a" (__res), "=&S" (__d0) - : "0" (__c), "1" (__s), - "m" ( *(struct { char __x[0xfffffff]; } *)__s) - : "cc"); - return __res - 1; -} -#ifdef __USE_GNU -# define strchrnul(s, c) __strchrnul (s, c) -#endif - - -/* Return the length of the initial segment of S which - consists entirely of characters not in REJECT. */ -#define _HAVE_STRING_ARCH_strcspn 1 -#ifndef _FORCE_INLINES -# ifdef __PIC__ -__STRING_INLINE size_t -strcspn (__const char *__s, __const char *__reject) -{ - register unsigned long int __d0, __d1, __d2; - register char *__res; - __asm__ __volatile__ - ("pushl %%ebx\n\t" - "cld\n\t" - "movl %4,%%edi\n\t" - "repne; scasb\n\t" - "notl %%ecx\n\t" - "decl %%ecx\n\t" - "movl %%ecx,%%ebx\n" - "1:\n\t" - "lodsb\n\t" - "testb %%al,%%al\n\t" - "je 2f\n\t" - "movl %4,%%edi\n\t" - "movl %%ebx,%%ecx\n\t" - "repne; scasb\n\t" - "jne 1b\n" - "2:\n\t" - "popl %%ebx" - : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2) - : "d" (__reject), "0" (__s), "1" (0), "2" (0xffffffff), - "m" ( *(struct { char __x[0xfffffff]; } *)__s) - : "cc"); - return (__res - 1) - __s; -} -# else -__STRING_INLINE size_t -strcspn (__const char *__s, __const char *__reject) -{ - register unsigned long int __d0, __d1, __d2, __d3; - register char *__res; - __asm__ __volatile__ - ("cld\n\t" - "movl %5,%%edi\n\t" - "repne; scasb\n\t" - "notl %%ecx\n\t" - "decl %%ecx\n\t" - "movl %%ecx,%%edx\n" - "1:\n\t" - "lodsb\n\t" - "testb %%al,%%al\n\t" - "je 2f\n\t" - "movl %5,%%edi\n\t" - "movl %%edx,%%ecx\n\t" - "repne; scasb\n\t" - "jne 1b\n" - "2:" - : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3) - : "g" (__reject), "0" (__s), "1" (0), "2" (0xffffffff), - "m" ( *(struct { char __x[0xfffffff]; } *)__s) - : "cc"); - return (__res - 1) - __s; -} -# endif -#endif - - -/* Return the length of the initial segment of S which - consists entirely of characters in ACCEPT. */ -#define _HAVE_STRING_ARCH_strspn 1 -#ifndef _FORCE_INLINES -# ifdef __PIC__ -__STRING_INLINE size_t -strspn (__const char *__s, __const char *__accept) -{ - register unsigned long int __d0, __d1, __d2; - register char *__res; - __asm__ __volatile__ - ("pushl %%ebx\n\t" - "cld\n\t" - "movl %4,%%edi\n\t" - "repne; scasb\n\t" - "notl %%ecx\n\t" - "decl %%ecx\n\t" - "movl %%ecx,%%ebx\n" - "1:\n\t" - "lodsb\n\t" - "testb %%al,%%al\n\t" - "je 2f\n\t" - "movl %4,%%edi\n\t" - "movl %%ebx,%%ecx\n\t" - "repne; scasb\n\t" - "je 1b\n" - "2:\n\t" - "popl %%ebx" - : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2) - : "r" (__accept), "0" (__s), "1" (0), "2" (0xffffffff), - "m" ( *(struct { char __x[0xfffffff]; } *)__s) - : "cc"); - return (__res - 1) - __s; -} -# else -__STRING_INLINE size_t -strspn (__const char *__s, __const char *__accept) -{ - register unsigned long int __d0, __d1, __d2, __d3; - register char *__res; - __asm__ __volatile__ - ("cld\n\t" - "movl %5,%%edi\n\t" - "repne; scasb\n\t" - "notl %%ecx\n\t" - "decl %%ecx\n\t" - "movl %%ecx,%%edx\n" - "1:\n\t" - "lodsb\n\t" - "testb %%al,%%al\n\t" - "je 2f\n\t" - "movl %5,%%edi\n\t" - "movl %%edx,%%ecx\n\t" - "repne; scasb\n\t" - "je 1b\n" - "2:" - : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3) - : "g" (__accept), "0" (__s), "1" (0), "2" (0xffffffff), - "m" ( *(struct { char __x[0xfffffff]; } *)__s) - : "cc"); - return (__res - 1) - __s; -} -# endif -#endif - - -/* Find the first occurrence in S of any character in ACCEPT. */ -#define _HAVE_STRING_ARCH_strpbrk 1 -#ifndef _FORCE_INLINES -# ifdef __PIC__ -__STRING_INLINE char * -strpbrk (__const char *__s, __const char *__accept) -{ - unsigned long int __d0, __d1, __d2; - register char *__res; - __asm__ __volatile__ - ("pushl %%ebx\n\t" - "cld\n\t" - "movl %4,%%edi\n\t" - "repne; scasb\n\t" - "notl %%ecx\n\t" - "decl %%ecx\n\t" - "movl %%ecx,%%ebx\n" - "1:\n\t" - "lodsb\n\t" - "testb %%al,%%al\n\t" - "je 2f\n\t" - "movl %4,%%edi\n\t" - "movl %%ebx,%%ecx\n\t" - "repne; scasb\n\t" - "jne 1b\n\t" - "decl %0\n\t" - "jmp 3f\n" - "2:\n\t" - "xorl %0,%0\n" - "3:\n\t" - "popl %%ebx" - : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2) - : "r" (__accept), "0" (__s), "1" (0), "2" (0xffffffff), - "m" ( *(struct { char __x[0xfffffff]; } *)__s) - : "cc"); - return __res; -} -# else -__STRING_INLINE char * -strpbrk (__const char *__s, __const char *__accept) -{ - register unsigned long int __d0, __d1, __d2, __d3; - register char *__res; - __asm__ __volatile__ - ("cld\n\t" - "movl %5,%%edi\n\t" - "repne; scasb\n\t" - "notl %%ecx\n\t" - "decl %%ecx\n\t" - "movl %%ecx,%%edx\n" - "1:\n\t" - "lodsb\n\t" - "testb %%al,%%al\n\t" - "je 2f\n\t" - "movl %5,%%edi\n\t" - "movl %%edx,%%ecx\n\t" - "repne; scasb\n\t" - "jne 1b\n\t" - "decl %0\n\t" - "jmp 3f\n" - "2:\n\t" - "xorl %0,%0\n" - "3:" - : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3) - : "g" (__accept), "0" (__s), "1" (0), "2" (0xffffffff), - "m" ( *(struct { char __x[0xfffffff]; } *)__s) - : "cc"); - return __res; -} -# endif -#endif - - -/* Find the first occurrence of NEEDLE in HAYSTACK. */ -#define _HAVE_STRING_ARCH_strstr 1 -#ifndef _FORCE_INLINES -# ifdef __PIC__ -__STRING_INLINE char * -strstr (__const char *__haystack, __const char *__needle) -{ - register unsigned long int __d0, __d1, __d2; - register char *__res; - __asm__ __volatile__ - ("pushl %%ebx\n\t" - "cld\n\t" \ - "movl %4,%%edi\n\t" - "repne; scasb\n\t" - "notl %%ecx\n\t" - "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */ - "movl %%ecx,%%ebx\n" - "1:\n\t" - "movl %4,%%edi\n\t" - "movl %%esi,%%eax\n\t" - "movl %%ebx,%%ecx\n\t" - "repe; cmpsb\n\t" - "je 2f\n\t" /* also works for empty string, see above */ - "xchgl %%eax,%%esi\n\t" - "incl %%esi\n\t" - "cmpb $0,-1(%%eax)\n\t" - "jne 1b\n\t" - "xorl %%eax,%%eax\n\t" - "2:\n\t" - "popl %%ebx" - : "=&a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2) - : "r" (__needle), "0" (0), "1" (0xffffffff), "2" (__haystack) - : "memory", "cc"); - return __res; -} -# else -__STRING_INLINE char * -strstr (__const char *__haystack, __const char *__needle) -{ - register unsigned long int __d0, __d1, __d2, __d3; - register char *__res; - __asm__ __volatile__ - ("cld\n\t" \ - "movl %5,%%edi\n\t" - "repne; scasb\n\t" - "notl %%ecx\n\t" - "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */ - "movl %%ecx,%%edx\n" - "1:\n\t" - "movl %5,%%edi\n\t" - "movl %%esi,%%eax\n\t" - "movl %%edx,%%ecx\n\t" - "repe; cmpsb\n\t" - "je 2f\n\t" /* also works for empty string, see above */ - "xchgl %%eax,%%esi\n\t" - "incl %%esi\n\t" - "cmpb $0,-1(%%eax)\n\t" - "jne 1b\n\t" - "xorl %%eax,%%eax\n\t" - "2:" - : "=&a" (__res), "=&c" (__d0), "=&S" (__d1), "=&d" (__d2), "=&D" (__d3) - : "g" (__needle), "0" (0), "1" (0xffffffff), "2" (__haystack) - : "memory", "cc"); - return __res; -} -# endif -#endif - -#ifndef _FORCE_INLINES -# undef __STRING_INLINE -#endif - -#endif /* use string inlines && GNU CC */ diff --git a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S index aa8df167d0..ee329ee86c 100644 --- a/sysdeps/i386/bsd-_setjmp.S +++ b/sysdeps/i386/bsd-_setjmp.S @@ -1,5 +1,5 @@ /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. i386 version. - Copyright (C) 1994-1997,2000,2001,2002 Free Software Foundation, Inc. + Copyright (C) 1994-1997,2000-2002,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 @@ -22,9 +22,7 @@ in setjmp doesn't clobber the state restored by longjmp. */ #include <sysdep.h> -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> +#include <jmpbuf-offsets.h> #include "bp-sym.h" #include "bp-asm.h" @@ -44,8 +42,14 @@ ENTRY (BP_SYM (_setjmp)) movl %esi, (JB_SI*4)(%edx) movl %edi, (JB_DI*4)(%edx) leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */ +#ifdef PTR_MANGLE + PTR_MANGLE (%ecx) +#endif movl %ecx, (JB_SP*4)(%edx) movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */ +#ifdef PTR_MANGLE + PTR_MANGLE (%ecx) +#endif movl %ecx, (JB_PC*4)(%edx) LEAVE movl %ebp, (JB_BP*4)(%edx) /* Save caller's frame pointer. */ diff --git a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S index ea242d1f96..c9af0e1477 100644 --- a/sysdeps/i386/bsd-setjmp.S +++ b/sysdeps/i386/bsd-setjmp.S @@ -1,5 +1,5 @@ /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. i386 version. - Copyright (C) 1994,1995,1996,1997,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1994-1997,2000,2001,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 @@ -22,12 +22,14 @@ in setjmp doesn't clobber the state restored by longjmp. */ #include <sysdep.h> -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> +#include <jmpbuf-offsets.h> #include "bp-sym.h" #include "bp-asm.h" +#define PARMS LINKAGE /* no space for saved regs */ +#define JMPBUF PARMS +#define SIGMSK JMPBUF+PTR_SIZE + ENTRY (BP_SYM (setjmp)) /* Note that we have to use a non-exported symbol in the next jump since otherwise gas will emit it as a jump through the @@ -42,17 +44,27 @@ ENTRY (BP_SYM (setjmp)) movl %esi, (JB_SI*4)(%eax) movl %edi, (JB_DI*4)(%eax) leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */ +#ifdef PTR_MANGLE + PTR_MANGLE (%ecx) +#endif movl %ecx, (JB_SP*4)(%eax) movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */ +#ifdef PTR_MANGLE + PTR_MANGLE (%ecx) +#endif movl %ecx, (JB_PC*4)(%eax) LEAVE /* pop frame pointer to prepare for tail-call. */ movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer. */ /* Call __sigjmp_save. */ pushl $1 + cfi_adjust_cfa_offset (4) pushl 8(%esp) + cfi_adjust_cfa_offset (4) call BP_SYM (__sigjmp_save) popl %ecx + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) ret END (BP_SYM (setjmp)) diff --git a/sysdeps/i386/bzero.c b/sysdeps/i386/bzero.c index c2b135cb88..a1cfe36ba1 100644 --- a/sysdeps/i386/bzero.c +++ b/sysdeps/i386/bzero.c @@ -1,6 +1,6 @@ /* bzero -- set a block of memory to zero. For Intel 80x86, x>=3. This file is part of the GNU C Library. - Copyright (C) 1991,92,93,97,98,99 Free Software Foundation, Inc. + Copyright (C) 1991,92,93,97,98,99, 05 Free Software Foundation, Inc. Contributed by Torbjorn Granlund (tege@sics.se). The GNU C Library is free software; you can redistribute it and/or @@ -79,5 +79,5 @@ __bzero (dstpp, len) weak_alias (__bzero, bzero) #else -#include <sysdeps/generic/bzero.c> +#include <string/bzero.c> #endif diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure new file mode 100755 index 0000000000..d1d4dc15a7 --- /dev/null +++ b/sysdeps/i386/configure @@ -0,0 +1,54 @@ +# This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/i386. + +echo "$as_me:$LINENO: checking if -g produces usable source locations for assembler-with-cpp" >&5 +echo $ECHO_N "checking if -g produces usable source locations for assembler-with-cpp... $ECHO_C" >&6 +if test "${libc_cv_cpp_asm_debuginfo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat > conftest.S <<EOF +#include "confdefs.h" + +/* comment on + two lines */ + ${libc_cv_dot_text} + ${libc_cv_asm_global_directive} foo +foo: + /* Unfortunately this test only works for a real instruction, + not for any of the machine-independent pseudo-ops. + So we just have to assume everybody has a "nop". */ + nop + /* comment */ + nop + /* comment */ + nop +EOF +if { ac_try='${CC-cc} $CPPFLAGS $ASFLAGS -g -c conftest.S 1>&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && { + ac_pattern='conftest\.S' + { ac_try='readelf --debug-dump=line conftest.o | + grep $ac_pattern 1>&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + }; then + libc_cv_cpp_asm_debuginfo=yes +else + libc_cv_cpp_asm_debuginfo=no +fi +rm -f conftest* +fi +echo "$as_me:$LINENO: result: $libc_cv_cpp_asm_debuginfo" >&5 +echo "${ECHO_T}$libc_cv_cpp_asm_debuginfo" >&6 +if test $libc_cv_cpp_asm_debuginfo = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_CPP_ASM_DEBUGINFO 1 +_ACEOF + +fi diff --git a/sysdeps/i386/configure.in b/sysdeps/i386/configure.in new file mode 100644 index 0000000000..028e1ae8e1 --- /dev/null +++ b/sysdeps/i386/configure.in @@ -0,0 +1,35 @@ +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local configure fragment for sysdeps/i386. + +AC_CACHE_CHECK(if -g produces usable source locations for assembler-with-cpp, + libc_cv_cpp_asm_debuginfo, [dnl +cat > conftest.S <<EOF +#include "confdefs.h" + +/* comment on + two lines */ + ${libc_cv_dot_text} + ${libc_cv_asm_global_directive} foo +foo: + /* Unfortunately this test only works for a real instruction, + not for any of the machine-independent pseudo-ops. + So we just have to assume everybody has a "nop". */ + nop + /* comment */ + nop + /* comment */ + nop +EOF +if AC_TRY_COMMAND([${CC-cc} $CPPFLAGS $ASFLAGS -g -c conftest.S 1>&AS_MESSAGE_LOG_FD]) && { + ac_pattern='conftest\.S' + AC_TRY_COMMAND([readelf --debug-dump=line conftest.o | + grep $ac_pattern 1>&AS_MESSAGE_LOG_FD]) + }; then + libc_cv_cpp_asm_debuginfo=yes +else + libc_cv_cpp_asm_debuginfo=no +fi +rm -f conftest*])AC_SUBST(libc_cv_cpp_asm_debuginfo) +if test $libc_cv_cpp_asm_debuginfo = yes; then + AC_DEFINE(HAVE_CPP_ASM_DEBUGINFO) +fi diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index c48d9d325e..df3edf5460 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. i386 version. - Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-2002, 2003, 2004, 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 @@ -129,7 +129,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf32_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (GLRO(dl_profile), l)) + if (GLRO(dl_profile) != NULL + && _dl_name_match_p (GLRO(dl_profile), l)) /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ GL(dl_profile_map) = l; @@ -154,112 +155,18 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) destroys the passed register information. */ /* GKM FIXME: Fix trampoline to pass bounds so we can do without the `__unbounded' qualifier. */ -#define ARCH_FIXUP_ATTRIBUTE __attribute__ ((regparm (3), unused)) +#define ARCH_FIXUP_ATTRIBUTE __attribute__ ((regparm (3), stdcall, unused)) -static ElfW(Addr) fixup (struct link_map *__unbounded l, - ElfW(Word) reloc_offset) +extern ElfW(Addr) _dl_fixup (struct link_map *__unbounded l, + ElfW(Word) reloc_offset) ARCH_FIXUP_ATTRIBUTE; -static ElfW(Addr) profile_fixup (struct link_map *l, ElfW(Word) reloc_offset, - ElfW(Addr) retaddr) +extern ElfW(Addr) _dl_profile_fixup (struct link_map *l, + ElfW(Word) reloc_offset, + ElfW(Addr) retaddr, void *regs, + long int *framesizep) ARCH_FIXUP_ATTRIBUTE; # endif -/* This code is used in dl-runtime.c to call the `fixup' function - and then redirect to the address it returns. */ -# if !defined PROF && !__BOUNDED_POINTERS__ -# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\ - .text\n\ - .globl _dl_runtime_resolve\n\ - .type _dl_runtime_resolve, @function\n\ - " CFI_STARTPROC "\n\ - .align 16\n\ -_dl_runtime_resolve:\n\ - " CFI_ADJUST_CFA_OFFSET (8) "\n\ - pushl %eax # Preserve registers otherwise clobbered.\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - pushl %ecx\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - pushl %edx\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - movl 16(%esp), %edx # Copy args pushed by PLT in register. Note\n\ - movl 12(%esp), %eax # that `fixup' takes its parameters in regs.\n\ - call fixup # Call resolver.\n\ - popl %edx # Get register content back.\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - popl %ecx\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - xchgl %eax, (%esp) # Get %eax contents end store function address.\n\ - ret $8 # Jump to function address.\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 16\n\ -_dl_runtime_profile:\n\ - " CFI_ADJUST_CFA_OFFSET (8) "\n\ - pushl %eax # Preserve registers otherwise clobbered.\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - pushl %ecx\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - pushl %edx\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - movl 20(%esp), %ecx # Load return address\n\ - movl 16(%esp), %edx # Copy args pushed by PLT in register. Note\n\ - movl 12(%esp), %eax # that `fixup' takes its parameters in regs.\n\ - call profile_fixup # Call resolver.\n\ - popl %edx # Get register content back.\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - popl %ecx\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - xchgl %eax, (%esp) # Get %eax contents end store function address.\n\ - ret $8 # Jump to function address.\n\ - " CFI_ENDPROC "\n\ - .size _dl_runtime_profile, .-_dl_runtime_profile\n\ - .previous\n\ -"); -# else -# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\ - .text\n\ - .globl _dl_runtime_resolve\n\ - .globl _dl_runtime_profile\n\ - .type _dl_runtime_resolve, @function\n\ - .type _dl_runtime_profile, @function\n\ - " CFI_STARTPROC "\n\ - .align 16\n\ -_dl_runtime_resolve:\n\ -_dl_runtime_profile:\n\ - " CFI_ADJUST_CFA_OFFSET (8) "\n\ - pushl %eax # Preserve registers otherwise clobbered.\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - pushl %ecx\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - pushl %edx\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - movl 16(%esp), %edx # Push the arguments for `fixup'\n\ - movl 12(%esp), %eax\n\ - pushl %edx\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - pushl %eax\n\ - " CFI_ADJUST_CFA_OFFSET (4) "\n\ - call fixup # Call resolver.\n\ - popl %edx # Pop the parameters\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - popl %ecx\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - popl %edx # Get register content back.\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - popl %ecx\n\ - " CFI_ADJUST_CFA_OFFSET (-4) "\n\ - xchgl %eax, (%esp) # Get %eax contents end store function address.\n\ - ret $8 # Jump to function address.\n\ - " CFI_ENDPROC "\n\ - .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ - .size _dl_runtime_profile, .-_dl_runtime_profile\n\ - .previous\n\ -"); -# endif #endif /* Mask identifying addresses reserved for the user program, @@ -308,11 +215,21 @@ _dl_start_user:\n\ movl _rtld_local@GOTOFF(%ebx), %eax\n\ leal 8(%esp,%edx,4), %esi\n\ leal 4(%esp), %ecx\n\ + movl %esp, %ebp\n\ + # Make sure _dl_init is run with 16 byte aligned stack.\n\ + andl $-16, %esp\n\ + pushl %eax\n\ + pushl %eax\n\ + pushl %ebp\n\ pushl %esi\n\ + # Clear %ebp, so that even constructors have terminated backchain.\n\ + xorl %ebp, %ebp\n\ # Call the function to run the initializers.\n\ call _dl_init_internal@PLT\n\ # Pass our finalizer function to the user in %edx, as per ELF ABI.\n\ leal _dl_fini@GOTOFF(%ebx), %edx\n\ + # Restore %esp _start expects.\n\ + movl (%esp), %esp\n\ # Jump to the user's entry point.\n\ jmp *%edi\n\ .previous\n\ @@ -375,15 +292,18 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc, return value; } -#endif /* !dl_machine_h */ -#ifdef RESOLVE +/* Names of the architecture-specific auditing callback functions. */ +#define ARCH_LA_PLTENTER i86_gnu_pltenter +#define ARCH_LA_PLTEXIT i86_gnu_pltexit + +#endif /* !dl_machine_h */ /* The i386 never uses Elf32_Rela relocations for the dynamic linker. Prelinked libraries may use Elf32_Rela though. */ -#ifdef RTLD_BOOTSTRAP -# define ELF_MACHINE_NO_RELA 1 -#endif +#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP + +#ifdef RESOLVE_MAP /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ @@ -422,17 +342,8 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, #endif /* !RTLD_BOOTSTRAP and have no -z combreloc */ { const Elf32_Sym *const refsym = sym; -#if defined USE_TLS && !defined RTLD_BOOTSTRAP struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); - Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; -#else - Elf32_Addr value = RESOLVE (&sym, version, r_type); - -# ifndef RTLD_BOOTSTRAP - if (sym != NULL) -# endif - value += sym->st_value; -#endif /* use TLS and !RTLD_BOOTSTRAP */ + Elf32_Addr value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value; switch (r_type) { @@ -549,14 +460,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, # ifndef RESOLVE_CONFLICT_FIND_MAP const Elf32_Sym *const refsym = sym; # endif -# ifdef USE_TLS struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value; -# else - Elf32_Addr value = RESOLVE (&sym, version, r_type); - if (sym != NULL) - value += sym->st_value; -# endif switch (ELF32_R_TYPE (reloc->r_info)) { @@ -692,4 +597,4 @@ elf_machine_lazy_rela (struct link_map *map, #endif /* !RTLD_BOOTSTRAP */ -#endif /* RESOLVE */ +#endif /* RESOLVE_MAP */ diff --git a/sysdeps/i386/dl-trampoline.S b/sysdeps/i386/dl-trampoline.S new file mode 100644 index 0000000000..fd87eb711d --- /dev/null +++ b/sysdeps/i386/dl-trampoline.S @@ -0,0 +1,184 @@ +/* PLT trampolines. i386 version. + Copyright (C) 2004, 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 <sysdep.h> + + .text + .globl _dl_runtime_resolve + .type _dl_runtime_resolve, @function + cfi_startproc + .align 16 +_dl_runtime_resolve: + cfi_adjust_cfa_offset (8) + pushl %eax # Preserve registers otherwise clobbered. + cfi_adjust_cfa_offset (4) + pushl %ecx + cfi_adjust_cfa_offset (4) + pushl %edx + cfi_adjust_cfa_offset (4) + movl 16(%esp), %edx # Copy args pushed by PLT in register. Note + movl 12(%esp), %eax # that `fixup' takes its parameters in regs. + call _dl_fixup # Call resolver. + popl %edx # Get register content back. + cfi_adjust_cfa_offset (-4) + popl %ecx + cfi_adjust_cfa_offset (-4) + xchgl %eax, (%esp) # Get %eax contents end store function address. + ret $8 # Jump to function address. + cfi_endproc + .size _dl_runtime_resolve, .-_dl_runtime_resolve + + +#ifndef PROF + .globl _dl_runtime_profile + .type _dl_runtime_profile, @function + cfi_startproc + .align 16 +_dl_runtime_profile: + cfi_adjust_cfa_offset (8) + pushl %esp + cfi_adjust_cfa_offset (4) + addl $8, (%esp) # Account for the pushed PLT data + pushl %ebp + cfi_adjust_cfa_offset (4) + pushl %eax # Preserve registers otherwise clobbered. + cfi_adjust_cfa_offset (4) + pushl %ecx + cfi_adjust_cfa_offset (4) + pushl %edx + cfi_adjust_cfa_offset (4) + movl %esp, %ecx + subl $8, %esp + cfi_adjust_cfa_offset (8) + movl $-1, 4(%esp) + leal 4(%esp), %edx + movl %edx, (%esp) + pushl %ecx # Address of the register structure + cfi_adjust_cfa_offset (4) + movl 40(%esp), %ecx # Load return address + movl 36(%esp), %edx # Copy args pushed by PLT in register. Note + movl 32(%esp), %eax # that `fixup' takes its parameters in regs. + call _dl_profile_fixup # Call resolver. + cfi_adjust_cfa_offset (-8) + movl (%esp), %edx + testl %edx, %edx + jns 1f + popl %edx + cfi_adjust_cfa_offset (-4) + popl %edx # Get register content back. + cfi_adjust_cfa_offset (-4) + popl %ecx + cfi_adjust_cfa_offset (-4) + xchgl %eax, (%esp) # Get %eax contents end store function address. + ret $16 # Jump to function address. + + /* + +32 return address + +28 PLT1 + +24 PLT2 + +20 %esp + +16 %ebp + +12 %eax + +8 %ecx + +4 %edx + %esp free + */ + cfi_adjust_cfa_offset (12) +1: movl %ebx, (%esp) + cfi_rel_offset (3, 0) + movl %edx, %ebx # This is the frame buffer size + pushl %edi + cfi_adjust_cfa_offset (4) + cfi_rel_offset (7, 0) + pushl %esi + cfi_adjust_cfa_offset (4) + cfi_rel_offset (6, 0) + leal 44(%esp), %esi + movl %ebx, %ecx + movl %esp, %edi + subl %ebx, %edi + andl $0xfffffff0, %edi # Align stack + movl %esp, %ebx + cfi_def_cfa_register (3) + movl %edi, %esp + shrl $2, %ecx + rep + movsl + movl (%edi), %esi + cfi_restore (6) + movl 4(%edi), %edi + cfi_restore (7) + /* + %ebx+40 return address + %ebx+36 PLT1 + %ebx+32 PLT2 + %ebx+28 %esp + %ebx+24 %ebp + %ebx+20 %eax + %ebx+16 %ecx + %ebx+12 %edx + %ebx+8 %ebx + %ebx+4 free + %ebx free + %esp copied stack frame + */ + movl %eax, (%ebx) + movl 12(%ebx), %edx + movl 16(%ebx), %ecx + movl 20(%ebx), %eax + call *(%ebx) + movl %ebx, %esp + cfi_def_cfa_register (4) + movl 8(%esp), %ebx + cfi_restore (3) + /* + +40 return address + +36 PLT1 + +32 PLT2 + +28 %esp + +24 %ebp + +20 %eax + +16 %ecx + +12 %edx + +8 free + +4 free + %esp free + */ + subl $20, %esp + cfi_adjust_cfa_offset (20) + movl %eax, (%esp) + movl %edx, 4(%esp) + fstpt 8(%esp) + fstpt 20(%esp) + pushl %esp + cfi_adjust_cfa_offset (4) + leal 36(%esp), %ecx + movl 56(%esp), %eax + movl 60(%esp), %edx + call _dl_call_pltexit + movl (%esp), %eax + movl 4(%esp), %edx + fldt 20(%esp) + fldt 8(%esp) + addl $60, %esp + cfi_adjust_cfa_offset (-60) + ret + cfi_endproc + .size _dl_runtime_profile, .-_dl_runtime_profile +#endif diff --git a/sysdeps/i386/elf/bsd-setjmp.S b/sysdeps/i386/elf/bsd-setjmp.S deleted file mode 100644 index 72a85b18e1..0000000000 --- a/sysdeps/i386/elf/bsd-setjmp.S +++ /dev/null @@ -1,78 +0,0 @@ -/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. i386 version. - Copyright (C) 1995-1997,2000,2001,2002,2003 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 <sysdep.h> -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> -#include "bp-sym.h" -#include "bp-asm.h" - -#define PARMS LINKAGE /* no space for saved regs */ -#define JMPBUF PARMS -#define SIGMSK JMPBUF+PTR_SIZE - -ENTRY (BP_SYM (setjmp)) - /* Note that we have to use a non-exported symbol in the next - jump since otherwise gas will emit it as a jump through the - PLT which is what we cannot use here. */ - ENTER - - movl JMPBUF(%esp), %eax - CHECK_BOUNDS_BOTH_WIDE (%eax, JMPBUF(%esp), $JB_SIZE) - - /* Save registers. */ - movl %ebx, (JB_BX*4)(%eax) - movl %esi, (JB_SI*4)(%eax) - movl %edi, (JB_DI*4)(%eax) - leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */ - movl %ecx, (JB_SP*4)(%eax) - movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */ - movl %ecx, (JB_PC*4)(%eax) - LEAVE /* pop frame pointer to prepare for tail-call. */ - movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer. */ - - /* Call __sigjmp_save. */ - pushl $1 - pushl 8(%esp) -#ifdef PIC - /* We cannot use the PLT, because it requires that %ebx be set, but - we can't save and restore our caller's value. Instead, we do an - indirect jump through the GOT, using for the temporary register - %ecx, which is call-clobbered. */ - call __i686.get_pc_thunk.cx - addl $_GLOBAL_OFFSET_TABLE_, %ecx - leal C_SYMBOL_NAME (BP_SYM (__sigjmp_save)@GOTOFF)(%ecx), %ecx - call *%ecx -#else - call BP_SYM (__sigjmp_save) -#endif - popl %ecx - popl %edx - ret -END (BP_SYM (setjmp)) - - .section .gnu.linkonce.t.__i686.get_pc_thunk.cx,"ax",@progbits - .globl __i686.get_pc_thunk.cx - .hidden __i686.get_pc_thunk.cx - .type __i686.get_pc_thunk.cx,@function -__i686.get_pc_thunk.cx: - movl (%esp), %ecx - ret - .size __i686.get_pc_thunk.cx, . - __i686.get_pc_thunk.cx diff --git a/sysdeps/i386/elf/setjmp.S b/sysdeps/i386/elf/setjmp.S deleted file mode 100644 index d6ae98b8b4..0000000000 --- a/sysdeps/i386/elf/setjmp.S +++ /dev/null @@ -1,70 +0,0 @@ -/* setjmp for i386, ELF version. - Copyright (C) 1995-1997,2000,2001,2002,2003 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 <sysdep.h> -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> -#include "bp-sym.h" -#include "bp-asm.h" - -#define PARMS LINKAGE /* no space for saved regs */ -#define JMPBUF PARMS -#define SIGMSK JMPBUF+PTR_SIZE - -ENTRY (BP_SYM (__sigsetjmp)) - ENTER - - movl JMPBUF(%esp), %eax - CHECK_BOUNDS_BOTH_WIDE (%eax, JMPBUF(%esp), $JB_SIZE) - - /* Save registers. */ - movl %ebx, (JB_BX*4)(%eax) - movl %esi, (JB_SI*4)(%eax) - movl %edi, (JB_DI*4)(%eax) - leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */ - movl %ecx, (JB_SP*4)(%eax) - movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */ - movl %ecx, (JB_PC*4)(%eax) - LEAVE /* pop frame pointer to prepare for tail-call. */ - movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer. */ - - /* Make a tail call to __sigjmp_save; it takes the same args. */ -#ifdef PIC - /* We cannot use the PLT, because it requires that %ebx be set, but - we can't save and restore our caller's value. Instead, we do an - indirect jump through the GOT, using for the temporary register - %ecx, which is call-clobbered. */ - call __i686.get_pc_thunk.cx - addl $_GLOBAL_OFFSET_TABLE_, %ecx - leal C_SYMBOL_NAME (BP_SYM (__sigjmp_save)@GOTOFF)(%ecx), %ecx - jmp *%ecx -#else - jmp BP_SYM (__sigjmp_save) -#endif -END (BP_SYM (__sigsetjmp)) - - .section .gnu.linkonce.t.__i686.get_pc_thunk.cx,"ax",@progbits - .globl __i686.get_pc_thunk.cx - .hidden __i686.get_pc_thunk.cx - .type __i686.get_pc_thunk.cx,@function -__i686.get_pc_thunk.cx: - movl (%esp), %ecx - ret - .size __i686.get_pc_thunk.cx, . - __i686.get_pc_thunk.cx diff --git a/sysdeps/i386/ffs.c b/sysdeps/i386/ffs.c index 695d48be56..b6aac64dd8 100644 --- a/sysdeps/i386/ffs.c +++ b/sysdeps/i386/ffs.c @@ -1,7 +1,7 @@ /* ffs -- find first set bit in a word, counted from least significant end. For Intel 80x86, x>=3. This file is part of the GNU C Library. - Copyright (C) 1991, 92, 93, 94, 97, 98, 2004 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 97, 98, 2004, 2005 Free Software Foundation, Inc. Contributed by Torbjorn Granlund (tege@sics.se). The GNU C Library is free software; you can redistribute it and/or @@ -47,5 +47,5 @@ libc_hidden_builtin_def (ffs) weak_alias (__ffs, ffsl) #else -#include <sysdeps/generic/ffs.c> +#include <string/ffs.c> #endif diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h index e04ce95099..28547d44b8 100644 --- a/sysdeps/i386/fpu/bits/mathinline.h +++ b/sysdeps/i386/fpu/bits/mathinline.h @@ -1,5 +1,5 @@ /* Inline math functions for i387. - Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by John C. Bowman <bowman@math.ualberta.ca>, 1995. @@ -529,24 +529,38 @@ __inline_mathcodeNP (tanh, __x, \ __inline_mathcodeNP (floor, __x, \ register long double __value; \ - __volatile unsigned short int __cw; \ - __volatile unsigned short int __cwtmp; \ - __asm __volatile ("fnstcw %0" : "=m" (__cw)); \ - __cwtmp = (__cw & 0xf3ff) | 0x0400; /* rounding down */ \ - __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); \ - __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); \ - __asm __volatile ("fldcw %0" : : "m" (__cw)); \ + register int __ignore; \ + unsigned short int __cw; \ + unsigned short int __cwtmp; \ + __asm __volatile ("fnstcw %3\n\t" \ + "movzwl %3, %1\n\t" \ + "andl $0xf3ff, %1\n\t" \ + "orl $0x0400, %1\n\t" /* rounding down */ \ + "movw %w1, %2\n\t" \ + "fldcw %2\n\t" \ + "frndint\n\t" \ + "fldcw %3" \ + : "=t" (__value), "=&q" (__ignore), "=m" (__cwtmp), \ + "=m" (__cw) \ + : "0" (__x)); \ return __value) __inline_mathcodeNP (ceil, __x, \ register long double __value; \ - __volatile unsigned short int __cw; \ - __volatile unsigned short int __cwtmp; \ - __asm __volatile ("fnstcw %0" : "=m" (__cw)); \ - __cwtmp = (__cw & 0xf3ff) | 0x0800; /* rounding up */ \ - __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); \ - __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); \ - __asm __volatile ("fldcw %0" : : "m" (__cw)); \ + register int __ignore; \ + unsigned short int __cw; \ + unsigned short int __cwtmp; \ + __asm __volatile ("fnstcw %3\n\t" \ + "movzwl %3, %1\n\t" \ + "andl $0xf3ff, %1\n\t" \ + "orl $0x0800, %1\n\t" /* rounding up */ \ + "movw %w1, %2\n\t" \ + "fldcw %2\n\t" \ + "frndint\n\t" \ + "fldcw %3" \ + : "=t" (__value), "=&q" (__ignore), "=m" (__cwtmp), \ + "=m" (__cw) \ + : "0" (__x)); \ return __value) #ifdef __FAST_MATH__ diff --git a/sysdeps/i386/fpu/e_acosh.S b/sysdeps/i386/fpu/e_acosh.S index 981425ec7a..62a232471f 100644 --- a/sysdeps/i386/fpu/e_acosh.S +++ b/sysdeps/i386/fpu/e_acosh.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -50,9 +50,7 @@ ENTRY(__ieee754_acosh) cmpl $0x41b00000, %ecx ja 3f // x > 2^28 #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif cmpl $0x40000000, %ecx ja 4f // x > 2 diff --git a/sysdeps/i386/fpu/e_acoshf.S b/sysdeps/i386/fpu/e_acoshf.S index 17be69d575..1906c60578 100644 --- a/sysdeps/i386/fpu/e_acoshf.S +++ b/sysdeps/i386/fpu/e_acoshf.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -50,9 +50,7 @@ ENTRY(__ieee754_acoshf) cmpl $0x47000000, %ecx ja 3f // x > 2^14 #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif cmpl $0x40000000, %ecx ja 4f // x > 2 diff --git a/sysdeps/i386/fpu/e_acoshl.S b/sysdeps/i386/fpu/e_acoshl.S index 7b6885da18..c7b548d25a 100644 --- a/sysdeps/i386/fpu/e_acoshl.S +++ b/sysdeps/i386/fpu/e_acoshl.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -57,9 +57,7 @@ ENTRY(__ieee754_acoshl) cmpl $0x4020, %ecx ja 3f // x > 2^34 #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif cmpl $0x4000, %ecx ja 4f // x > 2 diff --git a/sysdeps/i386/fpu/e_atanh.S b/sysdeps/i386/fpu/e_atanh.S index 6fb53a4acc..3566ec6eff 100644 --- a/sysdeps/i386/fpu/e_atanh.S +++ b/sysdeps/i386/fpu/e_atanh.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arctanh function. - Copyright (C) 1996, 1999 Free Software Foundation, Inc. + Copyright (C) 1996, 1999, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -58,7 +58,9 @@ ENTRY(__ieee754_atanh) #ifdef PIC call 1f + cfi_adjust_cfa_offset (4) 1: popl %edx + cfi_adjust_cfa_offset (-4) addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx #endif diff --git a/sysdeps/i386/fpu/e_atanhf.S b/sysdeps/i386/fpu/e_atanhf.S index a517929f2a..10ce6aed9e 100644 --- a/sysdeps/i386/fpu/e_atanhf.S +++ b/sysdeps/i386/fpu/e_atanhf.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arctanh function. - Copyright (C) 1996, 1999 Free Software Foundation, Inc. + Copyright (C) 1996, 1999, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -57,9 +57,7 @@ ENTRY(__ieee754_atanhf) ja 5f #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif andl $0x80000000, %ecx // ECX == 0 iff X >= 0 diff --git a/sysdeps/i386/fpu/e_atanhl.S b/sysdeps/i386/fpu/e_atanhl.S index 6fda9bef89..8618c3fb35 100644 --- a/sysdeps/i386/fpu/e_atanhl.S +++ b/sysdeps/i386/fpu/e_atanhl.S @@ -64,9 +64,7 @@ ENTRY(__ieee754_atanhl) 7: #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif andl $0x8000, %ecx // ECX == 0 iff X >= 0 diff --git a/sysdeps/i386/fpu/e_expl.c b/sysdeps/i386/fpu/e_expl.c index a090d0dabc..2240ceac47 100644 --- a/sysdeps/i386/fpu/e_expl.c +++ b/sysdeps/i386/fpu/e_expl.c @@ -24,8 +24,8 @@ #include <math_private.h> -static long double c0 = 1.44268798828125L; -static long double c1 = 7.05260771340735992468e-6L; +static const long double c0 = 1.44268798828125L; +static const long double c1 = 7.05260771340735992468e-6L; long double __ieee754_expl (long double x) diff --git a/sysdeps/i386/fpu/e_log.S b/sysdeps/i386/fpu/e_log.S index c7cacdfb0a..ce55b72292 100644 --- a/sysdeps/i386/fpu/e_log.S +++ b/sysdeps/i386/fpu/e_log.S @@ -36,13 +36,15 @@ limit: .double 0.29 ENTRY(__ieee754_log) fldln2 // log(2) fldl 4(%esp) // x : log(2) + fxam + fnstsw #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif fld %st // x : x : log(2) - fsubl MO(one) // x-1 : x : log(2) + sahf + jc 3f // in case x is NaN or +-Inf +4: fsubl MO(one) // x-1 : x : log(2) fld %st // x-1 : x-1 : x : log(2) fabs // |x-1| : x-1 : x : log(2) fcompl MO(limit) // x-1 : x : log(2) @@ -56,4 +58,9 @@ ENTRY(__ieee754_log) 2: fstp %st(0) // x : log(2) fyl2x // log(x) ret + +3: jp 4b // in case x is +-Inf + fstp %st(1) + fstp %st(1) + ret END (__ieee754_log) diff --git a/sysdeps/i386/fpu/e_log10.S b/sysdeps/i386/fpu/e_log10.S index e93184c219..525f08c96d 100644 --- a/sysdeps/i386/fpu/e_log10.S +++ b/sysdeps/i386/fpu/e_log10.S @@ -37,9 +37,7 @@ ENTRY(__ieee754_log10) fldlg2 // log10(2) fldl 4(%esp) // x : log10(2) #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif fxam fnstsw diff --git a/sysdeps/i386/fpu/e_log10f.S b/sysdeps/i386/fpu/e_log10f.S index 0a89f54784..da5069d583 100644 --- a/sysdeps/i386/fpu/e_log10f.S +++ b/sysdeps/i386/fpu/e_log10f.S @@ -38,9 +38,7 @@ ENTRY(__ieee754_log10f) fldlg2 // log10(2) flds 4(%esp) // x : log10(2) #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif fxam fnstsw diff --git a/sysdeps/i386/fpu/e_log10l.S b/sysdeps/i386/fpu/e_log10l.S index 25d3501663..3811516be5 100644 --- a/sysdeps/i386/fpu/e_log10l.S +++ b/sysdeps/i386/fpu/e_log10l.S @@ -39,9 +39,7 @@ ENTRY(__ieee754_log10l) fldlg2 // log10(2) fldt 4(%esp) // x : log10(2) #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif fxam fnstsw diff --git a/sysdeps/i386/fpu/e_log2.S b/sysdeps/i386/fpu/e_log2.S index 4f7f0d57d9..d80bf80239 100644 --- a/sysdeps/i386/fpu/e_log2.S +++ b/sysdeps/i386/fpu/e_log2.S @@ -34,9 +34,7 @@ limit: .double 0.29 .text ENTRY(__ieee754_log2) #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif fldl MO(one) fldl 4(%esp) // x : 1 diff --git a/sysdeps/i386/fpu/e_log2f.S b/sysdeps/i386/fpu/e_log2f.S index 88f28b423c..9eb7b2a826 100644 --- a/sysdeps/i386/fpu/e_log2f.S +++ b/sysdeps/i386/fpu/e_log2f.S @@ -34,9 +34,7 @@ limit: .double 0.29 .text ENTRY(__ieee754_log2f) #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif fldl MO(one) flds 4(%esp) // x : 1 diff --git a/sysdeps/i386/fpu/e_log2l.S b/sysdeps/i386/fpu/e_log2l.S index f5c661a2d1..9de08f5de1 100644 --- a/sysdeps/i386/fpu/e_log2l.S +++ b/sysdeps/i386/fpu/e_log2l.S @@ -34,9 +34,7 @@ limit: .double 0.29 .text ENTRY(__ieee754_log2l) #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif fldl MO(one) fldt 4(%esp) // x : 1 diff --git a/sysdeps/i386/fpu/e_logf.S b/sysdeps/i386/fpu/e_logf.S index bdba1d3225..cd4538b594 100644 --- a/sysdeps/i386/fpu/e_logf.S +++ b/sysdeps/i386/fpu/e_logf.S @@ -37,13 +37,15 @@ limit: .double 0.29 ENTRY(__ieee754_logf) fldln2 // log(2) flds 4(%esp) // x : log(2) + fxam + fnstsw #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif fld %st // x : x : log(2) - fsubl MO(one) // x-1 : x : log(2) + sahf + jc 3f // in case x is NaN or +-Inf +4: fsubl MO(one) // x-1 : x : log(2) fld %st // x-1 : x-1 : x : log(2) fabs // |x-1| : x-1 : x : log(2) fcompl MO(limit) // x-1 : x : log(2) @@ -57,4 +59,9 @@ ENTRY(__ieee754_logf) 2: fstp %st(0) // x : log(2) fyl2x // log(x) ret + +3: jp 4b // in case x is +-Inf + fstp %st(1) + fstp %st(1) + ret END (__ieee754_logf) diff --git a/sysdeps/i386/fpu/e_logl.S b/sysdeps/i386/fpu/e_logl.S index bda3ea508e..551dcf1e46 100644 --- a/sysdeps/i386/fpu/e_logl.S +++ b/sysdeps/i386/fpu/e_logl.S @@ -37,13 +37,15 @@ limit: .double 0.29 ENTRY(__ieee754_logl) fldln2 // log(2) fldt 4(%esp) // x : log(2) + fxam + fnstsw #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif fld %st // x : x : log(2) - fsubl MO(one) // x-1 : x : log(2) + sahf + jc 3f // in case x is NaN or +-Inf +4: fsubl MO(one) // x-1 : x : log(2) fld %st // x-1 : x-1 : x : log(2) fabs // |x-1| : x-1 : x : log(2) fcompl MO(limit) // x-1 : x : log(2) @@ -57,4 +59,9 @@ ENTRY(__ieee754_logl) 2: fstp %st(0) // x : log(2) fyl2x // log(x) ret + +3: jp 4b // in case x is +-Inf + fstp %st(1) + fstp %st(1) + ret END (__ieee754_logl) diff --git a/sysdeps/i386/fpu/e_pow.S b/sysdeps/i386/fpu/e_pow.S index d100c0ac57..792f926902 100644 --- a/sysdeps/i386/fpu/e_pow.S +++ b/sysdeps/i386/fpu/e_pow.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004 + Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -67,9 +67,7 @@ ENTRY(__ieee754_pow) fxam #ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx + LOAD_PIC_REG (cx) #endif fnstsw @@ -87,6 +85,7 @@ ENTRY(__ieee754_pow) fldl 4(%esp) // x : y subl $8,%esp + cfi_adjust_cfa_offset (8) fxam fnstsw @@ -120,7 +119,9 @@ ENTRY(__ieee754_pow) /* OK, we have an integer value for y. */ popl %eax + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) orl $0, %edx fstp %st(0) // x jns 4f // y >= 0, jump @@ -155,14 +156,16 @@ ENTRY(__ieee754_pow) 31: fstp %st(1) ret + cfi_adjust_cfa_offset (8) .align ALIGNARG(4) 2: /* y is a real number. */ fxch // x : y fldl MO(one) // 1.0 : x : y - fld %st(1) // x : 1.0 : x : y - fsub %st(1) // x-1 : 1.0 : x : y - fabs // |x-1| : 1.0 : x : y - fcompl MO(limit) // 1.0 : x : y + fldl MO(limit) // 0.29 : 1.0 : x : y + fld %st(2) // x : 0.29 : 1.0 : x : y + fsub %st(2) // x-1 : 0.29 : 1.0 : x : y + fabs // |x-1| : 0.29 : 1.0 : x : y + fucompp // 1.0 : x : y fnstsw fxch // x : 1.0 : y sahf @@ -181,6 +184,7 @@ ENTRY(__ieee754_pow) faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) addl $8, %esp + cfi_adjust_cfa_offset (-8) fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) ret @@ -194,9 +198,10 @@ ENTRY(__ieee754_pow) // y == ±inf .align ALIGNARG(4) 12: fstp %st(0) // pop y - fldl 4(%esp) // x - fabs - fcompl MO(one) // < 1, == 1, or > 1 + fldl MO(one) // 1 + fldl 4(%esp) // x : 1 + fabs // abs(x) : 1 + fucompp // < 1, == 1, or > 1 fnstsw andb $0x45, %ah cmpb $0x45, %ah @@ -219,6 +224,7 @@ ENTRY(__ieee754_pow) 13: fldl 4(%esp) // load x == NaN ret + cfi_adjust_cfa_offset (8) .align ALIGNARG(4) // x is ±inf 15: fstp %st(0) // y @@ -237,7 +243,9 @@ ENTRY(__ieee754_pow) // OK, the value is an integer, but is the number of bits small // enough so that all are coming from the mantissa? popl %eax + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) andb $1, %al jz 18f // jump if not odd movl %edx, %eax @@ -251,22 +259,27 @@ ENTRY(__ieee754_pow) fldl MOX(minf_mzero, %edx, 8) ret + cfi_adjust_cfa_offset (8) .align ALIGNARG(4) 16: fcompl MO(zero) addl $8, %esp + cfi_adjust_cfa_offset (-8) fnstsw shrl $5, %eax andl $8, %eax fldl MOX(inf_zero, %eax, 1) ret + cfi_adjust_cfa_offset (8) .align ALIGNARG(4) 17: shll $30, %edx // sign bit for y in right position addl $8, %esp + cfi_adjust_cfa_offset (-8) 18: shrl $31, %edx fldl MOX(inf_zero, %edx, 8) ret + cfi_adjust_cfa_offset (8) .align ALIGNARG(4) // x is ±0 20: fstp %st(0) // y @@ -288,7 +301,9 @@ ENTRY(__ieee754_pow) // OK, the value is an integer, but is the number of bits small // enough so that all are coming from the mantissa? popl %eax + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) andb $1, %al jz 27f // jump if not odd cmpl $0xffe00000, %edx @@ -300,13 +315,16 @@ ENTRY(__ieee754_pow) fchs ret + cfi_adjust_cfa_offset (8) 25: fstp %st(0) 26: addl $8, %esp + cfi_adjust_cfa_offset (-8) 27: // Raise divide-by-zero exception and get infinity value. fldl MO(one) fdivl MO(zero) ret + cfi_adjust_cfa_offset (8) .align ALIGNARG(4) // x is ±0 and y is > 0. We must find out whether y is an odd integer. 21: testb $2, %dh @@ -323,7 +341,9 @@ ENTRY(__ieee754_pow) // OK, the value is an integer, but is the number of bits small // enough so that all are coming from the mantissa? popl %eax + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) andb $1, %al jz 24f // jump if not odd cmpl $0xffe00000, %edx @@ -332,8 +352,10 @@ ENTRY(__ieee754_pow) fldl MO(mzero) ret + cfi_adjust_cfa_offset (8) 22: fstp %st(0) 23: addl $8, %esp // Don't use 2 x pop + cfi_adjust_cfa_offset (-8) 24: fldl MO(zero) ret diff --git a/sysdeps/i386/fpu/e_powf.S b/sysdeps/i386/fpu/e_powf.S index b3fa624f4d..c91545418d 100644 --- a/sysdeps/i386/fpu/e_powf.S +++ b/sysdeps/i386/fpu/e_powf.S @@ -1,5 +1,6 @@ /* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997, 1999, 2001, 2004 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999, 2001, 2004, 2005, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -66,9 +67,7 @@ ENTRY(__ieee754_powf) fxam #ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx + LOAD_PIC_REG (cx) #endif fnstsw @@ -86,6 +85,7 @@ ENTRY(__ieee754_powf) flds 4(%esp) // x : y subl $4, %esp + cfi_adjust_cfa_offset (4) fxam fnstsw @@ -119,6 +119,7 @@ ENTRY(__ieee754_powf) /* OK, we have an integer value for y. */ popl %edx + cfi_adjust_cfa_offset (-4) orl $0, %edx fstp %st(0) // x jns 4f // y >= 0, jump @@ -149,14 +150,16 @@ ENTRY(__ieee754_powf) 31: fstp %st(1) ret + cfi_adjust_cfa_offset (4) .align ALIGNARG(4) 2: /* y is a real number. */ fxch // x : y fldl MO(one) // 1.0 : x : y - fld %st(1) // x : 1.0 : x : y - fsub %st(1) // x-1 : 1.0 : x : y - fabs // |x-1| : 1.0 : x : y - fcompl MO(limit) // 1.0 : x : y + fldl MO(limit) // 0.29 : 1.0 : x : y + fld %st(2) // x : 0.29 : 1.0 : x : y + fsub %st(2) // x-1 : 0.29 : 1.0 : x : y + fabs // |x-1| : 0.29 : 1.0 : x : y + fucompp // 1.0 : x : y fnstsw fxch // x : 1.0 : y sahf @@ -175,6 +178,7 @@ ENTRY(__ieee754_powf) faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) addl $4, %esp + cfi_adjust_cfa_offset (-4) fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) ret @@ -188,9 +192,10 @@ ENTRY(__ieee754_powf) // y == ±inf .align ALIGNARG(4) 12: fstp %st(0) // pop y - flds 4(%esp) // x - fabs - fcompl MO(one) // < 1, == 1, or > 1 + fldl MO(one) // 1 + flds 4(%esp) // x : 1 + fabs // abs(x) : 1 + fucompp // < 1, == 1, or > 1 fnstsw andb $0x45, %ah cmpb $0x45, %ah @@ -213,6 +218,7 @@ ENTRY(__ieee754_powf) 13: flds 4(%esp) // load x == NaN ret + cfi_adjust_cfa_offset (4) .align ALIGNARG(4) // x is ±inf 15: fstp %st(0) // y @@ -231,6 +237,7 @@ ENTRY(__ieee754_powf) // OK, the value is an integer, but is the number of bits small // enough so that all are coming from the mantissa? popl %edx + cfi_adjust_cfa_offset (-4) testb $1, %dl jz 18f // jump if not odd movl %edx, %eax @@ -244,22 +251,27 @@ ENTRY(__ieee754_powf) fldl MOX(minf_mzero, %edx, 8) ret + cfi_adjust_cfa_offset (4) .align ALIGNARG(4) 16: fcompl MO(zero) addl $4, %esp + cfi_adjust_cfa_offset (-4) fnstsw shrl $5, %eax andl $8, %eax fldl MOX(inf_zero, %eax, 1) ret + cfi_adjust_cfa_offset (4) .align ALIGNARG(4) 17: shll $30, %edx // sign bit for y in right position addl $4, %esp + cfi_adjust_cfa_offset (-4) 18: shrl $31, %edx fldl MOX(inf_zero, %edx, 8) ret + cfi_adjust_cfa_offset (4) .align ALIGNARG(4) // x is ±0 20: fstp %st(0) // y @@ -281,6 +293,7 @@ ENTRY(__ieee754_powf) // OK, the value is an integer, but is the number of bits small // enough so that all are coming from the mantissa? popl %edx + cfi_adjust_cfa_offset (-4) testb $1, %dl jz 27f // jump if not odd cmpl $0xff000000, %edx @@ -292,13 +305,16 @@ ENTRY(__ieee754_powf) fchs ret + cfi_adjust_cfa_offset (4) 25: fstp %st(0) 26: addl $4, %esp + cfi_adjust_cfa_offset (-4) 27: // Raise divide-by-zero exception and get infinity value. fldl MO(one) fdivl MO(zero) ret + cfi_adjust_cfa_offset (4) .align ALIGNARG(4) // x is ±0 and y is > 0. We must find out whether y is an odd integer. 21: testb $2, %dh @@ -315,6 +331,7 @@ ENTRY(__ieee754_powf) // OK, the value is an integer, but is the number of bits small // enough so that all are coming from the mantissa? popl %edx + cfi_adjust_cfa_offset (-4) testb $1, %dl jz 24f // jump if not odd cmpl $0xff000000, %edx @@ -323,8 +340,10 @@ ENTRY(__ieee754_powf) fldl MO(mzero) ret + cfi_adjust_cfa_offset (4) 22: fstp %st(0) 23: addl $4, %esp // Don't use pop. + cfi_adjust_cfa_offset (-4) 24: fldl MO(zero) ret diff --git a/sysdeps/i386/fpu/e_powl.S b/sysdeps/i386/fpu/e_powl.S index 080764b84a..6215496207 100644 --- a/sysdeps/i386/fpu/e_powl.S +++ b/sysdeps/i386/fpu/e_powl.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004 + Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -67,9 +67,7 @@ ENTRY(__ieee754_powl) fxam #ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx + LOAD_PIC_REG (cx) #endif fnstsw @@ -87,6 +85,7 @@ ENTRY(__ieee754_powl) fldt 4(%esp) // x : y subl $8,%esp + cfi_adjust_cfa_offset (8) fxam fnstsw @@ -120,7 +119,9 @@ ENTRY(__ieee754_powl) /* OK, we have an integer value for y. */ popl %eax + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) orl $0, %edx fstp %st(0) // x jns 4f // y >= 0, jump @@ -155,14 +156,16 @@ ENTRY(__ieee754_powl) 31: fstp %st(1) ret + cfi_adjust_cfa_offset (8) .align ALIGNARG(4) 2: /* y is a real number. */ fxch // x : y fldl MO(one) // 1.0 : x : y - fld %st(1) // x : 1.0 : x : y - fsub %st(1) // x-1 : 1.0 : x : y - fabs // |x-1| : 1.0 : x : y - fcompl MO(limit) // 1.0 : x : y + fldl MO(limit) // 0.29 : 1.0 : x : y + fld %st(2) // x : 0.29 : 1.0 : x : y + fsub %st(2) // x-1 : 0.29 : 1.0 : x : y + fabs // |x-1| : 0.29 : 1.0 : x : y + fucompp // 1.0 : x : y fnstsw fxch // x : 1.0 : y sahf @@ -186,13 +189,16 @@ ENTRY(__ieee754_powl) faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x)) fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) addl $8, %esp + cfi_adjust_cfa_offset (-8) fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x)) ret + cfi_adjust_cfa_offset (8) 28: fstp %st(1) // y*log2(x) fldl MO(one) // 1 : y*log2(x) fscale // 2^(y*log2(x)) : y*log2(x) addl $8, %esp + cfi_adjust_cfa_offset (-8) fstp %st(1) // 2^(y*log2(x)) ret @@ -205,9 +211,10 @@ ENTRY(__ieee754_powl) // y == ±inf .align ALIGNARG(4) 12: fstp %st(0) // pop y - fldt 4(%esp) // x - fabs - fcompl MO(one) // < 1, == 1, or > 1 + fldl MO(one) // 1 + fldt 4(%esp) // x : 1 + fabs // abs(x) : 1 + fucompp // < 1, == 1, or > 1 fnstsw andb $0x45, %ah cmpb $0x45, %ah @@ -230,6 +237,7 @@ ENTRY(__ieee754_powl) 13: fldt 4(%esp) // load x == NaN ret + cfi_adjust_cfa_offset (8) .align ALIGNARG(4) // x is ±inf 15: fstp %st(0) // y @@ -247,7 +255,9 @@ ENTRY(__ieee754_powl) // OK, the value is an integer, but is it odd? popl %eax + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) andb $1, %al jz 18f // jump if not odd // It's an odd integer. @@ -255,22 +265,27 @@ ENTRY(__ieee754_powl) fldl MOX(minf_mzero, %edx, 8) ret + cfi_adjust_cfa_offset (8) .align ALIGNARG(4) 16: fcompl MO(zero) addl $8, %esp + cfi_adjust_cfa_offset (-8) fnstsw shrl $5, %eax andl $8, %eax fldl MOX(inf_zero, %eax, 1) ret + cfi_adjust_cfa_offset (8) .align ALIGNARG(4) 17: shll $30, %edx // sign bit for y in right position addl $8, %esp + cfi_adjust_cfa_offset (-8) 18: shrl $31, %edx fldl MOX(inf_zero, %edx, 8) ret + cfi_adjust_cfa_offset (8) .align ALIGNARG(4) // x is ±0 20: fstp %st(0) // y @@ -291,7 +306,9 @@ ENTRY(__ieee754_powl) // OK, the value is an integer, but is it odd? popl %eax + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) andb $1, %al jz 27f // jump if not odd // It's an odd integer. @@ -301,13 +318,16 @@ ENTRY(__ieee754_powl) fchs ret + cfi_adjust_cfa_offset (8) 25: fstp %st(0) 26: addl $8, %esp + cfi_adjust_cfa_offset (-8) 27: // Raise divide-by-zero exception and get infinity value. fldl MO(one) fdivl MO(zero) ret + cfi_adjust_cfa_offset (8) .align ALIGNARG(4) // x is ±0 and y is > 0. We must find out whether y is an odd integer. 21: testb $2, %dh @@ -323,15 +343,19 @@ ENTRY(__ieee754_powl) // OK, the value is an integer, but is it odd? popl %eax + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) andb $1, %al jz 24f // jump if not odd // It's an odd integer. fldl MO(mzero) ret + cfi_adjust_cfa_offset (8) 22: fstp %st(0) 23: addl $8, %esp // Don't use 2 x pop + cfi_adjust_cfa_offset (-8) 24: fldl MO(zero) ret diff --git a/sysdeps/i386/fpu/e_scalb.S b/sysdeps/i386/fpu/e_scalb.S index 1596f6a700..7e334a3611 100644 --- a/sysdeps/i386/fpu/e_scalb.S +++ b/sysdeps/i386/fpu/e_scalb.S @@ -64,9 +64,7 @@ ENTRY(__ieee754_scalb) /* y is -inf */ 1: fxam #ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx + LOAD_PIC_REG (cx) #endif fnstsw movl 8(%esp), %edx @@ -86,9 +84,7 @@ ENTRY(__ieee754_scalb) 2: fstp %st fstp %st #ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx + LOAD_PIC_REG (cx) #endif fldl MO(nan) ret diff --git a/sysdeps/i386/fpu/e_scalbf.S b/sysdeps/i386/fpu/e_scalbf.S index d41c29327d..e99ee92cb0 100644 --- a/sysdeps/i386/fpu/e_scalbf.S +++ b/sysdeps/i386/fpu/e_scalbf.S @@ -66,9 +66,7 @@ ENTRY(__ieee754_scalbf) /* y is -inf */ 1: fxam #ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx + LOAD_PIC_REG (cx) #endif fnstsw movl 4(%esp), %edx @@ -88,9 +86,7 @@ ENTRY(__ieee754_scalbf) 2: fstp %st fstp %st #ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx + LOAD_PIC_REG (cx) #endif fldl MO(nan) ret diff --git a/sysdeps/i386/fpu/e_scalbl.S b/sysdeps/i386/fpu/e_scalbl.S index 65644f8f0e..3f67d0befb 100644 --- a/sysdeps/i386/fpu/e_scalbl.S +++ b/sysdeps/i386/fpu/e_scalbl.S @@ -66,9 +66,7 @@ ENTRY(__ieee754_scalbl) /* y is -inf */ 1: fxam #ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx + LOAD_PIC_REG (cx) #endif fnstsw movl 12(%esp), %edx @@ -88,9 +86,7 @@ ENTRY(__ieee754_scalbl) 2: fstp %st fstp %st #ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx + LOAD_PIC_REG (cx) #endif fldl MO(nan) ret diff --git a/sysdeps/i386/fpu/feholdexcpt.c b/sysdeps/i386/fpu/feholdexcpt.c index 55096869a1..feaa24b8d9 100644 --- a/sysdeps/i386/fpu/feholdexcpt.c +++ b/sysdeps/i386/fpu/feholdexcpt.c @@ -1,5 +1,5 @@ /* Store current floating-point environment and clear exceptions. - Copyright (C) 1997, 1999, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -51,3 +51,4 @@ feholdexcept (fenv_t *envp) return 0; } +libm_hidden_def (feholdexcept) diff --git a/sysdeps/i386/fpu/fesetround.c b/sysdeps/i386/fpu/fesetround.c index 2746f3ebf3..a868f275f0 100644 --- a/sysdeps/i386/fpu/fesetround.c +++ b/sysdeps/i386/fpu/fesetround.c @@ -1,5 +1,5 @@ /* Set current rounding direction. - Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1997, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -50,3 +50,4 @@ fesetround (int round) return 0; } +libm_hidden_def (fesetround) diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps index 71c1ab5d8e..4efc714b29 100644 --- a/sysdeps/i386/fpu/libm-test-ulps +++ b/sysdeps/i386/fpu/libm-test-ulps @@ -7,20 +7,20 @@ ldouble: 1 # asin Test "asin (-0.5) == -pi/6": -ldouble: 1 ildouble: 1 -Test "asin (-1.0) == -pi/2": ldouble: 1 +Test "asin (-1.0) == -pi/2": ildouble: 1 -Test "asin (0.5) == pi/6": ldouble: 1 +Test "asin (0.5) == pi/6": ildouble: 1 -Test "asin (0.75) == 0.848062078981481008052944338998418080": ldouble: 1 +Test "asin (0.75) == 0.848062078981481008052944338998418080": ildouble: 1 -Test "asin (1.0) == pi/2": ldouble: 1 +Test "asin (1.0) == pi/2": ildouble: 1 +ldouble: 1 # atanh Test "atanh (0.75) == 0.972955074527656652552676371721589865": @@ -35,20 +35,20 @@ ildouble: 2 ldouble: 2 # 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: 9 idouble: 1 ifloat: 9 ildouble: 6 ldouble: 6 -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: 4 idouble: 1 +ifloat: 4 ildouble: 1 ldouble: 1 -ifloat: 4 -float: 4 Test "Real part of: cacosh (0.75 + 1.25 i) == 1.13239363160530819522266333696834467 + 1.11752014915610270578240049553777969 i": ildouble: 1 ldouble: 1 @@ -149,7 +149,9 @@ float: 1 idouble: 1 ifloat: 1 Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +double: 1 float: 1 +idouble: 1 ifloat: 1 # cexp @@ -354,7 +356,9 @@ ifloat: 1 ildouble: 2 ldouble: 2 Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -377,7 +381,9 @@ Test "Real part of: ctan (0.75 + 1.25 i) == 0.1608077859162064267251660581734386 ildouble: 1 ldouble: 1 Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 3 ldouble: 3 @@ -395,7 +401,9 @@ Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i": float: 1 ifloat: 1 Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "Imaginary part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": double: 1 @@ -473,24 +481,26 @@ float: 1 # j0 Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1": double: 1 -float: 1 +float: 2 idouble: 1 -ifloat: 1 +ifloat: 2 ildouble: 1 ldouble: 1 Test "j0 (10.0) == -0.245935764451348335197760862485328754": -double: 1 +double: 3 float: 1 -idouble: 1 +idouble: 3 ifloat: 1 Test "j0 (2.0) == 0.223890779141235668051827454649948626": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1": double: 1 -float: 1 +float: 2 idouble: 1 -ifloat: 1 +ifloat: 2 ildouble: 1 ldouble: 1 Test "j0 (8.0) == 0.171650807137553906090869407851972001": @@ -498,22 +508,23 @@ float: 1 ifloat: 1 # j1 +Test "j1 (0.75) == 0.349243602174862192523281016426251335": +double: 1 +idouble: 1 Test "j1 (10.0) == 0.0434727461688614366697487680258592883": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 -Test "j1 (0.75) == 0.349243602174862192523281016426251335": -double: 1 -idouble: 1 Test "j1 (2.0) == 0.576724807756873387202448242269137087": double: 1 idouble: 1 -Test "j1 (0.75) == 0.349243602174862192523281016426251335": -double: 1 -idouble: 1 Test "j1 (8.0) == 0.234636346853914624381276651590454612": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -521,24 +532,26 @@ ldouble: 1 # jn Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1": double: 1 -float: 1 +float: 2 idouble: 1 -ifloat: 1 +ifloat: 2 ildouble: 1 ldouble: 1 Test "jn (0, 10.0) == -0.245935764451348335197760862485328754": -double: 1 +double: 3 float: 1 -idouble: 1 +idouble: 3 ifloat: 1 Test "jn (0, 2.0) == 0.223890779141235668051827454649948626": +double: 1 float: 1 +idouble: 1 ifloat: 1 Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1": double: 1 -float: 1 +float: 2 idouble: 1 -ifloat: 1 +ifloat: 2 ildouble: 1 ldouble: 1 Test "jn (0, 8.0) == 0.171650807137553906090869407851972001": @@ -548,7 +561,9 @@ Test "jn (1, 0.75) == 0.349243602174862192523281016426251335": double: 1 idouble: 1 Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -556,22 +571,24 @@ Test "jn (1, 2.0) == 0.576724807756873387202448242269137087": double: 1 idouble: 1 Test "jn (1, 8.0) == 0.234636346853914624381276651590454612": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9": double: 1 +float: 1 idouble: 1 +ifloat: 1 ildouble: 1 ldouble: 1 -ifloat: 1 -float: 1 Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18": -float: 1 -ifloat: 1 double: 1 +float: 1 idouble: 1 +ifloat: 1 Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10": float: 1 ifloat: 1 @@ -579,46 +596,46 @@ ildouble: 2 ldouble: 2 Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9": double: 1 +float: 1 idouble: 1 +ifloat: 1 ildouble: 1 ldouble: 1 -ifloat: 1 -float: 1 Test "jn (10, 10.0) == 0.207486106633358857697278723518753428": -double: 2 +double: 5 float: 2 -idouble: 2 +idouble: 5 ifloat: 2 ildouble: 2 ldouble: 2 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6": +double: 2 +idouble: 2 ildouble: 1 ldouble: 1 -idouble: 2 -double: 2 Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083": ildouble: 1 ldouble: 1 Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2": -float: 1 -ifloat: 1 double: 1 +float: 1 idouble: 1 +ifloat: 1 Test "jn (3, 1.0) == 0.0195633539826684059189053216217515083": ildouble: 1 ldouble: 1 Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563": -double: 1 +double: 5 float: 2 -idouble: 1 +idouble: 5 ifloat: 2 ildouble: 1 ldouble: 1 Test "jn (3, 2.0) == 0.128943249474402051098793332969239835": -ildouble: 1 -ldouble: 1 double: 1 idouble: 1 +ildouble: 1 +ldouble: 1 # lgamma Test "lgamma (-0.5) == log(2*sqrt(pi))": @@ -627,10 +644,10 @@ idouble: 1 ildouble: 1 ldouble: 1 Test "lgamma (0.7) == 0.260867246531666514385732417016759578": -float: 1 -ifloat: 1 double: 1 +float: 1 idouble: 1 +ifloat: 1 Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": double: 1 float: 2 @@ -677,6 +694,7 @@ ldouble: 1 # sinh Test "sinh (0.75) == 0.822316731935829980703661634446913849": +double: 1 ildouble: 1 # tan @@ -714,32 +732,39 @@ float: 1 idouble: 1 ifloat: 1 Test "y0 (1.0) == 0.0882569642156769579829267660235151628": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 ildouble: 1 ldouble: 1 -ifloat: 1 +Test "y0 (1.5) == 0.382448923797758843955068554978089862": +double: 1 float: 1 -double: 2 -idouble: 2 +idouble: 1 +ifloat: 1 Test "y0 (10.0) == 0.0556711672835993914244598774101900481": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 Test "y0 (8.0) == 0.223521489387566220527323400498620359": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 -Test "y0 (1.5) == 0.382448923797758843955068554978089862": -float: 1 -ifloat: 1 -double: 1 -idouble: 1 # y1 Test "y1 (0.125) == -5.19993611253477499595928744876579921": ildouble: 1 ldouble: 1 +Test "y1 (1.0) == -0.781212821300288716547150000047964821": +double: 1 +idouble: 1 Test "y1 (10.0) == 0.249015424206953883923283474663222803": double: 2 float: 2 @@ -753,13 +778,12 @@ ifloat: 2 ildouble: 1 ldouble: 1 Test "y1 (8.0) == -0.158060461731247494255555266187483550": +double: 1 float: 2 +idouble: 1 ifloat: 2 ildouble: 1 ldouble: 1 -Test "y1 (1.0) == -0.781212821300288716547150000047964821": -double: 1 -idouble: 1 # yn Test "yn (0, 0.125) == -1.38968062514384052915582277745018693": @@ -771,24 +795,28 @@ float: 1 idouble: 1 ifloat: 1 Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628": -ildouble: 1 -ldouble: 1 -ifloat: 1 -float: 1 double: 2 +float: 1 idouble: 2 -Test "yn (0, 1.5) == 0.382448923797758843955068554978089862": ifloat: 1 -float: 1 +ildouble: 1 +ldouble: 1 +Test "yn (0, 1.5) == 0.382448923797758843955068554978089862": double: 1 +float: 1 idouble: 1 +ifloat: 1 Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 Test "yn (0, 8.0) == 0.223521489387566220527323400498620359": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -796,8 +824,8 @@ Test "yn (1, 0.125) == -5.19993611253477499595928744876579921": ildouble: 1 ldouble: 1 Test "yn (1, 1.0) == -0.781212821300288716547150000047964821": -idouble: 1 double: 1 +idouble: 1 Test "yn (1, 10.0) == 0.249015424206953883923283474663222803": double: 2 float: 2 @@ -811,13 +839,12 @@ ifloat: 2 ildouble: 1 ldouble: 1 Test "yn (1, 8.0) == -0.158060461731247494255555266187483550": +double: 1 float: 2 +idouble: 1 ifloat: 2 ildouble: 1 ldouble: 1 -Test "yn (3, 0.75) == -12.9877176234475433186319774484809207": -ifloat: 1 -float: 1 Test "yn (10, 0.125) == -127057845771019398.252538486899753195": double: 1 float: 1 @@ -841,10 +868,10 @@ float: 3 idouble: 1 ifloat: 3 Test "yn (10, 2.0) == -129184.542208039282635913145923304214": -float: 3 -ifloat: 3 double: 2 +float: 3 idouble: 2 +ifloat: 3 Test "yn (3, 0.125) == -2612.69757350066712600220955744091741": ildouble: 1 ldouble: 1 @@ -855,12 +882,12 @@ idouble: 1 ifloat: 1 ildouble: 2 ldouble: 2 -Test "yn (3, 2.0) == -1.12778377684042778608158395773179238": -float: 1 -ifloat: 1 +Test "yn (3, 10.0) == -0.251362657183837329779204747654240998": double: 1 +float: 1 idouble: 1 -Test "yn (3, 10.0) == -0.251362657183837329779204747654240998": +ifloat: 1 +Test "yn (3, 2.0) == -1.12778377684042778608158395773179238": double: 1 float: 1 idouble: 1 @@ -872,8 +899,8 @@ ildouble: 622 ldouble: 622 Function: "asin": -ldouble: 1 ildouble: 1 +ldouble: 1 Function: "atanh": ildouble: 2 @@ -895,11 +922,11 @@ ldouble: 6 Function: Imaginary part of "cacosh": double: 1 +float: 4 idouble: 1 +ifloat: 4 ildouble: 1 ldouble: 1 -ifloat: 4 -float: 4 Function: Real part of "casin": double: 1 @@ -1073,7 +1100,9 @@ ildouble: 3 ldouble: 3 Function: Real part of "ctanh": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 5 ldouble: 5 @@ -1115,10 +1144,10 @@ Function: "hypot": float: 1 Function: "j0": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 +double: 3 +float: 2 +idouble: 3 +ifloat: 2 ildouble: 1 ldouble: 1 @@ -1131,9 +1160,9 @@ ildouble: 1 ldouble: 1 Function: "jn": -double: 2 +double: 5 float: 2 -idouble: 2 +idouble: 5 ifloat: 2 ildouble: 2 ldouble: 2 @@ -1165,6 +1194,7 @@ ildouble: 1 ldouble: 1 Function: "sinh": +double: 1 ildouble: 1 Function: "tan": diff --git a/sysdeps/i386/fpu/math_private.h b/sysdeps/i386/fpu/math_private.h new file mode 100644 index 0000000000..a426788ef1 --- /dev/null +++ b/sysdeps/i386/fpu/math_private.h @@ -0,0 +1,18 @@ +#ifndef _MATH_PRIVATE_H + +#define math_opt_barrier(x) \ +({ __typeof(x) __x; \ + __asm ("" : "=t" (__x) : "0" (x)); \ + __x; }) +#define math_force_eval(x) \ +do \ + { \ + if (sizeof (x) <= sizeof (double)) \ + __asm __volatile ("" : : "m" (x)); \ + else \ + __asm __volatile ("" : : "f" (x)); \ + } \ +while (0) + +#include <math/math_private.h> +#endif diff --git a/sysdeps/i386/fpu/s_asinh.S b/sysdeps/i386/fpu/s_asinh.S index 6c99d3b6f6..ca042b414b 100644 --- a/sysdeps/i386/fpu/s_asinh.S +++ b/sysdeps/i386/fpu/s_asinh.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -62,9 +62,7 @@ ENTRY(__asinh) fxch // |x| : log(2) ja 3f // |x| > 2^28 #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif cmpl $0x40000000, %eax ja 5f // |x| > 2 @@ -100,9 +98,7 @@ ENTRY(__asinh) .align ALIGNARG(4) 2: #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif jecxz 4f fchs // x diff --git a/sysdeps/i386/fpu/s_asinhf.S b/sysdeps/i386/fpu/s_asinhf.S index 32e6fd6071..d0ce6afc22 100644 --- a/sysdeps/i386/fpu/s_asinhf.S +++ b/sysdeps/i386/fpu/s_asinhf.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -62,9 +62,7 @@ ENTRY(__asinhf) fxch // |x| : log(2) ja 3f // |x| > 2^14 #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif cmpl $0x40000000, %eax ja 5f // |x| > 2 @@ -100,9 +98,7 @@ ENTRY(__asinhf) .align ALIGNARG(4) 2: #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif jecxz 4f fchs // x diff --git a/sysdeps/i386/fpu/s_asinhl.S b/sysdeps/i386/fpu/s_asinhl.S index 5933460f64..1040eead1c 100644 --- a/sysdeps/i386/fpu/s_asinhl.S +++ b/sysdeps/i386/fpu/s_asinhl.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -69,9 +69,7 @@ ENTRY(__asinhl) fxch // |x| : log(2) ja 3f // |x| > 2^34 #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif cmpl $0x4000, %eax ja 5f // |x| > 2 @@ -107,9 +105,7 @@ ENTRY(__asinhl) .align ALIGNARG(4) 2: #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif jecxz 4f fchs // x diff --git a/sysdeps/i386/fpu/s_cbrt.S b/sysdeps/i386/fpu/s_cbrt.S index c69958bb57..e180b15466 100644 --- a/sysdeps/i386/fpu/s_cbrt.S +++ b/sysdeps/i386/fpu/s_cbrt.S @@ -1,5 +1,5 @@ /* Compute cubic root of double value. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Dirk Alboth <dirka@uni-paderborn.de> and Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -89,9 +89,9 @@ ENTRY(__cbrt) #ifdef PIC pushl %ebx - call 3f -3: popl %ebx - addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx + cfi_adjust_cfa_offset (4) + cfi_rel_offset (ebx, 0) + LOAD_PIC_REG (bx) #endif cmpl $0x00100000, %eax @@ -178,13 +178,17 @@ ENTRY(__cbrt) fdivp %st, %st(1) /* u*(t2+2*xm)/(2*t2+xm) */ fmull MOX(16+factor,%ecx) /* u*(t2+2*xm)/(2*t2+xm)*FACT */ pushl %eax + cfi_adjust_cfa_offset (4) fildl (%esp) /* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */ fxch /* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */ fscale /* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */ popl %edx + cfi_adjust_cfa_offset (-4) #ifdef PIC movl 12(%esp), %eax popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) #else movl 8(%esp), %eax #endif diff --git a/sysdeps/i386/fpu/s_cbrtf.S b/sysdeps/i386/fpu/s_cbrtf.S index 03d5770efa..2ff4f6e088 100644 --- a/sysdeps/i386/fpu/s_cbrtf.S +++ b/sysdeps/i386/fpu/s_cbrtf.S @@ -1,5 +1,5 @@ /* Compute cubic root of float value. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Dirk Alboth <dirka@uni-paderborn.de> and Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -76,9 +76,9 @@ ENTRY(__cbrtf) #ifdef PIC pushl %ebx - call 3f -3: popl %ebx - addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx + cfi_adjust_cfa_offset (4) + cfi_rel_offset (ebx, 0) + LOAD_PIC_REG (bx) #endif cmpl $0x00800000, %eax @@ -155,13 +155,17 @@ ENTRY(__cbrtf) fdivp %st, %st(1) /* u*(t2+2*xm)/(2*t2+xm) */ fmull MOX(16+factor,%ecx) /* u*(t2+2*xm)/(2*t2+xm)*FACT */ pushl %eax + cfi_adjust_cfa_offset (4) fildl (%esp) /* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */ fxch /* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */ fscale /* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */ popl %edx + cfi_adjust_cfa_offset (-4) #ifdef PIC movl 8(%esp), %eax popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) #else movl 4(%esp), %eax #endif diff --git a/sysdeps/i386/fpu/s_cbrtl.S b/sysdeps/i386/fpu/s_cbrtl.S index f9dac170e0..637ad729c1 100644 --- a/sysdeps/i386/fpu/s_cbrtl.S +++ b/sysdeps/i386/fpu/s_cbrtl.S @@ -1,5 +1,5 @@ /* Compute cubic root of long double value. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Dirk Alboth <dirka@uni-paderborn.de> and Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -108,9 +108,9 @@ ENTRY(__cbrtl) #ifdef PIC pushl %ebx - call 3f -3: popl %ebx - addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx + cfi_adjust_cfa_offset (4) + cfi_rel_offset (ebx, 0) + LOAD_PIC_REG (bx) #endif cmpl $0, %eax @@ -206,13 +206,17 @@ ENTRY(__cbrtl) fldt MOX(32+factor,%ecx) fmulp /* u*(t2+2*xm)/(2*t2+xm)*FACT */ pushl %eax + cfi_adjust_cfa_offset (4) fildl (%esp) /* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */ fxch /* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */ fscale /* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */ popl %edx + cfi_adjust_cfa_offset (-4) #ifdef PIC movl 16(%esp), %eax popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) #else movl 12(%esp), %eax #endif diff --git a/sysdeps/i386/fpu/s_cexp.S b/sysdeps/i386/fpu/s_cexp.S index 50d17aea11..47e3eb66a6 100644 --- a/sysdeps/i386/fpu/s_cexp.S +++ b/sysdeps/i386/fpu/s_cexp.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of complex exponential function for double. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -71,9 +71,7 @@ ENTRY(__cexp) fnstsw fldl 16(%esp) /* y : x */ #ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx + LOAD_PIC_REG (cx) #endif movb %ah, %dh andb $0x45, %ah diff --git a/sysdeps/i386/fpu/s_cexpf.S b/sysdeps/i386/fpu/s_cexpf.S index 396e056135..f116854096 100644 --- a/sysdeps/i386/fpu/s_cexpf.S +++ b/sysdeps/i386/fpu/s_cexpf.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of complex exponential function for double. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -71,9 +71,7 @@ ENTRY(__cexpf) fnstsw flds 8(%esp) /* y : x */ #ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx + LOAD_PIC_REG (cx) #endif movb %ah, %dh andb $0x45, %ah @@ -114,10 +112,13 @@ ENTRY(__cexpf) fmulp %st, %st(3) /* sin(y) : e^x : e^x * cos(y) */ fmulp %st, %st(1) /* e^x * sin(y) : e^x * cos(y) */ subl $8, %esp + cfi_adjust_cfa_offset (8) fstps 4(%esp) fstps (%esp) popl %eax + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) ret /* We have to reduce the argument to fsincos. */ @@ -133,10 +134,13 @@ ENTRY(__cexpf) fmulp %st, %st(3) fmulp %st, %st(1) subl $8, %esp + cfi_adjust_cfa_offset (8) fstps 4(%esp) fstps (%esp) popl %eax + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) ret /* The real part is +-inf. We must make further differences. */ @@ -210,12 +214,14 @@ ENTRY(__cexpf) +-Inf+-0i. */ .align ALIGNARG(4) 4: subl $4, %esp + cfi_adjust_cfa_offset (4) fstps (%esp) shrl $6, %edx fstp %st(0) andl $8, %edx movl MOX(huge_nan_null_null,%edx,1), %eax popl %edx + cfi_adjust_cfa_offset (-4) ret /* The real part is +-Inf, the imaginary is also is not finite. */ diff --git a/sysdeps/i386/fpu/s_cexpl.S b/sysdeps/i386/fpu/s_cexpl.S index cbc7c99f0e..8bb0680bce 100644 --- a/sysdeps/i386/fpu/s_cexpl.S +++ b/sysdeps/i386/fpu/s_cexpl.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of complex exponential function for double. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -71,9 +71,7 @@ ENTRY(__cexpl) fnstsw fldt 20(%esp) /* y : x */ #ifdef PIC - call 1f -1: popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx + LOAD_PIC_REG (cx) #endif movb %ah, %dh andb $0x45, %ah diff --git a/sysdeps/i386/fpu/s_expm1.S b/sysdeps/i386/fpu/s_expm1.S index 35e1ff6693..e761183639 100644 --- a/sysdeps/i386/fpu/s_expm1.S +++ b/sysdeps/i386/fpu/s_expm1.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of exp(x)-1. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>. @@ -56,9 +56,7 @@ ENTRY(__expm1) cmpb $0x40, %ch je 3f // If +-0, jump. #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif cmpb $0x05, %ch je 2f // If +-Inf, jump. diff --git a/sysdeps/i386/fpu/s_expm1f.S b/sysdeps/i386/fpu/s_expm1f.S index c2c64f0748..88adb75b86 100644 --- a/sysdeps/i386/fpu/s_expm1f.S +++ b/sysdeps/i386/fpu/s_expm1f.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of exp(x)-1. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>. @@ -56,9 +56,7 @@ ENTRY(__expm1f) cmpb $0x40, %ch je 3f // If +-0, jump. #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif cmpb $0x05, %ch je 2f // If +-Inf, jump. diff --git a/sysdeps/i386/fpu/s_expm1l.S b/sysdeps/i386/fpu/s_expm1l.S index 4d491c02f8..2dc379b790 100644 --- a/sysdeps/i386/fpu/s_expm1l.S +++ b/sysdeps/i386/fpu/s_expm1l.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of exp(x)-1. - Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2002, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>. @@ -56,9 +56,7 @@ ENTRY(__expm1l) cmpb $0x40, %ch je 3f // If +-0, jump. #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif cmpb $0x05, %ch je 2f // If +-Inf, jump. diff --git a/sysdeps/i386/fpu/s_frexp.S b/sysdeps/i386/fpu/s_frexp.S index 563105a917..cfc822106e 100644 --- a/sysdeps/i386/fpu/s_frexp.S +++ b/sysdeps/i386/fpu/s_frexp.S @@ -1,5 +1,5 @@ /* ix87 specific frexp implementation for double. - Copyright (C) 1997, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -63,9 +63,7 @@ ENTRY (BP_SYM (__frexp)) fldl VAL0(%esp) #ifdef PIC - call 3f -3: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %edx + LOAD_PIC_REG (dx) #endif fmull MO(two54) movl $-54, %ecx diff --git a/sysdeps/i386/fpu/s_frexpf.S b/sysdeps/i386/fpu/s_frexpf.S index 00c4ab5b8e..8640bbc223 100644 --- a/sysdeps/i386/fpu/s_frexpf.S +++ b/sysdeps/i386/fpu/s_frexpf.S @@ -1,5 +1,5 @@ /* ix87 specific frexp implementation for float. - Copyright (C) 1997, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -60,9 +60,7 @@ ENTRY (BP_SYM (__frexpf)) flds VAL(%esp) #ifdef PIC - call 3f -3: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %edx + LOAD_PIC_REG (dx) #endif fmuls MO(two25) movl $-25, %ecx diff --git a/sysdeps/i386/fpu/s_frexpl.S b/sysdeps/i386/fpu/s_frexpl.S index 1417507ded..60ae57ee3e 100644 --- a/sysdeps/i386/fpu/s_frexpl.S +++ b/sysdeps/i386/fpu/s_frexpl.S @@ -1,5 +1,5 @@ /* ix87 specific frexp implementation for long double. - Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1997, 2000, 2001, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -65,9 +65,7 @@ ENTRY (BP_SYM (__frexpl)) fldt VAL0(%esp) #ifdef PIC - call 3f -3: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %edx + LOAD_PIC_REG (dx) #endif fmull MO(two64) /* It's not necessary to use a 80bit factor */ diff --git a/sysdeps/i386/fpu/s_ilogb.S b/sysdeps/i386/fpu/s_ilogb.S index 68d9c1a680..0cf1ad7419 100644 --- a/sysdeps/i386/fpu/s_ilogb.S +++ b/sysdeps/i386/fpu/s_ilogb.S @@ -21,11 +21,13 @@ ENTRY(__ilogb) fxtract pushl %eax + cfi_adjust_cfa_offset (4) fstp %st fistpl (%esp) fwait popl %eax + cfi_adjust_cfa_offset (-4) ret diff --git a/sysdeps/i386/fpu/s_ilogbf.S b/sysdeps/i386/fpu/s_ilogbf.S index 521afe2b60..99e53edd75 100644 --- a/sysdeps/i386/fpu/s_ilogbf.S +++ b/sysdeps/i386/fpu/s_ilogbf.S @@ -21,11 +21,13 @@ ENTRY(__ilogbf) fxtract pushl %eax + cfi_adjust_cfa_offset (4) fstp %st fistpl (%esp) fwait popl %eax + cfi_adjust_cfa_offset (-4) ret diff --git a/sysdeps/i386/fpu/s_ilogbl.S b/sysdeps/i386/fpu/s_ilogbl.S index ed547bdc8b..1f559b311e 100644 --- a/sysdeps/i386/fpu/s_ilogbl.S +++ b/sysdeps/i386/fpu/s_ilogbl.S @@ -22,11 +22,13 @@ ENTRY(__ilogbl) fxtract pushl %eax + cfi_adjust_cfa_offset (4) fstp %st fistpl (%esp) fwait popl %eax + cfi_adjust_cfa_offset (-4) ret diff --git a/sysdeps/i386/fpu/s_llrint.S b/sysdeps/i386/fpu/s_llrint.S index e8e5ecee09..23bbec6024 100644 --- a/sysdeps/i386/fpu/s_llrint.S +++ b/sysdeps/i386/fpu/s_llrint.S @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -25,10 +25,13 @@ ENTRY(__llrint) fldl 4(%esp) subl $8, %esp + cfi_adjust_cfa_offset (8) fistpll (%esp) fwait popl %eax + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) ret END(__llrint) weak_alias (__llrint, llrint) diff --git a/sysdeps/i386/fpu/s_llrintf.S b/sysdeps/i386/fpu/s_llrintf.S index 1deabc4f54..3de73f6661 100644 --- a/sysdeps/i386/fpu/s_llrintf.S +++ b/sysdeps/i386/fpu/s_llrintf.S @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -25,10 +25,13 @@ ENTRY(__llrintf) flds 4(%esp) subl $8, %esp + cfi_adjust_cfa_offset (8) fistpll (%esp) fwait popl %eax + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) ret END(__llrintf) weak_alias (__llrintf, llrintf) diff --git a/sysdeps/i386/fpu/s_llrintl.S b/sysdeps/i386/fpu/s_llrintl.S index b34d79a5d8..f6545e9fcd 100644 --- a/sysdeps/i386/fpu/s_llrintl.S +++ b/sysdeps/i386/fpu/s_llrintl.S @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -25,10 +25,13 @@ ENTRY(__llrintl) fldt 4(%esp) subl $8, %esp + cfi_adjust_cfa_offset (8) fistpll (%esp) fwait popl %eax + cfi_adjust_cfa_offset (-4) popl %edx + cfi_adjust_cfa_offset (-4) ret END(__llrintl) weak_alias (__llrintl, llrintl) diff --git a/sysdeps/i386/fpu/s_log1p.S b/sysdeps/i386/fpu/s_log1p.S index d3bc3d7251..ec777fdf93 100644 --- a/sysdeps/i386/fpu/s_log1p.S +++ b/sysdeps/i386/fpu/s_log1p.S @@ -31,9 +31,7 @@ ENTRY(__log1p) fldl 4(%esp) #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif fxam diff --git a/sysdeps/i386/fpu/s_log1pf.S b/sysdeps/i386/fpu/s_log1pf.S index d5283fcfee..6919ac902e 100644 --- a/sysdeps/i386/fpu/s_log1pf.S +++ b/sysdeps/i386/fpu/s_log1pf.S @@ -31,9 +31,7 @@ ENTRY(__log1pf) flds 4(%esp) #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif fxam diff --git a/sysdeps/i386/fpu/s_log1pl.S b/sysdeps/i386/fpu/s_log1pl.S index 26c407b606..4bca67d6b0 100644 --- a/sysdeps/i386/fpu/s_log1pl.S +++ b/sysdeps/i386/fpu/s_log1pl.S @@ -36,9 +36,7 @@ ENTRY(__log1pl) fldt 4(%esp) #ifdef PIC - call 1f -1: popl %edx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx + LOAD_PIC_REG (dx) #endif fxam diff --git a/sysdeps/i386/fpu/s_lrint.S b/sysdeps/i386/fpu/s_lrint.S index a15f54f1da..799875b335 100644 --- a/sysdeps/i386/fpu/s_lrint.S +++ b/sysdeps/i386/fpu/s_lrint.S @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -25,9 +25,11 @@ ENTRY(__lrint) fldl 4(%esp) subl $4, %esp + cfi_adjust_cfa_offset (4) fistpl (%esp) fwait popl %eax + cfi_adjust_cfa_offset (-4) ret END(__lrint) weak_alias (__lrint, lrint) diff --git a/sysdeps/i386/fpu/s_lrintf.S b/sysdeps/i386/fpu/s_lrintf.S index 0f15e64de2..2aa1a4e83d 100644 --- a/sysdeps/i386/fpu/s_lrintf.S +++ b/sysdeps/i386/fpu/s_lrintf.S @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -25,9 +25,11 @@ ENTRY(__lrintf) flds 4(%esp) subl $4, %esp + cfi_adjust_cfa_offset (4) fistpl (%esp) fwait popl %eax + cfi_adjust_cfa_offset (-4) ret END(__lrintf) weak_alias (__lrintf, lrintf) diff --git a/sysdeps/i386/fpu/s_lrintl.S b/sysdeps/i386/fpu/s_lrintl.S index 90313d612c..c0211c11da 100644 --- a/sysdeps/i386/fpu/s_lrintl.S +++ b/sysdeps/i386/fpu/s_lrintl.S @@ -1,6 +1,6 @@ /* Round argument to nearest integral value according to current rounding direction. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -25,9 +25,11 @@ ENTRY(__lrintl) fldt 4(%esp) subl $4, %esp + cfi_adjust_cfa_offset (4) fistpl (%esp) fwait popl %eax + cfi_adjust_cfa_offset (-4) ret END(__lrintl) weak_alias (__lrintl, lrintl) diff --git a/sysdeps/i386/fpu/s_nearbyint.S b/sysdeps/i386/fpu/s_nearbyint.S index d8bb382d9e..52909139a9 100644 --- a/sysdeps/i386/fpu/s_nearbyint.S +++ b/sysdeps/i386/fpu/s_nearbyint.S @@ -9,7 +9,9 @@ ENTRY(__nearbyint) fldl 4(%esp) pushl %eax + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) fnstcw (%esp) movl (%esp), %eax orl $0x20, %eax @@ -19,7 +21,9 @@ ENTRY(__nearbyint) fclex fldcw (%esp) popl %ecx + cfi_adjust_cfa_offset (-4) popl %eax + cfi_adjust_cfa_offset (-4) ret END (__nearbyint) weak_alias (__nearbyint, nearbyint) diff --git a/sysdeps/i386/fpu/s_nearbyintf.S b/sysdeps/i386/fpu/s_nearbyintf.S index 21858650e2..6a6b1d6c2b 100644 --- a/sysdeps/i386/fpu/s_nearbyintf.S +++ b/sysdeps/i386/fpu/s_nearbyintf.S @@ -9,7 +9,9 @@ ENTRY(__nearbyintf) flds 4(%esp) pushl %eax + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) fnstcw (%esp) movl (%esp), %eax orl $0x20, %eax @@ -19,7 +21,9 @@ ENTRY(__nearbyintf) fclex fldcw (%esp) popl %ecx + cfi_adjust_cfa_offset (-4) popl %eax + cfi_adjust_cfa_offset (-4) ret END (__nearbyintf) weak_alias (__nearbyintf, nearbyintf) diff --git a/sysdeps/i386/fpu/s_nearbyintl.S b/sysdeps/i386/fpu/s_nearbyintl.S index d74dacb990..819af63a8d 100644 --- a/sysdeps/i386/fpu/s_nearbyintl.S +++ b/sysdeps/i386/fpu/s_nearbyintl.S @@ -9,7 +9,9 @@ ENTRY(__nearbyintl) fldt 4(%esp) pushl %eax + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) fnstcw (%esp) movl (%esp), %eax orl $0x20, %eax @@ -19,7 +21,9 @@ ENTRY(__nearbyintl) fclex fldcw (%esp) popl %ecx + cfi_adjust_cfa_offset (-4) popl %eax + cfi_adjust_cfa_offset (-4) ret END (__nearbyintl) weak_alias (__nearbyintl, nearbyintl) diff --git a/sysdeps/i386/fpu/s_nextafterl.c b/sysdeps/i386/fpu/s_nextafterl.c index 5b617cb4e7..aef0a144e5 100644 --- a/sysdeps/i386/fpu/s_nextafterl.c +++ b/sysdeps/i386/fpu/s_nextafterl.c @@ -27,7 +27,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include <math_private.h> #ifdef __STDC__ long double __nextafterl(long double x, long double y) @@ -52,9 +52,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if(x==y) return y; /* x=y, return y */ if((ix|hx|lx)==0) { /* x == 0 */ + long double u; SET_LDOUBLE_WORDS(x,esy&0x8000,0,1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(esx>=0) { /* x > 0 */ if(esx>esy||((esx==esy) && (hx>hy||((hx==hy)&&(lx>ly))))) { @@ -109,12 +112,9 @@ static char rcsid[] = "$NetBSD: $"; } esy = esx&0x7fff; if(esy==0x7fff) return x+x; /* overflow */ - if(esy==0) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_LDOUBLE_WORDS(y,esx,hx,lx); - return y; - } + if(esy==0) { + long double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_LDOUBLE_WORDS(x,esx,hx,lx); return x; diff --git a/sysdeps/i386/fpu/s_nexttoward.c b/sysdeps/i386/fpu/s_nexttoward.c index 2bd768e448..9bd86a3724 100644 --- a/sysdeps/i386/fpu/s_nexttoward.c +++ b/sysdeps/i386/fpu/s_nexttoward.c @@ -27,7 +27,8 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include <math_private.h> +#include <float.h> #ifdef __STDC__ double __nexttoward(double x, long double y) @@ -52,10 +53,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ - double x2; + double u; INSERT_WORDS(x,(esy&0x8000)<<16,1); /* return +-minsub */ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if (esy>=0x8000||((ix>>20)&0x7ff)>iy-0x3c00 @@ -85,16 +88,14 @@ static char rcsid[] = "$NetBSD: $"; hy = hx&0x7ff00000; if(hy>=0x7ff00000) { x = x+x; /* overflow */ - /* Force conversion to double. */ - asm ("" : "=m"(x) : "m"(x)); + if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1) + /* Force conversion to double. */ + asm ("" : "+m"(x)); return x; } - if(hy<0x00100000) { /* underflow */ - double x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - INSERT_WORDS(x2,hx,lx); - return x2; - } + if(hy<0x00100000) { + double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } INSERT_WORDS(x,hx,lx); return x; diff --git a/sysdeps/i386/fpu/s_nexttowardf.c b/sysdeps/i386/fpu/s_nexttowardf.c index 3fbe53c338..25f70e4f4d 100644 --- a/sysdeps/i386/fpu/s_nexttowardf.c +++ b/sysdeps/i386/fpu/s_nexttowardf.c @@ -19,7 +19,8 @@ static char rcsid[] = "$NetBSD: $"; #endif #include "math.h" -#include "math_private.h" +#include <math_private.h> +#include <float.h> #ifdef __STDC__ float __nexttowardf(float x, long double y) @@ -44,10 +45,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ - float x2; + float u; SET_FLOAT_WORD(x,((esy&0x8000)<<16)|1);/* return +-minsub*/ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(esy>=0x8000||((ix>>23)&0xff)>iy-0x3f80 @@ -69,16 +72,14 @@ static char rcsid[] = "$NetBSD: $"; hy = hx&0x7f800000; if(hy>=0x7f800000) { x = x+x; /* overflow */ - /* Force conversion to float. */ - asm ("" : "=m"(x) : "m"(x)); + if (FLT_EVAL_METHOD != 0) + /* Force conversion to float. */ + asm ("" : "+m"(x)); return x; } - if(hy<0x00800000) { /* underflow */ - float x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(x2,hx); - return x2; - } + if(hy<0x00800000) { + float u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; diff --git a/sysdeps/i386/i386-mcount.S b/sysdeps/i386/i386-mcount.S index 727d7a0ab8..8b11adb2e3 100644 --- a/sysdeps/i386/i386-mcount.S +++ b/sysdeps/i386/i386-mcount.S @@ -52,4 +52,4 @@ C_LABEL(_mcount) ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount)) #undef mcount -weak_alias(_mcount, mcount) +weak_alias (_mcount, mcount) diff --git a/sysdeps/i386/i486/strcat.S b/sysdeps/i386/i486/strcat.S index 7d8279fe14..ec7d4c80b6 100644 --- a/sysdeps/i386/i486/strcat.S +++ b/sysdeps/i386/i486/strcat.S @@ -1,6 +1,6 @@ /* strcat(dest, src) -- Append SRC on the end of DEST. For Intel 80x86, x>=4. - Copyright (C) 1994,1995,1996,1997,2000,2003 Free Software Foundation, Inc. + Copyright (C) 1994-1997,2000,2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>. Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> @@ -35,6 +35,7 @@ ENTRY (BP_SYM (strcat)) ENTER pushl %edi /* Save callee-safe register. */ + cfi_adjust_cfa_offset (4) movl DEST(%esp), %edx movl SRC(%esp), %ecx @@ -66,6 +67,7 @@ ENTRY (BP_SYM (strcat)) /* Now we are aligned. Begin scan loop. */ jmp L(1) + cfi_rel_offset (edi, 0) ALIGN(4) L(4): addl $16,%edx /* increment destination pointer for round */ @@ -263,6 +265,8 @@ L(8): /* GKM FIXME: check high bounds */ movl DEST(%esp), %eax /* start address of destination is result */ RETURN_BOUNDED_POINTER (DEST(%esp)) popl %edi /* restore saved register */ + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE RET_PTR diff --git a/sysdeps/i386/i586/add_n.S b/sysdeps/i386/i586/add_n.S index c2afc37ee3..57706b23b4 100644 --- a/sysdeps/i386/i586/add_n.S +++ b/sysdeps/i386/i586/add_n.S @@ -1,6 +1,6 @@ /* Pentium __mpn_add_n -- Add two limb vectors of the same length > 0 and store sum in a third limb vector. - Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc. + Copyright (C) 1992,94,95,96,97,98,2000,2005 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -34,13 +34,20 @@ ENTRY (BP_SYM (__mpn_add_n)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) pushl %esi + cfi_adjust_cfa_offset (4) pushl %ebp + cfi_adjust_cfa_offset (4) pushl %ebx + cfi_adjust_cfa_offset (4) movl RES(%esp),%edi + cfi_rel_offset (edi, 12) movl S1(%esp),%esi + cfi_rel_offset (esi, 8) movl S2(%esp),%ebx + cfi_rel_offset (ebx, 0) movl SIZE(%esp),%ecx #if __BOUNDED_POINTERS__ shll $2, %ecx /* convert limbs to bytes */ @@ -50,6 +57,7 @@ ENTRY (BP_SYM (__mpn_add_n)) shrl $2, %ecx #endif movl (%ebx),%ebp + cfi_rel_offset (ebp, 4) decl %ecx movl %ecx,%edx @@ -58,6 +66,7 @@ ENTRY (BP_SYM (__mpn_add_n)) testl %ecx,%ecx /* zero carry flag */ jz L(end) pushl %edx + cfi_adjust_cfa_offset (4) ALIGN (3) L(oop): movl 28(%edi),%eax /* fetch destination cache line */ @@ -105,6 +114,7 @@ L(4): movl 24(%esi),%eax jnz L(oop) popl %edx + cfi_adjust_cfa_offset (-4) L(end): decl %edx /* test %edx w/o clobbering carry */ js L(end2) @@ -128,9 +138,17 @@ L(end2): negl %eax popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) popl %ebp + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret diff --git a/sysdeps/i386/i586/addmul_1.S b/sysdeps/i386/i586/addmul_1.S index 9329637fe2..1890c5dfa1 100644 --- a/sysdeps/i386/i586/addmul_1.S +++ b/sysdeps/i386/i586/addmul_1.S @@ -1,6 +1,6 @@ /* Pentium __mpn_addmul_1 -- Multiply a limb vector with a limb and add the result to a second limb vector. - Copyright (C) 1992, 94, 96, 97, 98, 00 Free Software Foundation, Inc. + Copyright (C) 1992, 94, 96, 97, 98, 00, 2005 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -38,15 +38,22 @@ ENTRY (BP_SYM (__mpn_addmul_1)) ENTER - pushl %edi - pushl %esi + pushl %res_ptr + cfi_adjust_cfa_offset (4) + pushl %s1_ptr + cfi_adjust_cfa_offset (4) pushl %ebp - pushl %ebx + cfi_adjust_cfa_offset (4) + pushl %s2_limb + cfi_adjust_cfa_offset (4) movl RES(%esp), %res_ptr + cfi_rel_offset (res_ptr, 12) movl S1(%esp), %s1_ptr + cfi_rel_offset (s1_ptr, 8) movl SIZE(%esp), %size movl S2LIMB(%esp), %s2_limb + cfi_rel_offset (s2_limb, 0) #if __BOUNDED_POINTERS__ shll $2, %size /* convert limbs to bytes */ CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size) @@ -57,6 +64,7 @@ ENTRY (BP_SYM (__mpn_addmul_1)) leal (%s1_ptr,%size,4), %s1_ptr negl %size xorl %ebp, %ebp + cfi_rel_offset (ebp, 4) ALIGN (3) L(oop): adcl $0, %ebp @@ -78,10 +86,18 @@ L(oop): adcl $0, %ebp adcl $0, %ebp movl %ebp, %eax - popl %ebx + popl %s2_limb + cfi_adjust_cfa_offset (-4) + cfi_restore (s2_limb) popl %ebp - popl %esi - popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) + popl %s1_ptr + cfi_adjust_cfa_offset (-4) + cfi_restore (s1_ptr) + popl %res_ptr + cfi_adjust_cfa_offset (-4) + cfi_restore (res_ptr) LEAVE ret diff --git a/sysdeps/i386/i586/lshift.S b/sysdeps/i386/i586/lshift.S index 59d587934e..bc73ee6f3c 100644 --- a/sysdeps/i386/i586/lshift.S +++ b/sysdeps/i386/i586/lshift.S @@ -1,5 +1,5 @@ /* Pentium optimized __mpn_lshift -- - Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc. + Copyright (C) 1992,94,95,96,97,98,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 @@ -33,13 +33,21 @@ ENTRY (BP_SYM (__mpn_lshift)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) pushl %esi + cfi_adjust_cfa_offset (4) pushl %ebp + cfi_adjust_cfa_offset (4) + cfi_rel_offset (ebp, 0) pushl %ebx + cfi_adjust_cfa_offset (4) movl RES(%esp),%edi + cfi_rel_offset (edi, 12) movl S(%esp),%esi + cfi_rel_offset (esi, 8) movl SIZE(%esp),%ebx + cfi_rel_offset (ebx, 0) movl CNT(%esp),%ecx #if __BOUNDED_POINTERS__ shll $2, %ebx /* convert limbs to bytes */ @@ -67,9 +75,11 @@ L(normal): xorl %eax,%eax shldl %cl,%edx,%eax /* compute carry limb */ pushl %eax /* push carry limb onto stack */ + cfi_adjust_cfa_offset (4) decl %ebx pushl %ebx + cfi_adjust_cfa_offset (4) shrl $3,%ebx jz L(end) @@ -113,6 +123,7 @@ L(oop): movl -28(%edi),%eax /* fetch destination cache line */ jnz L(oop) L(end): popl %ebx + cfi_adjust_cfa_offset (-4) andl $7,%ebx jz L(end2) L(oop2): @@ -130,11 +141,20 @@ L(end2): movl %edx,(%edi) /* store it */ popl %eax /* pop carry limb */ + cfi_adjust_cfa_offset (-4) popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) popl %ebp + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret @@ -144,12 +164,18 @@ L(end2): function is documented to work for overlapping source and destination. */ + cfi_adjust_cfa_offset (16) + cfi_rel_offset (edi, 12) + cfi_rel_offset (esi, 8) + cfi_rel_offset (ebp, 4) + cfi_rel_offset (ebx, 0) L(special): movl (%esi),%edx addl $4,%esi decl %ebx pushl %ebx + cfi_adjust_cfa_offset (4) shrl $3,%ebx addl %edx,%edx @@ -199,6 +225,7 @@ L(Loop): L(Lend): popl %ebx + cfi_adjust_cfa_offset (-4) sbbl %eax,%eax /* save carry in %eax */ andl $7,%ebx jz L(Lend2) @@ -223,9 +250,17 @@ L(L1): movl %edx,(%edi) /* store last limb */ negl %eax popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) popl %ebp + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret diff --git a/sysdeps/i386/i586/memcpy.S b/sysdeps/i386/i586/memcpy.S index d8181ffa1b..6ab457fc55 100644 --- a/sysdeps/i386/i586/memcpy.S +++ b/sysdeps/i386/i586/memcpy.S @@ -1,5 +1,5 @@ /* Highly optimized version for i586. - Copyright (C) 1997, 2000, 2003 Free Software Foundation, Inc. + Copyright (C) 1997, 2000, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -39,10 +39,14 @@ ENTRY (BP_SYM (memcpy)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) pushl %esi + cfi_adjust_cfa_offset (4) movl DEST(%esp), %edi + cfi_rel_offset (edi, 4) movl SRC(%esp), %esi + cfi_rel_offset (esi, 0) movl LEN(%esp), %ecx CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %ecx) CHECK_BOUNDS_BOTH_WIDE (%esi, SRC(%esp), %ecx) @@ -111,7 +115,11 @@ L(1): rep; movsb #endif popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE RET_PTR diff --git a/sysdeps/i386/i586/memset.S b/sysdeps/i386/i586/memset.S index 0b59849f9e..c21e9f7a71 100644 --- a/sysdeps/i386/i586/memset.S +++ b/sysdeps/i386/i586/memset.S @@ -1,6 +1,6 @@ /* memset/bzero -- set memory area to CH/0 Highly optimized version for ix86, x>=5. - Copyright (C) 1996, 1997, 2000, 2003 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2000, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund, <tege@matematik.su.se> @@ -42,8 +42,10 @@ ENTRY (BP_SYM (memset)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) movl DEST(%esp), %edi + cfi_rel_offset (edi, 0) movl LEN(%esp), %edx CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %edx) #if BZERO_P @@ -106,6 +108,8 @@ L(2): shrl $2, %ecx /* convert byte count to longword count */ RETURN_BOUNDED_POINTER (DEST(%esp)) #endif popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE #if BZERO_P diff --git a/sysdeps/i386/i586/memusage.h b/sysdeps/i386/i586/memusage.h new file mode 100644 index 0000000000..c8170874d0 --- /dev/null +++ b/sysdeps/i386/i586/memusage.h @@ -0,0 +1 @@ +#include "../i686/memusage.h" diff --git a/sysdeps/i386/i586/mul_1.S b/sysdeps/i386/i586/mul_1.S index f7865697e6..15765d758f 100644 --- a/sysdeps/i386/i586/mul_1.S +++ b/sysdeps/i386/i586/mul_1.S @@ -1,6 +1,6 @@ /* Pentium __mpn_mul_1 -- Multiply a limb vector with a limb and store the result in a second limb vector. - Copyright (C) 1992, 94, 96, 97, 98, 00 Free Software Foundation, Inc. + Copyright (C) 1992, 94, 96, 97, 98, 00, 2005 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -38,15 +38,22 @@ ENTRY (BP_SYM (__mpn_mul_1)) ENTER - pushl %edi - pushl %esi + pushl %res_ptr + cfi_adjust_cfa_offset (4) + pushl %s1_ptr + cfi_adjust_cfa_offset (4) pushl %ebp - pushl %ebx + cfi_adjust_cfa_offset (4) + pushl %s2_limb + cfi_adjust_cfa_offset (4) movl RES(%esp), %res_ptr + cfi_rel_offset (res_ptr, 12) movl S1(%esp), %s1_ptr + cfi_rel_offset (s1_ptr, 8) movl SIZE(%esp), %size movl S2LIMB(%esp), %s2_limb + cfi_rel_offset (s2_limb, 0) #if __BOUNDED_POINTERS__ shll $2, %size /* convert limbs to bytes */ CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size) @@ -57,6 +64,7 @@ ENTRY (BP_SYM (__mpn_mul_1)) leal (%s1_ptr,%size,4), %s1_ptr negl %size xorl %ebp, %ebp + cfi_rel_offset (ebp, 4) ALIGN (3) L(oop): adcl $0, %ebp @@ -74,10 +82,18 @@ L(oop): adcl $0, %ebp adcl $0, %ebp movl %ebp, %eax - popl %ebx + popl %s2_limb + cfi_adjust_cfa_offset (-4) + cfi_restore (s2_limb) popl %ebp - popl %esi - popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) + popl %s1_ptr + cfi_adjust_cfa_offset (-4) + cfi_restore (s1_ptr) + popl %res_ptr + cfi_adjust_cfa_offset (-4) + cfi_restore (res_ptr) LEAVE ret diff --git a/sysdeps/i386/i586/rshift.S b/sysdeps/i386/i586/rshift.S index db9326a442..7b88289d3e 100644 --- a/sysdeps/i386/i586/rshift.S +++ b/sysdeps/i386/i586/rshift.S @@ -1,5 +1,5 @@ /* Pentium optimized __mpn_rshift -- - Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc. + Copyright (C) 1992,94,95,96,97,98,2000,2005 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -33,13 +33,21 @@ ENTRY (BP_SYM (__mpn_rshift)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) pushl %esi + cfi_adjust_cfa_offset (4) pushl %ebp + cfi_adjust_cfa_offset (4) + cfi_rel_offset (ebp, 0) pushl %ebx + cfi_adjust_cfa_offset (4) movl RES(%esp),%edi + cfi_rel_offset (edi, 12) movl S(%esp),%esi + cfi_rel_offset (esi, 8) movl SIZE(%esp),%ebx + cfi_rel_offset (ebx, 0) movl CNT(%esp),%ecx #if __BOUNDED_POINTERS__ shll $2, %ebx /* convert limbs to bytes */ @@ -64,9 +72,11 @@ L(normal): xorl %eax,%eax shrdl %cl,%edx,%eax /* compute carry limb */ pushl %eax /* push carry limb onto stack */ + cfi_adjust_cfa_offset (4) decl %ebx pushl %ebx + cfi_adjust_cfa_offset (4) shrl $3,%ebx jz L(end) @@ -110,6 +120,7 @@ L(oop): movl 28(%edi),%eax /* fetch destination cache line */ jnz L(oop) L(end): popl %ebx + cfi_adjust_cfa_offset (-4) andl $7,%ebx jz L(end2) L(oop2): @@ -127,11 +138,20 @@ L(end2): movl %edx,(%edi) /* store it */ popl %eax /* pop carry limb */ + cfi_adjust_cfa_offset (-4) popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) popl %ebp + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret @@ -141,6 +161,11 @@ L(end2): function is documented to work for overlapping source and destination. */ + cfi_adjust_cfa_offset (16) + cfi_rel_offset (edi, 12) + cfi_rel_offset (esi, 8) + cfi_rel_offset (ebp, 4) + cfi_rel_offset (ebx, 0) L(special): leal -4(%edi,%ebx,4),%edi leal -4(%esi,%ebx,4),%esi @@ -150,6 +175,7 @@ L(special): decl %ebx pushl %ebx + cfi_adjust_cfa_offset (4) shrl $3,%ebx shrl $1,%edx @@ -199,6 +225,7 @@ L(Loop): L(Lend): popl %ebx + cfi_adjust_cfa_offset (-4) sbbl %eax,%eax /* save carry in %eax */ andl $7,%ebx jz L(Lend2) @@ -223,9 +250,17 @@ L(L1): movl %edx,(%edi) /* store last limb */ rcrl $1,%eax popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) popl %ebp + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret diff --git a/sysdeps/i386/i586/strchr.S b/sysdeps/i386/i586/strchr.S index 9df504d335..136b19a3f3 100644 --- a/sysdeps/i386/i586/strchr.S +++ b/sysdeps/i386/i586/strchr.S @@ -1,6 +1,6 @@ /* Find character CH in a NUL terminated string. Highly optimized version for ix85, x>=5. - Copyright (C) 1995, 1996, 1997, 2000, 2003 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1997,2000,2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>. @@ -47,16 +47,21 @@ ENTRY (BP_SYM (strchr)) ENTER pushl %edi /* Save callee-safe registers. */ + cfi_adjust_cfa_offset (-4) pushl %esi + cfi_adjust_cfa_offset (-4) pushl %ebx + cfi_adjust_cfa_offset (-4) pushl %ebp + cfi_adjust_cfa_offset (-4) movl STR(%esp), %eax movl CHR(%esp), %edx CHECK_BOUNDS_LOW (%eax, STR(%esp)) movl %eax, %edi /* duplicate string pointer for later */ + cfi_rel_offset (edi, 12) xorl %ecx, %ecx /* clear %ecx */ /* At the moment %edx contains C. What we need for the @@ -107,6 +112,10 @@ L(0): movb (%eax), %cl /* load single byte */ incl %eax /* increment pointer */ + cfi_rel_offset (esi, 8) + cfi_rel_offset (ebx, 4) + cfi_rel_offset (ebp, 0) + /* The following code is the preparation for the loop. The four instruction up to `L1' will not be executed in the loop because the same code is found at the end of the loop, but @@ -283,15 +292,28 @@ L(5): subl $4, %eax /* adjust pointer */ L(2): CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb) RETURN_BOUNDED_POINTER (STR(%esp)) - popl %ebp /* restore saved registers */ +L(out): popl %ebp /* restore saved registers */ + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE RET_PTR + cfi_adjust_cfa_offset (16) + cfi_rel_offset (edi, 12) + cfi_rel_offset (esi, 8) + cfi_rel_offset (ebx, 4) + cfi_rel_offset (ebp, 0) /* We know there is a NUL byte in the word. But we have to test whether there is an C byte before it in the word. */ L(4): subl $4, %eax /* adjust pointer */ @@ -327,14 +349,7 @@ L(4): subl $4, %eax /* adjust pointer */ L(3): xorl %eax, %eax RETURN_NULL_BOUNDED_POINTER - popl %ebp /* restore saved registers */ - popl %ebx - - popl %esi - popl %edi - - LEAVE - RET_PTR + jmp L(out) END (BP_SYM (strchr)) #undef index diff --git a/sysdeps/i386/i586/strcpy.S b/sysdeps/i386/i586/strcpy.S index f7c1986b4b..5426e59749 100644 --- a/sysdeps/i386/i586/strcpy.S +++ b/sysdeps/i386/i586/strcpy.S @@ -1,5 +1,5 @@ /* strcpy/stpcpy implementation for i586. - Copyright (C) 1997, 2000, 2003 Free Software Foundation, Inc. + Copyright (C) 1997, 2000, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -39,11 +39,16 @@ ENTRY (BP_SYM (STRCPY)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) pushl %esi + cfi_adjust_cfa_offset (4) pushl %ebx + cfi_adjust_cfa_offset (4) movl DEST(%esp), %edi + cfi_rel_offset (edi, 8) movl SRC(%esp), %esi + cfi_rel_offset (esi, 4) CHECK_BOUNDS_LOW (%edi, DEST(%esp)) CHECK_BOUNDS_LOW (%esi, SRC(%esp)) @@ -51,11 +56,14 @@ ENTRY (BP_SYM (STRCPY)) leal -1(%esi), %ecx movl $magic, %ebx + cfi_rel_offset (ebx, 0) andl $3, %ecx #ifdef PIC call 2f + cfi_adjust_cfa_offset (4) 2: popl %edx + cfi_adjust_cfa_offset (-4) /* 0xb is the distance between 2: and 1: but we avoid writing 1f-2b because the assembler generates worse code. */ leal 0xb(%edx,%ecx,8), %ecx @@ -153,8 +161,14 @@ L(end2): #endif RETURN_BOUNDED_POINTER (DEST(%esp)) popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE RET_PTR diff --git a/sysdeps/i386/i586/sub_n.S b/sysdeps/i386/i586/sub_n.S index fcc9cba4ad..7c32c1adb6 100644 --- a/sysdeps/i386/i586/sub_n.S +++ b/sysdeps/i386/i586/sub_n.S @@ -1,6 +1,6 @@ /* Pentium __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and store difference in a third limb vector. - Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc. + Copyright (C) 1992,94,95,96,97,98,2000,2005 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -34,13 +34,20 @@ ENTRY (BP_SYM (__mpn_sub_n)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) pushl %esi + cfi_adjust_cfa_offset (4) pushl %ebp + cfi_adjust_cfa_offset (4) pushl %ebx + cfi_adjust_cfa_offset (4) movl RES(%esp),%edi + cfi_rel_offset (edi, 12) movl S1(%esp),%esi + cfi_rel_offset (esi, 8) movl S2(%esp),%ebx + cfi_rel_offset (ebx, 0) movl SIZE(%esp),%ecx #if __BOUNDED_POINTERS__ shll $2, %ecx /* convert limbs to bytes */ @@ -50,6 +57,7 @@ ENTRY (BP_SYM (__mpn_sub_n)) shrl $2, %ecx #endif movl (%ebx),%ebp + cfi_rel_offset (ebp, 4) decl %ecx movl %ecx,%edx @@ -58,6 +66,7 @@ ENTRY (BP_SYM (__mpn_sub_n)) testl %ecx,%ecx /* zero carry flag */ jz L(end) pushl %edx + cfi_adjust_cfa_offset (4) ALIGN (3) L(oop): movl 28(%edi),%eax /* fetch destination cache line */ @@ -105,6 +114,7 @@ L(4): movl 24(%esi),%eax jnz L(oop) popl %edx + cfi_adjust_cfa_offset (-4) L(end): decl %edx /* test %edx w/o clobbering carry */ js L(end2) @@ -128,9 +138,17 @@ L(end2): negl %eax popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) popl %ebp + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret diff --git a/sysdeps/i386/i586/submul_1.S b/sysdeps/i386/i586/submul_1.S index 542200110f..e8bc6478c1 100644 --- a/sysdeps/i386/i586/submul_1.S +++ b/sysdeps/i386/i586/submul_1.S @@ -1,6 +1,6 @@ /* Pentium __mpn_submul_1 -- Multiply a limb vector with a limb and subtract the result from a second limb vector. - Copyright (C) 1992, 94, 96, 97, 98, 00 Free Software Foundation, Inc. + Copyright (C) 1992, 94, 96, 97, 98, 00, 2005 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -38,15 +38,22 @@ ENTRY (BP_SYM (__mpn_submul_1)) ENTER - pushl %edi - pushl %esi + pushl %res_ptr + cfi_adjust_cfa_offset (4) + pushl %s1_ptr + cfi_adjust_cfa_offset (4) pushl %ebp - pushl %ebx + cfi_adjust_cfa_offset (4) + pushl %s2_limb + cfi_adjust_cfa_offset (4) movl RES(%esp), %res_ptr + cfi_rel_offset (res_ptr, 12) movl S1(%esp), %s1_ptr + cfi_rel_offset (s1_ptr, 8) movl SIZE(%esp), %size movl S2LIMB(%esp), %s2_limb + cfi_rel_offset (s2_limb, 0) #if __BOUNDED_POINTERS__ shll $2, %sizeP /* convert limbs to bytes */ CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %sizeP) @@ -57,6 +64,7 @@ ENTRY (BP_SYM (__mpn_submul_1)) leal (%s1_ptr,%size,4), %s1_ptr negl %size xorl %ebp, %ebp + cfi_rel_offset (ebp, 4) ALIGN (3) L(oop): adcl $0, %ebp @@ -78,10 +86,18 @@ L(oop): adcl $0, %ebp adcl $0, %ebp movl %ebp, %eax - popl %ebx + popl %s2_limb + cfi_adjust_cfa_offset (-4) + cfi_restore (s2_limb) popl %ebp - popl %esi - popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) + popl %s1_ptr + cfi_adjust_cfa_offset (-4) + cfi_restore (s1_ptr) + popl %res_ptr + cfi_adjust_cfa_offset (-4) + cfi_restore (res_ptr) LEAVE ret diff --git a/sysdeps/i386/i686/Dist b/sysdeps/i386/i686/Dist deleted file mode 100644 index dbf11d5009..0000000000 --- a/sysdeps/i386/i686/Dist +++ /dev/null @@ -1 +0,0 @@ -hp-timing.c diff --git a/sysdeps/i386/i686/add_n.S b/sysdeps/i386/i686/add_n.S index e36b0d0a5d..3cce33acfe 100644 --- a/sysdeps/i386/i686/add_n.S +++ b/sysdeps/i386/i686/add_n.S @@ -1,6 +1,6 @@ /* Add two limb vectors of the same length > 0 and store sum in a third limb vector. - Copyright (C) 1992, 94, 95, 97, 98, 2000 Free Software Foundation, Inc. + Copyright (C) 1992,94,95,97,98,2000,2005 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -38,10 +38,14 @@ ENTRY (BP_SYM (__mpn_add_n)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) pushl %esi + cfi_adjust_cfa_offset (4) movl RES(%esp),%edi + cfi_rel_offset (edi, 4) movl S1(%esp),%esi + cfi_rel_offset (esi, 0) movl S2(%esp),%edx movl SIZE(%esp),%ecx #if __BOUNDED_POINTERS__ @@ -107,7 +111,11 @@ L(oop): movl (%esi),%eax negl %eax popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret diff --git a/sysdeps/i386/i686/dl-hash.h b/sysdeps/i386/i686/dl-hash.h index 61183d80da..4bdd998aa8 100644 --- a/sysdeps/i386/i686/dl-hash.h +++ b/sysdeps/i386/i686/dl-hash.h @@ -1,5 +1,5 @@ /* Compute hash alue for given string according to ELF standard. - Copyright (C) 1998, 2003 Free Software Foundation, Inc. + Copyright (C) 1998, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -27,7 +27,7 @@ would be much slower than the generic C implementation. So don't use it. */ static unsigned int -_dl_elf_hash (const unsigned char *name) +_dl_elf_hash (const char *name) { unsigned int result; unsigned int temp0; @@ -71,7 +71,7 @@ _dl_elf_hash (const unsigned char *name) "jnz 2b\n" "1:\t" : "=&r" (result), "=r" (name), "=&c" (temp0), "=&r" (temp1) - : "0" (0), "1" (name)); + : "0" (0), "1" ((const unsigned char *) name)); return result; } diff --git a/sysdeps/i386/i686/ffs.c b/sysdeps/i386/i686/ffs.c index fd7ef1a3d6..684ae21827 100644 --- a/sysdeps/i386/i686/ffs.c +++ b/sysdeps/i386/i686/ffs.c @@ -1,7 +1,7 @@ /* ffs -- find first set bit in a word, counted from least significant end. For Intel 80x86, x>=6. This file is part of the GNU C Library. - Copyright (C) 1991, 92, 93, 94, 97, 98, 2004 Free Software Foundation, Inc. + Copyright (C) 1991, 92, 93, 94, 97, 98, 2004, 2005 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@cygnus.com>. The GNU C Library is free software; you can redistribute it and/or @@ -45,5 +45,5 @@ libc_hidden_builtin_def (ffs) weak_alias (__ffs, ffsl) #else -#include <sysdeps/generic/ffs.c> +#include <string/ffs.c> #endif diff --git a/sysdeps/i386/i686/hp-timing.h b/sysdeps/i386/i686/hp-timing.h index a5906835f7..b924869649 100644 --- a/sysdeps/i386/i686/hp-timing.h +++ b/sysdeps/i386/i686/hp-timing.h @@ -1,5 +1,5 @@ /* High precision, low overhead timing functions. i686 version. - Copyright (C) 1998, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1998, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -119,26 +119,24 @@ typedef unsigned long long int hp_timing_t; /* We have to jump through hoops to get this correctly implemented. */ #define HP_TIMING_ACCUM(Sum, Diff) \ do { \ - char __not_done; \ + int __not_done; \ hp_timing_t __oldval = (Sum); \ hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead); \ do \ { \ hp_timing_t __newval = __oldval + __diff; \ int __temp0, __temp1; \ - __asm__ __volatile__ ("xchgl %4, %%ebx\n\t" \ + __asm__ __volatile__ ("xchgl %0, %%ebx\n\t" \ "lock; cmpxchg8b %1\n\t" \ - "sete %0\n\t" \ - "movl %4, %%ebx" \ - : "=q" (__not_done), "=m" (Sum), \ - "=A" (__oldval), "=c" (__temp0), \ - "=SD" (__temp1) \ - : "1" (Sum), "2" (__oldval), \ - "3" (__newval >> 32), \ - "4" (__newval & 0xffffffff) \ - : "memory"); \ + "sete %%bl\n\t" \ + "xchgl %0, %%ebx" \ + : "=SD" (__not_done), "=m" (Sum), \ + "=A" (__oldval), "=c" (__temp0) \ + : "m" (Sum), "2" (__oldval), \ + "3" ((unsigned int) (__newval >> 32)), \ + "0" ((unsigned int) __newval)); \ } \ - while (__not_done); \ + while ((unsigned char) __not_done); \ } while (0) /* No threads, no extra work. */ diff --git a/sysdeps/i386/i686/memcmp.S b/sysdeps/i386/i686/memcmp.S index ef57acdee8..4bd5394bec 100644 --- a/sysdeps/i386/i686/memcmp.S +++ b/sysdeps/i386/i686/memcmp.S @@ -1,5 +1,5 @@ /* Compare two memory blocks for differences in the first COUNT bytes. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 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 @@ -26,8 +26,11 @@ #define BLK1 PARMS #define BLK2 BLK1+PTR_SIZE #define LEN BLK2+PTR_SIZE -#define ENTRANCE pushl %ebx; ENTER -#define RETURN popl %ebx; LEAVE; ret +#define ENTRANCE pushl %ebx; cfi_adjust_cfa_offset (4); \ + cfi_rel_offset (ebx, 0); ENTER +#define RETURN popl %ebx; cfi_adjust_cfa_offset (-4); \ + cfi_restore (ebx); LEAVE; ret; \ + cfi_adjust_cfa_offset (4); cfi_rel_offset (ebx, 0); /* Load an entry in a jump table into EBX. TABLE is a jump table with relative offsets. INDEX is a register contains the index @@ -77,11 +80,15 @@ L(neq): sbbl $-1, %eax RETURN + cfi_adjust_cfa_offset (4) + cfi_rel_offset (ebx, 0) L(not_1): jl L(bye) /* LEN == 0 */ pushl %esi + cfi_adjust_cfa_offset (4) movl %eax, %esi + cfi_rel_offset (esi, 0) cmpl $32, %ecx; jge L(32bytesormore) /* LEN => 32 */ @@ -128,9 +135,14 @@ L(4bytes): jne L(find_diff) L(0bytes): popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) xorl %eax, %eax RETURN + cfi_adjust_cfa_offset (8) + cfi_rel_offset (esi, 0) + cfi_rel_offset (ebx, 4) L(29bytes): movl -29(%esi), %eax movl -29(%edx), %ecx @@ -171,9 +183,14 @@ L(1bytes): cmpb -1(%edx), %al jne L(set) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) xorl %eax, %eax RETURN + cfi_adjust_cfa_offset (8) + cfi_rel_offset (esi, 0) + cfi_rel_offset (ebx, 4) L(30bytes): movl -30(%esi), %eax movl -30(%edx), %ecx @@ -217,9 +234,14 @@ L(2bytes): cmpl %ecx, %eax jne L(set) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) xorl %eax, %eax RETURN + cfi_adjust_cfa_offset (8) + cfi_rel_offset (esi, 0) + cfi_rel_offset (ebx, 4) L(31bytes): movl -31(%esi), %eax movl -31(%edx), %ecx @@ -266,9 +288,14 @@ L(3bytes): cmpb -1(%edx), %al jne L(set) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) xorl %eax, %eax RETURN + cfi_adjust_cfa_offset (8) + cfi_rel_offset (esi, 0) + cfi_rel_offset (ebx, 4) ALIGN (4) /* ECX >= 32. */ L(32bytesormore): @@ -349,7 +376,10 @@ L(set): sbbl %eax, %eax sbbl $-1, %eax popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) RETURN +END (BP_SYM (memcmp)) .section .rodata ALIGN (2) @@ -387,7 +417,6 @@ L(table_32bytes) : .long L(30bytes) - . + 0x78 .long L(31bytes) - . + 0x7c -END (BP_SYM (memcmp)) #undef bcmp weak_alias (BP_SYM (memcmp), BP_SYM (bcmp)) diff --git a/sysdeps/i386/i686/memcpy_chk.S b/sysdeps/i386/i686/memcpy_chk.S index 561263f9bf..2893911cd2 100644 --- a/sysdeps/i386/i686/memcpy_chk.S +++ b/sysdeps/i386/i686/memcpy_chk.S @@ -1,4 +1,4 @@ -/* Checking memcpy for x86-64. +/* Checking memcpy for i686. Copyright (C) 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/sysdeps/i386/i686/memmove.S b/sysdeps/i386/i686/memmove.S index 951e139ad4..b93b5c729f 100644 --- a/sysdeps/i386/i686/memmove.S +++ b/sysdeps/i386/i686/memmove.S @@ -1,7 +1,7 @@ /* Copy memory block and return pointer to beginning of destination block For Intel 80x86, x>=6. This file is part of the GNU C Library. - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2003. The GNU C Library is free software; you can redistribute it and/or @@ -42,11 +42,14 @@ ENTRY (BP_SYM (memmove)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) movl LEN(%esp), %ecx movl DEST(%esp), %edi + cfi_rel_offset (edi, 0) movl %esi, %edx movl SRC(%esp), %esi + cfi_register (esi, edx) CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %ecx) CHECK_BOUNDS_BOTH_WIDE (%esi, SRC(%esp), %ecx) @@ -65,14 +68,21 @@ ENTRY (BP_SYM (memmove)) 2: rep movsl movl %edx, %esi + cfi_restore (esi) movl DEST(%esp), %eax RETURN_BOUNDED_POINTER (DEST(%esp)) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE RET_PTR + cfi_adjust_cfa_offset (4) + cfi_rel_offset (edi, 0) + cfi_register (esi, edx) + /* Backward copying. */ 3: std leal -1(%edi, %ecx), %edi @@ -90,11 +100,14 @@ ENTRY (BP_SYM (memmove)) rep movsl movl %edx, %esi + cfi_restore (esi) movl DEST(%esp), %eax RETURN_BOUNDED_POINTER (DEST(%esp)) cld popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE RET_PTR diff --git a/sysdeps/i386/i686/mempcpy.S b/sysdeps/i386/i686/mempcpy.S index 843a35823a..6437e4a5d4 100644 --- a/sysdeps/i386/i686/mempcpy.S +++ b/sysdeps/i386/i686/mempcpy.S @@ -1,7 +1,7 @@ /* Copy memory block and return pointer to following byte. For Intel 80x86, x>=6. This file is part of the GNU C Library. - Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1998,1999,2000,2002,2004,2005 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. The GNU C Library is free software; you can redistribute it and/or @@ -43,9 +43,11 @@ ENTRY (BP_SYM (__mempcpy)) movl LEN(%esp), %ecx movl %edi, %eax + cfi_register (edi, eax) movl DEST(%esp), %edi CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %ecx) movl %esi, %edx + cfi_register (esi, edx) movl SRC(%esp), %esi CHECK_BOUNDS_BOTH_WIDE (%esi, SRC(%esp), %ecx) cld @@ -58,7 +60,9 @@ ENTRY (BP_SYM (__mempcpy)) 2: rep movsl xchgl %edi, %eax + cfi_restore (edi) movl %edx, %esi + cfi_restore (esi) RETURN_BOUNDED_POINTER (DEST(%esp)) LEAVE diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S index 561188ffec..dfa1aa7019 100644 --- a/sysdeps/i386/i686/memset.S +++ b/sysdeps/i386/i686/memset.S @@ -1,6 +1,6 @@ /* memset/bzero -- set memory area to CH/0 Highly optimized version for ix86, x>=6. - 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. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. @@ -51,6 +51,7 @@ ENTRY (BP_SYM (memset)) cld pushl %edi + cfi_adjust_cfa_offset (4) movl DEST(%esp), %edx movl LEN(%esp), %ecx CHECK_BOUNDS_BOTH_WIDE (%edx, DEST(%esp), %ecx) @@ -61,18 +62,19 @@ ENTRY (BP_SYM (memset)) #endif jecxz 1f movl %edx, %edi + cfi_rel_offset (edi, 0) andl $3, %edx - jz 2f - jnp 3f - stosb + jz 2f /* aligned */ + jp 3f /* misaligned at 3, store just one byte below */ + stosb /* misaligned at 1 or 2, store two bytes */ decl %ecx jz 1f 3: stosb decl %ecx jz 1f - xorl $3, %edx - jz 2f - stosb + xorl $1, %edx + jnz 2f /* was misaligned at 2 or 3, now aligned */ + stosb /* was misaligned at 1, store third byte */ decl %ecx 2: movl %ecx, %edx shrl $2, %ecx @@ -92,6 +94,8 @@ ENTRY (BP_SYM (memset)) RETURN_BOUNDED_POINTER (DEST(%esp)) #endif popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE #if BZERO_P @@ -101,3 +105,9 @@ ENTRY (BP_SYM (memset)) #endif END (BP_SYM (memset)) libc_hidden_builtin_def (memset) + +#if defined PIC && !defined NOT_IN_libc && !BZERO_P +strong_alias (__memset_chk, __memset_zero_constant_len_parameter) + .section .gnu.warning.__memset_zero_constant_len_parameter + .string "memset used with constant zero length parameter; this could be due to transposed parameters" +#endif diff --git a/sysdeps/i386/i686/memset_chk.S b/sysdeps/i386/i686/memset_chk.S index d178654994..cd93d5ee10 100644 --- a/sysdeps/i386/i686/memset_chk.S +++ b/sysdeps/i386/i686/memset_chk.S @@ -1,5 +1,5 @@ -/* Checking memset for x86-64. - Copyright (C) 2004 Free Software Foundation, Inc. +/* Checking memset for i686. + Copyright (C) 2004, 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 diff --git a/sysdeps/i386/i686/memusage.h b/sysdeps/i386/i686/memusage.h new file mode 100644 index 0000000000..235c3fc725 --- /dev/null +++ b/sysdeps/i386/i686/memusage.h @@ -0,0 +1,22 @@ +/* Copyright (C) 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 + 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 GETSP() ({ register uintptr_t stack_ptr asm ("esp"); stack_ptr; }) +#define GETTIME(low,high) asm ("rdtsc" : "=a" (low), "=d" (high)) + +#include <sysdeps/generic/memusage.h> diff --git a/sysdeps/i386/i686/strtok.S b/sysdeps/i386/i686/strtok.S index 3d81fb6d42..fe225e5485 100644 --- a/sysdeps/i386/i686/strtok.S +++ b/sysdeps/i386/i686/strtok.S @@ -1,6 +1,6 @@ /* strtok (str, delim) -- Return next DELIM separated token from STR. For Intel 80686. - Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2001, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -86,6 +86,8 @@ ENTRY (BP_SYM (FUNCTION)) #if !defined USE_AS_STRTOK_R && defined PIC pushl %ebx /* Save PIC register. */ + cfi_adjust_cfa_offset (4) + cfi_rel_offset (ebx, 0) call 0b addl $_GLOBAL_OFFSET_TABLE_, %ebx #endif @@ -97,6 +99,7 @@ ENTRY (BP_SYM (FUNCTION)) table. */ movl %edi, %edx subl $256, %esp + cfi_adjust_cfa_offset (256) movl $64, %ecx movl %esp, %edi xorl %eax, %eax @@ -247,9 +250,9 @@ L(8): cmpl %eax, %edx cmovne %ecx, %edx /* Store the pointer to the next character. */ -# ifdef USE_AS_STRTOK_R +#ifdef USE_AS_STRTOK_R movl SAVE(%esp), %ecx -# endif +#endif movl %edx, SAVE_PTR CHECK_BOUNDS_HIGH (%edx, SAVE_PTR, jb) RETURN_BOUNDED_POINTER (SAVE_PTR) @@ -257,14 +260,21 @@ L(8): cmpl %eax, %edx L(epilogue): /* Remove the stopset table. */ addl $256, %esp + cfi_adjust_cfa_offset (-256) #if !defined USE_AS_STRTOK_R && defined PIC popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) #endif LEAVE RET_PTR L(returnNULL): xorl %eax, %eax +#ifdef USE_AS_STRTOK_R + movl SAVE(%esp), %ecx +#endif + movl %edx, SAVE_PTR RETURN_NULL_BOUNDED_POINTER jmp L(epilogue) diff --git a/sysdeps/i386/jmpbuf-offsets.h b/sysdeps/i386/jmpbuf-offsets.h new file mode 100644 index 0000000000..c53d539edd --- /dev/null +++ b/sysdeps/i386/jmpbuf-offsets.h @@ -0,0 +1,26 @@ +/* Private macros for accessing __jmp_buf contents. i386 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_BX 0 +#define JB_SI 1 +#define JB_DI 2 +#define JB_BP 3 +#define JB_SP 4 +#define JB_PC 5 +#define JB_SIZE 24 diff --git a/sysdeps/i386/jmpbuf-unwind.h b/sysdeps/i386/jmpbuf-unwind.h new file mode 100644 index 0000000000..360493fb35 --- /dev/null +++ b/sysdeps/i386/jmpbuf-unwind.h @@ -0,0 +1,48 @@ +/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>, 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 <setjmp.h> +#include <jmpbuf-offsets.h> +#include <stdint.h> +#include <unwind.h> +#include <sysdep.h> + +/* 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)[JB_SP])) + +#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[JB_SP]; +#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/i386/ldbl2mpn.c b/sysdeps/i386/ldbl2mpn.c index bf4e4ff43f..01be777270 100644 --- a/sysdeps/i386/ldbl2mpn.c +++ b/sysdeps/i386/ldbl2mpn.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 2000, 2007 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 @@ -19,7 +19,7 @@ #include "gmp.h" #include "gmp-impl.h" #include "longlong.h" -#include "ieee754.h" +#include <ieee754.h> #include <float.h> #include <stdlib.h> @@ -46,7 +46,7 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size, #elif BITS_PER_MP_LIMB == 64 /* Hopefully the compiler will combine the two bitfield extracts and this composition into just the original quadword extract. */ - res_ptr[0] = ((unsigned long int) u.ieee.mantissa0 << 32) | u.ieee.mantissa1; + res_ptr[0] = ((mp_limb_t) u.ieee.mantissa0 << 32) | u.ieee.mantissa1; #define N 1 #else #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" @@ -109,6 +109,13 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size, } } } + else if (u.ieee.exponent < 0x7fff +#if N == 2 + && res_ptr[0] == 0 +#endif + && res_ptr[N - 1] == 0) + /* Pseudo zero. */ + *expt = 0; return N; } diff --git a/sysdeps/i386/lshift.S b/sysdeps/i386/lshift.S index ab1c89d23b..536d9878eb 100644 --- a/sysdeps/i386/lshift.S +++ b/sysdeps/i386/lshift.S @@ -1,5 +1,5 @@ /* i80386 __mpn_lshift -- - Copyright (C) 1992, 1994, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1992, 1994, 1997-2000, 2005 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -33,11 +33,16 @@ ENTRY (BP_SYM (__mpn_lshift)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) pushl %esi + cfi_adjust_cfa_offset (4) pushl %ebx + cfi_adjust_cfa_offset (4) movl RES(%esp),%edi + cfi_rel_offset (edi, 8) movl S(%esp),%esi + cfi_rel_offset (esi, 4) movl SIZE(%esp),%edx movl CNT(%esp),%ecx #if __BOUNDED_POINTERS__ @@ -49,11 +54,13 @@ ENTRY (BP_SYM (__mpn_lshift)) subl $4,%esi /* adjust s_ptr */ movl (%esi,%edx,4),%ebx /* read most significant limb */ + cfi_rel_offset (ebx, 0) xorl %eax,%eax shldl %cl,%ebx,%eax /* compute carry limb */ decl %edx jz L(end) pushl %eax /* push carry limb onto stack */ + cfi_adjust_cfa_offset (4) testb $1,%dl jnz L(1) /* enter loop in the middle */ movl %ebx,%eax @@ -73,10 +80,17 @@ L(1): movl (%esi,%edx,4),%eax movl %eax,(%edi) /* store it */ popl %eax /* pop carry limb */ + cfi_adjust_cfa_offset (-4) popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret @@ -85,8 +99,14 @@ L(end): shll %cl,%ebx /* compute least significant limb */ movl %ebx,(%edi) /* store it */ popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret diff --git a/sysdeps/i386/memchr.S b/sysdeps/i386/memchr.S index 3cfb3d666f..08989397bd 100644 --- a/sysdeps/i386/memchr.S +++ b/sysdeps/i386/memchr.S @@ -1,7 +1,6 @@ -/* memchr (str, chr, len) -- Return pointer to first occurrence of CHR in STR less - than LEN. - For Intel 80x86, x>=3. - Copyright (C) 1994-1998, 2000, 2003 Free Software Foundation, Inc. +/* memchr (str, chr, len) -- Return pointer to first occurrence of CHR in STR + less than LEN. For Intel 80x86, x>=3. + Copyright (C) 1994-1998, 2000, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> @@ -45,12 +44,16 @@ ENTRY (BP_SYM (__memchr)) /* Save callee-safe registers used in this function. */ pushl %esi + cfi_adjust_cfa_offset (4) pushl %edi + cfi_adjust_cfa_offset (4) + cfi_rel_offset (edi, 0) /* Load parameters into registers. */ movl STR(%esp), %eax /* str: pointer to memory block. */ movl CHR(%esp), %edx /* c: byte we are looking for. */ movl LEN(%esp), %esi /* len: length of memory block. */ + cfi_rel_offset (esi, 4) CHECK_BOUNDS_LOW (%eax, STR(%esp)) /* If my must not test more than three characters test @@ -320,7 +323,11 @@ L(9): RETURN_BOUNDED_POINTER (STR(%esp)) #endif L(pop): popl %edi /* pop saved registers */ + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) LEAVE RET_PTR diff --git a/sysdeps/i386/memcmp.S b/sysdeps/i386/memcmp.S index a795911094..60b75126bd 100644 --- a/sysdeps/i386/memcmp.S +++ b/sysdeps/i386/memcmp.S @@ -1,5 +1,5 @@ /* Compare two memory blocks for differences in the first COUNT bytes. - Copyright (C) 1995, 1996, 1997, 2000, 2004 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1997,2000,2004,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 @@ -32,10 +32,13 @@ ENTRY (BP_SYM (memcmp)) ENTER pushl %esi /* Save callee-safe registers. */ + cfi_adjust_cfa_offset (4) movl %edi, %edx /* Note that %edx is not used and can so be used to save %edi. It's faster. */ + cfi_register (edi, edx) movl BLK1(%esp), %esi + cfi_rel_offset (esi, 0) movl BLK2(%esp), %edi movl LEN(%esp), %ecx CHECK_BOUNDS_LOW (%esi, BLK1(%esp)) @@ -65,7 +68,10 @@ ENTRY (BP_SYM (memcmp)) L(1): CHECK_BOUNDS_HIGH (%esi, BLK1(%esp), jbe) CHECK_BOUNDS_HIGH (%edi, BLK2(%esp), jbe) popl %esi /* Restore registers. */ + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) movl %edx, %edi + cfi_restore (edi) LEAVE ret diff --git a/sysdeps/i386/memset.c b/sysdeps/i386/memset.c index 6a7fff8747..120df94d63 100644 --- a/sysdeps/i386/memset.c +++ b/sysdeps/i386/memset.c @@ -1,6 +1,6 @@ /* Set a block of memory to some byte value. For Intel 80x86, x>=3. - Copyright (C) 1991,1992,1993,1997,1998,2003 Free Software Foundation, Inc. + Copyright (C) 1991,1992,1993,1997,1998,2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund (tege@sics.se). @@ -82,5 +82,5 @@ memset (void *dstpp, int c, size_t len) libc_hidden_builtin_def (memset) #else -#include <sysdeps/generic/memset.c> +#include <string/memset.c> #endif diff --git a/sysdeps/i386/memusage.h b/sysdeps/i386/memusage.h index 73ce98c630..8d5749f655 100644 --- a/sysdeps/i386/memusage.h +++ b/sysdeps/i386/memusage.h @@ -17,6 +17,5 @@ 02111-1307 USA. */ #define GETSP() ({ register uintptr_t stack_ptr asm ("esp"); stack_ptr; }) -#define GETTIME(low,high) asm ("rdtsc" : "=a" (low), "=d" (high)) #include <sysdeps/generic/memusage.h> diff --git a/sysdeps/i386/mul_1.S b/sysdeps/i386/mul_1.S index e9be6fb618..0d0c07e7cf 100644 --- a/sysdeps/i386/mul_1.S +++ b/sysdeps/i386/mul_1.S @@ -1,6 +1,6 @@ /* i80386 __mpn_mul_1 -- Multiply a limb vector with a limb and store the result in a second limb vector. - Copyright (C) 1992, 1994, 1997, 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1992,1994,1997,1998,2000,2005 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -38,15 +38,22 @@ ENTRY (BP_SYM (__mpn_mul_1)) ENTER - pushl %edi - pushl %esi + pushl %res_ptr + cfi_adjust_cfa_offset (4) + pushl %s1_ptr + cfi_adjust_cfa_offset (4) pushl %ebp - pushl %ebx + cfi_adjust_cfa_offset (4) + pushl %s2_limb + cfi_adjust_cfa_offset (4) movl RES(%esp), %res_ptr + cfi_rel_offset (res_ptr, 12) movl S1(%esp), %s1_ptr + cfi_rel_offset (s1_ptr, 8) movl SIZE(%esp), %size movl S2LIMB(%esp), %s2_limb + cfi_rel_offset (s2_limb, 0) #if __BOUNDED_POINTERS__ shll $2, %size /* convert limbs to bytes */ CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size) @@ -57,6 +64,7 @@ ENTRY (BP_SYM (__mpn_mul_1)) leal (%s1_ptr,%size,4), %s1_ptr negl %size xorl %ebp, %ebp + cfi_rel_offset (ebp, 4) ALIGN (3) L(oop): movl (%s1_ptr,%size,4), %eax @@ -70,10 +78,18 @@ L(oop): jnz L(oop) movl %ebp, %eax - popl %ebx + popl %s2_limb + cfi_adjust_cfa_offset (-4) + cfi_restore (s2_limb) popl %ebp - popl %esi - popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) + popl %s1_ptr + cfi_adjust_cfa_offset (-4) + cfi_restore (s1_ptr) + popl %res_ptr + cfi_adjust_cfa_offset (-4) + cfi_restore (res_ptr) LEAVE ret diff --git a/sysdeps/i386/rawmemchr.S b/sysdeps/i386/rawmemchr.S index 75c08ead39..ddb9d52162 100644 --- a/sysdeps/i386/rawmemchr.S +++ b/sysdeps/i386/rawmemchr.S @@ -1,6 +1,6 @@ /* rawmemchr (str, ch) -- Return pointer to first occurrence of CH in STR. For Intel 80x86, x>=3. - Copyright (C) 1994,95,96,97,98,99,2000,2002 Free Software Foundation, Inc. + Copyright (C) 1994-2000,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> @@ -43,6 +43,8 @@ ENTRY (BP_SYM (__rawmemchr)) /* Save callee-safe register used in this function. */ pushl %edi + cfi_adjust_cfa_offset (4) + cfi_rel_offset (edi, 0) /* Load parameters into registers. */ movl STR(%esp), %eax @@ -217,6 +219,8 @@ L(9): CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb) RETURN_BOUNDED_POINTER (STR(%esp)) popl %edi /* pop saved register */ + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE RET_PTR diff --git a/sysdeps/i386/rshift.S b/sysdeps/i386/rshift.S index 51973fe998..3fd0afe822 100644 --- a/sysdeps/i386/rshift.S +++ b/sysdeps/i386/rshift.S @@ -1,5 +1,5 @@ /* i80386 __mpn_rshift -- - Copyright (C) 1992, 1994, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1992,1994,1997-2000,2005 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -33,11 +33,16 @@ ENTRY (BP_SYM (__mpn_rshift)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) pushl %esi + cfi_adjust_cfa_offset (4) pushl %ebx + cfi_adjust_cfa_offset (4) movl RES(%esp),%edi + cfi_rel_offset (edi, 8) movl S(%esp),%esi + cfi_rel_offset (esi, 4) movl SIZE(%esp),%edx movl CNT(%esp),%ecx #if __BOUNDED_POINTERS__ @@ -51,11 +56,13 @@ ENTRY (BP_SYM (__mpn_rshift)) negl %edx movl (%esi,%edx,4),%ebx /* read least significant limb */ + cfi_rel_offset (ebx, 0) xorl %eax,%eax shrdl %cl,%ebx,%eax /* compute carry limb */ incl %edx jz L(end) pushl %eax /* push carry limb onto stack */ + cfi_adjust_cfa_offset (4) testb $1,%dl jnz L(1) /* enter loop in the middle */ movl %ebx,%eax @@ -75,20 +82,37 @@ L(1): movl (%esi,%edx,4),%eax movl %eax,(%edi) /* store it */ popl %eax /* pop carry limb */ + cfi_adjust_cfa_offset (-4) popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret + cfi_adjust_cfa_offset (12) + cfi_rel_offset (edi, 8) + cfi_rel_offset (esi, 4) + cfi_rel_offset (ebx, 0) L(end): shrl %cl,%ebx /* compute most significant limb */ movl %ebx,(%edi) /* store it */ popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S index e01d32b66c..56c3994f66 100644 --- a/sysdeps/i386/setjmp.S +++ b/sysdeps/i386/setjmp.S @@ -1,5 +1,6 @@ /* setjmp for i386. - Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1997,2000,2001,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 +19,7 @@ 02111-1307 USA. */ #include <sysdep.h> -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> +#include <jmpbuf-offsets.h> #include <asm-syntax.h> #include "bp-sym.h" #include "bp-asm.h" @@ -40,12 +39,24 @@ ENTRY (BP_SYM (__sigsetjmp)) movl %esi, (JB_SI*4)(%eax) movl %edi, (JB_DI*4)(%eax) leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */ +#ifdef PTR_MANGLE + PTR_MANGLE (%ecx) +#endif movl %ecx, (JB_SP*4)(%eax) movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */ +#ifdef PTR_MANGLE + PTR_MANGLE (%ecx) +#endif movl %ecx, (JB_PC*4)(%eax) LEAVE /* pop frame pointer to prepare for tail-call. */ movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer. */ +#if defined NOT_IN_libc && defined IS_IN_rtld + /* In ld.so we never save the signal mask. */ + xorl %eax, %eax + ret +#else /* Make a tail call to __sigjmp_save; it takes the same args. */ - jmp BP_SYM (__sigjmp_save) + jmp __sigjmp_save +#endif END (BP_SYM (__sigsetjmp)) diff --git a/sysdeps/i386/soft-fp/Dist b/sysdeps/i386/soft-fp/Dist deleted file mode 100644 index 7e9914fe58..0000000000 --- a/sysdeps/i386/soft-fp/Dist +++ /dev/null @@ -1 +0,0 @@ -sfp-machine.h diff --git a/sysdeps/i386/stpncpy.S b/sysdeps/i386/stpncpy.S index acde5e3d66..c163a33591 100644 --- a/sysdeps/i386/stpncpy.S +++ b/sysdeps/i386/stpncpy.S @@ -1,7 +1,7 @@ /* copy no more then N bytes from SRC to DEST, returning the address of the terminating '\0' in DEST. For Intel 80x86, x>=3. - Copyright (C) 1994,1995,1996,1997,2000,2002 Free Software Foundation, Inc. + Copyright (C) 1994-1997,2000,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Some bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> @@ -40,9 +40,11 @@ ENTRY (BP_SYM (__stpncpy)) ENTER pushl %esi + cfi_adjust_cfa_offset (4) movl DEST(%esp), %eax movl SRC(%esp), %esi + cfi_rel_offset (esi, 0) movl LEN(%esp), %ecx CHECK_BOUNDS_LOW (%eax, DEST(%esp)) CHECK_BOUNDS_LOW (%esi, SRC(%esp)) @@ -148,6 +150,8 @@ L(9): RETURN_BOUNDED_POINTER (DEST(%esp)) #endif popl %esi /* restore saved register content */ + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) LEAVE RET_PTR diff --git a/sysdeps/i386/strchr.S b/sysdeps/i386/strchr.S index f5cee2f872..93b4cce8da 100644 --- a/sysdeps/i386/strchr.S +++ b/sysdeps/i386/strchr.S @@ -1,6 +1,7 @@ /* strchr (str, ch) -- Return pointer to first occurrence of CH in STR. For Intel 80x86, x>=3. - Copyright (C) 1994-1997,1999,2000,2002,2003 Free Software Foundation, Inc. + Copyright (C) 1994-1997,1999,2000,2002,2003,2005 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> @@ -35,6 +36,8 @@ ENTRY (BP_SYM (strchr)) ENTER pushl %edi /* Save callee-safe registers used here. */ + cfi_adjust_cfa_offset (4) + cfi_rel_offset (edi, 0) movl STR(%esp), %eax movl CHR(%esp), %edx CHECK_BOUNDS_LOW (%eax, STR(%esp)) @@ -244,10 +247,14 @@ L(2): /* Return NULL. */ xorl %eax, %eax RETURN_NULL_BOUNDED_POINTER popl %edi /* restore saved register content */ + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE RET_PTR + cfi_adjust_cfa_offset (4) + cfi_rel_offset (edi, 0) L(73): addl $4, %eax /* adjust pointer */ L(72): addl $4, %eax L(71): addl $4, %eax @@ -283,6 +290,8 @@ L(6): CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb) RETURN_BOUNDED_POINTER (STR(%esp)) popl %edi /* restore saved register content */ + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE RET_PTR diff --git a/sysdeps/i386/strchrnul.S b/sysdeps/i386/strchrnul.S index 9a521eb65a..8d1f7b2a5e 100644 --- a/sysdeps/i386/strchrnul.S +++ b/sysdeps/i386/strchrnul.S @@ -1,7 +1,7 @@ /* strchrnul (str, chr) -- Return pointer to first occurrence of CHR in STR or the final NUL byte. For Intel 80x86, x>=3. - Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1994-1997, 1999, 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.org> Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> @@ -36,6 +36,8 @@ ENTRY (BP_SYM (__strchrnul)) ENTER pushl %edi /* Save callee-safe registers used here. */ + cfi_adjust_cfa_offset (4) + cfi_rel_offset (edi, 0) movl STR(%esp), %eax movl CHR(%esp), %edx @@ -274,6 +276,8 @@ L(7): testb %cl, %cl /* is first byte CHR? */ L(6): CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb) RETURN_BOUNDED_POINTER (STR(%esp)) popl %edi /* restore saved register content */ + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE RET_PTR diff --git a/sysdeps/i386/strcspn.S b/sysdeps/i386/strcspn.S index dc3a176bf1..df6a136606 100644 --- a/sysdeps/i386/strcspn.S +++ b/sysdeps/i386/strcspn.S @@ -1,7 +1,7 @@ /* strcspn (str, ss) -- Return the length of the initial segment of STR which contains no characters from SS. For Intel 80x86, x>=3. - Copyright (C) 1994,1995,1996,1997,2000,2003 Free Software Foundation, Inc. + Copyright (C) 1994-1997,2000,2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> @@ -46,69 +46,133 @@ ENTRY (BP_SYM (strcspn)) xorl %ecx, %ecx /* %ecx = 0 !!! */ pushl %ecx /* make a 256 bytes long block filled with 0 */ + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl $0 /* These immediate values make the label 2 */ + cfi_adjust_cfa_offset (4) pushl $0 /* to be aligned on a 16 byte boundary to */ + cfi_adjust_cfa_offset (4) pushl $0 /* get a better performance of the loop. */ + cfi_adjust_cfa_offset (4) pushl $0 + cfi_adjust_cfa_offset (4) pushl $0 + cfi_adjust_cfa_offset (4) pushl $0 + cfi_adjust_cfa_offset (4) /* For understanding the following code remember that %ecx == 0 now. Although all the following instruction only modify %cl we always @@ -172,6 +236,7 @@ L(6): incl %eax L(5): incl %eax L(4): addl $256, %esp /* remove stopset */ + cfi_adjust_cfa_offset (-256) CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb) subl %edx, %eax /* we have to return the number of valid characters, so compute distance to first diff --git a/sysdeps/i386/strpbrk.S b/sysdeps/i386/strpbrk.S index 66136c209e..1f78e20646 100644 --- a/sysdeps/i386/strpbrk.S +++ b/sysdeps/i386/strpbrk.S @@ -1,7 +1,7 @@ /* strcspn (str, ss) -- Return the length of the initial segement of STR which contains no characters from SS. For Intel 80x86, x>=3. - Copyright (C) 1994-1997, 2000, 2003 Free Software Foundation, Inc. + Copyright (C) 1994-1997, 2000, 2003, 2005 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> This file is part of the GNU C Library. @@ -47,69 +47,133 @@ ENTRY (BP_SYM (strpbrk)) xorl %ecx, %ecx /* %ecx = 0 !!! */ pushl %ecx /* make a 256 bytes long block filled with 0 */ + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl $0 /* These immediate values make the label 2 */ + cfi_adjust_cfa_offset (4) pushl $0 /* to be aligned on a 16 byte boundary to */ + cfi_adjust_cfa_offset (4) pushl $0 /* get a better performance of the loop. */ + cfi_adjust_cfa_offset (4) pushl $0 + cfi_adjust_cfa_offset (4) pushl $0 + cfi_adjust_cfa_offset (4) pushl $0 + cfi_adjust_cfa_offset (4) /* For understanding the following code remember that %ecx == 0 now. Although all the following instruction only modify %cl we always @@ -173,6 +237,7 @@ L(6): incl %eax L(5): incl %eax L(4): addl $256, %esp /* remove stopset */ + cfi_adjust_cfa_offset (-256) CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb) orb %cl, %cl /* was last character NUL? */ diff --git a/sysdeps/i386/strrchr.S b/sysdeps/i386/strrchr.S index 0fd95b54f5..98c0c08bd0 100644 --- a/sysdeps/i386/strrchr.S +++ b/sysdeps/i386/strrchr.S @@ -1,6 +1,6 @@ /* strrchr (str, ch) -- Return pointer to last occurrence of CH in STR. For Intel 80x86, x>=3. - Copyright (C) 1994-1997, 2000, 2003 Free Software Foundation, Inc. + Copyright (C) 1994-1997, 2000, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> @@ -35,10 +35,14 @@ ENTRY (BP_SYM (strrchr)) ENTER pushl %edi /* Save callee-safe registers used here. */ + cfi_adjust_cfa_offset (4) + cfi_rel_offset (edi, 0) pushl %esi + cfi_adjust_cfa_offset (4) xorl %eax, %eax movl STR(%esp), %esi + cfi_rel_offset (esi, 0) movl CHR(%esp), %ecx CHECK_BOUNDS_LOW (%esi, STR(%esp)) @@ -299,20 +303,20 @@ L(21): addl $4, %esi returned. */ L(20): cmpb %cl, %dl /* is first byte == C? */ - jne L(24) /* no => skip */ + jne L(24) /* no => skip */ movl %esi, %eax /* store address as result */ L(24): testb %dl, %dl /* is first byte == NUL? */ jz L(2) /* yes => return */ cmpb %cl, %dh /* is second byte == C? */ - jne L(25) /* no => skip */ + jne L(25) /* no => skip */ leal 1(%esi), %eax /* store address as result */ L(25): testb %dh, %dh /* is second byte == NUL? */ jz L(2) /* yes => return */ shrl $16,%edx /* make upper bytes accessible */ cmpb %cl, %dl /* is third byte == C */ - jne L(26) /* no => skip */ + jne L(26) /* no => skip */ leal 2(%esi), %eax /* store address as result */ L(26): testb %dl, %dl /* is third byte == NUL */ jz L(2) /* yes => return */ @@ -324,7 +328,11 @@ L(26): testb %dl, %dl /* is third byte == NUL */ L(2): CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb) RETURN_BOUNDED_POINTER (STR(%esp)) popl %esi /* restore saved register content */ + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE RET_PTR diff --git a/sysdeps/i386/strspn.S b/sysdeps/i386/strspn.S index e1c109e590..c061438a0f 100644 --- a/sysdeps/i386/strspn.S +++ b/sysdeps/i386/strspn.S @@ -1,7 +1,7 @@ /* strcspn (str, ss) -- Return the length of the initial segment of STR which contains only characters from SS. For Intel 80x86, x>=3. - Copyright (C) 1994-1997, 2000, 2003 Free Software Foundation, Inc. + Copyright (C) 1994-1997, 2000, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> @@ -46,69 +46,133 @@ ENTRY (BP_SYM (strspn)) xorl %ecx, %ecx /* %ecx = 0 !!! */ pushl %ecx /* make a 256 bytes long block filled with 0 */ + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl $0 /* These immediate values make the label 2 */ + cfi_adjust_cfa_offset (4) pushl $0 /* to be aligned on a 16 byte boundary to */ + cfi_adjust_cfa_offset (4) pushl $0 /* get a better performance of the loop. */ + cfi_adjust_cfa_offset (4) pushl $0 + cfi_adjust_cfa_offset (4) pushl $0 + cfi_adjust_cfa_offset (4) pushl $0 + cfi_adjust_cfa_offset (4) /* For understanding the following code remember that %ecx == 0 now. Although all the following instruction only modify %cl we always @@ -172,6 +236,7 @@ L(6): incl %eax L(5): incl %eax L(4): addl $256, %esp /* remove stopset */ + cfi_adjust_cfa_offset (-256) CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb) subl %edx, %eax /* we have to return the number of valid characters, so compute distance to first diff --git a/sysdeps/i386/strtok.S b/sysdeps/i386/strtok.S index d2786e2ca4..c5f40a83b1 100644 --- a/sysdeps/i386/strtok.S +++ b/sysdeps/i386/strtok.S @@ -1,6 +1,6 @@ /* strtok (str, delim) -- Return next DELIM separated token from STR. For Intel 80x86, x>=3. - Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1996-1998,2000,2001,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -78,9 +78,13 @@ ENTRY (BP_SYM (FUNCTION)) #if !defined USE_AS_STRTOK_R && defined PIC pushl %ebx /* Save PIC register. */ + cfi_adjust_cfa_offset (4) call L(here) + cfi_adjust_cfa_offset (4) + cfi_rel_offset (ebx, 0) L(here): popl %ebx + cfi_adjust_cfa_offset (-4) addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ebx #endif @@ -125,69 +129,133 @@ L(1): xorl %ecx, %ecx /* %ecx = 0 !!! */ pushl %ecx /* make a 256 bytes long block filled with 0 */ + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl %ecx + cfi_adjust_cfa_offset (4) pushl $0 /* These immediate values make the label 2 */ + cfi_adjust_cfa_offset (4) pushl $0 /* to be aligned on a 16 byte boundary to */ + cfi_adjust_cfa_offset (4) pushl $0 /* get a better performance of the loop. */ + cfi_adjust_cfa_offset (4) pushl $0 + cfi_adjust_cfa_offset (4) pushl $0 + cfi_adjust_cfa_offset (4) pushl $0 + cfi_adjust_cfa_offset (4) /* For understanding the following code remember that %ecx == 0 now. Although all the following instruction only modify %cl we always @@ -284,6 +352,7 @@ L(9): incl %edx L(8): /* Remove the stopset table. */ addl $256, %esp + cfi_adjust_cfa_offset (-256) cmpl %eax, %edx je L(returnNULL) /* There was no token anymore. */ @@ -308,12 +377,18 @@ L(11): L(epilogue): #if !defined USE_AS_STRTOK_R && defined PIC popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) #endif LEAVE RET_PTR L(returnNULL): xorl %eax, %eax +#ifdef USE_AS_STRTOK_R + movl SAVE(%esp), %ecx +#endif + movl %edx, SAVE_PTR RETURN_NULL_BOUNDED_POINTER jmp L(epilogue) diff --git a/sysdeps/i386/sub_n.S b/sysdeps/i386/sub_n.S index b545985374..e1e62b89d3 100644 --- a/sysdeps/i386/sub_n.S +++ b/sysdeps/i386/sub_n.S @@ -1,6 +1,7 @@ /* i80386 __mpn_sub_n -- Add two limb vectors of the same length > 0 and store sum in a third limb vector. - Copyright (C) 1992, 1994, 1995, 1997, 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1992,1994,1995,1997,1998,2000,2005 + Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -34,10 +35,14 @@ ENTRY (BP_SYM (__mpn_sub_n)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) pushl %esi + cfi_adjust_cfa_offset (4) movl RES(%esp),%edi + cfi_rel_offset (edi, 4) movl S1(%esp),%esi + cfi_rel_offset (esi, 0) movl S2(%esp),%edx movl SIZE(%esp),%ecx #if __BOUNDED_POINTERS__ @@ -62,10 +67,12 @@ ENTRY (BP_SYM (__mpn_sub_n)) /* Calculate start address in loop for PIC. Due to limitations in some assemblers, Loop-L0-3 cannot be put into the leal */ call L(0) + cfi_adjust_cfa_offset (4) L(0): leal (%eax,%eax,8),%eax addl (%esp),%eax addl $(L(oop)-L(0)-3),%eax addl $4,%esp + cfi_adjust_cfa_offset (-4) #else /* Calculate start address in loop for non-PIC. */ leal (L(oop) - 3)(%eax,%eax,8),%eax @@ -106,7 +113,11 @@ L(oop): movl (%esi),%eax negl %eax popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret diff --git a/sysdeps/i386/submul_1.S b/sysdeps/i386/submul_1.S index 8bfcde1557..7f8523d96d 100644 --- a/sysdeps/i386/submul_1.S +++ b/sysdeps/i386/submul_1.S @@ -1,6 +1,6 @@ /* i80386 __mpn_submul_1 -- Multiply a limb vector with a limb and subtract the result from a second limb vector. - Copyright (C) 1992, 1994, 1997, 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1992,1994,1997,1998,2000,2005 Free Software Foundation, Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify @@ -39,9 +39,17 @@ ENTRY (BP_SYM (__mpn_submul_1)) ENTER pushl %edi + cfi_adjust_cfa_offset (4) pushl %esi + cfi_adjust_cfa_offset (4) pushl %ebp + cfi_adjust_cfa_offset (4) pushl %ebx + cfi_adjust_cfa_offset (4) + cfi_rel_offset (edi, 12) + cfi_rel_offset (esi, 8) + cfi_rel_offset (ebp, 4) + cfi_rel_offset (ebx, 0) movl RES(%esp), %res_ptr movl S1(%esp), %s1_ptr @@ -72,9 +80,17 @@ L(oop): movl %ebp, %eax popl %ebx + cfi_adjust_cfa_offset (-4) + cfi_restore (ebx) popl %ebp + cfi_adjust_cfa_offset (-4) + cfi_restore (ebp) popl %esi + cfi_adjust_cfa_offset (-4) + cfi_restore (esi) popl %edi + cfi_adjust_cfa_offset (-4) + cfi_restore (edi) LEAVE ret diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h index e955b43f95..2739cb00b3 100644 --- a/sysdeps/i386/sysdep.h +++ b/sysdeps/i386/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for i386. - Copyright (C) 1991,92,93,95,96,98,2002,2003 Free Software Foundation, Inc. + Copyright (C) 1991-93,95,96,98,2002,2003,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 @@ -57,10 +57,12 @@ .align ALIGNARG(4); \ STABS_FUN(name) \ C_LABEL(name) \ + cfi_startproc; \ CALL_MCOUNT #undef END #define END(name) \ + cfi_endproc; \ ASM_SIZE_DIRECTIVE(name) \ STABS_FUN_END(name) @@ -92,7 +94,9 @@ /* The mcount code relies on a normal frame pointer being on the stack to locate our caller, so push one just for its benefit. */ #define CALL_MCOUNT \ - pushl %ebp; movl %esp, %ebp; call JUMPTARGET(mcount); popl %ebp; + pushl %ebp; cfi_adjust_cfa_offset (4); movl %esp, %ebp; \ + cfi_def_cfa_register (ebp); call JUMPTARGET(mcount); \ + popl %ebp; cfi_def_cfa (esp, 4); #else #define CALL_MCOUNT /* Do nothing. */ #endif @@ -122,9 +126,38 @@ lose: SYSCALL_PIC_SETUP \ #define JUMPTARGET(name) name##@PLT #define SYSCALL_PIC_SETUP \ pushl %ebx; \ + cfi_adjust_cfa_offset (4); \ call 0f; \ 0: popl %ebx; \ + cfi_adjust_cfa_offset (-4); \ addl $_GLOBAL_OFFSET_TABLE+[.-0b], %ebx; + +# ifndef HAVE_HIDDEN +# define SETUP_PIC_REG(reg) \ + call 1f; \ + .subsection 1; \ +1:movl (%esp), %e##reg; \ + ret; \ + .previous +# else +# define SETUP_PIC_REG(reg) \ + .ifndef __i686.get_pc_thunk.reg; \ + .section .gnu.linkonce.t.__i686.get_pc_thunk.reg,"ax",@progbits; \ + .globl __i686.get_pc_thunk.reg; \ + .hidden __i686.get_pc_thunk.reg; \ + .type __i686.get_pc_thunk.reg,@function; \ +__i686.get_pc_thunk.reg: \ + movl (%esp), %e##reg; \ + ret; \ + .size __i686.get_pc_thunk.reg, . - __i686.get_pc_thunk.reg; \ + .previous; \ + .endif; \ + call __i686.get_pc_thunk.reg +# endif + +# define LOAD_PIC_REG(reg) \ + SETUP_PIC_REG(reg); addl $_GLOBAL_OFFSET_TABLE_, %e##reg + #else #define JUMPTARGET(name) name #define SYSCALL_PIC_SETUP /* Nothing. */ |