From a334319f6530564d22e775935d9c91663623a1b4 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 22 Dec 2004 20:10:10 +0000 Subject: (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4. --- sysdeps/x86_64/Dist | 4 + sysdeps/x86_64/Versions | 7 -- sysdeps/x86_64/__longjmp.S | 27 +++--- sysdeps/x86_64/_mcount.S | 2 +- sysdeps/x86_64/bits/byteswap.h | 7 +- sysdeps/x86_64/bits/link.h | 125 +++---------------------- sysdeps/x86_64/bits/linkmap.h | 14 --- sysdeps/x86_64/bits/mathdef.h | 48 ---------- sysdeps/x86_64/bits/setjmp.h | 41 ++++++++- sysdeps/x86_64/bsd-_setjmp.S | 5 +- sysdeps/x86_64/bsd-setjmp.S | 6 +- sysdeps/x86_64/dl-machine.h | 176 ++++++++++++++++++++++++++++------- sysdeps/x86_64/dl-trampoline.S | 189 -------------------------------------- sysdeps/x86_64/elf/start.S | 4 +- sysdeps/x86_64/fpu/bits/mathdef.h | 48 ++++++++++ sysdeps/x86_64/fpu/e_log10l.S | 5 +- sysdeps/x86_64/fpu/e_log2l.S | 5 +- sysdeps/x86_64/fpu/e_logl.S | 12 +-- sysdeps/x86_64/fpu/e_powl.S | 19 ++-- sysdeps/x86_64/fpu/feholdexcpt.c | 3 +- sysdeps/x86_64/fpu/fesetround.c | 3 +- sysdeps/x86_64/fpu/libm-test-ulps | 19 ++-- sysdeps/x86_64/fpu/math_private.h | 21 ----- sysdeps/x86_64/fpu/printf_fphex.c | 4 +- sysdeps/x86_64/fpu/s_log1pl.S | 5 +- sysdeps/x86_64/fpu/s_sincos.S | 61 ------------ sysdeps/x86_64/fpu/s_sincosl.S | 7 +- sysdeps/x86_64/hp-timing.h | 10 +- sysdeps/x86_64/jmpbuf-offsets.h | 30 ------ sysdeps/x86_64/jmpbuf-unwind.h | 48 ---------- sysdeps/x86_64/ldbl2mpn.c | 1 - sysdeps/x86_64/memset.S | 10 +- sysdeps/x86_64/memset_chk.S | 2 +- sysdeps/x86_64/setjmp.S | 28 ++---- sysdeps/x86_64/soft-fp/Dist | 1 + sysdeps/x86_64/strchr.S | 4 +- sysdeps/x86_64/strcmp.S | 4 +- sysdeps/x86_64/strcspn.S | 9 +- sysdeps/x86_64/strspn.S | 7 +- sysdeps/x86_64/strtok.S | 10 +- 40 files changed, 331 insertions(+), 700 deletions(-) create mode 100644 sysdeps/x86_64/Dist delete mode 100644 sysdeps/x86_64/Versions delete mode 100644 sysdeps/x86_64/bits/linkmap.h delete mode 100644 sysdeps/x86_64/bits/mathdef.h delete mode 100644 sysdeps/x86_64/dl-trampoline.S create mode 100644 sysdeps/x86_64/fpu/bits/mathdef.h delete mode 100644 sysdeps/x86_64/fpu/math_private.h delete mode 100644 sysdeps/x86_64/fpu/s_sincos.S delete mode 100644 sysdeps/x86_64/jmpbuf-offsets.h delete mode 100644 sysdeps/x86_64/jmpbuf-unwind.h delete mode 100644 sysdeps/x86_64/ldbl2mpn.c create mode 100644 sysdeps/x86_64/soft-fp/Dist (limited to 'sysdeps/x86_64') diff --git a/sysdeps/x86_64/Dist b/sysdeps/x86_64/Dist new file mode 100644 index 0000000000..d0e516c5bc --- /dev/null +++ b/sysdeps/x86_64/Dist @@ -0,0 +1,4 @@ +bp-asm.h +hp-timing.c +_mcount.S +bits/link.h diff --git a/sysdeps/x86_64/Versions b/sysdeps/x86_64/Versions deleted file mode 100644 index 253a65f04e..0000000000 --- a/sysdeps/x86_64/Versions +++ /dev/null @@ -1,7 +0,0 @@ -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/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S index a68e7a8a4f..9ed480c540 100644 --- a/sysdeps/x86_64/__longjmp.S +++ b/sysdeps/x86_64/__longjmp.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2001,2004,2005,2006 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,7 +17,9 @@ 02111-1307 USA. */ #include -#include +#define _ASM +#define _SETJMP_H +#include #include /* Jump to the position specified by ENV, causing the @@ -25,33 +27,28 @@ void __longjmp (__jmp_buf env, int val). */ ENTRY(__longjmp) /* Restore registers. */ - movq (JB_RSP*8)(%rdi),%r8 - movq (JB_RBP*8)(%rdi),%r9 - movq (JB_PC*8)(%rdi),%rdx -#ifdef PTR_DEMANGLE - PTR_DEMANGLE (%r8) - PTR_DEMANGLE (%r9) - PTR_DEMANGLE (%rdx) -#endif /* We add unwind information for the target here. */ cfi_def_cfa(%rdi, 0) - cfi_register(%rsp,%r8) - cfi_register(%rbp,%r9) - cfi_register(%rip,%rdx) cfi_offset(%rbx,JB_RBX*8) cfi_offset(%rbp,JB_RBP*8) cfi_offset(%r12,JB_R12*8) cfi_offset(%r13,JB_R13*8) cfi_offset(%r14,JB_R14*8) cfi_offset(%r15,JB_R15*8) + cfi_offset(%rsp,JB_RSP*8) + cfi_offset(%rip,JB_PC*8) movq (JB_RBX*8)(%rdi),%rbx + movq (JB_RBP*8)(%rdi),%rbp movq (JB_R12*8)(%rdi),%r12 movq (JB_R13*8)(%rdi),%r13 movq (JB_R14*8)(%rdi),%r14 movq (JB_R15*8)(%rdi),%r15 /* Set return value for setjmp. */ + test %esi,%esi + mov $01,%eax + cmove %eax,%esi mov %esi, %eax - movq %r8,%rsp - movq %r9,%rbp + movq (JB_PC*8)(%rdi),%rdx + movq (JB_RSP*8)(%rdi),%rsp jmpq *%rdx END (BP_SYM (__longjmp)) diff --git a/sysdeps/x86_64/_mcount.S b/sysdeps/x86_64/_mcount.S index c005932c0c..1cc4e3065b 100644 --- a/sysdeps/x86_64/_mcount.S +++ b/sysdeps/x86_64/_mcount.S @@ -64,4 +64,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/x86_64/bits/byteswap.h b/sysdeps/x86_64/bits/byteswap.h index ec2b17889d..e1c861c75f 100644 --- a/sysdeps/x86_64/bits/byteswap.h +++ b/sysdeps/x86_64/bits/byteswap.h @@ -1,6 +1,5 @@ /* Macros to swap the order of bytes in integer values. - Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007 - Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2000, 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 @@ -60,9 +59,7 @@ # if __WORDSIZE == 64 || (defined __i486__ || defined __pentium__ \ || defined __pentiumpro__ || defined __pentium4__ \ || defined __k8__ || defined __athlon__ \ - || defined __k6__ || defined __nocona__ \ - || defined __core2__ || defined __geode__ \ - || defined __amdfam10__) + || defined __k6__) /* To swap the bytes in a word the i486 processors and up provide the `bswap' opcode. On i386 we have to use three instructions. */ # define __bswap_32(x) \ diff --git a/sysdeps/x86_64/bits/link.h b/sysdeps/x86_64/bits/link.h index 2890c2d88d..8ea7157156 100644 --- a/sysdeps/x86_64/bits/link.h +++ b/sysdeps/x86_64/bits/link.h @@ -1,117 +1,14 @@ -/* 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 directly; use instead." -#endif - - -#if __ELF_NATIVE_CLASS == 32 -/* 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 +#if __WORDSIZE == 64 +struct link_map_machine + { + Elf64_Addr plt; /* Address of .plt + 0x16 */ + Elf64_Addr gotplt; /* Address of .got + 0x18 */ + }; #else - -/* Registers for entry into PLT on x86-64. */ -# if __GNUC_PREREQ (4,0) -typedef float La_x86_64_xmm __attribute__ ((__vector_size__ (16))); -# else -typedef float La_x86_64_xmm __attribute__ ((__mode__ (__V4SF__))); -# endif - -typedef struct La_x86_64_regs -{ - uint64_t lr_rdx; - uint64_t lr_r8; - uint64_t lr_r9; - uint64_t lr_rcx; - uint64_t lr_rsi; - uint64_t lr_rdi; - uint64_t lr_rbp; - uint64_t lr_rsp; - La_x86_64_xmm lr_xmm[8]; -} La_x86_64_regs; - -/* Return values for calls from PLT on x86-64. */ -typedef struct La_x86_64_retval -{ - uint64_t lrv_rax; - uint64_t lrv_rdx; - La_x86_64_xmm lrv_xmm0; - La_x86_64_xmm lrv_xmm1; - long double lrv_st0; - long double lrv_st1; -} La_x86_64_retval; - - -__BEGIN_DECLS - -extern Elf64_Addr la_x86_64_gnu_pltenter (Elf64_Sym *__sym, - unsigned int __ndx, - uintptr_t *__refcook, - uintptr_t *__defcook, - La_x86_64_regs *__regs, - unsigned int *__flags, - const char *__symname, - long int *__framesizep); -extern unsigned int la_x86_64_gnu_pltexit (Elf64_Sym *__sym, - unsigned int __ndx, - uintptr_t *__refcook, - uintptr_t *__defcook, - const La_x86_64_regs *__inregs, - La_x86_64_retval *__outregs, - const char *symname); - -__END_DECLS - +struct link_map_machine + { + Elf32_Addr plt; /* Address of .plt + 0x16 */ + Elf32_Addr gotplt; /* Address of .got + 0x0c */ + }; #endif diff --git a/sysdeps/x86_64/bits/linkmap.h b/sysdeps/x86_64/bits/linkmap.h deleted file mode 100644 index 8ea7157156..0000000000 --- a/sysdeps/x86_64/bits/linkmap.h +++ /dev/null @@ -1,14 +0,0 @@ -#if __WORDSIZE == 64 -struct link_map_machine - { - Elf64_Addr plt; /* Address of .plt + 0x16 */ - Elf64_Addr gotplt; /* Address of .got + 0x18 */ - }; - -#else -struct link_map_machine - { - Elf32_Addr plt; /* Address of .plt + 0x16 */ - Elf32_Addr gotplt; /* Address of .got + 0x0c */ - }; -#endif diff --git a/sysdeps/x86_64/bits/mathdef.h b/sysdeps/x86_64/bits/mathdef.h deleted file mode 100644 index 7b16189590..0000000000 --- a/sysdeps/x86_64/bits/mathdef.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 2001, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#if !defined _MATH_H && !defined _COMPLEX_H -# error "Never use directly; include instead" -#endif - -#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF -# define _MATH_H_MATHDEF 1 - -# include - -# if __WORDSIZE == 64 || (defined __FLT_EVAL_METHOD__ && __FLT_EVAL_METHOD__ == 0) -/* The x86-64 architecture computes values with the precission of the - used type. Similarly for -m32 -mfpmath=sse. */ -typedef float float_t; /* `float' expressions are evaluated as `float'. */ -typedef double double_t; /* `double' expressions are evaluated - as `double'. */ -# else -/* The ix87 FPUs evaluate all values in the 80 bit floating-point format - which is also available for the user as `long double'. Therefore we - define: */ -typedef long double float_t; /* `float' expressions are evaluated as - `long double'. */ -typedef long double double_t; /* `double' expressions are evaluated as - `long double'. */ -# endif - -/* The values returned by `ilogb' for 0 and NaN respectively. */ -# define FP_ILOGB0 (-2147483647 - 1) -# define FP_ILOGBNAN (-2147483647 - 1) - -#endif /* ISO C99 */ diff --git a/sysdeps/x86_64/bits/setjmp.h b/sysdeps/x86_64/bits/setjmp.h index c9b98b2e3b..96646efdda 100644 --- a/sysdeps/x86_64/bits/setjmp.h +++ b/sysdeps/x86_64/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001,2002,2003,2005,2006 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -26,6 +26,36 @@ #include +#if __WORDSIZE == 64 + +/* We only need to save callee-saved registers plus stackpointer and + program counter. */ +# if defined __USE_MISC || defined _ASM +# define JB_RBX 0 +# define JB_RBP 1 +# define JB_R12 2 +# define JB_R13 3 +# define JB_R14 4 +# define JB_R15 5 +# define JB_RSP 6 +# define JB_PC 7 +# define JB_SIZE (8*8) +# endif + +#else + +# 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 + +#endif + #ifndef _ASM # if __WORDSIZE == 64 @@ -34,6 +64,15 @@ typedef long int __jmp_buf[8]; typedef int __jmp_buf[6]; # endif +/* Test if longjmp to JMPBUF would unwind the frame + containing a local variable at ADDRESS. */ +# if __WORDSIZE == 64 +# define _JMPBUF_UNWINDS(jmpbuf, address) \ + ((void *) (address) < (void *) (jmpbuf)[JB_RSP]) +# else +# define _JMPBUF_UNWINDS(jmpbuf, address) \ + ((void *) (address) < (void *) (jmpbuf)[JB_SP]) +# endif #endif #endif /* bits/setjmp.h */ diff --git a/sysdeps/x86_64/bsd-_setjmp.S b/sysdeps/x86_64/bsd-_setjmp.S index 838fae70f7..22b6eb423d 100644 --- a/sysdeps/x86_64/bsd-_setjmp.S +++ b/sysdeps/x86_64/bsd-_setjmp.S @@ -1,6 +1,5 @@ /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. x86-64 version. - Copyright (C) 1994-1997, 2000, 2001, 2002, 2003, 2005 - Free Software Foundation, Inc. + Copyright (C) 1994-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 @@ -31,7 +30,7 @@ ENTRY (BP_SYM (_setjmp)) /* Set up arguments, we only need to set the second arg. */ - xorl %esi, %esi + xorq %rsi, %rsi #ifdef PIC jmp HIDDEN_JUMPTARGET (__sigsetjmp) #else diff --git a/sysdeps/x86_64/bsd-setjmp.S b/sysdeps/x86_64/bsd-setjmp.S index 216c503ccb..c168f81867 100644 --- a/sysdeps/x86_64/bsd-setjmp.S +++ b/sysdeps/x86_64/bsd-setjmp.S @@ -1,6 +1,5 @@ /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. x86-64 version. - Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2005 - Free Software Foundation, Inc. + Copyright (C) 1994,1995,1996,1997,2000,2001 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 @@ -31,9 +30,8 @@ ENTRY (BP_SYM (setjmp)) /* Set up arguments, we only need to set the 2nd arg. */ - movl $1, %esi + movq $1, %rsi #ifdef PIC - jmp HIDDEN_JUMPTARGET (__sigsetjmp) #else jmp BP_SYM (__sigsetjmp) #endif diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 73e271775a..b932f51d15 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. x86-64 version. - Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger . @@ -55,7 +55,7 @@ elf_machine_dynamic (void) static inline Elf64_Addr __attribute__ ((unused)) elf_machine_load_address (void) { - Elf64_Addr addr; + register Elf64_Addr addr, tmp; /* The easy way is just the same as on x86: leaq _dl_start, %0 @@ -66,18 +66,15 @@ elf_machine_load_address (void) Instead we store the address of _dl_start in the data section and compare it with the current value that we can get via - an RIP relative addressing mode. Note that this is the address - of _dl_start before any relocation performed at runtime. In case - the binary is prelinked the resulting "address" is actually a - load offset which is zero if the binary was loaded at the address - it is prelinked for. */ - - asm ("leaq _dl_start(%%rip), %0\n\t" - "subq 1f(%%rip), %0\n\t" - ".section\t.data.rel.ro\n" + an RIP relative addressing mode. */ + + asm ("movq 1f(%%rip), %1\n" + "0:\tleaq _dl_start(%%rip), %0\n\t" + "subq %1, %0\n\t" + ".section\t.data\n" "1:\t.quad _dl_start\n\t" ".previous\n\t" - : "=r" (addr) : : "cc"); + : "=r" (addr), "=r" (tmp) : : "cc"); return addr; } @@ -119,8 +116,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf64_Addr) &_dl_runtime_profile; - if (GLRO(dl_profile) != NULL - && _dl_name_match_p (GLRO(dl_profile), l)) + if (_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; @@ -134,6 +130,128 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) return lazy; } +/* This code is used in dl-runtime.c to call the `fixup' function + and then redirect to the address it returns. */ +#ifndef PROF +# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\ + .text\n\ + .globl _dl_runtime_resolve\n\ + .type _dl_runtime_resolve, @function\n\ + .align 16\n\ + " CFI_STARTPROC "\n\ +_dl_runtime_resolve:\n\ + subq $56,%rsp\n\ + " CFI_ADJUST_CFA_OFFSET(72)" # Incorporate PLT\n\ + movq %rax,(%rsp) # Preserve registers otherwise clobbered.\n\ + movq %rcx,8(%rsp)\n\ + movq %rdx,16(%rsp)\n\ + movq %rsi,24(%rsp)\n\ + movq %rdi,32(%rsp)\n\ + movq %r8,40(%rsp)\n\ + movq %r9,48(%rsp)\n\ + movq 64(%rsp), %rsi # Copy args pushed by PLT in register.\n\ + movq %rsi,%r11 # Multiply by 24\n\ + addq %r11,%rsi\n\ + addq %r11,%rsi\n\ + shlq $3, %rsi\n\ + movq 56(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset\n\ + call fixup # Call resolver.\n\ + movq %rax, %r11 # Save return value\n\ + movq 48(%rsp),%r9 # Get register content back.\n\ + movq 40(%rsp),%r8\n\ + movq 32(%rsp),%rdi\n\ + movq 24(%rsp),%rsi\n\ + movq 16(%rsp),%rdx\n\ + movq 8(%rsp),%rcx\n\ + movq (%rsp),%rax\n\ + addq $72,%rsp # Adjust stack(PLT did 2 pushes)\n\ + " CFI_ADJUST_CFA_OFFSET(-72)" \n\ + jmp *%r11 # 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\ + .align 16\n\ + " CFI_STARTPROC "\n\ +_dl_runtime_profile:\n\ + subq $56,%rsp\n\ + " CFI_ADJUST_CFA_OFFSET(72)" # Incorporate PLT\n\ + movq %rax,(%rsp) # Preserve registers otherwise clobbered.\n\ + movq %rcx,8(%rsp)\n\ + movq %rdx,16(%rsp)\n\ + movq %rsi,24(%rsp)\n\ + movq %rdi,32(%rsp)\n\ + movq %r8,40(%rsp)\n\ + movq %r9,48(%rsp)\n\ + movq 72(%rsp), %rdx # Load return address if needed\n\ + movq 64(%rsp), %rsi # Copy args pushed by PLT in register.\n\ + movq %rsi,%r11 # Multiply by 24\n\ + addq %r11,%rsi\n\ + addq %r11,%rsi\n\ + shlq $3, %rsi\n\ + movq 56(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset\n\ + call profile_fixup # Call resolver.\n\ + movq %rax, %r11 # Save return value\n\ + movq 48(%rsp),%r9 # Get register content back.\n\ + movq 40(%rsp),%r8\n\ + movq 32(%rsp),%rdi\n\ + movq 24(%rsp),%rsi\n\ + movq 16(%rsp),%rdx\n\ + movq 8(%rsp),%rcx\n\ + movq (%rsp),%rax\n\ + addq $72,%rsp # Adjust stack\n\ + " CFI_ADJUST_CFA_OFFSET(-72)"\n\ + jmp *%r11 # 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\ + .align 16\n\ + " CFI_STARTPROC "\n\ +_dl_runtime_resolve:\n\ +_dl_runtime_profile:\n\ + subq $56,%rsp\n\ + " CFI_ADJUST_CFA_OFFSET(72)" # Incorporate PLT\n\ + movq %rax,(%rsp) # Preserve registers otherwise clobbered.\n\ + movq %rcx,8(%rsp)\n\ + movq %rdx,16(%rsp)\n\ + movq %rsi,24(%rsp)\n\ + movq %rdi,32(%rsp)\n\ + movq %r8,40(%rsp)\n\ + movq %r9,48(%rsp)\n\ + movq 64(%rsp), %rsi # Copy args pushed by PLT in register.\n\ + movq %rsi,%r11 # Multiply by 24\n\ + addq %r11,%rsi\n\ + addq %r11,%rsi\n\ + shlq $3, %rsi\n\ + movq 56(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset\n\ + call fixup # Call resolver.\n\ + movq %rax, %r11 # Save return value\n\ + movq 48(%rsp),%r9 # Get register content back.\n\ + movq 40(%rsp),%r8\n\ + movq 32(%rsp),%rdi\n\ + movq 24(%rsp),%rsi\n\ + movq 16(%rsp),%rdx\n\ + movq 8(%rsp),%rcx\n\ + movq (%rsp),%rax\n\ + addq $72,%rsp # Adjust stack\n\ + " CFI_ADJUST_CFA_OFFSET(-72)"\n\ + jmp *%r11 # 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 + /* Initial entry point code for the dynamic linker. The C function `_dl_start' is the real entry point; its return value is the user program's entry point. */ @@ -162,24 +280,16 @@ _dl_start_user:\n\ # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\ # argc -> rsi\n\ movq %rdx, %rsi\n\ - # Save %rsp value in %r13.\n\ - movq %rsp, %r13\n\ - # And align stack for the _dl_init_internal call. \n\ - andq $-16, %rsp\n\ # _dl_loaded -> rdi\n\ movq _rtld_local(%rip), %rdi\n\ # env -> rcx\n\ - leaq 16(%r13,%rdx,8), %rcx\n\ + leaq 16(%rsp,%rdx,8), %rcx\n\ # argv -> rdx\n\ - leaq 8(%r13), %rdx\n\ - # Clear %rbp to mark outermost frame obviously even for constructors.\n\ - xorl %ebp, %ebp\n\ + leaq 8(%rsp), %rdx\n\ # Call the function to run the initializers.\n\ call _dl_init_internal@PLT\n\ # Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\ leaq _dl_fini(%rip), %rdx\n\ - # And make sure %rsp points to argc stored on the stack.\n\ - movq %r13, %rsp\n\ # Jump to the user's entry point.\n\ jmp *%r12\n\ .previous\n\ @@ -238,14 +348,9 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, return value; } - -/* Names of the architecture-specific auditing callback functions. */ -#define ARCH_LA_PLTENTER x86_64_gnu_pltenter -#define ARCH_LA_PLTEXIT x86_64_gnu_pltexit - #endif /* !dl_machine_h */ -#ifdef RESOLVE_MAP +#ifdef RESOLVE /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ @@ -285,9 +390,18 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, #ifndef RTLD_BOOTSTRAP const Elf64_Sym *const refsym = sym; #endif +#if defined USE_TLS && !defined RTLD_BOOTSTRAP struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); Elf64_Addr value = (sym == NULL ? 0 : (Elf64_Addr) sym_map->l_addr + sym->st_value); +#else + Elf64_Addr value = RESOLVE (&sym, version, r_type); + +# ifndef RTLD_BOOTSTRAP + if (sym != NULL) +# endif + value += sym->st_value; +#endif #if defined RTLD_BOOTSTRAP && !USE___THREAD assert (r_type == R_X86_64_GLOB_DAT || r_type == R_X86_64_JUMP_SLOT); @@ -439,4 +553,4 @@ elf_machine_lazy_rel (struct link_map *map, _dl_reloc_bad_type (map, r_type, 1); } -#endif /* RESOLVE_MAP */ +#endif /* RESOLVE */ diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S deleted file mode 100644 index c1686dae10..0000000000 --- a/sysdeps/x86_64/dl-trampoline.S +++ /dev/null @@ -1,189 +0,0 @@ -/* PLT trampolines. x86-64 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 - - .text - .globl _dl_runtime_resolve - .type _dl_runtime_resolve, @function - .align 16 - cfi_startproc -_dl_runtime_resolve: - subq $56,%rsp - cfi_adjust_cfa_offset(72) # Incorporate PLT - movq %rax,(%rsp) # Preserve registers otherwise clobbered. - movq %rcx, 8(%rsp) - movq %rdx, 16(%rsp) - movq %rsi, 24(%rsp) - movq %rdi, 32(%rsp) - movq %r8, 40(%rsp) - movq %r9, 48(%rsp) - movq 64(%rsp), %rsi # Copy args pushed by PLT in register. - movq %rsi, %r11 # Multiply by 24 - addq %r11, %rsi - addq %r11, %rsi - shlq $3, %rsi - movq 56(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset - call _dl_fixup # Call resolver. - movq %rax, %r11 # Save return value - movq 48(%rsp), %r9 # Get register content back. - movq 40(%rsp), %r8 - movq 32(%rsp), %rdi - movq 24(%rsp), %rsi - movq 16(%rsp), %rdx - movq 8(%rsp), %rcx - movq (%rsp), %rax - addq $72, %rsp # Adjust stack(PLT did 2 pushes) - cfi_adjust_cfa_offset(-72) - jmp *%r11 # Jump to function address. - cfi_endproc - .size _dl_runtime_resolve, .-_dl_runtime_resolve - - -#ifndef PROF - .globl _dl_runtime_profile - .type _dl_runtime_profile, @function - .align 16 - cfi_startproc -_dl_runtime_profile: - subq $80, %rsp - cfi_adjust_cfa_offset(96) # Incorporate PLT - movq %rax, (%rsp) # Preserve registers otherwise clobbered. - movq %rdx, 8(%rsp) - movq %r8, 16(%rsp) - movq %r9, 24(%rsp) - movq %rcx, 32(%rsp) - movq %rsi, 40(%rsp) - movq %rdi, 48(%rsp) - movq %rbp, 56(%rsp) # Information for auditors. - leaq 96(%rsp), %rax - movq %rax, 64(%rsp) - leaq 8(%rsp), %rcx - movq 96(%rsp), %rdx # Load return address if needed - movq 88(%rsp), %rsi # Copy args pushed by PLT in register. - movq %rsi,%r11 # Multiply by 24 - addq %r11,%rsi - addq %r11,%rsi - shlq $3, %rsi - movq 80(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset - leaq 72(%rsp), %r8 - call _dl_profile_fixup # Call resolver. - movq %rax, %r11 # Save return value - movq 8(%rsp), %rdx # Get back register content. - movq 16(%rsp), %r8 - movq 24(%rsp), %r9 - movq (%rsp),%rax - movq 72(%rsp), %r10 - testq %r10, %r10 - jns 1f - movq 32(%rsp), %rcx - movq 40(%rsp), %rsi - movq 48(%rsp), %rdi - addq $96,%rsp # Adjust stack - cfi_adjust_cfa_offset (-96) - jmp *%r11 # Jump to function address. - - /* - +96 return address - +88 PLT2 - +80 PLT1 - +72 free - +64 %rsp - +56 %rbp - +48 %rdi - +40 %rsi - +32 %rcx - +24 %r9 - +16 %r8 - +8 %rdx - %esp %rax - */ - cfi_adjust_cfa_offset (96) -1: movq %rbx, 72(%rsp) - cfi_rel_offset (1, 72) - leaq 104(%rsp), %rsi - movq %rsp, %rbx - cfi_def_cfa_register (1) - subq %r10, %rsp - movq %rsp, %rdi - movq %r10, %rcx - shrq $3, %rcx - rep - movsq - andq $0xfffffffffffffff0, %rsp - movq 32(%rbx), %rcx - movq 40(%rbx), %rsi - movq 48(%rbx), %rdi - call *%r11 - movq %rbx, %rsp - cfi_def_cfa_register (7) - subq $72, %rsp - cfi_adjust_cfa_offset (72) - movq %rsp, %rcx - movq %rax, (%rcx) - movq %rdx, 8(%rcx) - /* Even though the stack is correctly aligned to allow using movaps - we use movups. Some callers might provide an incorrectly aligned - stack and we do not want to have it blow up here. */ - movups %xmm0, 16(%rcx) - movups %xmm1, 32(%rcx) - fstpt 48(%rcx) - fstpt 64(%rcx) - /* - +168 return address - +160 PLT2 - +152 PLT1 - +144 free - +136 %rsp - +128 %rbp - +120 %rdi - +112 %rsi - +104 %rcx - +96 %r9 - +88 %r8 - +80 %rdx - +64 %st1 result - +48 %st result - +32 %xmm1 result - +16 %xmm0 result - +8 %rdx result - %esp %rax result - */ - leaq 80(%rsp), %rdx - movq 144(%rsp), %rbx - cfi_restore (1) - movq 160(%rsp), %rsi # Copy args pushed by PLT in register. - movq %rsi,%r11 # Multiply by 24 - addq %r11,%rsi - addq %r11,%rsi - shlq $3, %rsi - movq 152(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset - call _dl_call_pltexit - movq (%rsp), %rax - movq 8(%rsp), %rdx - movups 16(%rsp), %xmm0 - movups 32(%rsp), %xmm1 - fldt 64(%rsp) - fldt 48(%rsp) - addq $168, %rsp - cfi_adjust_cfa_offset (-168) - retq - cfi_endproc - .size _dl_runtime_profile, .-_dl_runtime_profile -#endif diff --git a/sysdeps/x86_64/elf/start.S b/sysdeps/x86_64/elf/start.S index 3c2caf9d00..0ef252309a 100644 --- a/sysdeps/x86_64/elf/start.S +++ b/sysdeps/x86_64/elf/start.S @@ -1,5 +1,5 @@ /* Startup code compliant to the ELF x86-64 ABI. - Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 2001. @@ -62,7 +62,7 @@ _start: /* Clear the frame pointer. The ABI suggests this be done, to mark the outermost frame obviously. */ - xorl %ebp, %ebp + xorq %rbp, %rbp /* Extract the arguments as encoded on the stack and set up the arguments for __libc_start_main (int (*main) (int, char **, char **), diff --git a/sysdeps/x86_64/fpu/bits/mathdef.h b/sysdeps/x86_64/fpu/bits/mathdef.h new file mode 100644 index 0000000000..7b16189590 --- /dev/null +++ b/sysdeps/x86_64/fpu/bits/mathdef.h @@ -0,0 +1,48 @@ +/* Copyright (C) 2001, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _MATH_H && !defined _COMPLEX_H +# error "Never use directly; include instead" +#endif + +#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF +# define _MATH_H_MATHDEF 1 + +# include + +# if __WORDSIZE == 64 || (defined __FLT_EVAL_METHOD__ && __FLT_EVAL_METHOD__ == 0) +/* The x86-64 architecture computes values with the precission of the + used type. Similarly for -m32 -mfpmath=sse. */ +typedef float float_t; /* `float' expressions are evaluated as `float'. */ +typedef double double_t; /* `double' expressions are evaluated + as `double'. */ +# else +/* The ix87 FPUs evaluate all values in the 80 bit floating-point format + which is also available for the user as `long double'. Therefore we + define: */ +typedef long double float_t; /* `float' expressions are evaluated as + `long double'. */ +typedef long double double_t; /* `double' expressions are evaluated as + `long double'. */ +# endif + +/* The values returned by `ilogb' for 0 and NaN respectively. */ +# define FP_ILOGB0 (-2147483647 - 1) +# define FP_ILOGBNAN (-2147483647 - 1) + +#endif /* ISO C99 */ diff --git a/sysdeps/x86_64/fpu/e_log10l.S b/sysdeps/x86_64/fpu/e_log10l.S index 633234b744..b4343bef45 100644 --- a/sysdeps/x86_64/fpu/e_log10l.S +++ b/sysdeps/x86_64/fpu/e_log10l.S @@ -42,7 +42,7 @@ ENTRY(__ieee754_log10l) fxam fnstsw fld %st // x : x : log10(2) - testb $1, %ah + andb $1,%ah jnz 3f // in case x is NaN or ħInf 4: fsubl MO(one) // x-1 : x : log10(2) fld %st // x-1 : x-1 : x : log10(2) @@ -59,8 +59,7 @@ ENTRY(__ieee754_log10l) fyl2x // log10(x) ret -3: testb $4, %ah - jnz 4b // in case x is ħInf +3: jp 4b // in case x is ħInf fstp %st(1) fstp %st(1) ret diff --git a/sysdeps/x86_64/fpu/e_log2l.S b/sysdeps/x86_64/fpu/e_log2l.S index f04d30a05a..7a89b94d9f 100644 --- a/sysdeps/x86_64/fpu/e_log2l.S +++ b/sysdeps/x86_64/fpu/e_log2l.S @@ -39,7 +39,7 @@ ENTRY(__ieee754_log2l) fxam fnstsw fld %st // x : x : 1 - testb $1, %ah + andb $1,%ah jnz 3f // in case x is NaN or ħInf 4: fsub %st(2), %st // x-1 : x : 1 fld %st // x-1 : x-1 : x : 1 @@ -56,8 +56,7 @@ ENTRY(__ieee754_log2l) fyl2x // log(x) ret -3: testb $4, %ah - jnz 4b // in case x is ħInf +3: jp 4b // in case x is ħInf fstp %st(1) fstp %st(1) ret diff --git a/sysdeps/x86_64/fpu/e_logl.S b/sysdeps/x86_64/fpu/e_logl.S index 2ba91eedfd..a0bed663c8 100644 --- a/sysdeps/x86_64/fpu/e_logl.S +++ b/sysdeps/x86_64/fpu/e_logl.S @@ -38,12 +38,8 @@ limit: .double 0.29 ENTRY(__ieee754_logl) fldln2 // log(2) fldt 8(%rsp) // x : log(2) - fxam - fnstsw fld %st // x : x : log(2) - testb $1, %ah - jnz 3f // in case x is NaN or +-Inf -4: fsubl MO(one) // x-1 : x : log(2) + 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,10 +53,4 @@ ENTRY(__ieee754_logl) 2: fstp %st(0) // x : log(2) fyl2x // log(x) ret - -3: testb $4, %ah - jnz 4b // in case x is +-Inf - fstp %st(1) - fstp %st(1) - ret END (__ieee754_logl) diff --git a/sysdeps/x86_64/fpu/e_powl.S b/sysdeps/x86_64/fpu/e_powl.S index 4959bea7ac..85f4deb3c7 100644 --- a/sysdeps/x86_64/fpu/e_powl.S +++ b/sysdeps/x86_64/fpu/e_powl.S @@ -1,6 +1,5 @@ /* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2007 - Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -147,11 +146,10 @@ ENTRY(__ieee754_powl) 2: /* y is a real number. */ fxch // x : y fldl MO(one) // 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 + 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 fnstsw fxch // x : 1.0 : y test $4500,%eax @@ -192,10 +190,9 @@ ENTRY(__ieee754_powl) // y == ħinf .align ALIGNARG(4) 12: fstp %st(0) // pop y - fldl MO(one) // 1 - fldt 8(%rsp) // x : 1 - fabs // abs(x) : 1 - fucompp // < 1, == 1, or > 1 + fldt 8(%rsp) // x + fabs + fcompl MO(one) // < 1, == 1, or > 1 fnstsw andb $0x45, %ah cmpb $0x45, %ah diff --git a/sysdeps/x86_64/fpu/feholdexcpt.c b/sysdeps/x86_64/fpu/feholdexcpt.c index a9b21a3c25..db53d0f07f 100644 --- a/sysdeps/x86_64/fpu/feholdexcpt.c +++ b/sysdeps/x86_64/fpu/feholdexcpt.c @@ -1,5 +1,5 @@ /* Store current floating-point environment and clear exceptions. - Copyright (C) 2001, 2005 Free Software Foundation, Inc. + Copyright (C) 2001 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 @@ -39,4 +39,3 @@ feholdexcept (fenv_t *envp) return 0; } -libm_hidden_def (feholdexcept) diff --git a/sysdeps/x86_64/fpu/fesetround.c b/sysdeps/x86_64/fpu/fesetround.c index 408116eee8..429b7f1d0c 100644 --- a/sysdeps/x86_64/fpu/fesetround.c +++ b/sysdeps/x86_64/fpu/fesetround.c @@ -1,5 +1,5 @@ /* Set current rounding direction. - Copyright (C) 2001, 2005 Free Software Foundation, Inc. + Copyright (C) 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -44,4 +44,3 @@ fesetround (int round) return 0; } -libm_hidden_def (fesetround) diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps index 0ced4be7b8..b3ce8bfeee 100644 --- a/sysdeps/x86_64/fpu/libm-test-ulps +++ b/sysdeps/x86_64/fpu/libm-test-ulps @@ -24,14 +24,17 @@ ldouble: 1 # atan2 Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025": -float: 1 -ifloat: 1 +float: 3 +ifloat: 3 Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025": -float: 1 -ifloat: 1 +float: 3 +ifloat: 3 Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772": float: 1 ifloat: 1 +Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112": +float: 6 +ifloat: 6 # atanh Test "atanh (0.75) == 0.972955074527656652552676371721589865": @@ -48,14 +51,14 @@ 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: 7 idouble: 1 ifloat: 7 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: 3 idouble: 1 @@ -950,8 +953,8 @@ ildouble: 1 ldouble: 1 Function: "atan2": -float: 1 -ifloat: 1 +float: 6 +ifloat: 6 Function: "atanh": float: 1 diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h deleted file mode 100644 index 4febcbb5ec..0000000000 --- a/sysdeps/x86_64/fpu/math_private.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _MATH_PRIVATE_H - -#define math_opt_barrier(x) \ -({ __typeof(x) __x; \ - if (sizeof (x) <= sizeof (double)) \ - __asm ("" : "=x" (__x) : "0" (x)); \ - else \ - __asm ("" : "=t" (__x) : "0" (x)); \ - __x; }) -#define math_force_eval(x) \ -do \ - { \ - if (sizeof (x) <= sizeof (double)) \ - __asm __volatile ("" : : "x" (x)); \ - else \ - __asm __volatile ("" : : "f" (x)); \ - } \ -while (0) - -#include -#endif diff --git a/sysdeps/x86_64/fpu/printf_fphex.c b/sysdeps/x86_64/fpu/printf_fphex.c index b701b20b87..d6ca102a88 100644 --- a/sysdeps/x86_64/fpu/printf_fphex.c +++ b/sysdeps/x86_64/fpu/printf_fphex.c @@ -1,5 +1,5 @@ /* Print floating point number in hexadecimal notation according to ISO C99. - Copyright (C) 1997,1998,1999,2000,2001,2005 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000, 2001 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 @@ -89,4 +89,4 @@ do { \ } \ } while (0) -#include +#include diff --git a/sysdeps/x86_64/fpu/s_log1pl.S b/sysdeps/x86_64/fpu/s_log1pl.S index ac2bd22a4f..7fbd0e5aaa 100644 --- a/sysdeps/x86_64/fpu/s_log1pl.S +++ b/sysdeps/x86_64/fpu/s_log1pl.S @@ -45,7 +45,7 @@ ENTRY(__log1pl) fxam fnstsw fld %st - testb $1, %ah + andb $1,%ah jnz 3f // in case x is NaN or ħInf 4: fabs @@ -62,8 +62,7 @@ ENTRY(__log1pl) 2: fyl2xp1 ret -3: testb $4, %ah - jnz 4b // in case x is ħInf +3: jp 4b // in case x is ħInf fstp %st(1) fstp %st(1) ret diff --git a/sysdeps/x86_64/fpu/s_sincos.S b/sysdeps/x86_64/fpu/s_sincos.S deleted file mode 100644 index 9a33615340..0000000000 --- a/sysdeps/x86_64/fpu/s_sincos.S +++ /dev/null @@ -1,61 +0,0 @@ -/* Compute sine and cosine of argument. - Copyright (C) 1997, 2000, 2001, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include "bp-sym.h" -#include "bp-asm.h" - -#define PARMS LINKAGE /* no space for saved regs */ -#define ANGLE PARMS -#define SINP ANGLE+12 -#define COSP SINP+PTR_SIZE - - .text -ENTRY (BP_SYM (__sincos)) - ENTER - - movsd %xmm0, -8(%rsp) - fldl -8(%rsp) - fsincos - fnstsw %ax - testl $0x400,%eax - jnz 1f - fstpl (%rsi) - fstpl (%rdi) - - LEAVE - retq - -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fsincos - fstpl (%rsi) - fstpl (%rdi) - - LEAVE - retq -END (BP_SYM (__sincos)) -weak_alias (BP_SYM (__sincos), BP_SYM (sincos)) diff --git a/sysdeps/x86_64/fpu/s_sincosl.S b/sysdeps/x86_64/fpu/s_sincosl.S index b17eabe767..9a3025ab5f 100644 --- a/sysdeps/x86_64/fpu/s_sincosl.S +++ b/sysdeps/x86_64/fpu/s_sincosl.S @@ -1,5 +1,5 @@ /* Compute sine and cosine of argument. - Copyright (C) 1997, 2000, 2001, 2005 Free Software Foundation, Inc. + Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -40,8 +40,9 @@ ENTRY (BP_SYM (__sincosl)) fstpt (%rdi) LEAVE - retq + ret + .align ALIGNARG(4) 1: fldpi fadd %st(0) fxch %st(1) @@ -55,6 +56,6 @@ ENTRY (BP_SYM (__sincosl)) fstpt (%rdi) LEAVE - retq + ret END (BP_SYM (__sincosl)) weak_alias (BP_SYM (__sincosl), BP_SYM (sincosl)) diff --git a/sysdeps/x86_64/hp-timing.h b/sysdeps/x86_64/hp-timing.h index 59a29abd45..e015ff79db 100644 --- a/sysdeps/x86_64/hp-timing.h +++ b/sysdeps/x86_64/hp-timing.h @@ -1,5 +1,5 @@ /* High precision, low overhead timing functions. x86-64 version. - Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,11 +31,7 @@ /* The funny business for 32-bit mode is not required here. */ # undef HP_TIMING_ACCUM -# define HP_TIMING_ACCUM(Sum, Diff) \ - do { \ - hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead); \ - __asm__ __volatile__ ("lock; addq %1, %0" \ - : "=m" (Sum) : "r" (__diff), "m" (Sum)); \ - } while (0) +# define HP_TIMING_ACCUM(Sum, Diff) ((Sum) += (Diff)) + #endif /* hp-timing.h */ diff --git a/sysdeps/x86_64/jmpbuf-offsets.h b/sysdeps/x86_64/jmpbuf-offsets.h deleted file mode 100644 index 46c7768013..0000000000 --- a/sysdeps/x86_64/jmpbuf-offsets.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Private macros for accessing __jmp_buf contents. x86-64 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. */ - -/* We only need to save callee-saved registers plus stackpointer and - program counter. */ -#define JB_RBX 0 -#define JB_RBP 1 -#define JB_R12 2 -#define JB_R13 3 -#define JB_R14 4 -#define JB_R15 5 -#define JB_RSP 6 -#define JB_PC 7 -#define JB_SIZE (8*8) diff --git a/sysdeps/x86_64/jmpbuf-unwind.h b/sysdeps/x86_64/jmpbuf-unwind.h deleted file mode 100644 index 299a4a8d14..0000000000 --- a/sysdeps/x86_64/jmpbuf-unwind.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2003. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include -#include -#include -#include - -/* Test if longjmp to JMPBUF would unwind the frame - containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ - ((void *) (address) < (void *) demangle ((jmpbuf)[JB_RSP])) - -#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_RSP]; -#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/x86_64/ldbl2mpn.c b/sysdeps/x86_64/ldbl2mpn.c deleted file mode 100644 index 641b789cd4..0000000000 --- a/sysdeps/x86_64/ldbl2mpn.c +++ /dev/null @@ -1 +0,0 @@ -#include "../i386/ldbl2mpn.c" diff --git a/sysdeps/x86_64/memset.S b/sysdeps/x86_64/memset.S index 1c421c75f3..6c47f4c863 100644 --- a/sysdeps/x86_64/memset.S +++ b/sysdeps/x86_64/memset.S @@ -1,6 +1,6 @@ /* memset/bzero -- set memory area to CH/0 Optimized version for x86-64. - Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger . @@ -41,7 +41,7 @@ END (__memset_chk) ENTRY (memset) #if BZERO_P mov %rsi,%rdx /* Adjust parameter. */ - xorl %esi,%esi /* Fill with 0s. */ + xorq %rsi,%rsi /* Fill with 0s. */ #endif cmp $0x7,%rdx /* Check for small length. */ mov %rdi,%rcx /* Save ptr as return value. */ @@ -138,9 +138,3 @@ END (memset) #if !BZERO_P libc_hidden_builtin_def (memset) #endif - -#if !BZERO_P && defined PIC && !defined NOT_IN_libc -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/x86_64/memset_chk.S b/sysdeps/x86_64/memset_chk.S index c1c8c23f90..e62cb58cc0 100644 --- a/sysdeps/x86_64/memset_chk.S +++ b/sysdeps/x86_64/memset_chk.S @@ -1,5 +1,5 @@ /* Checking memset for x86-64. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/sysdeps/x86_64/setjmp.S b/sysdeps/x86_64/setjmp.S index a66b0e61e5..811ab1d913 100644 --- a/sysdeps/x86_64/setjmp.S +++ b/sysdeps/x86_64/setjmp.S @@ -1,5 +1,5 @@ /* setjmp for x86-64. - Copyright (C) 2001, 2003, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 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 @@ -18,45 +18,29 @@ 02111-1307 USA. */ #include -#include +#define _ASM +#define _SETJMP_H +#include #include ENTRY (__sigsetjmp) /* Save registers. */ movq %rbx, (JB_RBX*8)(%rdi) -#ifdef PTR_MANGLE - movq %rbp, %rax - PTR_MANGLE (%rax) - movq %rax, (JB_RBP*8)(%rdi) -#else movq %rbp, (JB_RBP*8)(%rdi) -#endif movq %r12, (JB_R12*8)(%rdi) movq %r13, (JB_R13*8)(%rdi) movq %r14, (JB_R14*8)(%rdi) movq %r15, (JB_R15*8)(%rdi) leaq 8(%rsp), %rdx /* Save SP as it will be after we return. */ -#ifdef PTR_MANGLE - PTR_MANGLE (%rdx) -#endif movq %rdx, (JB_RSP*8)(%rdi) movq (%rsp), %rax /* Save PC we are returning to now. */ -#ifdef PTR_MANGLE - PTR_MANGLE (%rax) -#endif movq %rax, (JB_PC*8)(%rdi) -#if defined NOT_IN_libc && defined IS_IN_rtld - /* In ld.so we never save the signal mask. */ - xorl %eax, %eax - retq -#else /* Make a tail call to __sigjmp_save; it takes the same args. */ -# ifdef PIC +#ifdef PIC jmp C_SYMBOL_NAME (BP_SYM (__sigjmp_save))@PLT -# else +#else jmp BP_SYM (__sigjmp_save) -# endif #endif END (BP_SYM (__sigsetjmp)) hidden_def (__sigsetjmp) diff --git a/sysdeps/x86_64/soft-fp/Dist b/sysdeps/x86_64/soft-fp/Dist new file mode 100644 index 0000000000..7e9914fe58 --- /dev/null +++ b/sysdeps/x86_64/soft-fp/Dist @@ -0,0 +1 @@ +sfp-machine.h diff --git a/sysdeps/x86_64/strchr.S b/sysdeps/x86_64/strchr.S index 8934697972..a657796851 100644 --- a/sysdeps/x86_64/strchr.S +++ b/sysdeps/x86_64/strchr.S @@ -1,6 +1,6 @@ /* strchr (str, ch) -- Return pointer to first occurrence of CH in STR. For AMD x86-64. - Copyright (C) 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 2002 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 @@ -221,7 +221,7 @@ ENTRY (BP_SYM (strchr)) 7: /* Return NULL. */ - xorl %eax, %eax + xorq %rax, %rax retq diff --git a/sysdeps/x86_64/strcmp.S b/sysdeps/x86_64/strcmp.S index 119b88e40b..ed6710b1ac 100644 --- a/sysdeps/x86_64/strcmp.S +++ b/sysdeps/x86_64/strcmp.S @@ -1,5 +1,5 @@ /* Highly optimized version for x86-64. - Copyright (C) 1999, 2000, 2002, 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Based on i686 version contributed by Ulrich Drepper , 1999. @@ -34,7 +34,7 @@ L(oop): movb (%rdi), %al testb %al, %al jnz L(oop) - xorl %eax, %eax + xorq %rax, %rax ret L(neq): movl $1, %eax diff --git a/sysdeps/x86_64/strcspn.S b/sysdeps/x86_64/strcspn.S index 467201388b..63af04aeab 100644 --- a/sysdeps/x86_64/strcspn.S +++ b/sysdeps/x86_64/strcspn.S @@ -1,8 +1,7 @@ /* strcspn (str, ss) -- Return the length of the initial segment of STR which contains no characters from SS. For AMD x86-64. - Copyright (C) 1994-1997, 2000, 2002, 2003, 2004, 2005 - Free Software Foundation, Inc. + Copyright (C) 1994-1997,2000,2002,2003,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper . Bug fixes by Alan Modra . @@ -42,9 +41,9 @@ ENTRY (strcspn) movq %rdi, %r8 /* Save value. */ subq $256, %rsp /* Make space for 256 bytes. */ cfi_adjust_cfa_offset(256) - movl $32, %ecx /* 32*8 bytes = 256 bytes. */ + movq $32, %rcx /* 32*8 bytes = 256 bytes. */ movq %rsp, %rdi - xorl %eax, %eax /* We store 0s. */ + xorq %rax, %rax /* We store 0s. */ cld rep stosq @@ -114,7 +113,7 @@ L(5): incq %rax L(4): addq $256, %rsp /* remove skipset */ cfi_adjust_cfa_offset(-256) #if STRPBRK_P - xorl %edx,%edx + xorq %rdx,%rdx orb %cl, %cl /* was last character NUL? */ cmovzq %rdx, %rax /* Yes: return NULL */ #else diff --git a/sysdeps/x86_64/strspn.S b/sysdeps/x86_64/strspn.S index 54aac18d61..fa4abd1537 100644 --- a/sysdeps/x86_64/strspn.S +++ b/sysdeps/x86_64/strspn.S @@ -1,8 +1,7 @@ /* strspn (str, ss) -- Return the length of the initial segment of STR which contains only characters from SS. For AMD x86-64. - Copyright (C) 1994-1997, 2000, 2002, 2003, 2004, 2005 - Free Software Foundation, Inc. + Copyright (C) 1994-1997,2000,2002,2003,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper . Bug fixes by Alan Modra . @@ -38,9 +37,9 @@ ENTRY (strspn) movq %rdi, %r8 /* Save value. */ subq $256, %rsp /* Make space for 256 bytes. */ cfi_adjust_cfa_offset(256) - movl $32, %ecx /* 32*8 bytes = 256 bytes. */ + movq $32, %rcx /* 32*8 bytes = 256 bytes. */ movq %rsp, %rdi - xorl %eax, %eax /* We store 0s. */ + xorq %rax, %rax /* We store 0s. */ cld rep stosq diff --git a/sysdeps/x86_64/strtok.S b/sysdeps/x86_64/strtok.S index 4037f0b850..5d0cbef2e5 100644 --- a/sysdeps/x86_64/strtok.S +++ b/sysdeps/x86_64/strtok.S @@ -1,6 +1,6 @@ /* strtok (str, delim) -- Return next DELIM separated token from STR. For AMD x86-64. - Copyright (C) 1998,2000-2003,2005,2006 Free Software Foundation, Inc. + Copyright (C) 1998,2000,2001,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Based on i686 version contributed by Ulrich Drepper , 1998. @@ -69,9 +69,9 @@ ENTRY (BP_SYM (FUNCTION)) movq %rdi, %r8 /* Save value. */ subq $256, %rsp /* Make space for 256 bytes. */ cfi_adjust_cfa_offset(256) - movl $32, %ecx /* 32*8 bytes = 256 bytes. */ + movq $32, %rcx /* 32*8 bytes = 256 bytes. */ movq %rsp, %rdi - xorl %eax, %eax /* We store 0s. */ + xorq %rax, %rax /* We store 0s. */ cld rep stosq @@ -204,9 +204,7 @@ L(epilogue): retq L(returnNULL): - xorl %eax, %eax - /* Store the pointer to the next character. */ - movq %rdx, SAVE_PTR + xorq %rax, %rax jmp L(epilogue) END (BP_SYM (FUNCTION)) -- cgit 1.4.1