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/alpha | |
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/alpha')
64 files changed, 1034 insertions, 441 deletions
diff --git a/sysdeps/alpha/Dist b/sysdeps/alpha/Dist deleted file mode 100644 index 7cf49111e4..0000000000 --- a/sysdeps/alpha/Dist +++ /dev/null @@ -1,11 +0,0 @@ -divrem.h -divl.S -divq.S -reml.S -remq.S -_mcount.S -stxcpy.S -stxncpy.S -fpu/fenv_libc.h -alphaev6/stxncpy.S -alphaev6/stxcpy.S diff --git a/sysdeps/alpha/Implies b/sysdeps/alpha/Implies index 4b354f3e47..18c35908c4 100644 --- a/sysdeps/alpha/Implies +++ b/sysdeps/alpha/Implies @@ -1,5 +1,6 @@ wordsize-64 -# Alpha uses IEEE 754 single and double precision floating point. -ieee754/flt-32 +# Alpha uses IEEE 754 single, double and quad precision floating point. +ieee754/ldbl-128 ieee754/dbl-64 +ieee754/flt-32 alpha/soft-fp diff --git a/sysdeps/alpha/__longjmp.S b/sysdeps/alpha/__longjmp.S index 40d50312a3..bed26658de 100644 --- a/sysdeps/alpha/__longjmp.S +++ b/sysdeps/alpha/__longjmp.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1994, 1997, 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 @@ -19,9 +19,7 @@ #define __ASSEMBLY__ #include <sysdep.h> -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> +#include <jmpbuf-offsets.h> ENTRY(__longjmp) @@ -54,6 +52,11 @@ ENTRY(__longjmp) ldt $f7, JB_F7*8(a0) ldt $f8, JB_F8*8(a0) ldt $f9, JB_F9*8(a0) +#ifdef PTR_DEMANGLE + PTR_DEMANGLE(ra, t1) + PTR_DEMANGLE2(t0, t1) + PTR_DEMANGLE2(fp, t1) +#endif cmoveq v0, 1, v0 mov t0, sp ret diff --git a/sysdeps/alpha/bits/link.h b/sysdeps/alpha/bits/link.h new file mode 100644 index 0000000000..429faff432 --- /dev/null +++ b/sysdeps/alpha/bits/link.h @@ -0,0 +1,69 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LINK_H +# error "Never include <bits/link.h> directly; use <link.h> instead." +#endif + + +/* Registers for entry into PLT on Alpha. */ +typedef struct La_alpha_regs +{ + uint64_t lr_r26; + uint64_t lr_sp; + uint64_t lr_r16; + uint64_t lr_r17; + uint64_t lr_r18; + uint64_t lr_r19; + uint64_t lr_r20; + uint64_t lr_r21; + double lr_f16; + double lr_f17; + double lr_f18; + double lr_f19; + double lr_f20; + double lr_f21; +} La_alpha_regs; + +/* Return values for calls from PLT on Alpha. */ +typedef struct La_alpha_retval +{ + uint64_t lrv_r0; + uint64_t lrv_r1; + double lrv_f0; + double lrv_f1; +} La_alpha_retval; + + +__BEGIN_DECLS + +extern Elf64_Addr la_alpha_gnu_pltenter (Elf64_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_alpha_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_alpha_gnu_pltexit (Elf64_Sym *__sym, unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + const La_alpha_regs *__inregs, + La_alpha_retval *__outregs, + const char *symname); + +__END_DECLS diff --git a/sysdeps/alpha/fpu/bits/mathdef.h b/sysdeps/alpha/bits/mathdef.h index d5f2d5a843..cbfaf68e22 100644 --- a/sysdeps/alpha/fpu/bits/mathdef.h +++ b/sysdeps/alpha/bits/mathdef.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2003, 2004 - Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,2000,2003,2004,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 @@ -55,12 +55,6 @@ typedef double double_t; #endif /* ISO C99 && MATH_H */ -#ifndef __NO_LONG_DOUBLE_MATH -/* Signal that we do not really have a `long double'. The disables the - declaration of all the `long double' function variants. */ -# define __NO_LONG_DOUBLE_MATH 1 -#endif - #if defined _COMPLEX_H && !defined _COMPLEX_H_MATHDEF # define _COMPLEX_H_MATHDEF 1 # if defined(__GNUC__) && !__GNUC_PREREQ(3,4) diff --git a/sysdeps/alpha/bits/setjmp.h b/sysdeps/alpha/bits/setjmp.h index c603a35554..eb0b478fb8 100644 --- a/sysdeps/alpha/bits/setjmp.h +++ b/sysdeps/alpha/bits/setjmp.h @@ -1,5 +1,5 @@ /* Define the machine-dependent type `jmp_buf'. Alpha version. - Copyright (C) 1992, 1997, 2003 Free Software Foundation, Inc. + Copyright (C) 1992,1997,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 @@ -55,33 +55,8 @@ * registers. */ -#if defined __USE_MISC || defined __ASSEMBLY__ -# define JB_S0 0 -# define JB_S1 1 -# define JB_S2 2 -# define JB_S3 3 -# define JB_S4 4 -# define JB_S5 5 -# define JB_PC 6 -# define JB_FP 7 -# define JB_SP 8 -# define JB_F2 9 -# define JB_F3 10 -# define JB_F4 11 -# define JB_F5 12 -# define JB_F6 13 -# define JB_F7 14 -# define JB_F8 15 -# define JB_F9 16 -#endif - #ifndef __ASSEMBLY__ typedef long int __jmp_buf[17]; - -/* 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 #endif /* bits/setjmp.h */ diff --git a/sysdeps/alpha/div_libc.h b/sysdeps/alpha/div_libc.h index 62b4470355..b731b02e25 100644 --- a/sysdeps/alpha/div_libc.h +++ b/sysdeps/alpha/div_libc.h @@ -34,6 +34,12 @@ #define RV t12 #define RA t9 +/* The secureplt format does not allow the division routines to be called + via plt; there aren't enough registers free to be clobbered. Avoid + setting the symbol type to STT_FUNC, so that the linker won't be tempted + to create a plt entry. */ +#define funcnoplt notype + /* None of these functions should use implicit anything. */ .set nomacro .set noat diff --git a/sysdeps/alpha/divl.S b/sysdeps/alpha/divl.S index 408d66db00..9bac0450d0 100644 --- a/sysdeps/alpha/divl.S +++ b/sysdeps/alpha/divl.S @@ -36,7 +36,7 @@ .text .align 4 .globl __divl - .type __divl, @function + .type __divl, @funcnoplt .usepv __divl, no cfi_startproc diff --git a/sysdeps/alpha/divq.S b/sysdeps/alpha/divq.S index 7f245ac056..d2ed2c5af6 100644 --- a/sysdeps/alpha/divq.S +++ b/sysdeps/alpha/divq.S @@ -43,7 +43,7 @@ .text .align 4 .globl __divq - .type __divq, @function + .type __divq, @funcnoplt .usepv __divq, no cfi_startproc diff --git a/sysdeps/alpha/divqu.S b/sysdeps/alpha/divqu.S index fc00fa133c..ef3cdb1b2b 100644 --- a/sysdeps/alpha/divqu.S +++ b/sysdeps/alpha/divqu.S @@ -43,7 +43,7 @@ .text .align 4 .globl __divqu - .type __divqu, @function + .type __divqu, @funcnoplt .usepv __divqu, no cfi_startproc @@ -240,7 +240,7 @@ $y_is_neg: /* If we get here, Y is so big that bit 63 is set. The results from the divide will be completely wrong. Fortunately, the quotient must be either 0 or 1, so just compute it directly. */ - cmpult Y, X, RV + cmpule Y, X, RV excb mt_fpcr $f3 ldt $f0, 0(sp) diff --git a/sysdeps/alpha/dl-dtprocnum.h b/sysdeps/alpha/dl-dtprocnum.h new file mode 100644 index 0000000000..67845cdd62 --- /dev/null +++ b/sysdeps/alpha/dl-dtprocnum.h @@ -0,0 +1,3 @@ +/* Number of extra dynamic section entries for this architecture. By + default there are none. */ +#define DT_THISPROCNUM DT_ALPHA_NUM diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 780a3a57fd..88c357ea07 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. Alpha version. - Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson <rth@tamu.edu>. @@ -33,6 +33,9 @@ where the dynamic linker should not map anything. */ #define ELF_MACHINE_USER_ADDRESS_MASK 0x120000000UL +/* Translate a processor specific dynamic tag to the index in l_info array. */ +#define DT_ALPHA(x) (DT_ALPHA_##x - DT_LOPROC + DT_NUM) + /* Return nonzero iff ELF header is compatible with the running host. */ static inline int elf_machine_matches_host (const Elf64_Ehdr *ehdr) @@ -55,244 +58,77 @@ elf_machine_dynamic (void) } /* Return the run-time load address of the shared object. */ + static inline Elf64_Addr elf_machine_load_address (void) { - /* NOTE: While it is generally unfriendly to put data in the text - segment, it is only slightly less so when the "data" is an - instruction. While we don't have to worry about GLD just yet, an - optimizing linker might decide that our "data" is an unreachable - instruction and throw it away -- with the right switches, DEC's - linker will do this. What ought to happen is we should add - something to GAS to allow us access to the new GPREL_HI32/LO32 - relocation types stolen from OSF/1 3.0. */ - /* This code relies on the fact that BRADDR relocations do not - appear in dynamic relocation tables. Not that that would be very - useful anyway -- br/bsr has a 4MB range and the shared libraries - are usually many many terabytes away. */ - - Elf64_Addr dot; - long int zero_disp; - - asm("br %0, 1f\n" - "0:\n\t" - "br $0, 2f\n" - "1:\n\t" - ".section\t.data\n" - "2:\n\t" - ".quad 0b\n\t" - ".previous" - : "=r"(dot)); - - zero_disp = *(int *) dot; - zero_disp = (zero_disp << 43) >> 41; - - return dot - *(Elf64_Addr *) (dot + 4 + zero_disp); + /* This relies on the compiler using gp-relative addresses for static symbols. */ + static void *dot = ˙ + return (void *)&dot - dot; } /* Set up the loaded object described by L so its unrelocated PLT entries will jump to the on-demand fixup code in dl-runtime.c. */ static inline int -elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) +elf_machine_runtime_setup (struct link_map *map, int lazy, int profile) { - Elf64_Addr plt; - extern void _dl_runtime_resolve (void); - extern void _dl_runtime_profile (void); + extern char _dl_runtime_resolve_new[] attribute_hidden; + extern char _dl_runtime_profile_new[] attribute_hidden; + extern char _dl_runtime_resolve_old[] attribute_hidden; + extern char _dl_runtime_profile_old[] attribute_hidden; + + struct pltgot { + char *resolve; + struct link_map *link; + }; + + struct pltgot *pg; + long secureplt; + char *resolve; + + if (map->l_info[DT_JMPREL] == 0 || !lazy) + return lazy; + + /* Check to see if we're using the read-only plt form. */ + secureplt = map->l_info[DT_ALPHA(PLTRO)] != 0; + + /* If the binary uses the read-only secure plt format, PG points to + the .got.plt section, which is the right place for ld.so to place + its hooks. Otherwise, PG is currently pointing at the start of + the plt; the hooks go at offset 16. */ + pg = (struct pltgot *) D_PTR (map, l_info[DT_PLTGOT]); + pg += !secureplt; + + /* This function will be called to perform the relocation. They're + not declared as functions to convince the compiler to use gp + relative relocations for them. */ + if (secureplt) + resolve = _dl_runtime_resolve_new; + else + resolve = _dl_runtime_resolve_old; - if (l->l_info[DT_JMPREL] && lazy) + if (__builtin_expect (profile, 0)) { - /* The GOT entries for the functions in the PLT have not been - filled in yet. Their initial contents are directed to the - PLT which arranges for the dynamic linker to be called. */ - plt = D_PTR (l, l_info[DT_PLTGOT]); - - /* This function will be called to perform the relocation. */ - if (!profile) - *(Elf64_Addr *)(plt + 16) = (Elf64_Addr) &_dl_runtime_resolve; + if (secureplt) + resolve = _dl_runtime_profile_new; else - { - *(Elf64_Addr *)(plt + 16) = (Elf64_Addr) &_dl_runtime_profile; - - 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; - } - } - - /* Identify this shared object */ - *(Elf64_Addr *)(plt + 24) = (Elf64_Addr) l; + resolve = _dl_runtime_profile_old; - /* If the first instruction of the plt entry is not - "br $28, plt0", we have to reinitialize .plt for lazy relocation. */ - if (*(unsigned int *)(plt + 32) != 0xc39ffff7) + if (GLRO(dl_profile) && _dl_name_match_p (GLRO(dl_profile), map)) { - unsigned int val = 0xc39ffff7; - unsigned int *slot, *end; - const Elf64_Rela *rela = (const Elf64_Rela *) - D_PTR (l, l_info[DT_JMPREL]); - Elf64_Addr l_addr = l->l_addr; - - /* br t12,.+4; ldq t12,12(t12); nop; jmp t12,(t12),.+4 */ - *(unsigned long *)plt = 0xa77b000cc3600000; - *(unsigned long *)(plt + 8) = 0x6b7b000047ff041f; - slot = (unsigned int *)(plt + 32); - end = (unsigned int *)(plt + 32 - + l->l_info[DT_PLTRELSZ]->d_un.d_val / 2); - while (slot < end) - { - /* br at,.plt+0 */ - *slot = val; - *(Elf64_Addr *) rela->r_offset = (Elf64_Addr) slot - l_addr; - val -= 3; - slot += 3; - ++rela; - } + /* This is the object we are looking for. Say that we really + want profiling and the timers are started. */ + GL(dl_profile_map) = map; } } + pg->resolve = resolve; + pg->link = map; + return lazy; } -/* This code is used in dl-runtime.c to call the `fixup' function - and then redirect to the address it returns. */ -#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name, IMB) \ - extern void tramp_name (void); \ - asm ( "\ - .globl " #tramp_name " \n\ - .ent " #tramp_name " \n\ -" #tramp_name ": \n\ - lda $sp, -44*8($sp) \n\ - .frame $sp, 44*8, $26 \n\ - /* Preserve all integer registers that C normally \n\ - doesn't. */ \n\ - stq $26, 0*8($sp) \n\ - stq $0, 1*8($sp) \n\ - stq $1, 2*8($sp) \n\ - stq $2, 3*8($sp) \n\ - stq $3, 4*8($sp) \n\ - stq $4, 5*8($sp) \n\ - stq $5, 6*8($sp) \n\ - stq $6, 7*8($sp) \n\ - stq $7, 8*8($sp) \n\ - stq $8, 9*8($sp) \n\ - stq $16, 10*8($sp) \n\ - stq $17, 11*8($sp) \n\ - stq $18, 12*8($sp) \n\ - stq $19, 13*8($sp) \n\ - stq $20, 14*8($sp) \n\ - stq $21, 15*8($sp) \n\ - stq $22, 16*8($sp) \n\ - stq $23, 17*8($sp) \n\ - stq $24, 18*8($sp) \n\ - stq $25, 19*8($sp) \n\ - stq $29, 20*8($sp) \n\ - stt $f0, 21*8($sp) \n\ - stt $f1, 22*8($sp) \n\ - stt $f10, 23*8($sp) \n\ - stt $f11, 24*8($sp) \n\ - stt $f12, 25*8($sp) \n\ - stt $f13, 26*8($sp) \n\ - stt $f14, 27*8($sp) \n\ - stt $f15, 28*8($sp) \n\ - stt $f16, 29*8($sp) \n\ - stt $f17, 30*8($sp) \n\ - stt $f18, 31*8($sp) \n\ - stt $f19, 32*8($sp) \n\ - stt $f20, 33*8($sp) \n\ - stt $f21, 34*8($sp) \n\ - stt $f22, 35*8($sp) \n\ - stt $f23, 36*8($sp) \n\ - stt $f24, 37*8($sp) \n\ - stt $f25, 38*8($sp) \n\ - stt $f26, 39*8($sp) \n\ - stt $f27, 40*8($sp) \n\ - stt $f28, 41*8($sp) \n\ - stt $f29, 42*8($sp) \n\ - stt $f30, 43*8($sp) \n\ - .mask 0x27ff01ff, -44*8 \n\ - .fmask 0xfffffc03, -(44-21)*8 \n\ - /* Set up our $gp */ \n\ - br $gp, .+4 \n\ - ldgp $gp, 0($gp) \n\ - .prologue 0 \n\ - /* Set up the arguments for fixup: */ \n\ - /* $16 = link_map out of plt0 */ \n\ - /* $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24 */\n\ - /* $18 = return address */ \n\ - subq $28, $27, $17 \n\ - ldq $16, 8($27) \n\ - subq $17, 20, $17 \n\ - mov $26, $18 \n\ - addq $17, $17, $17 \n\ - /* Do the fixup */ \n\ - bsr $26, " #fixup_name " !samegp \n\ - /* Move the destination address into position. */ \n\ - mov $0, $27 \n\ - /* Restore program registers. */ \n\ - ldq $26, 0*8($sp) \n\ - ldq $0, 1*8($sp) \n\ - ldq $1, 2*8($sp) \n\ - ldq $2, 3*8($sp) \n\ - ldq $3, 4*8($sp) \n\ - ldq $4, 5*8($sp) \n\ - ldq $5, 6*8($sp) \n\ - ldq $6, 7*8($sp) \n\ - ldq $7, 8*8($sp) \n\ - ldq $8, 9*8($sp) \n\ - ldq $16, 10*8($sp) \n\ - ldq $17, 11*8($sp) \n\ - ldq $18, 12*8($sp) \n\ - ldq $19, 13*8($sp) \n\ - ldq $20, 14*8($sp) \n\ - ldq $21, 15*8($sp) \n\ - ldq $22, 16*8($sp) \n\ - ldq $23, 17*8($sp) \n\ - ldq $24, 18*8($sp) \n\ - ldq $25, 19*8($sp) \n\ - ldq $29, 20*8($sp) \n\ - ldt $f0, 21*8($sp) \n\ - ldt $f1, 22*8($sp) \n\ - ldt $f10, 23*8($sp) \n\ - ldt $f11, 24*8($sp) \n\ - ldt $f12, 25*8($sp) \n\ - ldt $f13, 26*8($sp) \n\ - ldt $f14, 27*8($sp) \n\ - ldt $f15, 28*8($sp) \n\ - ldt $f16, 29*8($sp) \n\ - ldt $f17, 30*8($sp) \n\ - ldt $f18, 31*8($sp) \n\ - ldt $f19, 32*8($sp) \n\ - ldt $f20, 33*8($sp) \n\ - ldt $f21, 34*8($sp) \n\ - ldt $f22, 35*8($sp) \n\ - ldt $f23, 36*8($sp) \n\ - ldt $f24, 37*8($sp) \n\ - ldt $f25, 38*8($sp) \n\ - ldt $f26, 39*8($sp) \n\ - ldt $f27, 40*8($sp) \n\ - ldt $f28, 41*8($sp) \n\ - ldt $f29, 42*8($sp) \n\ - ldt $f30, 43*8($sp) \n\ - /* Flush the Icache after having modified the .plt code. */\n\ - " #IMB " \n\ - /* Clean up and turn control to the destination */ \n\ - lda $sp, 44*8($sp) \n\ - jmp $31, ($27) \n\ - .end " #tramp_name) - -#ifndef PROF -#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ - TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup, imb); \ - TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup, /* nop */); -#else -#define ELF_MACHINE_RUNTIME_TRAMPOLINE \ - TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup, imb); \ - strong_alias (_dl_runtime_resolve, _dl_runtime_profile); -#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. */ @@ -416,7 +252,7 @@ $fixup_stack: \n\ /* Fix up the instructions of a PLT entry to invoke the function rather than the dynamic linker. */ static inline Elf64_Addr -elf_machine_fixup_plt (struct link_map *l, lookup_t t, +elf_machine_fixup_plt (struct link_map *map, lookup_t t, const Elf64_Rela *reloc, Elf64_Addr *got_addr, Elf64_Addr value) { @@ -427,10 +263,16 @@ elf_machine_fixup_plt (struct link_map *l, lookup_t t, /* Store the value we are going to load. */ *got_addr = value; + /* If this binary uses the read-only secure plt format, we're done. */ + if (map->l_info[DT_ALPHA(PLTRO)]) + return value; + + /* Otherwise we have to modify the plt entry in place to do the branch. */ + /* Recover the PLT entry address by calculating reloc's index into the .rela.plt, and finding that entry in the .plt. */ - rela_plt = (void *) D_PTR (l, l_info[DT_JMPREL]); - plte = (void *) (D_PTR (l, l_info[DT_PLTGOT]) + 32); + rela_plt = (const Elf64_Rela *) D_PTR (map, l_info[DT_JMPREL]); + plte = (Elf64_Word *) (D_PTR (map, l_info[DT_PLTGOT]) + 32); plte += 3 * (reloc - rela_plt); /* Find the displacement from the plt entry to the function. */ @@ -501,13 +343,18 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, return value + reloc->r_addend; } +/* Names of the architecture-specific auditing callback functions. */ +#define ARCH_LA_PLTENTER alpha_gnu_pltenter +#define ARCH_LA_PLTEXIT alpha_gnu_pltexit + #endif /* !dl_machine_h */ -#ifdef RESOLVE +#ifdef RESOLVE_MAP /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ auto inline void +__attribute__ ((always_inline)) elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, const Elf64_Sym *sym, @@ -555,26 +402,16 @@ elf_machine_rela (struct link_map *map, return; else { + struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); Elf64_Addr sym_value; Elf64_Addr sym_raw_value; -#if defined USE_TLS && !defined RTLD_BOOTSTRAP - struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type); sym_raw_value = sym_value = reloc->r_addend; - if (sym) + if (sym_map) { sym_raw_value += sym->st_value; sym_value = sym_raw_value + sym_map->l_addr; } -#else - Elf64_Addr loadbase = RESOLVE (&sym, version, r_type); - sym_raw_value = sym_value = reloc->r_addend; - if (sym) - { - sym_raw_value += sym->st_value; - sym_value = sym_raw_value + loadbase; - } -#endif if (r_type == R_ALPHA_GLOB_DAT) *reloc_addr = sym_value; @@ -646,6 +483,7 @@ elf_machine_rela (struct link_map *map, #define ELF_MACHINE_REL_RELATIVE 1 auto inline void +__attribute__ ((always_inline)) elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, void *const reloc_addr_arg) { @@ -662,6 +500,7 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, } auto inline void +__attribute__ ((always_inline)) elf_machine_lazy_rel (struct link_map *map, Elf64_Addr l_addr, const Elf64_Rela *reloc) { @@ -680,4 +519,4 @@ elf_machine_lazy_rel (struct link_map *map, _dl_reloc_bad_type (map, r_type, 1); } -#endif /* RESOLVE */ +#endif /* RESOLVE_MAP */ diff --git a/sysdeps/alpha/dl-sysdep.h b/sysdeps/alpha/dl-sysdep.h index 0b4c8050de..cd678f4e43 100644 --- a/sysdeps/alpha/dl-sysdep.h +++ b/sysdeps/alpha/dl-sysdep.h @@ -1,5 +1,5 @@ /* System-specific settings for dynamic linker code. Alpha version. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 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 @@ -17,25 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef _DL_SYSDEP_H -#define _DL_SYSDEP_H 1 - -/* This macro must be defined to either 0 or 1. - - If 1, then an errno global variable hidden in ld.so will work right with - all the errno-using libc code compiled for ld.so, and there is never a - need to share the errno location with libc. This is appropriate only if - all the libc functions that ld.so uses are called without PLT and always - get the versions linked into ld.so rather than the libc ones. */ - -#ifdef IS_IN_rtld -# define RTLD_PRIVATE_ERRNO 1 -#else -# define RTLD_PRIVATE_ERRNO 0 -#endif +#include_next <dl-sysdep.h> /* _dl_argv cannot be attribute_relro, because _dl_start_user might write into it after _dl_start returns. */ #define DL_ARGV_NOT_RELRO 1 - -#endif /* dl-sysdep.h */ diff --git a/sysdeps/alpha/dl-trampoline.S b/sysdeps/alpha/dl-trampoline.S new file mode 100644 index 0000000000..c52efbb3bc --- /dev/null +++ b/sysdeps/alpha/dl-trampoline.S @@ -0,0 +1,541 @@ +/* PLT trampolines. Alpha version. + Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + + .set noat + +.macro savei regno, offset + stq $\regno, \offset($30) + cfi_rel_offset(\regno, \offset) +.endm + +.macro savef regno, offset + stt $f\regno, \offset($30) + cfi_rel_offset(\regno+32, \offset) +.endm + + .align 4 + .globl _dl_runtime_resolve_new + .ent _dl_runtime_resolve_new + +#undef FRAMESIZE +#define FRAMESIZE 14*8 + +_dl_runtime_resolve_new: + .frame $30, FRAMESIZE, $26, 0 + .mask 0x4000000, 0 + + ldah $29, 0($27) !gpdisp!1 + lda $30, -FRAMESIZE($30) + stq $26, 0*8($30) + stq $16, 2*8($30) + + stq $17, 3*8($30) + lda $29, 0($29) !gpdisp!1 + stq $18, 4*8($30) + mov $28, $16 /* link_map from .got.plt */ + + stq $19, 5*8($30) + mov $25, $17 /* offset of reloc entry */ + stq $20, 6*8($30) + mov $26, $18 /* return address */ + + stq $21, 7*8($30) + stt $f16, 8*8($30) + stt $f17, 9*8($30) + stt $f18, 10*8($30) + + stt $f19, 11*8($30) + stt $f20, 12*8($30) + stt $f21, 13*8($30) + .prologue 2 + + bsr $26, _dl_fixup !samegp + mov $0, $27 + + ldq $26, 0*8($30) + ldq $16, 2*8($30) + ldq $17, 3*8($30) + ldq $18, 4*8($30) + ldq $19, 5*8($30) + ldq $20, 6*8($30) + ldq $21, 7*8($30) + ldt $f16, 8*8($30) + ldt $f17, 9*8($30) + ldt $f18, 10*8($30) + ldt $f19, 11*8($30) + ldt $f20, 12*8($30) + ldt $f21, 13*8($30) + lda $30, FRAMESIZE($30) + jmp $31, ($27), 0 + .end _dl_runtime_resolve_new + + .globl _dl_runtime_profile_new + .type _dl_runtime_profile_new, @function + +#undef FRAMESIZE +#define FRAMESIZE 20*8 + + /* We save the registers in a different order than desired by + .mask/.fmask, so we have to use explicit cfi directives. */ + cfi_startproc + +_dl_runtime_profile_new: + ldah $29, 0($27) !gpdisp!2 + lda $30, -FRAMESIZE($30) + savei 26, 0*8 + stq $16, 2*8($30) + + stq $17, 3*8($30) + lda $29, 0($29) !gpdisp!2 + stq $18, 4*8($30) + lda $1, FRAMESIZE($30) /* incoming sp value */ + + stq $1, 1*8($30) + stq $19, 5*8($30) + stq $20, 6*8($30) + mov $28, $16 /* link_map from .got.plt */ + + stq $21, 7*8($30) + mov $25, $17 /* offset of reloc entry */ + stt $f16, 8*8($30) + mov $26, $18 /* return address */ + + stt $f17, 9*8($30) + mov $30, $19 /* La_alpha_regs address */ + stt $f18, 10*8($30) + lda $20, 14*8($30) /* framesize address */ + + stt $f19, 11*8($30) + stt $f20, 12*8($30) + stt $f21, 13*8($30) + stq $28, 16*8($30) + stq $25, 17*8($30) + + bsr $26, _dl_profile_fixup !samegp + mov $0, $27 + + /* Discover if we're wrapping this call. */ + ldq $18, 14*8($30) + bge $18, 1f + + ldq $26, 0*8($30) + ldq $16, 2*8($30) + ldq $17, 3*8($30) + ldq $18, 4*8($30) + ldq $19, 5*8($30) + ldq $20, 6*8($30) + ldq $21, 7*8($30) + ldt $f16, 8*8($30) + ldt $f17, 9*8($30) + ldt $f18, 10*8($30) + ldt $f19, 11*8($30) + ldt $f20, 12*8($30) + ldt $f21, 13*8($30) + lda $30, FRAMESIZE($30) + jmp $31, ($27), 0 + +1: + /* Create a frame pointer and allocate a new argument frame. */ + savei 15, 15*8 + mov $30, $15 + cfi_def_cfa_register (15) + addq $18, 15, $18 + bic $18, 15, $18 + subq $30, $18, $30 + + /* Save the call destination around memcpy. */ + stq $0, 14*8($30) + + /* Copy the stack arguments into place. */ + lda $16, 0($30) + lda $17, FRAMESIZE($15) + jsr $26, memcpy + ldgp $29, 0($26) + + /* Reload the argument registers. */ + ldq $27, 14*8($30) + ldq $16, 2*8($15) + ldq $17, 3*8($15) + ldq $18, 4*8($15) + ldq $19, 5*8($15) + ldq $20, 6*8($15) + ldq $21, 7*8($15) + ldt $f16, 8*8($15) + ldt $f17, 9*8($15) + ldt $f18, 10*8($15) + ldt $f19, 11*8($15) + ldt $f20, 12*8($15) + ldt $f21, 13*8($15) + + jsr $26, ($27), 0 + ldgp $29, 0($26) + + /* Set up for call to _dl_call_pltexit. */ + ldq $16, 16*8($15) + ldq $17, 17*8($15) + stq $0, 16*8($15) + lda $18, 0($15) + stq $1, 17*8($15) + lda $19, 16*8($15) + stt $f0, 18*8($15) + stt $f1, 19*8($15) + bsr $26, _dl_call_pltexit !samegp + + mov $15, $30 + cfi_def_cfa_register (30) + ldq $26, 0($30) + ldq $15, 15*8($30) + lda $30, FRAMESIZE($30) + ret + + cfi_endproc + .size _dl_runtime_profile_new, .-_dl_runtime_profile_new + + .align 4 + .globl _dl_runtime_resolve_old + .ent _dl_runtime_resolve_old + +#undef FRAMESIZE +#define FRAMESIZE 44*8 + +_dl_runtime_resolve_old: + lda $30, -FRAMESIZE($30) + .frame $30, FRAMESIZE, $26 + /* Preserve all registers that C normally doesn't. */ + stq $26, 0*8($30) + stq $0, 1*8($30) + stq $1, 2*8($30) + stq $2, 3*8($30) + stq $3, 4*8($30) + stq $4, 5*8($30) + stq $5, 6*8($30) + stq $6, 7*8($30) + stq $7, 8*8($30) + stq $8, 9*8($30) + stq $16, 10*8($30) + stq $17, 11*8($30) + stq $18, 12*8($30) + stq $19, 13*8($30) + stq $20, 14*8($30) + stq $21, 15*8($30) + stq $22, 16*8($30) + stq $23, 17*8($30) + stq $24, 18*8($30) + stq $25, 19*8($30) + stq $29, 20*8($30) + stt $f0, 21*8($30) + stt $f1, 22*8($30) + stt $f10, 23*8($30) + stt $f11, 24*8($30) + stt $f12, 25*8($30) + stt $f13, 26*8($30) + stt $f14, 27*8($30) + stt $f15, 28*8($30) + stt $f16, 29*8($30) + stt $f17, 30*8($30) + stt $f18, 31*8($30) + stt $f19, 32*8($30) + stt $f20, 33*8($30) + stt $f21, 34*8($30) + stt $f22, 35*8($30) + stt $f23, 36*8($30) + stt $f24, 37*8($30) + stt $f25, 38*8($30) + stt $f26, 39*8($30) + stt $f27, 40*8($30) + stt $f28, 41*8($30) + stt $f29, 42*8($30) + stt $f30, 43*8($30) + .mask 0x27ff01ff, -FRAMESIZE + .fmask 0xfffffc03, -FRAMESIZE+21*8 + /* Set up our GP. */ + br $29, .+4 + ldgp $29, 0($29) + .prologue 0 + /* Set up the arguments for _dl_fixup: + $16 = link_map out of plt0 + $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24 + $18 = return address + */ + subq $28, $27, $17 + ldq $16, 8($27) + subq $17, 20, $17 + mov $26, $18 + addq $17, $17, $17 + bsr $26, _dl_fixup !samegp + + /* Move the destination address into position. */ + mov $0, $27 + /* Restore program registers. */ + ldq $26, 0*8($30) + ldq $0, 1*8($30) + ldq $1, 2*8($30) + ldq $2, 3*8($30) + ldq $3, 4*8($30) + ldq $4, 5*8($30) + ldq $5, 6*8($30) + ldq $6, 7*8($30) + ldq $7, 8*8($30) + ldq $8, 9*8($30) + ldq $16, 10*8($30) + ldq $17, 11*8($30) + ldq $18, 12*8($30) + ldq $19, 13*8($30) + ldq $20, 14*8($30) + ldq $21, 15*8($30) + ldq $22, 16*8($30) + ldq $23, 17*8($30) + ldq $24, 18*8($30) + ldq $25, 19*8($30) + ldq $29, 20*8($30) + ldt $f0, 21*8($30) + ldt $f1, 22*8($30) + ldt $f10, 23*8($30) + ldt $f11, 24*8($30) + ldt $f12, 25*8($30) + ldt $f13, 26*8($30) + ldt $f14, 27*8($30) + ldt $f15, 28*8($30) + ldt $f16, 29*8($30) + ldt $f17, 30*8($30) + ldt $f18, 31*8($30) + ldt $f19, 32*8($30) + ldt $f20, 33*8($30) + ldt $f21, 34*8($30) + ldt $f22, 35*8($30) + ldt $f23, 36*8($30) + ldt $f24, 37*8($30) + ldt $f25, 38*8($30) + ldt $f26, 39*8($30) + ldt $f27, 40*8($30) + ldt $f28, 41*8($30) + ldt $f29, 42*8($30) + ldt $f30, 43*8($30) + /* Flush the Icache after having modified the .plt code. */ + imb + /* Clean up and turn control to the destination */ + lda $30, FRAMESIZE($30) + jmp $31, ($27) + + .end _dl_runtime_resolve_old + + .globl _dl_runtime_profile_old + .usepv _dl_runtime_profile_old, no + .type _dl_runtime_profile_old, @function + + /* We save the registers in a different order than desired by + .mask/.fmask, so we have to use explicit cfi directives. */ + cfi_startproc + +#undef FRAMESIZE +#define FRAMESIZE 50*8 + + .align 4 +_dl_runtime_profile_old: + lda $30, -FRAMESIZE($30) + cfi_adjust_cfa_offset (FRAMESIZE) + + /* Preserve all argument registers. This also constructs the + La_alpha_regs structure. */ + savei 26, 0*8 + savei 16, 2*8 + savei 17, 3*8 + savei 18, 4*8 + savei 19, 5*8 + savei 20, 6*8 + savei 21, 7*8 + lda $16, FRAMESIZE($30) + savef 16, 8*8 + savef 17, 9*8 + savef 18, 10*8 + savef 19, 11*8 + savef 20, 12*8 + savef 21, 13*8 + stq $16, 1*8($30) + + /* Preserve all registers that C normally doesn't. */ + savei 0, 14*8 + savei 1, 15*8 + savei 2, 16*8 + savei 3, 17*8 + savei 4, 18*8 + savei 5, 19*8 + savei 6, 20*8 + savei 7, 21*8 + savei 8, 22*8 + savei 22, 23*8 + savei 23, 24*8 + savei 24, 25*8 + savei 25, 26*8 + savei 29, 27*8 + savef 0, 28*8 + savef 1, 29*8 + savef 10, 30*8 + savef 11, 31*8 + savef 12, 32*8 + savef 13, 33*8 + savef 14, 34*8 + savef 15, 35*8 + savef 22, 36*8 + savef 23, 37*8 + savef 24, 38*8 + savef 25, 39*8 + savef 26, 40*8 + savef 27, 41*8 + savef 28, 42*8 + savef 29, 43*8 + savef 30, 44*8 + + /* Set up our GP. */ + br $29, .+4 + ldgp $29, 0($29) + + /* Set up the arguments for _dl_profile_fixup: + $16 = link_map out of plt0 + $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24 + $18 = return address + $19 = La_alpha_regs address + $20 = framesize address + */ + subq $28, $27, $17 + ldq $16, 8($27) + subq $17, 20, $17 + mov $26, $18 + addq $17, $17, $17 + lda $19, 0($30) + lda $20, 45*8($30) + stq $16, 48*8($30) + stq $17, 49*8($30) + + bsr $26, _dl_profile_fixup !samegp + + /* Discover if we're wrapping this call. */ + ldq $18, 45*8($30) + bge $18, 1f + + /* Move the destination address into position. */ + mov $0, $27 + /* Restore program registers. */ + ldq $26, 0*8($30) + ldq $16, 2*8($30) + ldq $17, 3*8($30) + ldq $18, 4*8($30) + ldq $19, 5*8($30) + ldq $20, 6*8($30) + ldq $21, 7*8($30) + ldt $f16, 8*8($30) + ldt $f17, 9*8($30) + ldt $f18, 10*8($30) + ldt $f19, 11*8($30) + ldt $f20, 12*8($30) + ldt $f21, 13*8($30) + ldq $0, 14*8($30) + ldq $1, 15*8($30) + ldq $2, 16*8($30) + ldq $3, 17*8($30) + ldq $4, 18*8($30) + ldq $5, 19*8($30) + ldq $6, 20*8($30) + ldq $7, 21*8($30) + ldq $8, 22*8($30) + ldq $22, 23*8($30) + ldq $23, 24*8($30) + ldq $24, 25*8($30) + ldq $25, 26*8($30) + ldq $29, 27*8($30) + ldt $f0, 28*8($30) + ldt $f1, 29*8($30) + ldt $f10, 30*8($30) + ldt $f11, 31*8($30) + ldt $f12, 32*8($30) + ldt $f13, 33*8($30) + ldt $f14, 34*8($30) + ldt $f15, 35*8($30) + ldt $f22, 36*8($30) + ldt $f23, 37*8($30) + ldt $f24, 38*8($30) + ldt $f25, 39*8($30) + ldt $f26, 40*8($30) + ldt $f27, 41*8($30) + ldt $f28, 42*8($30) + ldt $f29, 43*8($30) + ldt $f30, 44*8($30) + + /* Clean up and turn control to the destination. */ + lda $30, FRAMESIZE($30) + jmp $31, ($27) + +1: + /* Create a frame pointer and allocate a new argument frame. */ + savei 15, 45*8 + mov $30, $15 + cfi_def_cfa_register (15) + addq $18, 15, $18 + bic $18, 15, $18 + subq $30, $18, $30 + + /* Save the call destination around memcpy. */ + stq $0, 46*8($30) + + /* Copy the stack arguments into place. */ + lda $16, 0($30) + lda $17, FRAMESIZE($15) + jsr $26, memcpy + ldgp $29, 0($26) + + /* Reload the argument registers. */ + ldq $27, 46*8($30) + ldq $16, 2*8($15) + ldq $17, 3*8($15) + ldq $18, 4*8($15) + ldq $19, 5*8($15) + ldq $20, 6*8($15) + ldq $21, 7*8($15) + ldt $f16, 8*8($15) + ldt $f17, 9*8($15) + ldt $f18, 10*8($15) + ldt $f19, 11*8($15) + ldt $f20, 12*8($15) + ldt $f21, 13*8($15) + + jsr $26, ($27), 0 + ldgp $29, 0($26) + + /* Set up for call to _dl_call_pltexit. */ + ldq $16, 48*8($15) + ldq $17, 49*8($15) + stq $0, 46*8($15) + lda $18, 0($15) + stq $1, 47*8($15) + lda $19, 46*8($15) + stt $f0, 48*8($15) + stt $f1, 49*8($15) + bsr $26, _dl_call_pltexit !samegp + + mov $15, $30 + cfi_def_cfa_register (30) + ldq $26, 0($30) + ldq $15, 45*8($30) + lda $30, FRAMESIZE($30) + ret + + cfi_endproc + .size _dl_runtime_profile_old, .-_dl_runtime_profile_old diff --git a/sysdeps/alpha/elf/start.S b/sysdeps/alpha/elf/start.S index 3c2bc59adc..ebe14b4c8e 100644 --- a/sysdeps/alpha/elf/start.S +++ b/sysdeps/alpha/elf/start.S @@ -77,7 +77,7 @@ _start: .end _start /* For ECOFF backwards compatibility. */ -weak_alias(_start, __start) +weak_alias (_start, __start) /* Define a symbol for the first piece of initialized data. */ .data diff --git a/sysdeps/alpha/fpu/bits/mathinline.h b/sysdeps/alpha/fpu/bits/mathinline.h index 187bd42f33..87d40058c3 100644 --- a/sysdeps/alpha/fpu/bits/mathinline.h +++ b/sysdeps/alpha/fpu/bits/mathinline.h @@ -46,7 +46,8 @@ #if (!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \ && defined __OPTIMIZE__ -#define __inline_copysign(NAME, TYPE) \ +#if !__GNUC_PREREQ (4, 0) +# define __inline_copysign(NAME, TYPE) \ __MATH_INLINE TYPE \ __NTH (NAME (TYPE __x, TYPE __y)) \ { \ @@ -60,19 +61,11 @@ __inline_copysign (copysignf, float) __inline_copysign (__copysign, double) __inline_copysign (copysign, double) -#undef __MATH_INLINE_copysign +# undef __inline_copysign +#endif -#if __GNUC_PREREQ (2, 8) -__MATH_INLINE float -__NTH (__fabsf (float __x)) { return __builtin_fabsf (__x); } -__MATH_INLINE float -__NTH (fabsf (float __x)) { return __builtin_fabsf (__x); } -__MATH_INLINE double -__NTH (__fabs (double __x)) { return __builtin_fabs (__x); } -__MATH_INLINE double -__NTH (fabs (double __x)) { return __builtin_fabs (__x); } -#else +#if !__GNUC_PREREQ (2, 8) # define __inline_fabs(NAME, TYPE) \ __MATH_INLINE TYPE \ __NTH (NAME (TYPE __x)) \ diff --git a/sysdeps/alpha/fpu/feholdexcpt.c b/sysdeps/alpha/fpu/feholdexcpt.c index 77d4cc1180..79aa970ac0 100644 --- a/sysdeps/alpha/fpu/feholdexcpt.c +++ b/sysdeps/alpha/fpu/feholdexcpt.c @@ -1,5 +1,5 @@ /* Store current floating-point environment and clear exceptions. - 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 Richard Henderson <rth@tamu.edu>, 1997 @@ -31,3 +31,4 @@ feholdexcept (fenv_t *envp) return 0; } +libm_hidden_def (feholdexcept) diff --git a/sysdeps/alpha/fpu/fesetround.c b/sysdeps/alpha/fpu/fesetround.c index c4dc196016..54b2bcf673 100644 --- a/sysdeps/alpha/fpu/fesetround.c +++ b/sysdeps/alpha/fpu/fesetround.c @@ -1,5 +1,5 @@ /* Set current rounding direction. - 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 Richard Henderson <rth@tamu.edu>, 1997 @@ -40,3 +40,4 @@ fesetround (int round) return 0; } +libm_hidden_def (fesetround) diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps index 7e8140cddc..6b882e388a 100644 --- a/sysdeps/alpha/fpu/libm-test-ulps +++ b/sysdeps/alpha/fpu/libm-test-ulps @@ -20,12 +20,12 @@ float: 1 ifloat: 1 # cacosh -Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i": +Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": double: 1 float: 7 idouble: 1 ifloat: 7 -Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i": +Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": double: 1 float: 3 idouble: 1 diff --git a/sysdeps/alpha/fpu/s_cacosf.c b/sysdeps/alpha/fpu/s_cacosf.c index 20e67f4ac9..46dca5aeb8 100644 --- a/sysdeps/alpha/fpu/s_cacosf.c +++ b/sysdeps/alpha/fpu/s_cacosf.c @@ -1,5 +1,5 @@ /* Return arc cosine of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_cacosf (_Complex float x); -#include <sysdeps/generic/s_cacosf.c> +#include <math/s_cacosf.c> #include "cfloat-compat.h" #undef __cacosf diff --git a/sysdeps/alpha/fpu/s_cacoshf.c b/sysdeps/alpha/fpu/s_cacoshf.c index 86cb4fbcaa..6b61d1ddaa 100644 --- a/sysdeps/alpha/fpu/s_cacoshf.c +++ b/sysdeps/alpha/fpu/s_cacoshf.c @@ -1,5 +1,5 @@ /* Return arc hyperbole cosine of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_cacoshf (_Complex float x); -#include <sysdeps/generic/s_cacoshf.c> +#include <math/s_cacoshf.c> #include "cfloat-compat.h" #undef __cacoshf diff --git a/sysdeps/alpha/fpu/s_casinf.c b/sysdeps/alpha/fpu/s_casinf.c index 3d0d4eadf2..fd41042ec9 100644 --- a/sysdeps/alpha/fpu/s_casinf.c +++ b/sysdeps/alpha/fpu/s_casinf.c @@ -1,5 +1,5 @@ /* Return arc sine of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_casinf (_Complex float x); -#include <sysdeps/generic/s_casinf.c> +#include <math/s_casinf.c> #include "cfloat-compat.h" #undef __casinf diff --git a/sysdeps/alpha/fpu/s_casinhf.c b/sysdeps/alpha/fpu/s_casinhf.c index 698ce10c04..0b72a24d5a 100644 --- a/sysdeps/alpha/fpu/s_casinhf.c +++ b/sysdeps/alpha/fpu/s_casinhf.c @@ -1,5 +1,5 @@ /* Return arc hyperbole sine of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_casinhf (_Complex float x); -#include <sysdeps/generic/s_casinhf.c> +#include <math/s_casinhf.c> #include "cfloat-compat.h" #undef __casinhf diff --git a/sysdeps/alpha/fpu/s_catanf.c b/sysdeps/alpha/fpu/s_catanf.c index 221a461c1b..8f40616617 100644 --- a/sysdeps/alpha/fpu/s_catanf.c +++ b/sysdeps/alpha/fpu/s_catanf.c @@ -1,5 +1,5 @@ /* Return arc tangent of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_catanf (_Complex float x); -#include <sysdeps/generic/s_catanf.c> +#include <math/s_catanf.c> #include "cfloat-compat.h" #undef __catanf diff --git a/sysdeps/alpha/fpu/s_catanhf.c b/sysdeps/alpha/fpu/s_catanhf.c index 7465a43cac..ac11945727 100644 --- a/sysdeps/alpha/fpu/s_catanhf.c +++ b/sysdeps/alpha/fpu/s_catanhf.c @@ -1,5 +1,5 @@ /* Return arc hyperbole tangent of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_catanhf (_Complex float x); -#include <sysdeps/generic/s_catanhf.c> +#include <math/s_catanhf.c> #include "cfloat-compat.h" #undef __catanhf diff --git a/sysdeps/alpha/fpu/s_ccosf.c b/sysdeps/alpha/fpu/s_ccosf.c index fd775903f0..04036f4613 100644 --- a/sysdeps/alpha/fpu/s_ccosf.c +++ b/sysdeps/alpha/fpu/s_ccosf.c @@ -1,5 +1,5 @@ /* Return cosine of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_ccosf (_Complex float x); -#include <sysdeps/generic/s_ccosf.c> +#include <math/s_ccosf.c> #include "cfloat-compat.h" #undef __ccosf diff --git a/sysdeps/alpha/fpu/s_ccoshf.c b/sysdeps/alpha/fpu/s_ccoshf.c index 0e8eab288f..e9fb34ce47 100644 --- a/sysdeps/alpha/fpu/s_ccoshf.c +++ b/sysdeps/alpha/fpu/s_ccoshf.c @@ -1,5 +1,5 @@ /* Return hyperbole cosine of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_ccoshf (_Complex float x); -#include <sysdeps/generic/s_ccoshf.c> +#include <math/s_ccoshf.c> #include "cfloat-compat.h" #undef __ccoshf diff --git a/sysdeps/alpha/fpu/s_ceil.c b/sysdeps/alpha/fpu/s_ceil.c index a7a46bb2b4..ec58fd9486 100644 --- a/sysdeps/alpha/fpu/s_ceil.c +++ b/sysdeps/alpha/fpu/s_ceil.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson. @@ -18,6 +18,7 @@ 02111-1307 USA. */ #include <math.h> +#include <math_ldbl_opt.h> /* Use the -inf rounding mode conversion instructions to implement ceil, via something akin to -floor(-x). This is much faster than @@ -52,3 +53,6 @@ weak_alias (__ceil, ceil) strong_alias (__ceil, __ceill) weak_alias (__ceil, ceill) #endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __ceil, ceill, GLIBC_2_0); +#endif diff --git a/sysdeps/alpha/fpu/s_cexpf.c b/sysdeps/alpha/fpu/s_cexpf.c index 2cf6db4b55..4a28dcd9bf 100644 --- a/sysdeps/alpha/fpu/s_cexpf.c +++ b/sysdeps/alpha/fpu/s_cexpf.c @@ -1,5 +1,5 @@ /* Return exponent of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_cexpf (_Complex float x); -#include <sysdeps/generic/s_cexpf.c> +#include <math/s_cexpf.c> #include "cfloat-compat.h" #undef __cexpf diff --git a/sysdeps/alpha/fpu/s_clog10f.c b/sysdeps/alpha/fpu/s_clog10f.c index 12ecdea957..e7dc7bb23f 100644 --- a/sysdeps/alpha/fpu/s_clog10f.c +++ b/sysdeps/alpha/fpu/s_clog10f.c @@ -1,5 +1,5 @@ /* Return base 10 logarithm of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_clog10f (_Complex float x); -#include <sysdeps/generic/s_clog10f.c> +#include <math/s_clog10f.c> #include "cfloat-compat.h" #undef __clog10f diff --git a/sysdeps/alpha/fpu/s_clogf.c b/sysdeps/alpha/fpu/s_clogf.c index 9eefe9fa30..364dcec883 100644 --- a/sysdeps/alpha/fpu/s_clogf.c +++ b/sysdeps/alpha/fpu/s_clogf.c @@ -1,5 +1,5 @@ /* Return natural logarithm of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_clogf (_Complex float x); -#include <sysdeps/generic/s_clogf.c> +#include <math/s_clogf.c> #include "cfloat-compat.h" #undef __clogf diff --git a/sysdeps/alpha/fpu/s_copysign.c b/sysdeps/alpha/fpu/s_copysign.c index e86778e840..52c632ec4c 100644 --- a/sysdeps/alpha/fpu/s_copysign.c +++ b/sysdeps/alpha/fpu/s_copysign.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson. @@ -18,6 +18,7 @@ 02111-1307 USA. */ #include <math.h> +#include <math_ldbl_opt.h> double __copysign (double x, double y) @@ -31,3 +32,10 @@ weak_alias (__copysign, copysign) strong_alias (__copysign, __copysignl) weak_alias (__copysign, copysignl) #endif +#ifdef IS_IN_libm +# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __copysign, copysignl, GLIBC_2_0); +# endif +#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) +compat_symbol (libc, __copysign, copysignl, GLIBC_2_0); +#endif diff --git a/sysdeps/alpha/fpu/s_cpowf.c b/sysdeps/alpha/fpu/s_cpowf.c index f4cb3547f6..cc61b1895e 100644 --- a/sysdeps/alpha/fpu/s_cpowf.c +++ b/sysdeps/alpha/fpu/s_cpowf.c @@ -1,5 +1,5 @@ /* Return power of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_cpowf (_Complex float x, _Complex float c); -#include <sysdeps/generic/s_cpowf.c> +#include <math/s_cpowf.c> #include "cfloat-compat.h" #undef __cpowf diff --git a/sysdeps/alpha/fpu/s_cprojf.c b/sysdeps/alpha/fpu/s_cprojf.c index eac8687707..5cfb526679 100644 --- a/sysdeps/alpha/fpu/s_cprojf.c +++ b/sysdeps/alpha/fpu/s_cprojf.c @@ -1,5 +1,5 @@ /* Return projection of complex float value to Riemann sphere. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_cprojf (_Complex float x); -#include <sysdeps/generic/s_cprojf.c> +#include <math/s_cprojf.c> #include "cfloat-compat.h" #undef __cprojf diff --git a/sysdeps/alpha/fpu/s_csinf.c b/sysdeps/alpha/fpu/s_csinf.c index eba70e9930..8eb9a1019d 100644 --- a/sysdeps/alpha/fpu/s_csinf.c +++ b/sysdeps/alpha/fpu/s_csinf.c @@ -1,5 +1,5 @@ /* Return sine of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_csinf (_Complex float x); -#include <sysdeps/generic/s_csinf.c> +#include <math/s_csinf.c> #include "cfloat-compat.h" #undef __csinf diff --git a/sysdeps/alpha/fpu/s_csinhf.c b/sysdeps/alpha/fpu/s_csinhf.c index 9db81a81e4..0e2c186740 100644 --- a/sysdeps/alpha/fpu/s_csinhf.c +++ b/sysdeps/alpha/fpu/s_csinhf.c @@ -1,5 +1,5 @@ /* Return hyperbole sine of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_csinhf (_Complex float x); -#include <sysdeps/generic/s_csinhf.c> +#include <math/s_csinhf.c> #include "cfloat-compat.h" #undef __csinhf diff --git a/sysdeps/alpha/fpu/s_csqrtf.c b/sysdeps/alpha/fpu/s_csqrtf.c index cc4a8e0245..ebf23a828e 100644 --- a/sysdeps/alpha/fpu/s_csqrtf.c +++ b/sysdeps/alpha/fpu/s_csqrtf.c @@ -1,5 +1,5 @@ /* Return square root of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_csqrtf (_Complex float x); -#include <sysdeps/generic/s_csqrtf.c> +#include <math/s_csqrtf.c> #include "cfloat-compat.h" #undef __csqrtf diff --git a/sysdeps/alpha/fpu/s_ctanf.c b/sysdeps/alpha/fpu/s_ctanf.c index 843ee53717..e26db963e4 100644 --- a/sysdeps/alpha/fpu/s_ctanf.c +++ b/sysdeps/alpha/fpu/s_ctanf.c @@ -1,5 +1,5 @@ /* Return tangent of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_ctanf (_Complex float x); -#include <sysdeps/generic/s_ctanf.c> +#include <math/s_ctanf.c> #include "cfloat-compat.h" #undef __ctanf diff --git a/sysdeps/alpha/fpu/s_ctanhf.c b/sysdeps/alpha/fpu/s_ctanhf.c index f1f74ab12d..5d047bd460 100644 --- a/sysdeps/alpha/fpu/s_ctanhf.c +++ b/sysdeps/alpha/fpu/s_ctanhf.c @@ -1,5 +1,5 @@ /* Return hyperbole tangent of complex float value. - 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 @@ -29,7 +29,7 @@ static _Complex float internal_ctanhf (_Complex float x); -#include <sysdeps/generic/s_ctanhf.c> +#include <math/s_ctanhf.c> #include "cfloat-compat.h" #undef __ctanhf diff --git a/sysdeps/alpha/fpu/s_fabs.c b/sysdeps/alpha/fpu/s_fabs.c index f7a2f9353b..9bc42f68d0 100644 --- a/sysdeps/alpha/fpu/s_fabs.c +++ b/sysdeps/alpha/fpu/s_fabs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson. @@ -18,6 +18,7 @@ 02111-1307 USA. */ #include <math.h> +#include <math_ldbl_opt.h> double __fabs (double x) @@ -35,3 +36,6 @@ weak_alias (__fabs, fabs) strong_alias (__fabs, __fabsl) weak_alias (__fabs, fabsl) #endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __fabs, fabsl, GLIBC_2_0); +#endif diff --git a/sysdeps/alpha/fpu/s_floor.c b/sysdeps/alpha/fpu/s_floor.c index c6872f5fcf..b22c52303d 100644 --- a/sysdeps/alpha/fpu/s_floor.c +++ b/sysdeps/alpha/fpu/s_floor.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2000, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson. @@ -18,6 +18,7 @@ 02111-1307 USA. */ #include <math.h> +#include <math_ldbl_opt.h> /* Use the -inf rounding mode conversion instructions to implement @@ -53,3 +54,6 @@ weak_alias (__floor, floor) strong_alias (__floor, __floorl) weak_alias (__floor, floorl) #endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __floor, floorl, GLIBC_2_0); +#endif diff --git a/sysdeps/alpha/fpu/s_rint.c b/sysdeps/alpha/fpu/s_rint.c index 61cba04c27..be09651b35 100644 --- a/sysdeps/alpha/fpu/s_rint.c +++ b/sysdeps/alpha/fpu/s_rint.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson. @@ -18,6 +18,7 @@ 02111-1307 USA. */ #include <math.h> +#include <math_ldbl_opt.h> double @@ -48,3 +49,6 @@ weak_alias (__rint, rint) strong_alias (__rint, __rintl) weak_alias (__rint, rintl) #endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __rint, rintl, GLIBC_2_0); +#endif diff --git a/sysdeps/alpha/htonl.S b/sysdeps/alpha/htonl.S index eb4fbd2ab4..ef2a575995 100644 --- a/sysdeps/alpha/htonl.S +++ b/sysdeps/alpha/htonl.S @@ -41,4 +41,4 @@ ENTRY(htonl) END(htonl) -weak_alias(htonl, ntohl) +weak_alias (htonl, ntohl) diff --git a/sysdeps/alpha/htons.S b/sysdeps/alpha/htons.S index f1ef754814..7c6270226d 100644 --- a/sysdeps/alpha/htons.S +++ b/sysdeps/alpha/htons.S @@ -37,4 +37,4 @@ ENTRY(htons) END(htons) -weak_alias(htons, ntohs) +weak_alias (htons, ntohs) diff --git a/sysdeps/alpha/jmpbuf-offsets.h b/sysdeps/alpha/jmpbuf-offsets.h new file mode 100644 index 0000000000..c2503d442a --- /dev/null +++ b/sysdeps/alpha/jmpbuf-offsets.h @@ -0,0 +1,36 @@ +/* Private macros for accessing __jmp_buf contents. Alpha 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_S0 0 +#define JB_S1 1 +#define JB_S2 2 +#define JB_S3 3 +#define JB_S4 4 +#define JB_S5 5 +#define JB_PC 6 +#define JB_FP 7 +#define JB_SP 8 +#define JB_F2 9 +#define JB_F3 10 +#define JB_F4 11 +#define JB_F5 12 +#define JB_F6 13 +#define JB_F7 14 +#define JB_F8 15 +#define JB_F9 16 diff --git a/sysdeps/alpha/jmpbuf-unwind.h b/sysdeps/alpha/jmpbuf-unwind.h new file mode 100644 index 0000000000..ca5f693d5d --- /dev/null +++ b/sysdeps/alpha/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/alpha/ldiv.S b/sysdeps/alpha/ldiv.S index 3909672782..0a971a7ed0 100644 --- a/sysdeps/alpha/ldiv.S +++ b/sysdeps/alpha/ldiv.S @@ -214,3 +214,5 @@ $divbyzero: ret .end ldiv + +weak_alias (ldiv, lldiv) diff --git a/sysdeps/alpha/libc-tls.c b/sysdeps/alpha/libc-tls.c index 434d5d9313..24629e9aca 100644 --- a/sysdeps/alpha/libc-tls.c +++ b/sysdeps/alpha/libc-tls.c @@ -1,5 +1,5 @@ /* Thread-local storage handling in the ELF dynamic linker. Alpha version. - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 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 @@ -17,7 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <sysdeps/generic/libc-tls.c> +#include <csu/libc-tls.c> #include <dl-tls.h> #if USE_TLS @@ -31,7 +31,7 @@ void * __tls_get_addr (tls_index *ti) { dtv_t *dtv = THREAD_DTV (); - return (char *) dtv[1].pointer + ti->ti_offset; + return (char *) dtv[1].pointer.val + ti->ti_offset; } #endif diff --git a/sysdeps/alpha/reml.S b/sysdeps/alpha/reml.S index bfc3be5c3f..ae291b0505 100644 --- a/sysdeps/alpha/reml.S +++ b/sysdeps/alpha/reml.S @@ -38,7 +38,7 @@ .text .align 4 .globl __reml - .type __reml, @function + .type __reml, @funcnoplt .usepv __reml, no cfi_startproc diff --git a/sysdeps/alpha/remq.S b/sysdeps/alpha/remq.S index 645a834453..64e958bb95 100644 --- a/sysdeps/alpha/remq.S +++ b/sysdeps/alpha/remq.S @@ -43,7 +43,7 @@ .text .align 4 .globl __remq - .type __remq, @function + .type __remq, @funcnoplt .usepv __remq, no cfi_startproc diff --git a/sysdeps/alpha/remqu.S b/sysdeps/alpha/remqu.S index bfa78dff57..398a345a18 100644 --- a/sysdeps/alpha/remqu.S +++ b/sysdeps/alpha/remqu.S @@ -43,7 +43,7 @@ .text .align 4 .globl __remqu - .type __remqu, @function + .type __remqu, @funcnoplt .usepv __remqu, no cfi_startproc @@ -246,7 +246,7 @@ $y_is_neg: from the divide will be completely wrong. Fortunately, the quotient must be either 0 or 1, so the remainder must be X or X-Y, so just compute it directly. */ - cmpult Y, X, AT + cmpule Y, X, AT subq X, Y, RV ldt $f0, 0(sp) cmoveq AT, X, RV diff --git a/sysdeps/alpha/setjmp.S b/sysdeps/alpha/setjmp.S index 14a0320cd3..bc5da0f5bc 100644 --- a/sysdeps/alpha/setjmp.S +++ b/sysdeps/alpha/setjmp.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1994, 1996, 1997, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1992,1994,1996,1997,2002,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 @@ -19,20 +19,24 @@ #define __ASSEMBLY__ #include <sysdep.h> -#define _ASM -#define _SETJMP_H -#include <bits/setjmp.h> +#include <jmpbuf-offsets.h> - .ent __sigsetjmp - .global __sigsetjmp + .ent __sigsetjmp + .global __sigsetjmp __sigsetjmp: - ldgp gp, 0(pv) + ldgp gp, 0(pv) $sigsetjmp_local: - subq sp, 16, sp - .frame sp, 16, ra, 0 - stq ra, 0(sp) - .mask 0x04000000, -16 +#ifndef PIC +#define FRAME 16 + subq sp, FRAME, sp + .frame sp, FRAME, ra, 0 + stq ra, 0(sp) + .mask 0x04000000, -FRAME +#else +#define FRAME 0 + .frame sp, FRAME, ra, 0 +#endif #ifdef PROF .set noat lda AT, _mcount @@ -47,10 +51,27 @@ $sigsetjmp_local: stq s3, JB_S3*8(a0) stq s4, JB_S4*8(a0) stq s5, JB_S5*8(a0) +#ifdef PTR_MANGLE + PTR_MANGLE(t1, ra, t0) + stq t1, JB_PC*8(a0) +#else stq ra, JB_PC*8(a0) - addq sp, 16, t0 +#endif +#if defined(PTR_MANGLE) && FRAME == 0 + PTR_MANGLE2(t1, sp, t0) +#else + addq sp, FRAME, t1 +# ifdef PTR_MANGLE + PTR_MANGLE2(t1, t1, t0) +# endif +#endif + stq t1, JB_SP*8(a0) +#ifdef PTR_MANGLE + PTR_MANGLE2(t1, fp, t0) + stq t1, JB_FP*8(a0) +#else stq fp, JB_FP*8(a0) - stq t0, JB_SP*8(a0) +#endif stt $f2, JB_F2*8(a0) stt $f3, JB_F3*8(a0) stt $f4, JB_F4*8(a0) @@ -60,12 +81,20 @@ $sigsetjmp_local: stt $f8, JB_F8*8(a0) stt $f9, JB_F9*8(a0) +#ifndef PIC /* Call to C to (potentially) save our signal mask. */ jsr ra, __sigjmp_save - ldq ra, 0(sp) addq sp, 16, sp ret +#elif defined NOT_IN_libc && defined IS_IN_rtld + /* In ld.so we never save the signal mask. */ + mov 0, v0 + ret +#else + /* Tailcall to save the signal mask. */ + br $31, __sigjmp_save !samegp +#endif END(__sigsetjmp) diff --git a/sysdeps/alpha/soft-fp/Dist b/sysdeps/alpha/soft-fp/Dist deleted file mode 100644 index 3d75ee78b5..0000000000 --- a/sysdeps/alpha/soft-fp/Dist +++ /dev/null @@ -1,14 +0,0 @@ -local-soft-fp.h -ots_add.c -ots_cmp.c -ots_cmpe.c -ots_cvtqux.c -ots_cvtqx.c -ots_cvttx.c -ots_cvtxq.c -ots_cvtxt.c -ots_div.c -ots_mul.c -ots_nintxq.c -ots_sub.c -sfp-machine.h diff --git a/sysdeps/alpha/soft-fp/Makefile b/sysdeps/alpha/soft-fp/Makefile index d7e7e2684a..5410a78984 100644 --- a/sysdeps/alpha/soft-fp/Makefile +++ b/sysdeps/alpha/soft-fp/Makefile @@ -4,3 +4,7 @@ ifeq ($(subdir),soft-fp) sysdep_routines += ots_add ots_sub ots_mul ots_div ots_cmp ots_cmpe \ ots_cvtxq ots_cvtqx ots_cvtqux ots_cvttx ots_cvtxt ots_nintxq endif + +ifeq ($(subdir),math) +CPPFLAGS += -I../soft-fp +endif diff --git a/sysdeps/alpha/soft-fp/e_sqrtl.c b/sysdeps/alpha/soft-fp/e_sqrtl.c new file mode 100644 index 0000000000..717d170127 --- /dev/null +++ b/sysdeps/alpha/soft-fp/e_sqrtl.c @@ -0,0 +1,40 @@ +/* long double square root in software floating-point emulation. + Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 <stdlib.h> +#include <soft-fp.h> +#include <quad.h> + +long double +__ieee754_sqrtl (const long double a) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(C); + long double c; + long _round = 4; /* dynamic rounding */ + + FP_INIT_ROUNDMODE; + FP_UNPACK_Q(A, a); + FP_SQRT_Q(C, A); + FP_PACK_Q(c, C); + FP_HANDLE_EXCEPTIONS; + return c; +} diff --git a/sysdeps/alpha/soft-fp/ots_add.c b/sysdeps/alpha/soft-fp/ots_add.c index b4f6c28f3d..acf66f316b 100644 --- a/sysdeps/alpha/soft-fp/ots_add.c +++ b/sysdeps/alpha/soft-fp/ots_add.c @@ -1,5 +1,5 @@ /* Software floating-point emulation: addition. - Copyright (C) 1997,1999,2004 Free Software Foundation, Inc. + Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson (rth@cygnus.com) and Jakub Jelinek (jj@ultra.linux.cz). @@ -29,10 +29,10 @@ _OtsAddX(long al, long ah, long bl, long bh, long _round) FP_DECL_RETURN(c); FP_INIT_ROUNDMODE; - FP_UNPACK_Q(A, a); - FP_UNPACK_Q(B, b); + FP_UNPACK_SEMIRAW_Q(A, a); + FP_UNPACK_SEMIRAW_Q(B, b); FP_ADD_Q(C, A, B); - FP_PACK_Q(c, C); + FP_PACK_SEMIRAW_Q(c, C); FP_HANDLE_EXCEPTIONS; FP_RETURN(c); diff --git a/sysdeps/alpha/soft-fp/ots_cvtqux.c b/sysdeps/alpha/soft-fp/ots_cvtqux.c index d7ab5bae43..82c50806c4 100644 --- a/sysdeps/alpha/soft-fp/ots_cvtqux.c +++ b/sysdeps/alpha/soft-fp/ots_cvtqux.c @@ -1,5 +1,5 @@ /* Software floating-point emulation: unsigned integer to float conversion. - Copyright (C) 1997,1999,2004 Free Software Foundation, Inc. + Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson (rth@cygnus.com) and Jakub Jelinek (jj@ultra.linux.cz). @@ -33,8 +33,8 @@ _OtsCvtQUX (unsigned long a) FP_DECL_Q(C); FP_DECL_RETURN(c); - FP_FROM_INT_Q(C, a, 64, long); - FP_PACK_Q(c, C); + FP_FROM_INT_Q(C, a, 64, unsigned long); + FP_PACK_RAW_Q(c, C); FP_RETURN(c); } diff --git a/sysdeps/alpha/soft-fp/ots_cvtqx.c b/sysdeps/alpha/soft-fp/ots_cvtqx.c index 0e1c6bdc41..dc80291506 100644 --- a/sysdeps/alpha/soft-fp/ots_cvtqx.c +++ b/sysdeps/alpha/soft-fp/ots_cvtqx.c @@ -1,5 +1,5 @@ /* Software floating-point emulation: signed integer to float conversion. - Copyright (C) 1997,1999,2004 Free Software Foundation, Inc. + Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson (rth@cygnus.com) and Jakub Jelinek (jj@ultra.linux.cz). @@ -33,7 +33,7 @@ _OtsCvtQX (long a) FP_DECL_Q(C); FP_DECL_RETURN(c); - FP_FROM_INT_Q(C, a, 64, long); - FP_PACK_Q(c, C); + FP_FROM_INT_Q(C, a, 64, unsigned long); + FP_PACK_RAW_Q(c, C); FP_RETURN(c); } diff --git a/sysdeps/alpha/soft-fp/ots_cvttx.c b/sysdeps/alpha/soft-fp/ots_cvttx.c index ee5ac324cd..2d0bc9bca9 100644 --- a/sysdeps/alpha/soft-fp/ots_cvttx.c +++ b/sysdeps/alpha/soft-fp/ots_cvttx.c @@ -1,5 +1,5 @@ /* Software floating-point emulation: floating point extension. - Copyright (C) 1997,1999,2004 Free Software Foundation, Inc. + Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson (rth@cygnus.com) and Jakub Jelinek (jj@ultra.linux.cz). @@ -35,13 +35,13 @@ _OtsConvertFloatTX(double a) FP_DECL_Q(C); FP_DECL_RETURN(c); - FP_UNPACK_D(A, a); + FP_UNPACK_RAW_D(A, a); #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - FP_CONV(Q,D,4,2,C,A); + FP_EXTEND(Q,D,4,2,C,A); #else - FP_CONV(Q,D,2,1,C,A); + FP_EXTEND(Q,D,2,1,C,A); #endif - FP_PACK_Q(c, C); + FP_PACK_RAW_Q(c, C); FP_HANDLE_EXCEPTIONS; FP_RETURN(c); diff --git a/sysdeps/alpha/soft-fp/ots_cvtxq.c b/sysdeps/alpha/soft-fp/ots_cvtxq.c index 1fd47da4f7..2c9df529d5 100644 --- a/sysdeps/alpha/soft-fp/ots_cvtxq.c +++ b/sysdeps/alpha/soft-fp/ots_cvtxq.c @@ -1,5 +1,5 @@ /* Software floating-point emulation: float to integer conversion. - Copyright (C) 1997,1999,2004 Free Software Foundation, Inc. + Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson (rth@cygnus.com) and Jakub Jelinek (jj@ultra.linux.cz). @@ -26,14 +26,15 @@ _OtsCvtXQ (long al, long ah, long _round) { FP_DECL_EX; FP_DECL_Q(A); - long r, s; + unsigned long r; + long s; /* If bit 3 is set, then integer overflow detection is requested. */ s = _round & 8 ? 1 : -1; _round = _round & 3; FP_INIT_ROUNDMODE; - FP_UNPACK_Q(A, a); + FP_UNPACK_RAW_Q(A, a); FP_TO_INT_Q(r, A, 64, s); if (s > 0 && (_fex &= FP_EX_INVALID)) diff --git a/sysdeps/alpha/soft-fp/ots_cvtxt.c b/sysdeps/alpha/soft-fp/ots_cvtxt.c index 2629dd9e40..6221a2365c 100644 --- a/sysdeps/alpha/soft-fp/ots_cvtxt.c +++ b/sysdeps/alpha/soft-fp/ots_cvtxt.c @@ -1,5 +1,5 @@ /* Software floating-point emulation: floating point truncation. - Copyright (C) 1997,1999,2004 Free Software Foundation, Inc. + Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson (rth@cygnus.com) and Jakub Jelinek (jj@ultra.linux.cz). @@ -31,13 +31,13 @@ _OtsConvertFloatXT (long al, long ah, long _round) double r; FP_INIT_ROUNDMODE; - FP_UNPACK_Q(A, a); + FP_UNPACK_SEMIRAW_Q(A, a); #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - FP_CONV(D,Q,2,4,R,A); + FP_TRUNC(D,Q,2,4,R,A); #else - FP_CONV(D,Q,1,2,R,A); + FP_TRUNC(D,Q,1,2,R,A); #endif - FP_PACK_D(r, R); + FP_PACK_SEMIRAW_D(r, R); FP_HANDLE_EXCEPTIONS; return r; diff --git a/sysdeps/alpha/soft-fp/ots_nintxq.c b/sysdeps/alpha/soft-fp/ots_nintxq.c index 2cb1ca4c2a..a718372af7 100644 --- a/sysdeps/alpha/soft-fp/ots_nintxq.c +++ b/sysdeps/alpha/soft-fp/ots_nintxq.c @@ -1,5 +1,5 @@ /* Software floating-point emulation: convert to fortran nearest. - Copyright (C) 1997,1999,2004 Free Software Foundation, Inc. + Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson (rth@cygnus.com) and Jakub Jelinek (jj@ultra.linux.cz). @@ -26,22 +26,24 @@ _OtsNintXQ (long al, long ah, long _round) { FP_DECL_EX; FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); - long r, s; + unsigned long r; + long s; /* If bit 3 is set, then integer overflow detection is requested. */ s = _round & 8 ? 1 : -1; _round = _round & 3; FP_INIT_ROUNDMODE; - FP_UNPACK_Q(A, a); + FP_UNPACK_SEMIRAW_Q(A, a); /* Build 0.5 * sign(A) */ B_e = _FP_EXPBIAS_Q; - __FP_FRAC_SET_2 (B, _FP_IMPLBIT_Q, 0); + __FP_FRAC_SET_2 (B, 0, 0); B_s = A_s; - _FP_UNPACK_CANONICAL(Q,2,B); FP_ADD_Q(C, A, B); + _FP_FRAC_SRL_2(C, _FP_WORKBITS); + _FP_FRAC_HIGH_RAW_Q(C) &= ~(_FP_W_TYPE)_FP_IMPLBIT_Q; FP_TO_INT_Q(r, C, 64, s); if (s > 0 && (_fex &= FP_EX_INVALID)) FP_HANDLE_EXCEPTIONS; diff --git a/sysdeps/alpha/soft-fp/ots_sub.c b/sysdeps/alpha/soft-fp/ots_sub.c index c10043f071..5147266a04 100644 --- a/sysdeps/alpha/soft-fp/ots_sub.c +++ b/sysdeps/alpha/soft-fp/ots_sub.c @@ -1,5 +1,5 @@ /* Software floating-point emulation: subtraction. - Copyright (C) 1997,1999,2004 Free Software Foundation, Inc. + Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson (rth@cygnus.com) and Jakub Jelinek (jj@ultra.linux.cz). @@ -29,10 +29,10 @@ _OtsSubX(long al, long ah, long bl, long bh, long _round) FP_DECL_RETURN(c); FP_INIT_ROUNDMODE; - FP_UNPACK_Q(A, a); - FP_UNPACK_Q(B, b); + FP_UNPACK_SEMIRAW_Q(A, a); + FP_UNPACK_SEMIRAW_Q(B, b); FP_SUB_Q(C, A, B); - FP_PACK_Q(c, C); + FP_PACK_SEMIRAW_Q(c, C); FP_HANDLE_EXCEPTIONS; FP_RETURN(c); diff --git a/sysdeps/alpha/strncmp.S b/sysdeps/alpha/strncmp.S index e2b4ebf857..ff199eb743 100644 --- a/sysdeps/alpha/strncmp.S +++ b/sysdeps/alpha/strncmp.S @@ -61,8 +61,10 @@ $aligned: ornot t0, t3, t0 # .. e1 : cmpbge zero, t1, t7 # e0 : bits set iff null found beq a2, $eoc # .. e1 : check end of count - subq a2, 1, a2 # e0 : + unop # e0 : bne t7, $eos # .. e1 : + unop # e0 : + beq t10, $ant_loop # .. e1 : /* Aligned compare main loop. On entry to this basic block: @@ -74,13 +76,30 @@ $a_loop: bne t2, $wordcmp # .. e1 (zdb) ldq_u t1, 8(a1) # e0 : ldq_u t0, 8(a0) # .. e1 : + subq a2, 1, a2 # e0 : + addq a1, 8, a1 # .. e1 : + addq a0, 8, a0 # e0 : + beq a2, $eoc # .. e1 : + cmpbge zero, t1, t7 # e0 : + beq t7, $a_loop # .. e1 : + unop # e0 : + br $eos # .. e1 : + + /* Alternate aligned compare loop, for when there's no trailing + bytes on the count. We have to avoid reading too much data. */ +$ant_loop: + xor t0, t1, t2 # e0 : + bne t2, $wordcmp # .. e1 (zdb) + subq a2, 1, a2 # e0 : + beq a2, $zerolength # .. e1 : + ldq_u t1, 8(a1) # e0 : + ldq_u t0, 8(a0) # .. e1 : addq a1, 8, a1 # e0 : addq a0, 8, a0 # .. e1 : cmpbge zero, t1, t7 # e0 : - beq a2, $eoc # .. e1 : - subq a2, 1, a2 # e0 : - beq t7, $a_loop # .. e1 : - br $eos # e1 : + beq t7, $ant_loop # .. e1 : + unop # e0 : + br $eos # .. e1 : /* The two strings are not co-aligned. Align s1 and cope. */ $unaligned: @@ -184,6 +203,8 @@ $u_final: $eoc: mskql t0, t10, t0 mskql t1, t10, t1 + unop + cmpbge zero, t1, t7 /* We've found a zero somewhere in a word we just read. On entry to this basic block: @@ -203,6 +224,7 @@ $eos: /* Here we have two differing co-aligned words in t0 & t1. Bytewise compare them and return (t0 > t1 ? 1 : -1). */ + .align 3 $wordcmp: cmpbge t0, t1, t2 # e0 : comparison yields bit mask of ge cmpbge t1, t0, t3 # .. e1 : @@ -216,6 +238,7 @@ $wordcmp: $done: ret # e1 : + .align 3 $zerolength: clr v0 ret |