mirror of
git://sourceware.org/git/glibc.git
synced 2026-09-11 05:58:27 +08:00
Compare commits
50
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae132f744b | ||
|
|
8ab0cd46c4 | ||
|
|
0de52d9345 | ||
|
|
4943a3cc59 | ||
|
|
9778f6af29 | ||
|
|
8ed434d1ef | ||
|
|
39d4957f7d | ||
|
|
efd3eaa055 | ||
|
|
b2b4f0081c | ||
|
|
9aaaf1363c | ||
|
|
af4c0b6afa | ||
|
|
3380772a3c | ||
|
|
47a1ab537d | ||
|
|
3368cae079 | ||
|
|
14f5085ae9 | ||
|
|
da5da702f3 | ||
|
|
41f2ffe086 | ||
|
|
e320d3f797 | ||
|
|
ab2cceea62 | ||
|
|
9cb11a4f1e | ||
|
|
a7e0baec8c | ||
|
|
0c6ff79379 | ||
|
|
de9b5ed644 | ||
|
|
0b6126961c | ||
|
|
943515f05c | ||
|
|
86a00204ac | ||
|
|
51f3cf36c1 | ||
|
|
6559b01648 | ||
|
|
54a051b62c | ||
|
|
4749a0058b | ||
|
|
ba2d2313fb | ||
|
|
0019b30b5d | ||
|
|
8cbf6ed460 | ||
|
|
381c66161e | ||
|
|
1fe05ea95e | ||
|
|
047d5aa350 | ||
|
|
1e2e988b3d | ||
|
|
57c8c39692 | ||
|
|
7933fbca75 | ||
|
|
cc390a1f15 | ||
|
|
c2b8191991 | ||
|
|
e6121c8630 | ||
|
|
51067b55a3 | ||
|
|
5b55fd9ae0 | ||
|
|
996cf2ef07 | ||
|
|
fbd64d7ff2 | ||
|
|
21afa712db | ||
|
|
ad05c6671f | ||
|
|
1f636cc82b | ||
|
|
e283e1d04c |
@@ -1,3 +1,343 @@
|
||||
2013-01-09 Anton Blanchard <anton@samba.org>
|
||||
|
||||
* sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c: New file.
|
||||
* sysdeps/unix/sysv/linux/powerpc/Versions: Add __vdso_getcpu.
|
||||
* sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/powerpc/init-first.c: Likewise.
|
||||
|
||||
2012-05-12 Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
* sysdeps/powerpc/memmove.c (MEMMOVE): Don't return a value if
|
||||
used as bcopy.
|
||||
|
||||
2012-04-18 Will Schmidt <will_schmidt@vnet.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/memmove.c: New file based on string/memmove.c where
|
||||
__builtin_memcopy is called when src and dest ranges are known to not
|
||||
overlap.
|
||||
|
||||
2012-04-18 Will Schmidt <will_schmidt@vnet.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/powerpc64/power6/wordcopy.c
|
||||
(_wordcopy_fwd_dest_aligned): Replace switch with a parameterized
|
||||
fwd_align_merge macro call.
|
||||
(_wordcopy_bwd_dest_aligned): Replace switch with a parameterized
|
||||
bwd_align_merge macro call.
|
||||
* sysdeps/powerpc/powerpc32/power6/wordcopy.c: Likewise.
|
||||
|
||||
2012-04-18 Will Schmidt <will_schmidt@vnet.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/powerpc64/power6/wordcopy.c: Add fwd_align_merge and
|
||||
bwd_align_merge macros.
|
||||
(_wordcopy_fwd_dest_aligned): Use fwd_align_merge macro calls.
|
||||
(_wordcopy_bwd_dest_aligned): Use bwd_align_merge macro calls.
|
||||
* sysdeps/powerpc/powerpc32/power6/wordcopy.c: Likewise.
|
||||
|
||||
2011-11-16 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/Makefile: Added locale-defines.sym generation.
|
||||
* sysdeps/powerpc/locale-defines.sym: Locale definitions for strcasecmp
|
||||
optimized code.
|
||||
* sysdeps/powerpc/powerpc32/power7/Makefile: New file: added unroll-loop
|
||||
option for strncasecmp/strncasecmp_l compilation.
|
||||
* sysdeps/powerpc/powerpc32/power7/strcasecmp.S: New file: strcasecmp
|
||||
optimization for PPC32.
|
||||
* sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S: New file: strcasecmp_l
|
||||
optimization for PPC32.
|
||||
* sysdeps/powerpc/powerpc64/power7/Makefile: Added unroll-loop option for
|
||||
strncasecmp/strncasecmp_l compilation.
|
||||
* sysdeps/powerpc/powerpc64/power7/strcasecmp.S: New file: strcasecmp
|
||||
optimization for PPC64.
|
||||
* sysdeps/powerpc/powerpc64/power7/strcasecmp_l.S: New file: strcasecmp_l
|
||||
optimization for PPC64.
|
||||
|
||||
2011-11-18 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
||||
|
||||
* math/libm-test.inc: Added more nerabyint tests.
|
||||
* sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: New file: nearbyint
|
||||
optimized for PPC32.
|
||||
* sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: New file: nearbyintf
|
||||
optimized for PPC32.
|
||||
* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: New file: nearbyint
|
||||
optimized for PPC64.
|
||||
* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: New file: nearbyintf
|
||||
optimized for PPC64.
|
||||
|
||||
2011-10-22 Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
* sysdeps/ieee754/ldbl-128ibm/s_atanl.c: Include <math.h> before
|
||||
"math_private.h".
|
||||
|
||||
2011-12-06 Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
[BZ #13472]
|
||||
* sysdeps/powerpc/fpu/e_hypot.c (twoM600): Correct value.
|
||||
|
||||
2011-11-07 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/fpu/math_private.h: Using inline assembly version
|
||||
of math functions ceil, trunc, floor, round, and sqrt, when
|
||||
avaliable on the platform.
|
||||
* sysdeps/powerpc/fpu/e_sqrt.c: Undefine __ieee754_sqrt to avoid
|
||||
name clash.
|
||||
* sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/fpu/e_sqrt.c: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c: Likewise.
|
||||
|
||||
2011-10-12 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
Add integration with gcc's -ffinite-math-only and optimize wrapper
|
||||
functions in libm.
|
||||
* sysdeps/powerpc/fpu/e_hypot.c: Add __*_finite alias.
|
||||
* sysdeps/powerpc/fpu/e_hypotf.c: Likewise.
|
||||
* sysdeps/powerpc/fpu/e_sqrt.c: Likewise.
|
||||
* sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/fpu/e_sqrt.c: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c: Likewise.
|
||||
* sysdeps/ieee754/dbl-64/halfulp.c: Likewise.
|
||||
|
||||
2011-09-15 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* sysdeps/powerpc/fpu/e_hypot.c (__ieee754_hypot): Use
|
||||
__ieee754_sqrt instead of sqrt.
|
||||
* sysdeps/powerpc/fpu/e_hypotf.c (__ieee754_hypotf): Use
|
||||
__ieee754_sqrtf instead of sqrtf.
|
||||
* sysdeps/powerpc/fpu/e_rem_pio2f.c (__ieee754_rem_pio2f): Use
|
||||
__floorf instead of floorf.
|
||||
* sysdeps/powerpc/fpu/k_rem_pio2f.c (__fp_kernel_rem_pio2f): Use
|
||||
__floorf, __truncf instead of floorf, truncf.
|
||||
|
||||
2011-08-18 David Flaherty <flaherty@linux.vnet.ibm.com>
|
||||
|
||||
* sysdeps/ieee754/ldbl-128ibm/s_fmal.c: New file which checks
|
||||
for finite and infinity parameters.
|
||||
|
||||
2011-08-15 Alan Modra <amodra@gmail.com>
|
||||
|
||||
PR 13092
|
||||
* sysdeps/powerpc/Makefile (gmon): Move sysdep_routines to..
|
||||
* sysdeps/powerpc/powerpc64/Makefile (gmon): ..here..
|
||||
* sysdeps/powerpc/powerpc32/Makefile (gmon): ..and here. Add
|
||||
ppc_mcount to static-only-routines.
|
||||
* sysdeps/powerpc/powerpc32/Versions: Export GLIBC_PRIVATE
|
||||
__mcount_internal.
|
||||
* sysdeps/powerpc/powerpc32/ppc-mcount.S (_mcount): Call
|
||||
__mcount_internal with usual JUMPTARGET. Remove useless nop.
|
||||
|
||||
2011-08-04 Will Schmidt <will_schmidt@vnet.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/powerpc32/power7/strncmp.S: Adjust the alignment
|
||||
and add nop instructions for throughput optimization.
|
||||
* sysdeps/powerpc/powerpc64/power7/strncmp.S: Adjust the alignment
|
||||
and nop instructions for throughput optimization.
|
||||
|
||||
2011-08-01 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/fpu/e_hypot.c: New file: hypot optimized for POWER.
|
||||
* sysdeps/powerpc/fpu/e_hypotf.c: New file: hypotf optimized for POWER.
|
||||
* sysdeps/powerpc/fpu/e_rem_pio2f.c: New file: optimized for POWER.
|
||||
* sysdeps/powerpc/fpu/k_rem_pio2f.c: Likewise.
|
||||
* sysdeps/powerpc/fpu/k_cosf.c: Likewise.
|
||||
* sysdeps/powerpc/fpu/k_sinf.c: Likewise.
|
||||
* sysdeps/powerpc/fpu/s_cosf.c: Likewise.
|
||||
* sysdeps/powerpc/fpu/s_sinf.c: Likewise.
|
||||
* sysdeps/powerpc/fpu/s_scalbnf.c: Likewise.
|
||||
* sysdeps/powerpc/fpu/s_float_bitwise.h: new file: bitwise operation over
|
||||
floats optimized for POWER7.
|
||||
|
||||
2011-07-28 Will Schmidt <will_schmidt@vnet.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/powerpc32/power7/memcpy.S: Optimize the
|
||||
aligned copy for power7 with vector-scalar instructions.
|
||||
|
||||
* sysdeps/powerpc/powerpc64/power7/memcpy.S: Optimize the
|
||||
aligned copy for power7 with vector-scalar instructions.
|
||||
|
||||
2011-06-30 Ryan S. Arnold <rsa@linux.vnet.ibm.com>
|
||||
|
||||
* nptl/sysdeps/unix/sysv/linux/aio_misc.h
|
||||
(__aio_create_helper_thread): Remove call to
|
||||
pthread_attr_setstacksize () which set the stacksize to
|
||||
PTHREAD_STACK_MIN. This is too small if large amounts of TLS are in
|
||||
use. Removing this call effectively sets stacksize to 'default'.
|
||||
|
||||
2011-05-18 Ryan S. Arnold <rsa@us.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/powerpc64/Makefile (no-special-regs): Add -mno-vsx
|
||||
and -mno-altivec to prevent the compiler from using Altivec and/or
|
||||
VSX instructions when the corresponding registers are not available.
|
||||
|
||||
2011-02-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* stdio-common/printf-parsemb.c (__parse_one_specmb): Handle
|
||||
arginfo fn returning -1.
|
||||
|
||||
* stdio-common/_i18n_number.h (_i18n_number_rewrite): Ensure decimal
|
||||
and thousands string is zero terminated.
|
||||
|
||||
2009-11-06 Petr Baudis <pasky@suse.cz>
|
||||
|
||||
* include/sys/uio.h: Change __vector to __iovec to avoid clash
|
||||
with altivec.
|
||||
|
||||
2010-10-26 Peter Bergner <bergner@vnet.ibm.com>
|
||||
|
||||
* elf/rtld.c (process_envvars): Added conditional EXTRA_LD_ENVVARS_11
|
||||
macro which allows overriding of AT_PLATFORM using an environment
|
||||
variable.
|
||||
* sysdeps/unix/sysv/linux/powerpc/dl-librecon.h: New file adding
|
||||
definition for the EXTRA_LD_ENVVARS_11 macro.
|
||||
|
||||
2011-03-15 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* elf/dl-reloc.c (_dl_try_allocate_static_tls <TLS_DTV_AT_TP>): Handle
|
||||
l_tls_firstbyte_offset non-zero. Save padding offset in
|
||||
l_tls_firstbyte_offset for later use. Add debug print.
|
||||
* elf/dl-close.c (_dl_close_worker <TLS_DTV_AT_TP>): Correct code
|
||||
freeing static tls block. Add debug print.
|
||||
* elf/fl-tls.c (_dl_determine_tlsoffset): Add debug print.
|
||||
|
||||
2011-05-03 Ryan S. Arnold <rsa@us.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/powerpc64/Makefile (CFLAGS-initfini.s): Add
|
||||
-fno-inline to prevent potential erroneous optimization where init is
|
||||
inlined to branch directly to fini.
|
||||
|
||||
2011-02-23 Andreas Schwab <schwab@redhat.com>
|
||||
Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12509]
|
||||
* include/link.h (struct link_map): Add l_orig_initfini.
|
||||
* elf/dl-load.c (_dl_map_object_from_fd): Free realname before
|
||||
returning unsuccessfully.
|
||||
* elf/dl-close.c (_dl_close_worker): If this is the last explicit
|
||||
close of a file loaded at startup, restore the original l_initfini
|
||||
list.
|
||||
* elf/dl-deps.c (_dl_map_object_deps): Don't free old l_initfini
|
||||
list, store the pointer.
|
||||
* elf/Makefile ($(objpfx)noload-mem): New rule.
|
||||
(noload-ENV): Define.
|
||||
(tests): Add $(objpfx)noload-mem.
|
||||
* elf/noload.c: Include <memcheck.h>.
|
||||
(main): Call mtrace. Close all opened handles.
|
||||
|
||||
2011-02-17 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
[BZ #12454]
|
||||
* elf/dl-deps.c (_dl_map_object_deps): Signal error early when
|
||||
dependencies are missing.
|
||||
|
||||
2010-09-28 Andreas Schwab <schwab@redhat.com>
|
||||
Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12489]
|
||||
* elf/rtld.c (dl_main): Move setting of GLRO(dl_init_all_dirs)
|
||||
before performing relro protection. At old place add assertion
|
||||
to make sure nothing changed.
|
||||
|
||||
2011-04-08 Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
* sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c:
|
||||
Make cancelable.
|
||||
|
||||
2011-03-14 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* elf/dl-load.c (_dl_dst_substitute): When skipping the first
|
||||
rpath element also skip the following colon.
|
||||
(expand_dynamic_string_token): Add is_path parameter and pass
|
||||
down to DL_DST_REQUIRED and _dl_dst_substitute.
|
||||
(decompose_rpath): Call expand_dynamic_string_token with
|
||||
non-zero is_path. Ignore empty rpaths.
|
||||
(_dl_map_object_from_fd): Call expand_dynamic_string_token
|
||||
with zero is_path.
|
||||
|
||||
2011-03-28 Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
* sysdeps/powerpc/powerpc32/power4/strncmp.S: Don't read past
|
||||
differing bytes.
|
||||
* sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc32/power7/strncmp.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
|
||||
|
||||
2011-04-10 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12650]
|
||||
* sysdeps/i386/dl-tls.h: Define TLS_DTV_UNALLOCATED.
|
||||
* sysdeps/ia64/dl-tls.h: Likewise.
|
||||
* sysdeps/powerpc/dl-tls.h: Likewise.
|
||||
* sysdeps/s390/dl-tls.h: Likewise.
|
||||
* sysdeps/sh/dl-tls.h: Likewise.
|
||||
* sysdeps/sparc/dl-tls.h: Likewise.
|
||||
* sysdeps/x86_64/dl-tls.h: Likewise.
|
||||
* elf/dl-tls.c: Don't define TLS_DTV_UNALLOCATED here.
|
||||
|
||||
2011-03-16 Ryan S. Arnold <rsa@us.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S (isnanf): Fix
|
||||
END(__isnan) to END(__isnanf) to match function entry point/label
|
||||
EALIGN(__isnanf,...).
|
||||
|
||||
2011-05-03 Ryan S. Arnold <rsa@us.ibm.com>
|
||||
|
||||
* elf/dynamic-link.h (elf_get_dynamic_info): Remove assert() around
|
||||
DT_RUNPATH and DT_RPATH which prevents running a dynamic linker with
|
||||
an embedded RPATH flag, which is what a compiler modified to embed a
|
||||
non-default INTERP section would do.
|
||||
|
||||
2011-05-30 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12454]
|
||||
* elf/dl-deps.c (_dl_map_object_deps): Run initializer sorting only
|
||||
when there are multiple maps.
|
||||
* elf/dl-fini.c (_dl_sort_fini): Check for list of one.
|
||||
(_dl_fini): Remove test here.
|
||||
|
||||
* elf/rtld.c (dl_main): Don't allow the loader to load itself.
|
||||
|
||||
2011-02-06 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
[BZ #12653]
|
||||
* sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S: Only protect
|
||||
MEMCPY_CHK with USE_AS_BCOPY ifdef check.
|
||||
* sysdeps/i386/i686/multiarch/memcpy-ssse3.S: Likewise.
|
||||
* sysdeps/x86_64/multiarch/memcpy-ssse3.S: Likewise.
|
||||
* sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Likewise.
|
||||
|
||||
2010-09-28 Andreas Schwab <schwab@redhat.com>
|
||||
Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12489]
|
||||
* elf/rtld.c (dl_main): Move setting of GLRO(dl_init_all_dirs)
|
||||
before performing relro protection. At old place add assertion
|
||||
to make sure nothing changed.
|
||||
|
||||
2011-02-16 Ryan S. Arnold <rsa@us.ibm.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h:
|
||||
(INTERNAL_VSYSCALL_NCS INTERNAL_SYSCALL_NCS): Remove erroneous (int)
|
||||
cast from r3.
|
||||
* sysdeps/wordsize-64/Makefile: New file. Add tst-writev to
|
||||
'tests' variable.
|
||||
* sysdeps/wordsize-64/tst-writev.c: New file.
|
||||
|
||||
2011-02-15 Ryan S. Arnold <rsa@us.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/powerpc64/power7/Makefile: New file which adds
|
||||
-mno-vsx to the CFLAGS-rtld.c variable to avoid using VSX registers and
|
||||
insns in _dl_start to prevent a TOC reference before relocs are
|
||||
resolved.
|
||||
|
||||
2011-02-02 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
* elf/dl-runtime.c (_dl_call_pltexit): Pass correct address of the
|
||||
function to the callback.
|
||||
Patch partly by Jiri Olsa <jolsa@redhat.com>.
|
||||
|
||||
2011-02-02 Andreas Schwab <schwab@redhat.com>
|
||||
|
||||
* shadow/sgetspent.c: Check return value of __sgetspent_r instead
|
||||
of errno.
|
||||
|
||||
2011-01-19 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #11724]
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
GNU C Library NEWS -- history of user-visible changes. 2011-1-19
|
||||
GNU C Library NEWS -- history of user-visible changes. 2011-5-30
|
||||
Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
See the end for copying conditions.
|
||||
|
||||
Please send GNU C library bug reports via <http://sources.redhat.com/bugzilla/>
|
||||
using `glibc' in the "product" field.
|
||||
|
||||
Version 2.1
|
||||
|
||||
* The following bugs are resolved with this release:
|
||||
|
||||
11724
|
||||
|
||||
Version 2.13
|
||||
|
||||
* The following bugs are resolved with this release:
|
||||
@@ -19,7 +13,7 @@ Version 2.13
|
||||
11655, 11701, 11840, 11856, 11883, 11903, 11904, 11968, 11979, 12005,
|
||||
12037, 12067, 12077, 12078, 12092, 12093, 12107, 12108, 12113, 12140,
|
||||
12159, 12167, 12191, 12194, 12201, 12204, 12205, 12207, 12348, 12378,
|
||||
12394, 12397
|
||||
12394, 12397, 12489, 12653, 12454
|
||||
|
||||
* New Linux interfaces: prlimit, prlimit64, fanotify_init, fanotify_mark
|
||||
|
||||
|
||||
+5
-1
@@ -213,7 +213,7 @@ endif
|
||||
ifeq (yesyes,$(have-fpie)$(build-shared))
|
||||
tests: $(objpfx)tst-pie1.out
|
||||
endif
|
||||
tests: $(objpfx)tst-leaks1-mem
|
||||
tests: $(objpfx)tst-leaks1-mem $(objpfx)noload-mem
|
||||
tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
||||
tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
||||
tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes))
|
||||
@@ -680,6 +680,10 @@ $(objpfx)noload: $(objpfx)testobj1.so $(common-objpfx)dlfcn/libdl.so
|
||||
LDFLAGS-noload = -rdynamic
|
||||
$(objpfx)noload.out: $(objpfx)testobj5.so
|
||||
|
||||
$(objpfx)noload-mem: $(objpfx)noload.out
|
||||
$(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@
|
||||
noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
|
||||
|
||||
LDFLAGS-nodelete = -rdynamic
|
||||
LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete
|
||||
LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete
|
||||
|
||||
+48
-13
@@ -1,5 +1,5 @@
|
||||
/* Close a shared object opened by `_dl_open'.
|
||||
Copyright (C) 1996-2007, 2009, 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996-2007, 2009, 2010, 2011 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
|
||||
@@ -119,8 +119,17 @@ _dl_close_worker (struct link_map *map)
|
||||
if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
|
||||
|| dl_close_state != not_pending)
|
||||
{
|
||||
if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
|
||||
dl_close_state = rerun;
|
||||
if (map->l_direct_opencount == 0)
|
||||
{
|
||||
if (map->l_type == lt_loaded)
|
||||
dl_close_state = rerun;
|
||||
else if (map->l_type == lt_library)
|
||||
{
|
||||
struct link_map **oldp = map->l_initfini;
|
||||
map->l_initfini = map->l_orig_initfini;
|
||||
_dl_scope_free (oldp);
|
||||
}
|
||||
}
|
||||
|
||||
/* There are still references to this object. Do nothing more. */
|
||||
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
|
||||
@@ -582,25 +591,51 @@ _dl_close_worker (struct link_map *map)
|
||||
}
|
||||
}
|
||||
#elif TLS_DTV_AT_TP
|
||||
if ((size_t) imap->l_tls_offset == tls_free_end)
|
||||
if (tls_free_start == NO_TLS_OFFSET)
|
||||
{
|
||||
tls_free_start = imap->l_tls_firstbyte_offset;
|
||||
tls_free_end = imap->l_tls_offset + imap->l_tls_blocksize;
|
||||
}
|
||||
else if (imap->l_tls_firstbyte_offset == tls_free_end)
|
||||
/* Extend the contiguous chunk being reclaimed. */
|
||||
tls_free_end -= imap->l_tls_blocksize;
|
||||
tls_free_end = imap->l_tls_offset + imap->l_tls_blocksize;
|
||||
else if (imap->l_tls_offset + imap->l_tls_blocksize
|
||||
== tls_free_start)
|
||||
/* Extend the chunk backwards. */
|
||||
tls_free_start = imap->l_tls_offset;
|
||||
else
|
||||
tls_free_start = imap->l_tls_firstbyte_offset;
|
||||
|
||||
/* This isn't contiguous with the last chunk freed.
|
||||
One of them will be leaked unless we can free
|
||||
one block right away. */
|
||||
else if (imap->l_tls_offset + imap->l_tls_blocksize
|
||||
== GL(dl_tls_static_used))
|
||||
GL(dl_tls_static_used) = imap->l_tls_firstbyte_offset;
|
||||
else if (tls_free_end == GL(dl_tls_static_used))
|
||||
{
|
||||
/* This isn't contiguous with the last chunk freed.
|
||||
One of them will be leaked. */
|
||||
if (tls_free_end == GL(dl_tls_static_used))
|
||||
GL(dl_tls_static_used) = tls_free_start;
|
||||
tls_free_start = imap->l_tls_offset;
|
||||
tls_free_end = tls_free_start + imap->l_tls_blocksize;
|
||||
GL(dl_tls_static_used) = tls_free_start;
|
||||
tls_free_start = imap->l_tls_firstbyte_offset;
|
||||
tls_free_end = imap->l_tls_offset + imap->l_tls_blocksize;
|
||||
}
|
||||
else if (tls_free_end < imap->l_tls_firstbyte_offset)
|
||||
{
|
||||
/* We pick the later block. It has a chance to
|
||||
be freed. */
|
||||
tls_free_start = imap->l_tls_firstbyte_offset;
|
||||
tls_free_end = imap->l_tls_offset + imap->l_tls_blocksize;
|
||||
}
|
||||
#else
|
||||
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
|
||||
#endif
|
||||
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
|
||||
_dl_debug_printf ("\nstatic tls free: %s\n"
|
||||
" tls_free_start = %Zu, "
|
||||
"tls_free_end = %Zu, "
|
||||
"dl_tls_static_used = %Zu\n",
|
||||
imap->l_name[0] ? imap->l_name
|
||||
: rtld_progname,
|
||||
tls_free_start, tls_free_end,
|
||||
GL(dl_tls_static_used));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+52
-49
@@ -491,6 +491,10 @@ _dl_map_object_deps (struct link_map *map,
|
||||
if (errno == 0 && errno_saved != 0)
|
||||
__set_errno (errno_saved);
|
||||
|
||||
if (errno_reason)
|
||||
_dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
|
||||
NULL, errstring);
|
||||
|
||||
struct link_map **old_l_initfini = NULL;
|
||||
if (map->l_initfini != NULL && map->l_type == lt_loaded)
|
||||
{
|
||||
@@ -613,61 +617,64 @@ Filters not supported with LD_TRACE_PRELINKING"));
|
||||
map->l_searchlist.r_list[i]->l_reserved = 0;
|
||||
}
|
||||
|
||||
/* Now determine the order in which the initialization has to happen. */
|
||||
/* Sort the initializer list to take dependencies into account. The binary
|
||||
itself will always be initialize last. */
|
||||
memcpy (l_initfini, map->l_searchlist.r_list,
|
||||
nlist * sizeof (struct link_map *));
|
||||
|
||||
/* We can skip looking for the binary itself which is at the front
|
||||
of the search list. */
|
||||
assert (nlist > 1);
|
||||
i = 1;
|
||||
bool seen[nlist];
|
||||
memset (seen, false, nlist * sizeof (seen[0]));
|
||||
while (1)
|
||||
if (__builtin_expect (nlist > 1, 1))
|
||||
{
|
||||
/* Keep track of which object we looked at this round. */
|
||||
seen[i] = true;
|
||||
struct link_map *thisp = l_initfini[i];
|
||||
|
||||
/* Find the last object in the list for which the current one is
|
||||
a dependency and move the current object behind the object
|
||||
with the dependency. */
|
||||
unsigned int k = nlist - 1;
|
||||
while (k > i)
|
||||
/* We can skip looking for the binary itself which is at the front
|
||||
of the search list. */
|
||||
i = 1;
|
||||
bool seen[nlist];
|
||||
memset (seen, false, nlist * sizeof (seen[0]));
|
||||
while (1)
|
||||
{
|
||||
struct link_map **runp = l_initfini[k]->l_initfini;
|
||||
if (runp != NULL)
|
||||
/* Look through the dependencies of the object. */
|
||||
while (*runp != NULL)
|
||||
if (__builtin_expect (*runp++ == thisp, 0))
|
||||
{
|
||||
/* Move the current object to the back past the last
|
||||
object with it as the dependency. */
|
||||
memmove (&l_initfini[i], &l_initfini[i + 1],
|
||||
(k - i) * sizeof (l_initfini[0]));
|
||||
l_initfini[k] = thisp;
|
||||
/* Keep track of which object we looked at this round. */
|
||||
seen[i] = true;
|
||||
struct link_map *thisp = l_initfini[i];
|
||||
|
||||
if (seen[i + 1])
|
||||
/* Find the last object in the list for which the current one is
|
||||
a dependency and move the current object behind the object
|
||||
with the dependency. */
|
||||
unsigned int k = nlist - 1;
|
||||
while (k > i)
|
||||
{
|
||||
struct link_map **runp = l_initfini[k]->l_initfini;
|
||||
if (runp != NULL)
|
||||
/* Look through the dependencies of the object. */
|
||||
while (*runp != NULL)
|
||||
if (__builtin_expect (*runp++ == thisp, 0))
|
||||
{
|
||||
++i;
|
||||
goto next_clear;
|
||||
/* Move the current object to the back past the last
|
||||
object with it as the dependency. */
|
||||
memmove (&l_initfini[i], &l_initfini[i + 1],
|
||||
(k - i) * sizeof (l_initfini[0]));
|
||||
l_initfini[k] = thisp;
|
||||
|
||||
if (seen[i + 1])
|
||||
{
|
||||
++i;
|
||||
goto next_clear;
|
||||
}
|
||||
|
||||
memmove (&seen[i], &seen[i + 1],
|
||||
(k - i) * sizeof (seen[0]));
|
||||
seen[k] = true;
|
||||
|
||||
goto next;
|
||||
}
|
||||
|
||||
memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0]));
|
||||
seen[k] = true;
|
||||
--k;
|
||||
}
|
||||
|
||||
goto next;
|
||||
}
|
||||
if (++i == nlist)
|
||||
break;
|
||||
next_clear:
|
||||
memset (&seen[i], false, (nlist - i) * sizeof (seen[0]));
|
||||
|
||||
--k;
|
||||
next:;
|
||||
}
|
||||
|
||||
if (++i == nlist)
|
||||
break;
|
||||
next_clear:
|
||||
memset (&seen[i], false, (nlist - i) * sizeof (seen[0]));
|
||||
|
||||
next:;
|
||||
}
|
||||
|
||||
/* Terminate the list of dependencies. */
|
||||
@@ -682,9 +689,5 @@ Filters not supported with LD_TRACE_PRELINKING"));
|
||||
_dl_scope_free (old_l_reldeps);
|
||||
}
|
||||
if (old_l_initfini != NULL)
|
||||
_dl_scope_free (old_l_initfini);
|
||||
|
||||
if (errno_reason)
|
||||
_dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
|
||||
NULL, errstring);
|
||||
map->l_orig_initfini = old_l_initfini;
|
||||
}
|
||||
|
||||
+6
-4
@@ -33,9 +33,12 @@ internal_function
|
||||
_dl_sort_fini (struct link_map *l, struct link_map **maps, size_t nmaps,
|
||||
char *used, Lmid_t ns)
|
||||
{
|
||||
/* A list of one element need not be sorted. */
|
||||
if (nmaps == 1)
|
||||
return;
|
||||
|
||||
/* We can skip looking for the binary itself which is at the front
|
||||
of the search list for the main namespace. */
|
||||
assert (nmaps > 1);
|
||||
unsigned int i = ns == LM_ID_BASE;
|
||||
bool seen[nmaps];
|
||||
memset (seen, false, nmaps * sizeof (seen[0]));
|
||||
@@ -195,9 +198,8 @@ _dl_fini (void)
|
||||
assert (ns == LM_ID_BASE || i == nloaded || i == nloaded - 1);
|
||||
nmaps = i;
|
||||
|
||||
if (nmaps > 1)
|
||||
/* Now we have to do the sorting. */
|
||||
_dl_sort_fini (GL(dl_ns)[ns]._ns_loaded, maps, nmaps, NULL, ns);
|
||||
/* Now we have to do the sorting. */
|
||||
_dl_sort_fini (GL(dl_ns)[ns]._ns_loaded, maps, nmaps, NULL, ns);
|
||||
|
||||
/* We do not rely on the linked list of loaded object anymore from
|
||||
this point on. We have our own list here (maps). The various
|
||||
|
||||
+20
-6
@@ -1,5 +1,5 @@
|
||||
/* Map in a shared object's segments from the file.
|
||||
Copyright (C) 1995-2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2005, 2006, 2007, 2009, 2010, 2011 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
|
||||
@@ -284,6 +284,10 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
|
||||
name += len;
|
||||
while (*name != '\0' && (!is_path || *name != ':'))
|
||||
++name;
|
||||
/* Also skip following colon if this is the first rpath
|
||||
element, but keep an empty element at the end. */
|
||||
if (wp == result && is_path && *name == ':' && name[1] != '\0')
|
||||
++name;
|
||||
}
|
||||
else
|
||||
/* No DST we recognize. */
|
||||
@@ -310,7 +314,7 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
|
||||
belonging to the map is loaded. In this case the path element
|
||||
containing $ORIGIN is left out. */
|
||||
static char *
|
||||
expand_dynamic_string_token (struct link_map *l, const char *s)
|
||||
expand_dynamic_string_token (struct link_map *l, const char *s, int is_path)
|
||||
{
|
||||
/* We make two runs over the string. First we determine how large the
|
||||
resulting string is and then we copy it over. Since this is no
|
||||
@@ -321,7 +325,7 @@ expand_dynamic_string_token (struct link_map *l, const char *s)
|
||||
char *result;
|
||||
|
||||
/* Determine the number of DST elements. */
|
||||
cnt = DL_DST_COUNT (s, 1);
|
||||
cnt = DL_DST_COUNT (s, is_path);
|
||||
|
||||
/* If we do not have to replace anything simply copy the string. */
|
||||
if (__builtin_expect (cnt, 0) == 0)
|
||||
@@ -335,7 +339,7 @@ expand_dynamic_string_token (struct link_map *l, const char *s)
|
||||
if (result == NULL)
|
||||
return NULL;
|
||||
|
||||
return _dl_dst_substitute (l, s, result, 1);
|
||||
return _dl_dst_substitute (l, s, result, is_path);
|
||||
}
|
||||
|
||||
|
||||
@@ -551,13 +555,21 @@ decompose_rpath (struct r_search_path_struct *sps,
|
||||
|
||||
/* Make a writable copy. At the same time expand possible dynamic
|
||||
string tokens. */
|
||||
copy = expand_dynamic_string_token (l, rpath);
|
||||
copy = expand_dynamic_string_token (l, rpath, 1);
|
||||
if (copy == NULL)
|
||||
{
|
||||
errstring = N_("cannot create RUNPATH/RPATH copy");
|
||||
goto signal_error;
|
||||
}
|
||||
|
||||
/* Ignore empty rpaths. */
|
||||
if (*copy == 0)
|
||||
{
|
||||
free (copy);
|
||||
sps->dirs = (char *) -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Count the number of necessary elements in the result array. */
|
||||
nelems = 0;
|
||||
for (cp = copy; *cp != '\0'; ++cp)
|
||||
@@ -894,6 +906,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
||||
{
|
||||
/* We are not supposed to load the object unless it is already
|
||||
loaded. So return now. */
|
||||
free (realname);
|
||||
__close (fd);
|
||||
return NULL;
|
||||
}
|
||||
@@ -912,6 +925,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
||||
_dl_zerofd = _dl_sysdep_open_zero_fill ();
|
||||
if (_dl_zerofd == -1)
|
||||
{
|
||||
free (realname);
|
||||
__close (fd);
|
||||
_dl_signal_error (errno, NULL, NULL,
|
||||
N_("cannot open zero fill device"));
|
||||
@@ -2175,7 +2189,7 @@ _dl_map_object (struct link_map *loader, const char *name,
|
||||
{
|
||||
/* The path may contain dynamic string tokens. */
|
||||
realname = (loader
|
||||
? expand_dynamic_string_token (loader, name)
|
||||
? expand_dynamic_string_token (loader, name, 0)
|
||||
: local_strdup (name));
|
||||
if (realname == NULL)
|
||||
fd = -1;
|
||||
|
||||
+15
-5
@@ -77,23 +77,33 @@ _dl_try_allocate_static_tls (struct link_map *map)
|
||||
|
||||
map->l_tls_offset = GL(dl_tls_static_used) = offset;
|
||||
#elif TLS_DTV_AT_TP
|
||||
size_t offset;
|
||||
size_t used;
|
||||
size_t check;
|
||||
|
||||
size_t offset = roundup (GL(dl_tls_static_used), map->l_tls_align);
|
||||
used = offset + map->l_tls_blocksize;
|
||||
check = used;
|
||||
/* dl_tls_static_used includes the TCB at the beginning. */
|
||||
offset = (((GL(dl_tls_static_used)
|
||||
- map->l_tls_firstbyte_offset
|
||||
+ map->l_tls_align - 1) & -map->l_tls_align)
|
||||
+ map->l_tls_firstbyte_offset);
|
||||
used = offset + map->l_tls_blocksize;
|
||||
|
||||
if (check > GL(dl_tls_static_size))
|
||||
if (used > GL(dl_tls_static_size))
|
||||
goto fail;
|
||||
|
||||
map->l_tls_offset = offset;
|
||||
map->l_tls_firstbyte_offset = GL(dl_tls_static_used);
|
||||
GL(dl_tls_static_used) = used;
|
||||
#else
|
||||
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
|
||||
#endif
|
||||
|
||||
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
|
||||
_dl_debug_printf ("\nstatic tls: %s\n"
|
||||
" l_tls_offset = %Zu, l_tls_firstbyte_offset = %Zu,"
|
||||
" dl_tls_static_used = %Zu\n",
|
||||
map->l_name[0] ? map->l_name : rtld_progname,
|
||||
map->l_tls_offset, map->l_tls_firstbyte_offset,
|
||||
GL(dl_tls_static_used));
|
||||
/* If the object is not yet relocated we cannot initialize the
|
||||
static TLS region. Delay it. */
|
||||
if (map->l_real->l_relocated)
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/* On-demand PLT fixup for shared objects.
|
||||
Copyright (C) 1995-2009, 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2009, 2010, 2011 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
|
||||
@@ -446,6 +446,7 @@ _dl_call_pltexit (struct link_map *l, ElfW(Word) reloc_arg,
|
||||
|
||||
/* Set up the sym parameter. */
|
||||
ElfW(Sym) sym = *defsym;
|
||||
sym.st_value = DL_FIXUP_VALUE_ADDR (reloc_result->addr);
|
||||
|
||||
/* Get the symbol name. */
|
||||
const char *strtab = (const void *) D_PTR (reloc_result->bound,
|
||||
|
||||
+6
-4
@@ -1,5 +1,5 @@
|
||||
/* Thread-local storage handling in the ELF dynamic linker. Generic version.
|
||||
Copyright (C) 2002,2003,2004,2005,2006,2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2006,2008,2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -33,9 +33,6 @@
|
||||
to allow dynamic loading of modules defining IE-model TLS data. */
|
||||
#define TLS_STATIC_SURPLUS 64 + DL_NNS * 100
|
||||
|
||||
/* Value used for dtv entries for which the allocation is delayed. */
|
||||
#define TLS_DTV_UNALLOCATED ((void *) -1l)
|
||||
|
||||
|
||||
/* Out-of-memory handler. */
|
||||
#ifdef SHARED
|
||||
@@ -249,6 +246,11 @@ _dl_determine_tlsoffset (void)
|
||||
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
|
||||
#endif
|
||||
|
||||
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
|
||||
_dl_debug_printf ("\ninitial static tls: "
|
||||
"dl_tls_static_used = %Zu, dl_tls_status_size = %Zu\n",
|
||||
GL(dl_tls_static_used), GL(dl_tls_static_size));
|
||||
|
||||
/* The alignment requirement for the static TLS block. */
|
||||
GL(dl_tls_static_align) = max_align;
|
||||
}
|
||||
|
||||
+2
-2
@@ -205,8 +205,8 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
|
||||
assert (info[DT_FLAGS] == NULL
|
||||
|| info[DT_FLAGS]->d_un.d_val == DF_BIND_NOW);
|
||||
/* Flags must not be set for ld.so. */
|
||||
assert (info[DT_RUNPATH] == NULL);
|
||||
assert (info[DT_RPATH] == NULL);
|
||||
info[DT_RUNPATH] = NULL;
|
||||
info[DT_RPATH] = NULL;
|
||||
#else
|
||||
if (info[DT_FLAGS] != NULL)
|
||||
{
|
||||
|
||||
+16
-6
@@ -1,20 +1,28 @@
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
#include <mcheck.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int result = 0;
|
||||
void *p;
|
||||
|
||||
mtrace ();
|
||||
|
||||
/* First try to load an object which is a dependency. This should
|
||||
succeed. */
|
||||
if (dlopen ("testobj1.so", RTLD_LAZY | RTLD_NOLOAD) == NULL)
|
||||
p = dlopen ("testobj1.so", RTLD_LAZY | RTLD_NOLOAD);
|
||||
if (p == NULL)
|
||||
{
|
||||
printf ("cannot open \"testobj1.so\": %s\n", dlerror ());
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
puts ("loading \"testobj1.so\" succeeded, OK");
|
||||
{
|
||||
puts ("loading \"testobj1.so\" succeeded, OK");
|
||||
dlclose (p);
|
||||
}
|
||||
|
||||
/* Now try loading an object which is not already loaded. */
|
||||
if (dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD) != NULL)
|
||||
@@ -25,8 +33,6 @@ main (void)
|
||||
else
|
||||
{
|
||||
/* Load the object and run the same test again. */
|
||||
void *p;
|
||||
|
||||
puts ("\"testobj5.so\" wasn't loaded and RTLD_NOLOAD prevented it, OK");
|
||||
|
||||
p = dlopen ("testobj5.so", RTLD_LAZY);
|
||||
@@ -41,13 +47,17 @@ main (void)
|
||||
{
|
||||
puts ("loading \"testobj5.so\" succeeded, OK");
|
||||
|
||||
if (dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD) == NULL)
|
||||
void *q = dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD);
|
||||
if (q == NULL)
|
||||
{
|
||||
printf ("cannot open \"testobj5.so\": %s\n", dlerror ());
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
puts ("loading \"testobj5.so\" with RTLD_NOLOAD succeeded, OK");
|
||||
{
|
||||
puts ("loading \"testobj5.so\" with RTLD_NOLOAD succeeded, OK");
|
||||
dlclose (q);
|
||||
}
|
||||
|
||||
if (dlclose (p) != 0)
|
||||
{
|
||||
|
||||
+12
-4
@@ -1,5 +1,5 @@
|
||||
/* Run time dynamic linker.
|
||||
Copyright (C) 1995-2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2010, 2011 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
|
||||
@@ -2179,6 +2179,10 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
|
||||
we need it in the memory handling later. */
|
||||
GLRO(dl_initial_searchlist) = *GL(dl_ns)[LM_ID_BASE]._ns_main_searchlist;
|
||||
|
||||
/* Remember the last search directory added at startup, now that
|
||||
malloc will no longer be the one from dl-minimal.c. */
|
||||
GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
|
||||
|
||||
if (prelinked)
|
||||
{
|
||||
if (main_map->l_info [ADDRIDX (DT_GNU_CONFLICT)] != NULL)
|
||||
@@ -2298,9 +2302,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
|
||||
lossage);
|
||||
}
|
||||
|
||||
/* Remember the last search directory added at startup, now that
|
||||
malloc will no longer be the one from dl-minimal.c. */
|
||||
GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
|
||||
/* Make sure no new search directories have been added. */
|
||||
assert (GLRO(dl_init_all_dirs) == GL(dl_all_dirs));
|
||||
|
||||
if (! prelinked && rtld_multiple_ref)
|
||||
{
|
||||
@@ -2611,6 +2614,11 @@ process_envvars (enum mode *modep)
|
||||
break;
|
||||
|
||||
case 11:
|
||||
#ifdef EXTRA_LD_ENVVARS_11
|
||||
/* We might have some extra environment variables with length 11
|
||||
to handle. */
|
||||
EXTRA_LD_ENVVARS_11
|
||||
#endif
|
||||
/* Path where the binary is found. */
|
||||
if (!INTUSE(__libc_enable_secure)
|
||||
&& memcmp (envline, "ORIGIN_PATH", 11) == 0)
|
||||
|
||||
+4
-1
@@ -1,6 +1,6 @@
|
||||
/* Data structure for communication from the run-time dynamic linker for
|
||||
loaded ELF shared objects.
|
||||
Copyright (C) 1995-2006, 2007, 2009, 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2006, 2007, 2009, 2010, 2011 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
|
||||
@@ -240,6 +240,9 @@ struct link_map
|
||||
|
||||
/* List of object in order of the init and fini calls. */
|
||||
struct link_map **l_initfini;
|
||||
/* The init and fini list generated at startup, saved when the
|
||||
object is also loaded dynamically. */
|
||||
struct link_map **l_orig_initfini;
|
||||
|
||||
/* List of the dependencies introduced through symbol binding. */
|
||||
struct link_map_reldeps
|
||||
|
||||
+4
-4
@@ -2,12 +2,12 @@
|
||||
#include <misc/sys/uio.h>
|
||||
|
||||
/* Now define the internal interfaces. */
|
||||
extern ssize_t __readv (int __fd, __const struct iovec *__vector,
|
||||
extern ssize_t __readv (int __fd, __const struct iovec *__iovec,
|
||||
int __count);
|
||||
extern ssize_t __libc_readv (int __fd, __const struct iovec *__vector,
|
||||
extern ssize_t __libc_readv (int __fd, __const struct iovec *__iovec,
|
||||
int __count);
|
||||
extern ssize_t __writev (int __fd, __const struct iovec *__vector,
|
||||
extern ssize_t __writev (int __fd, __const struct iovec *__iovec,
|
||||
int __count);
|
||||
extern ssize_t __libc_writev (int __fd, __const struct iovec *__vector,
|
||||
extern ssize_t __libc_writev (int __fd, __const struct iovec *__iovec,
|
||||
int __count);
|
||||
#endif
|
||||
|
||||
+1
-4
@@ -171,10 +171,7 @@ extern int __libc_pause (void);
|
||||
extern int __pause_nocancel (void) attribute_hidden;
|
||||
|
||||
extern int __have_sock_cloexec;
|
||||
/* At lot of other functionality became available at the same time as
|
||||
SOCK_CLOEXEC. Avoid defining separate variables for all of them
|
||||
unless it is really necessary. */
|
||||
#define __have_pipe2 __have_sock_cloexec
|
||||
extern int __have_pipe2;
|
||||
|
||||
extern int __getlogin_r_loginuid (char *name, size_t namesize)
|
||||
attribute_hidden;
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ routines := \
|
||||
sendfile sendfile64 \
|
||||
utimensat futimens
|
||||
|
||||
aux := have_o_cloexec
|
||||
aux := have_o_cloexec have_pipe2
|
||||
|
||||
# These routines will be omitted from the libc shared object.
|
||||
# Instead the static object files will be included in a special archive
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/* Copyright (C) 2011 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 <unistd.h>
|
||||
#include <kernel-features.h>
|
||||
|
||||
#ifndef __ASSUME_PIPE2
|
||||
int __have_pipe2;
|
||||
#endif
|
||||
@@ -4607,6 +4607,10 @@ nearbyint_test (void)
|
||||
TEST_f_f (nearbyint, minus_infty, minus_infty);
|
||||
TEST_f_f (nearbyint, nan_value, nan_value);
|
||||
|
||||
/* Subnormal values */
|
||||
TEST_f_f (nearbyint, -8.98847e+307, -8.98847e+307);
|
||||
TEST_f_f (nearbyint, -4.45015e-308, minus_zero);
|
||||
|
||||
/* Default rounding mode is round to nearest. */
|
||||
TEST_f_f (nearbyint, 0.5, 0.0);
|
||||
TEST_f_f (nearbyint, 1.5, 2.0);
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
2011-04-10 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12650]
|
||||
* allocatestack.c (get_cached_stack): Deallocate DTV entries before
|
||||
clearing memory.
|
||||
Patch partly by Robert Rex <robert.rex@exasol.com>.
|
||||
|
||||
2011-01-19 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* pthread_cond_wait.c (__pthread_cond_wait): Fix comment typo.
|
||||
|
||||
+1
-1
@@ -255,6 +255,6 @@ libpthread {
|
||||
GLIBC_PRIVATE {
|
||||
__pthread_initialize_minimal;
|
||||
__pthread_clock_gettime; __pthread_clock_settime;
|
||||
__pthread_unwind;
|
||||
__pthread_unwind; __pthread_get_minstack;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2002-2007, 2009, 2010 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2002-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sys/param.h>
|
||||
#include <dl-sysdep.h>
|
||||
#include <dl-tls.h>
|
||||
#include <tls.h>
|
||||
#include <lowlevellock.h>
|
||||
#include <kernel-features.h>
|
||||
@@ -241,6 +242,10 @@ get_cached_stack (size_t *sizep, void **memp)
|
||||
|
||||
/* Clear the DTV. */
|
||||
dtv_t *dtv = GET_DTV (TLS_TPADJ (result));
|
||||
for (size_t cnt = 0; cnt < dtv[-1].counter; ++cnt)
|
||||
if (! dtv[1 + cnt].pointer.is_static
|
||||
&& dtv[1 + cnt].pointer.val != TLS_DTV_UNALLOCATED)
|
||||
free (dtv[1 + cnt].pointer.val);
|
||||
memset (dtv, '\0', (dtv[-1].counter + 1) * sizeof (dtv_t));
|
||||
|
||||
/* Re-initialize the TLS. */
|
||||
|
||||
+11
-1
@@ -408,7 +408,7 @@ __pthread_initialize_minimal_internal (void)
|
||||
|
||||
/* Make sure it meets the minimum size that allocate_stack
|
||||
(allocatestack.c) will demand, which depends on the page size. */
|
||||
const uintptr_t pagesz = __sysconf (_SC_PAGESIZE);
|
||||
const uintptr_t pagesz = GLRO(dl_pagesize);
|
||||
const size_t minstack = pagesz + __static_tls_size + MINIMAL_REST_STACK;
|
||||
if (limit.rlim_cur < minstack)
|
||||
limit.rlim_cur = minstack;
|
||||
@@ -450,3 +450,13 @@ __pthread_initialize_minimal_internal (void)
|
||||
}
|
||||
strong_alias (__pthread_initialize_minimal_internal,
|
||||
__pthread_initialize_minimal)
|
||||
|
||||
|
||||
size_t
|
||||
__pthread_get_minstack (const pthread_attr_t *attr)
|
||||
{
|
||||
struct pthread_attr *iattr = (struct pthread_attr *) attr;
|
||||
|
||||
return (GLRO(dl_pagesize) + __static_tls_size + PTHREAD_STACK_MIN
|
||||
+ iattr->guardsize);
|
||||
}
|
||||
|
||||
@@ -397,6 +397,7 @@ weak_function;
|
||||
|
||||
extern void __pthread_init_static_tls (struct link_map *) attribute_hidden;
|
||||
|
||||
extern size_t __pthread_get_minstack (const pthread_attr_t *attr);
|
||||
|
||||
/* Namespace save aliases. */
|
||||
extern int __pthread_getschedparam (pthread_t thread_id, int *policy,
|
||||
|
||||
@@ -47,7 +47,7 @@ __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
|
||||
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
|
||||
|
||||
/* The helper thread needs only very little resources. */
|
||||
(void) pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
|
||||
(void) pthread_attr_setstacksize (&attr, __pthread_get_minstack (&attr));
|
||||
|
||||
/* Block all signals in the helper thread. To do this thoroughly we
|
||||
temporarily have to block all signals here. */
|
||||
|
||||
@@ -165,7 +165,7 @@ __start_helper_thread (void)
|
||||
and should go away automatically when canceled. */
|
||||
pthread_attr_t attr;
|
||||
(void) pthread_attr_init (&attr);
|
||||
(void) pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
|
||||
(void) pthread_attr_setstacksize (&attr, __pthread_get_minstack (&attr));
|
||||
|
||||
/* Block all signals in the helper thread but SIGSETXID. To do this
|
||||
thoroughly we temporarily have to block all signals here. The
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997, 2011 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
|
||||
@@ -49,8 +49,8 @@ sgetspent (const char *string)
|
||||
}
|
||||
|
||||
while (buffer != NULL
|
||||
&& __sgetspent_r (string, &resbuf, buffer, buffer_size, &result) != 0
|
||||
&& errno == ERANGE)
|
||||
&& (__sgetspent_r (string, &resbuf, buffer, buffer_size, &result)
|
||||
== ERANGE))
|
||||
{
|
||||
char *new_buf;
|
||||
buffer_size += BUFLEN_SPWD;
|
||||
|
||||
@@ -30,8 +30,8 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
|
||||
# define decimal NULL
|
||||
# define thousands NULL
|
||||
#else
|
||||
char decimal[MB_LEN_MAX];
|
||||
char thousands[MB_LEN_MAX];
|
||||
char decimal[MB_LEN_MAX + 1];
|
||||
char thousands[MB_LEN_MAX + 1];
|
||||
#endif
|
||||
|
||||
/* "to_outpunct" is a map from ASCII decimal point and thousands-sep
|
||||
@@ -47,13 +47,19 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
|
||||
mbstate_t state;
|
||||
memset (&state, '\0', sizeof (state));
|
||||
|
||||
if (__wcrtomb (decimal, wdecimal, &state) == (size_t) -1)
|
||||
size_t n = __wcrtomb (decimal, wdecimal, &state);
|
||||
if (n == (size_t) -1)
|
||||
memcpy (decimal, ".", 2);
|
||||
else
|
||||
decimal[n] = '\0';
|
||||
|
||||
memset (&state, '\0', sizeof (state));
|
||||
|
||||
if (__wcrtomb (thousands, wthousands, &state) == (size_t) -1)
|
||||
n = __wcrtomb (thousands, wthousands, &state);
|
||||
if (n == (size_t) -1)
|
||||
memcpy (thousands, ",", 2);
|
||||
else
|
||||
thousands[n] = '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -295,9 +295,9 @@ __parse_one_specmb (const UCHAR_T *format, size_t posn,
|
||||
/* We don't try to get the types for all arguments if the format
|
||||
uses more than one. The normal case is covered though. If
|
||||
the call returns -1 we continue with the normal specifiers. */
|
||||
|| (spec->ndata_args = (*__printf_arginfo_table[spec->info.spec])
|
||||
(&spec->info, 1, &spec->data_arg_type,
|
||||
&spec->size)) < 0)
|
||||
|| (int) (spec->ndata_args = (*__printf_arginfo_table[spec->info.spec])
|
||||
(&spec->info, 1, &spec->data_arg_type,
|
||||
&spec->size)) < 0)
|
||||
{
|
||||
/* Find the data argument types of a built-in spec. */
|
||||
spec->ndata_args = 1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Thread-local storage handling in the ELF dynamic linker. i386 version.
|
||||
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2004, 2011 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
|
||||
@@ -58,3 +58,6 @@ strong_alias (___tls_get_addr, ___tls_get_addr_internal)
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Value used for dtv entries for which the allocation is delayed. */
|
||||
#define TLS_DTV_UNALLOCATED ((void *) -1l)
|
||||
|
||||
@@ -110,7 +110,7 @@ __i686.get_pc_thunk.bx:
|
||||
#endif
|
||||
|
||||
.section .text.ssse3,"ax",@progbits
|
||||
#if defined SHARED && !defined NOT_IN_libc && !defined USE_AS_BCOPY
|
||||
#if !defined USE_AS_BCOPY
|
||||
ENTRY (MEMCPY_CHK)
|
||||
movl 12(%esp), %eax
|
||||
cmpl %eax, 16(%esp)
|
||||
|
||||
@@ -110,7 +110,7 @@ __i686.get_pc_thunk.bx:
|
||||
#endif
|
||||
|
||||
.section .text.ssse3,"ax",@progbits
|
||||
#if defined SHARED && !defined NOT_IN_libc && !defined USE_AS_BCOPY
|
||||
#if !defined USE_AS_BCOPY
|
||||
ENTRY (MEMCPY_CHK)
|
||||
movl 12(%esp), %eax
|
||||
cmpl %eax, 16(%esp)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Thread-local storage handling in the ELF dynamic linker. IA-64 version.
|
||||
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2011 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
|
||||
@@ -28,3 +28,6 @@
|
||||
#define DONT_USE_TLS_INDEX 1
|
||||
|
||||
extern void *__tls_get_addr (size_t m, size_t offset);
|
||||
|
||||
/* Value used for dtv entries for which the allocation is delayed. */
|
||||
#define TLS_DTV_UNALLOCATED ((void *) -1l)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* IBM Accurate Mathematical Library
|
||||
* written by International Business Machines Corp.
|
||||
* Copyright (C) 2001, 2005 Free Software Foundation
|
||||
* Copyright (C) 2001, 2005, 2011 Free Software Foundation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -40,13 +40,11 @@
|
||||
#include "dla.h"
|
||||
#include "math_private.h"
|
||||
|
||||
double __ieee754_sqrt(double x);
|
||||
|
||||
static const int4 tab54[32] = {
|
||||
262143, 11585, 1782, 511, 210, 107, 63, 42,
|
||||
30, 22, 17, 14, 12, 10, 9, 7,
|
||||
7, 6, 5, 5, 5, 4, 4, 4,
|
||||
3, 3, 3, 3, 3, 3, 3, 3 };
|
||||
7, 6, 5, 5, 5, 4, 4, 4,
|
||||
3, 3, 3, 3, 3, 3, 3, 3 };
|
||||
|
||||
|
||||
double __halfulp(double x, double y)
|
||||
@@ -64,12 +62,12 @@ double __halfulp(double x, double y)
|
||||
z = (double) k;
|
||||
return (z*y == -1075.0)?0: -10.0;
|
||||
}
|
||||
/* if y > 0 */
|
||||
/* if y > 0 */
|
||||
v.x = y;
|
||||
if (v.i[LOW_HALF] != 0) return -10.0;
|
||||
|
||||
v.x=x;
|
||||
/* case where x = 2**n for some integer n */
|
||||
/* case where x = 2**n for some integer n */
|
||||
if (((v.i[HIGH_HALF]&0x000fffff)|v.i[LOW_HALF]) == 0) {
|
||||
k=(v.i[HIGH_HALF]>>20)-1023;
|
||||
return (((double) k)*y == -1075.0)?0:-10.0;
|
||||
@@ -90,7 +88,7 @@ double __halfulp(double x, double y)
|
||||
k = -k;
|
||||
if (k>5) return -10.0;
|
||||
|
||||
/* now treat x */
|
||||
/* now treat x */
|
||||
while (k>0) {
|
||||
z = __ieee754_sqrt(x);
|
||||
EMULV(z,z,u,uu,j1,j2,j3,j4,j5);
|
||||
@@ -111,11 +109,11 @@ double __halfulp(double x, double y)
|
||||
m = (k&0x000fffff)|0x00100000;
|
||||
m = m>>(20-l); /* m is the odd integer of x */
|
||||
|
||||
/* now check whether the length of m**n is at most 54 bits */
|
||||
/* now check whether the length of m**n is at most 54 bits */
|
||||
|
||||
if (m > tab54[n-3]) return -10.0;
|
||||
|
||||
/* yes, it is - now compute x**n by simple multiplications */
|
||||
/* yes, it is - now compute x**n by simple multiplications */
|
||||
|
||||
u = x;
|
||||
for (k=1;k<n;k++) u = u*x;
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include "math_private.h"
|
||||
#include <math_ldbl_opt.h>
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/* Compute x * y + z as ternary operation.
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by David Flaherty <flaherty@linux.vnet.ibm.com>.
|
||||
|
||||
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 <math.h>
|
||||
#include <math_ldbl_opt.h>
|
||||
|
||||
long double
|
||||
__fmal (long double x, long double y, long double z)
|
||||
{
|
||||
/* An IBM long double 128 is really just 2 IEEE64 doubles, and in
|
||||
* the case of inf/nan only the first double counts. So we use the
|
||||
* (double) cast to avoid any data movement. */
|
||||
if ((finite ((double)x) && finite ((double)y)) && isinf ((double)z))
|
||||
return (z);
|
||||
|
||||
return (x * y) + z;
|
||||
}
|
||||
#ifdef IS_IN_libm
|
||||
long_double_symbol (libm, __fmal, fmal);
|
||||
#else
|
||||
long_double_symbol (libc, __fmal, fmal);
|
||||
#endif
|
||||
@@ -2,10 +2,6 @@
|
||||
# machine.
|
||||
+cflags += -mnew-mnemonics
|
||||
|
||||
ifeq ($(subdir),gmon)
|
||||
sysdep_routines += ppc-mcount
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),string)
|
||||
CFLAGS-memcmp.c += -Wno-uninitialized
|
||||
endif
|
||||
@@ -27,4 +23,6 @@ endif
|
||||
ifeq ($(subdir),csu)
|
||||
# get offset to rtld_global._dl_hwcap
|
||||
gen-as-const-headers += rtld-global-offsets.sym
|
||||
# get offset to __locale_struct.__ctype_tolower
|
||||
gen-as-const-headers += locale-defines.sym
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Thread-local storage handling in the ELF dynamic linker. PowerPC version.
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2011 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
|
||||
@@ -47,3 +47,6 @@ extern void *__tls_get_addr (tls_index *ti);
|
||||
# define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET)
|
||||
# define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET)
|
||||
#endif
|
||||
|
||||
/* Value used for dtv entries for which the allocation is delayed. */
|
||||
#define TLS_DTV_UNALLOCATED ((void *) -1l)
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/* Pythagorean addition using doubles
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library
|
||||
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const double two60 = 1.152921504606847e+18;
|
||||
static const double two500 = 3.2733906078961419e+150;
|
||||
static const double two600 = 4.149515568880993e+180;
|
||||
static const double two1022 = 4.49423283715579e+307;
|
||||
static const double twoM500 = 3.054936363499605e-151;
|
||||
static const double twoM600 = 2.4099198651028841e-181;
|
||||
static const double pdnum = 2.225073858507201e-308;
|
||||
|
||||
/* __ieee754_hypot(x,y)
|
||||
*
|
||||
* This a FP only version without any FP->INT conversion.
|
||||
* It is similar to default C version, making appropriates
|
||||
* overflow and underflows checks as well scaling when it
|
||||
* is needed.
|
||||
*/
|
||||
|
||||
#ifdef _ARCH_PWR7
|
||||
/* POWER7 isinf and isnan optimization are fast. */
|
||||
# define TEST_INF_NAN(x, y) \
|
||||
if (isinf(x) || isinf(y)) \
|
||||
return INFINITY; \
|
||||
if (isnan(x) || isnan(y)) \
|
||||
return NAN;
|
||||
# else
|
||||
/* For POWER6 and below isinf/isnan triggers LHS and PLT calls are
|
||||
* costly (especially for POWER6). */
|
||||
# define GET_TW0_HIGH_WORD(d1,d2,i1,i2) \
|
||||
do { \
|
||||
ieee_double_shape_type gh_u1; \
|
||||
ieee_double_shape_type gh_u2; \
|
||||
gh_u1.value = (d1); \
|
||||
gh_u2.value = (d2); \
|
||||
(i1) = gh_u1.parts.msw; \
|
||||
(i2) = gh_u2.parts.msw; \
|
||||
} while (0)
|
||||
|
||||
# define TEST_INF_NAN(x, y) \
|
||||
do { \
|
||||
int32_t hx, hy; \
|
||||
GET_TW0_HIGH_WORD(x, y, hx, hy); \
|
||||
if (hy > hx) { \
|
||||
uint32_t ht = hx; hx = hy; hy = ht; \
|
||||
} \
|
||||
if (hx >= 0x7ff00000) { \
|
||||
if (hx == 0x7ff00000 || hy == 0x7ff00000) \
|
||||
return INFINITY; \
|
||||
return NAN; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
double
|
||||
__ieee754_hypot (double x, double y)
|
||||
{
|
||||
x = fabs (x);
|
||||
y = fabs (y);
|
||||
|
||||
TEST_INF_NAN (x, y);
|
||||
|
||||
if (y > x)
|
||||
{
|
||||
double t = x;
|
||||
x = y;
|
||||
y = t;
|
||||
}
|
||||
if (y == 0.0 || (x / y) > two60)
|
||||
{
|
||||
return x + y;
|
||||
}
|
||||
if (x > two500)
|
||||
{
|
||||
x *= twoM600;
|
||||
y *= twoM600;
|
||||
return __ieee754_sqrt (x * x + y * y) / twoM600;
|
||||
}
|
||||
if (y < twoM500)
|
||||
{
|
||||
if (y <= pdnum)
|
||||
{
|
||||
x *= two1022;
|
||||
y *= two1022;
|
||||
return __ieee754_sqrt (x * x + y * y) / two1022;
|
||||
}
|
||||
else
|
||||
{
|
||||
x *= two600;
|
||||
y *= two600;
|
||||
return __ieee754_sqrt (x * x + y * y) / two600;
|
||||
}
|
||||
}
|
||||
return __ieee754_sqrt (x * x + y * y);
|
||||
}
|
||||
strong_alias (__ieee754_hypot, __hypot_finite)
|
||||
@@ -0,0 +1,119 @@
|
||||
/* Pythagorean addition using floats
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
static const float two30 = 1.0737418e09;
|
||||
static const float two50 = 1.1259000e15;
|
||||
static const float two60 = 1.1529221e18;
|
||||
static const float two126 = 8.5070592e+37;
|
||||
static const float twoM50 = 8.8817842e-16;
|
||||
static const float twoM60 = 6.7762644e-21;
|
||||
static const float pdnum = 1.1754939e-38;
|
||||
|
||||
|
||||
/* __ieee754_hypotf(x,y)
|
||||
*
|
||||
* This a FP only version without any FP->INT conversion.
|
||||
* It is similar to default C version, making appropriates
|
||||
* overflow and underflows checks as well scaling when it
|
||||
* is needed.
|
||||
*/
|
||||
|
||||
#ifdef _ARCH_PWR7
|
||||
/* POWER7 isinf and isnan optimizations are fast. */
|
||||
# define TEST_INF_NAN(x, y) \
|
||||
if (isinff(x) || isinff(y)) \
|
||||
return INFINITY; \
|
||||
if (isnanf(x) || isnanf(y)) \
|
||||
return NAN;
|
||||
# else
|
||||
/* For POWER6 and below isinf/isnan triggers LHS and PLT calls are
|
||||
* costly (especially for POWER6). */
|
||||
# define GET_TWO_FLOAT_WORD(f1,f2,i1,i2) \
|
||||
do { \
|
||||
ieee_float_shape_type gf_u1; \
|
||||
ieee_float_shape_type gf_u2; \
|
||||
gf_u1.value = (f1); \
|
||||
gf_u2.value = (f2); \
|
||||
(i1) = gf_u1.word; \
|
||||
(i2) = gf_u2.word; \
|
||||
} while (0)
|
||||
|
||||
# define TEST_INF_NAN(x, y) \
|
||||
do { \
|
||||
int32_t hx, hy; \
|
||||
GET_TWO_FLOAT_WORD(x, y, hx, hy); \
|
||||
if (hy > hx) { \
|
||||
uint32_t ht = hx; hx = hy; hy = ht; \
|
||||
} \
|
||||
if (hx >= 0x7f800000) { \
|
||||
if (hx == 0x7f800000 || hy == 0x7f800000) \
|
||||
return INFINITY; \
|
||||
return NAN; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
|
||||
float
|
||||
__ieee754_hypotf (float x, float y)
|
||||
{
|
||||
x = fabsf (x);
|
||||
y = fabsf (y);
|
||||
|
||||
TEST_INF_NAN (x, y);
|
||||
|
||||
if (y > x)
|
||||
{
|
||||
float t = y;
|
||||
y = x;
|
||||
x = t;
|
||||
}
|
||||
if (y == 0.0 || (x / y) > two30)
|
||||
{
|
||||
return x + y;
|
||||
}
|
||||
if (x > two50)
|
||||
{
|
||||
x *= twoM60;
|
||||
y *= twoM60;
|
||||
return __ieee754_sqrtf (x * x + y * y) / twoM60;
|
||||
}
|
||||
if (y < twoM50)
|
||||
{
|
||||
if (y <= pdnum)
|
||||
{
|
||||
x *= two126;
|
||||
y *= two126;
|
||||
return __ieee754_sqrtf (x * x + y * y) / two126;
|
||||
}
|
||||
else
|
||||
{
|
||||
x *= two60;
|
||||
y *= two60;
|
||||
return __ieee754_sqrtf (x * x + y * y) / two60;
|
||||
}
|
||||
}
|
||||
return __ieee754_sqrtf (x * x + y * y);
|
||||
}
|
||||
strong_alias (__ieee754_hypotf, __hypotf_finite)
|
||||
@@ -0,0 +1,189 @@
|
||||
/* e_rem_pio2f.c -- float version of e_rem_pio2.c
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
#include "s_float_bitwise.h"
|
||||
|
||||
/* defined in sysdeps/powerpc/fpu/k_rem_pio2f.c */
|
||||
int __fp_kernel_rem_pio2f (float *x, float *y, float e0, int32_t nx);
|
||||
|
||||
/* __ieee754_rem_pio2f(x,y)
|
||||
*
|
||||
* return the remainder of x rem pi/2 in y[0]+y[1]
|
||||
*/
|
||||
|
||||
static const float npio2_hw[] = {
|
||||
1.57077026e+00, 3.14154053e+00, 4.71228027e+00, 6.28308105e+00,
|
||||
7.85388184e+00, 9.42456055e+00, 1.09953613e+01, 1.25661621e+01,
|
||||
1.41369629e+01, 1.57077637e+01, 1.72783203e+01, 1.88491211e+01,
|
||||
2.04199219e+01, 2.19907227e+01, 2.35615234e+01, 2.51323242e+01,
|
||||
2.67031250e+01, 2.82739258e+01, 2.98447266e+01, 3.14155273e+01,
|
||||
3.29863281e+01, 3.45566406e+01, 3.61279297e+01, 3.76982422e+01,
|
||||
3.92695312e+01, 4.08398438e+01, 4.24111328e+01, 4.39814453e+01,
|
||||
4.55527344e+01, 4.71230469e+01, 4.86943359e+01, 5.02646484e+01
|
||||
};
|
||||
|
||||
|
||||
static const float zero = 0.0000000000e+00;
|
||||
static const float two8 = 2.5600000000e+02;
|
||||
|
||||
static const float half = 5.0000000000e-01;
|
||||
static const float invpio2 = 6.3661980629e-01;
|
||||
static const float pio2_1 = 1.5707855225e+00;
|
||||
static const float pio2_1t = 1.0804334124e-05;
|
||||
static const float pio2_2 = 1.0804273188e-05;
|
||||
static const float pio2_2t = 6.0770999344e-11;
|
||||
static const float pio2_3 = 6.0770943833e-11;
|
||||
static const float pio2_3t = 6.1232342629e-17;
|
||||
|
||||
static const float pio4 = 7.8539801e-01;
|
||||
static const float pio3_4 = 2.3561945e+00;
|
||||
static const float pio2_24b = 1.5707951e+00;
|
||||
static const float pio2_2e7 = 2.0106054e+02;
|
||||
|
||||
|
||||
int32_t
|
||||
__ieee754_rem_pio2f (float x, float *y)
|
||||
{
|
||||
float ax, z, n, r, w, t, e0;
|
||||
float tx[3];
|
||||
int32_t i, nx;
|
||||
|
||||
ax = __builtin_fabsf (x);
|
||||
if (ax <= pio4)
|
||||
{
|
||||
y[0] = x;
|
||||
y[1] = 0;
|
||||
return 0;
|
||||
}
|
||||
if (ax < pio3_4)
|
||||
{
|
||||
if (x > 0)
|
||||
{
|
||||
z = x - pio2_1;
|
||||
if (!__float_and_test28 (ax, pio2_24b))
|
||||
{
|
||||
y[0] = z - pio2_1t;
|
||||
y[1] = (z - y[0]) - pio2_1t;
|
||||
}
|
||||
else
|
||||
{
|
||||
z -= pio2_2;
|
||||
y[0] = z - pio2_2t;
|
||||
y[1] = (z - y[0]) - pio2_2t;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
z = x + pio2_1;
|
||||
if (!__float_and_test28 (ax, pio2_24b))
|
||||
{
|
||||
y[0] = z + pio2_1t;
|
||||
y[1] = (z - y[0]) + pio2_1t;
|
||||
}
|
||||
else
|
||||
{
|
||||
z += pio2_2;
|
||||
y[0] = z + pio2_2t;
|
||||
y[1] = (z - y[0]) + pio2_2t;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (ax <= pio2_2e7)
|
||||
{
|
||||
n = __floorf (ax * invpio2 + half);
|
||||
i = (int32_t) n;
|
||||
r = ax - n * pio2_1;
|
||||
w = n * pio2_1t; /* 1st round good to 40 bit */
|
||||
if (i < 32 && !__float_and_test24 (ax, npio2_hw[i - 1]))
|
||||
{
|
||||
y[0] = r - w;
|
||||
}
|
||||
else
|
||||
{
|
||||
float i, j;
|
||||
j = __float_and8 (ax);
|
||||
y[0] = r - w;
|
||||
i = __float_and8 (y[0]);
|
||||
if (j / i > 256.0 || j / i < 3.9062500e-3)
|
||||
{ /* 2nd iterations needed, good to 57 */
|
||||
t = r;
|
||||
w = n * pio2_2;
|
||||
r = t - w;
|
||||
w = n * pio2_2t - ((t - r) - w);
|
||||
y[0] = r - w;
|
||||
i = __float_and8 (y[0]);
|
||||
if (j / i > 33554432 || j / i < 2.9802322e-8)
|
||||
{ /* 3rd iteration needed, 74 bits acc */
|
||||
t = r;
|
||||
w = n * pio2_3;
|
||||
r = t - w;
|
||||
w = n * pio2_3t - ((t - r) - w);
|
||||
y[0] = r - w;
|
||||
}
|
||||
}
|
||||
}
|
||||
y[1] = (r - y[0]) - w;
|
||||
if (x < 0)
|
||||
{
|
||||
y[0] = -y[0];
|
||||
y[1] = -y[1];
|
||||
return -i;
|
||||
}
|
||||
else
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
/* all other (large) arguments */
|
||||
if (isnanf (x) || isinff (x))
|
||||
{
|
||||
y[0] = y[1] = x - x;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* set z = scalbn(|x|,ilogb(x)-7) */
|
||||
e0 = __float_and8 (ax / 128.0);
|
||||
z = ax / e0;
|
||||
|
||||
tx[0] = __floorf (z);
|
||||
z = (z - tx[0]) * two8;
|
||||
tx[1] = __floorf (z);
|
||||
z = (z - tx[1]) * two8;
|
||||
tx[2] = __floorf (z);
|
||||
|
||||
nx = 3;
|
||||
while (tx[nx - 1] == zero)
|
||||
nx--;
|
||||
|
||||
i = __fp_kernel_rem_pio2f (tx, y, e0, nx);
|
||||
if (x < 0)
|
||||
{
|
||||
y[0] = -y[0];
|
||||
y[1] = -y[1];
|
||||
return -i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Double-precision floating point square root.
|
||||
Copyright (C) 1997, 2002, 2003, 2004, 2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 2002-2004, 2008, 2011 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
|
||||
@@ -46,21 +46,15 @@ extern const float __t_sqrt[1024];
|
||||
generated guesses (which mostly runs on the integer unit, while the
|
||||
Newton-Raphson is running on the FPU). */
|
||||
|
||||
#ifdef __STDC__
|
||||
double
|
||||
__slow_ieee754_sqrt (double x)
|
||||
#else
|
||||
double
|
||||
__slow_ieee754_sqrt (x)
|
||||
double x;
|
||||
#endif
|
||||
{
|
||||
const float inf = a_inf.value;
|
||||
|
||||
if (x > 0)
|
||||
{
|
||||
/* schedule the EXTRACT_WORDS to get separation between the store
|
||||
and the load. */
|
||||
and the load. */
|
||||
ieee_double_shape_type ew_u;
|
||||
ieee_double_shape_type iw_u;
|
||||
ew_u.value = (x);
|
||||
@@ -147,7 +141,7 @@ __slow_ieee754_sqrt (x)
|
||||
else if (x < 0)
|
||||
{
|
||||
/* For some reason, some PowerPC32 processors don't implement
|
||||
FE_INVALID_SQRT. */
|
||||
FE_INVALID_SQRT. */
|
||||
#ifdef FE_INVALID_SQRT
|
||||
feraiseexcept (FE_INVALID_SQRT);
|
||||
|
||||
@@ -160,14 +154,9 @@ __slow_ieee754_sqrt (x)
|
||||
return f_wash (x);
|
||||
}
|
||||
|
||||
#ifdef __STDC__
|
||||
#undef __ieee754_sqrt
|
||||
double
|
||||
__ieee754_sqrt (double x)
|
||||
#else
|
||||
double
|
||||
__ieee754_sqrt (x)
|
||||
double x;
|
||||
#endif
|
||||
{
|
||||
double z;
|
||||
|
||||
@@ -175,7 +164,7 @@ __ieee754_sqrt (x)
|
||||
if (__CPU_HAS_FSQRT)
|
||||
{
|
||||
/* Volatile is required to prevent the compiler from moving the
|
||||
fsqrt instruction above the branch. */
|
||||
fsqrt instruction above the branch. */
|
||||
__asm __volatile (" fsqrt %0,%1\n"
|
||||
:"=f" (z):"f" (x));
|
||||
}
|
||||
@@ -184,3 +173,4 @@ __ieee754_sqrt (x)
|
||||
|
||||
return z;
|
||||
}
|
||||
strong_alias (__ieee754_sqrt, __sqrt_finite)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Single-precision floating point square root.
|
||||
Copyright (C) 1997, 2003, 2004, 2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 2003, 2004, 2008, 2011 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
|
||||
@@ -46,14 +46,8 @@ extern const float __t_sqrt[1024];
|
||||
generated guesses (which mostly runs on the integer unit, while the
|
||||
Newton-Raphson is running on the FPU). */
|
||||
|
||||
#ifdef __STDC__
|
||||
float
|
||||
__slow_ieee754_sqrtf (float x)
|
||||
#else
|
||||
float
|
||||
__slow_ieee754_sqrtf (x)
|
||||
float x;
|
||||
#endif
|
||||
{
|
||||
const float inf = a_inf.value;
|
||||
|
||||
@@ -123,7 +117,7 @@ __slow_ieee754_sqrtf (x)
|
||||
else if (x < 0)
|
||||
{
|
||||
/* For some reason, some PowerPC32 processors don't implement
|
||||
FE_INVALID_SQRT. */
|
||||
FE_INVALID_SQRT. */
|
||||
#ifdef FE_INVALID_SQRT
|
||||
feraiseexcept (FE_INVALID_SQRT);
|
||||
|
||||
@@ -136,15 +130,9 @@ __slow_ieee754_sqrtf (x)
|
||||
return f_washf (x);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __STDC__
|
||||
#undef __ieee754_sqrtf
|
||||
float
|
||||
__ieee754_sqrtf (float x)
|
||||
#else
|
||||
float
|
||||
__ieee754_sqrtf (x)
|
||||
float x;
|
||||
#endif
|
||||
{
|
||||
double z;
|
||||
|
||||
@@ -152,7 +140,7 @@ __ieee754_sqrtf (x)
|
||||
if (__CPU_HAS_FSQRT)
|
||||
{
|
||||
/* Volatile is required to prevent the compiler from moving the
|
||||
fsqrt instruction above the branch. */
|
||||
fsqrt instruction above the branch. */
|
||||
__asm __volatile (" fsqrts %0,%1\n"
|
||||
:"=f" (z):"f" (x));
|
||||
}
|
||||
@@ -161,3 +149,4 @@ __ieee754_sqrtf (x)
|
||||
|
||||
return z;
|
||||
}
|
||||
strong_alias (__ieee754_sqrtf, __sqrtf_finite)
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/* k_cosf.c -- float version of k_cos.c
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const float twom27 = 7.4505806e-09;
|
||||
static const float dot3 = 3.0000001e-01;
|
||||
static const float dot78125 = 7.8125000e-01;
|
||||
|
||||
static const float one = 1.0000000000e+00;
|
||||
static const float C1 = 4.1666667908e-02;
|
||||
static const float C2 = -1.3888889225e-03;
|
||||
static const float C3 = 2.4801587642e-05;
|
||||
static const float C4 = -2.7557314297e-07;
|
||||
static const float C5 = 2.0875723372e-09;
|
||||
static const float C6 = -1.1359647598e-11;
|
||||
|
||||
float
|
||||
__kernel_cosf (float x, float y)
|
||||
{
|
||||
float a, hz, z, r, qx;
|
||||
float ix;
|
||||
ix = __builtin_fabsf (x);
|
||||
if (ix < twom27)
|
||||
{ /* |x| < 2**-27 */
|
||||
if (x == 0.0)
|
||||
return one;
|
||||
}
|
||||
z = x * x;
|
||||
r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * C6)))));
|
||||
if (ix < dot3) /* if |x| < 0.3 */
|
||||
return one - ((float) 0.5 * z - (z * r - x * y));
|
||||
else
|
||||
{
|
||||
if (ix > dot78125)
|
||||
{ /* x > 0.78125 */
|
||||
qx = (float) 0.28125;
|
||||
}
|
||||
else
|
||||
{
|
||||
qx = ix / 4.0;
|
||||
}
|
||||
hz = (float) 0.5 *z - qx;
|
||||
a = one - qx;
|
||||
return a - (hz - (z * r - x * y));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
/* k_rem_pio2f.c -- float version of e_rem_pio2.c
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "math_private.h"
|
||||
#include "s_float_bitwise.h"
|
||||
|
||||
|
||||
static const float two_over_pi[] = {
|
||||
1.62000000e+02, 2.49000000e+02, 1.31000000e+02, 1.10000000e+02,
|
||||
7.80000000e+01, 6.80000000e+01, 2.10000000e+01, 4.10000000e+01,
|
||||
2.52000000e+02, 3.90000000e+01, 8.70000000e+01, 2.09000000e+02,
|
||||
2.45000000e+02, 5.20000000e+01, 2.21000000e+02, 1.92000000e+02,
|
||||
2.19000000e+02, 9.80000000e+01, 1.49000000e+02, 1.53000000e+02,
|
||||
6.00000000e+01, 6.70000000e+01, 1.44000000e+02, 6.50000000e+01,
|
||||
2.54000000e+02, 8.10000000e+01, 9.90000000e+01, 1.71000000e+02,
|
||||
2.22000000e+02, 1.87000000e+02, 1.97000000e+02, 9.70000000e+01,
|
||||
1.83000000e+02, 3.60000000e+01, 1.10000000e+02, 5.80000000e+01,
|
||||
6.60000000e+01, 7.70000000e+01, 2.10000000e+02, 2.24000000e+02,
|
||||
6.00000000e+00, 7.30000000e+01, 4.60000000e+01, 2.34000000e+02,
|
||||
9.00000000e+00, 2.09000000e+02, 1.46000000e+02, 2.80000000e+01,
|
||||
2.54000000e+02, 2.90000000e+01, 2.35000000e+02, 2.80000000e+01,
|
||||
1.77000000e+02, 4.10000000e+01, 1.67000000e+02, 6.20000000e+01,
|
||||
2.32000000e+02, 1.30000000e+02, 5.30000000e+01, 2.45000000e+02,
|
||||
4.60000000e+01, 1.87000000e+02, 6.80000000e+01, 1.32000000e+02,
|
||||
2.33000000e+02, 1.56000000e+02, 1.12000000e+02, 3.80000000e+01,
|
||||
1.80000000e+02, 9.50000000e+01, 1.26000000e+02, 6.50000000e+01,
|
||||
5.70000000e+01, 1.45000000e+02, 2.14000000e+02, 5.70000000e+01,
|
||||
1.31000000e+02, 8.30000000e+01, 5.70000000e+01, 2.44000000e+02,
|
||||
1.56000000e+02, 1.32000000e+02, 9.50000000e+01, 1.39000000e+02,
|
||||
1.89000000e+02, 2.49000000e+02, 4.00000000e+01, 5.90000000e+01,
|
||||
3.10000000e+01, 2.48000000e+02, 1.51000000e+02, 2.55000000e+02,
|
||||
2.22000000e+02, 5.00000000e+00, 1.52000000e+02, 1.50000000e+01,
|
||||
2.39000000e+02, 4.70000000e+01, 1.70000000e+01, 1.39000000e+02,
|
||||
9.00000000e+01, 1.00000000e+01, 1.09000000e+02, 3.10000000e+01,
|
||||
1.09000000e+02, 5.40000000e+01, 1.26000000e+02, 2.07000000e+02,
|
||||
3.90000000e+01, 2.03000000e+02, 9.00000000e+00, 1.83000000e+02,
|
||||
7.90000000e+01, 7.00000000e+01, 6.30000000e+01, 1.02000000e+02,
|
||||
1.58000000e+02, 9.50000000e+01, 2.34000000e+02, 4.50000000e+01,
|
||||
1.17000000e+02, 3.90000000e+01, 1.86000000e+02, 1.99000000e+02,
|
||||
2.35000000e+02, 2.29000000e+02, 2.41000000e+02, 1.23000000e+02,
|
||||
6.10000000e+01, 7.00000000e+00, 5.70000000e+01, 2.47000000e+02,
|
||||
1.38000000e+02, 8.20000000e+01, 1.46000000e+02, 2.34000000e+02,
|
||||
1.07000000e+02, 2.51000000e+02, 9.50000000e+01, 1.77000000e+02,
|
||||
3.10000000e+01, 1.41000000e+02, 9.30000000e+01, 8.00000000e+00,
|
||||
8.60000000e+01, 3.00000000e+00, 4.80000000e+01, 7.00000000e+01,
|
||||
2.52000000e+02, 1.23000000e+02, 1.07000000e+02, 1.71000000e+02,
|
||||
2.40000000e+02, 2.07000000e+02, 1.88000000e+02, 3.20000000e+01,
|
||||
1.54000000e+02, 2.44000000e+02, 5.40000000e+01, 2.90000000e+01,
|
||||
1.69000000e+02, 2.27000000e+02, 1.45000000e+02, 9.70000000e+01,
|
||||
9.40000000e+01, 2.30000000e+02, 2.70000000e+01, 8.00000000e+00,
|
||||
1.01000000e+02, 1.53000000e+02, 1.33000000e+02, 9.50000000e+01,
|
||||
2.00000000e+01, 1.60000000e+02, 1.04000000e+02, 6.40000000e+01,
|
||||
1.41000000e+02, 2.55000000e+02, 2.16000000e+02, 1.28000000e+02,
|
||||
7.70000000e+01, 1.15000000e+02, 3.90000000e+01, 4.90000000e+01,
|
||||
6.00000000e+00, 6.00000000e+00, 2.10000000e+01, 8.60000000e+01,
|
||||
2.02000000e+02, 1.15000000e+02, 1.68000000e+02, 2.01000000e+02,
|
||||
9.60000000e+01, 2.26000000e+02, 1.23000000e+02, 1.92000000e+02,
|
||||
1.40000000e+02, 1.07000000e+02
|
||||
};
|
||||
|
||||
|
||||
static const float PIo2[] = {
|
||||
1.5703125000e+00, /* 0x3fc90000 */
|
||||
4.5776367188e-04, /* 0x39f00000 */
|
||||
2.5987625122e-05, /* 0x37da0000 */
|
||||
7.5437128544e-08, /* 0x33a20000 */
|
||||
6.0026650317e-11, /* 0x2e840000 */
|
||||
7.3896444519e-13, /* 0x2b500000 */
|
||||
5.3845816694e-15, /* 0x27c20000 */
|
||||
5.6378512969e-18, /* 0x22d00000 */
|
||||
8.3009228831e-20, /* 0x1fc40000 */
|
||||
3.2756352257e-22, /* 0x1bc60000 */
|
||||
6.3331015649e-25, /* 0x17440000 */
|
||||
};
|
||||
|
||||
|
||||
static const float zero = 0.0000000000e+00;
|
||||
static const float one = 1.0000000000;
|
||||
static const float twon8 = 3.9062500000e-03;
|
||||
static const float two8 = 2.5600000000e+02;
|
||||
|
||||
|
||||
int32_t
|
||||
__fp_kernel_rem_pio2f (float *x, float *y, float e0, int32_t nx)
|
||||
{
|
||||
int32_t jz, jx, jv, jp, jk, carry, n, iq[20], i, j, k, m, q0, ih, exp;
|
||||
float z, fw, f[20], fq[20], q[20];
|
||||
|
||||
/* initialize jk */
|
||||
jp = jk = 9;
|
||||
|
||||
/* determine jx,jv,q0, note that 3>q0 */
|
||||
jx = nx - 1;
|
||||
exp = __float_get_exp (e0) - 127;
|
||||
jv = (exp - 3) / 8;
|
||||
if (jv < 0)
|
||||
jv = 0;
|
||||
q0 = exp - 8 * (jv + 1);
|
||||
|
||||
/* set up f[0] to f[jx+jk] where f[jx+jk] = two_over_pi[jv+jk] */
|
||||
j = jv - jx;
|
||||
m = jx + jk;
|
||||
for (i = 0; i <= m; i++, j++)
|
||||
f[i] = (j < 0) ? zero : two_over_pi[j];
|
||||
|
||||
/* compute q[0],q[1],...q[jk] */
|
||||
for (i = 0; i <= jk; i++)
|
||||
{
|
||||
for (j = 0, fw = 0.0; j <= jx; j++)
|
||||
fw += x[j] * f[jx + i - j];
|
||||
q[i] = fw;
|
||||
}
|
||||
|
||||
jz = jk;
|
||||
recompute:
|
||||
/* distill q[] into iq[] reversingly */
|
||||
for (i = 0, j = jz, z = q[jz]; j > 0; i++, j--)
|
||||
{
|
||||
fw = __truncf (twon8 * z);
|
||||
iq[i] = (int32_t) (z - two8 * fw);
|
||||
z = q[j - 1] + fw;
|
||||
}
|
||||
|
||||
/* compute n */
|
||||
z = __scalbnf (z, q0); /* actual value of z */
|
||||
z -= 8.0 * __floorf (z * 0.125); /* trim off integer >= 8 */
|
||||
n = (int32_t) z;
|
||||
z -= __truncf (z);
|
||||
ih = 0;
|
||||
if (q0 > 0)
|
||||
{ /* need iq[jz-1] to determine n */
|
||||
i = (iq[jz - 1] >> (8 - q0));
|
||||
n += i;
|
||||
iq[jz - 1] -= i << (8 - q0);
|
||||
ih = iq[jz - 1] >> (7 - q0);
|
||||
}
|
||||
else if (q0 == 0)
|
||||
ih = iq[jz - 1] >> 8;
|
||||
else if (z >= 0.5)
|
||||
ih = 2;
|
||||
|
||||
if (ih > 0)
|
||||
{ /* q > 0.5 */
|
||||
n += 1;
|
||||
carry = 0;
|
||||
for (i = 0; i < jz; i++)
|
||||
{ /* compute 1-q */
|
||||
j = iq[i];
|
||||
if (carry == 0)
|
||||
{
|
||||
if (j != 0)
|
||||
{
|
||||
carry = 1;
|
||||
iq[i] = 0x100 - j;
|
||||
}
|
||||
}
|
||||
else
|
||||
iq[i] = 0xff - j;
|
||||
}
|
||||
if (q0 > 0)
|
||||
{ /* rare case: chance is 1 in 12 */
|
||||
switch (q0)
|
||||
{
|
||||
case 1:
|
||||
iq[jz - 1] &= 0x7f;
|
||||
break;
|
||||
case 2:
|
||||
iq[jz - 1] &= 0x3f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ih == 2)
|
||||
{
|
||||
z = one - z;
|
||||
if (carry != 0)
|
||||
z -= __scalbnf (one, q0);
|
||||
}
|
||||
}
|
||||
|
||||
/* check if recomputation is needed */
|
||||
if (z == zero)
|
||||
{
|
||||
j = 0;
|
||||
for (i = jz - 1; i >= jk; i--)
|
||||
j |= iq[i];
|
||||
if (j == 0)
|
||||
{ /* need recomputation */
|
||||
for (k = 1; iq[jk - k] == 0; k++); /* k = no. of terms needed */
|
||||
|
||||
for (i = jz + 1; i <= jz + k; i++)
|
||||
{ /* add q[jz+1] to q[jz+k] */
|
||||
f[jx + i] = two_over_pi[jv + i];
|
||||
for (j = 0, fw = 0.0; j <= jx; j++)
|
||||
fw += x[j] * f[jx + i - j];
|
||||
q[i] = fw;
|
||||
}
|
||||
jz += k;
|
||||
goto recompute;
|
||||
}
|
||||
}
|
||||
|
||||
/* chop off zero terms */
|
||||
if (z == 0.0)
|
||||
{
|
||||
jz -= 1;
|
||||
q0 -= 8;
|
||||
while (iq[jz] == 0)
|
||||
{
|
||||
jz--;
|
||||
q0 -= 8;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* break z into 8-bit if necessary */
|
||||
z = __scalbnf (z, -q0);
|
||||
if (z >= two8)
|
||||
{
|
||||
fw = __truncf (twon8 * z);
|
||||
iq[jz] = (int32_t) (z - two8 * fw);
|
||||
jz += 1;
|
||||
q0 += 8;
|
||||
iq[jz] = (int32_t) fw;
|
||||
}
|
||||
else
|
||||
iq[jz] = (int32_t) z;
|
||||
}
|
||||
|
||||
/* convert integer "bit" chunk to floating-point value */
|
||||
fw = __scalbnf (one, q0);
|
||||
for (i = jz; i >= 0; i--)
|
||||
{
|
||||
q[i] = fw * (float) iq[i];
|
||||
fw *= twon8;
|
||||
}
|
||||
|
||||
/* compute PIo2[0,...,jp]*q[jz,...,0] */
|
||||
for (i = jz; i >= 0; i--)
|
||||
{
|
||||
for (fw = 0.0, k = 0; k <= jp && k <= jz - i; k++)
|
||||
fw += PIo2[k] * q[i + k];
|
||||
fq[jz - i] = fw;
|
||||
}
|
||||
|
||||
/* compress fq[] into y[] */
|
||||
fw = 0.0;
|
||||
for (i = jz; i >= 0; i--)
|
||||
fw += fq[i];
|
||||
y[0] = (ih == 0) ? fw : -fw;
|
||||
fw = fq[0] - fw;
|
||||
for (i = 1; i <= jz; i++)
|
||||
fw += fq[i];
|
||||
y[1] = (ih == 0) ? fw : -fw;
|
||||
|
||||
return n & 7;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/* k_sinf.c -- float version of k_sin.c
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
|
||||
static const float twom27 = 7.4505806000e-09;
|
||||
static const float half = 5.0000000000e-01;
|
||||
static const float S1 = -1.6666667163e-01;
|
||||
static const float S2 = 8.3333337680e-03;
|
||||
static const float S3 = -1.9841270114e-04;
|
||||
static const float S4 = 2.7557314297e-06;
|
||||
static const float S5 = -2.5050759689e-08;
|
||||
static const float S6 = 1.5896910177e-10;
|
||||
|
||||
|
||||
float
|
||||
__kernel_sinf (float x, float y, int iy)
|
||||
{
|
||||
float z, r, v;
|
||||
float ix;
|
||||
ix = __builtin_fabsf (x);
|
||||
if (ix < twom27)
|
||||
{ /* |x| < 2**-27 */
|
||||
if (x == 0.0)
|
||||
return x;
|
||||
}
|
||||
z = x * x;
|
||||
v = z * x;
|
||||
r = S2 + z * (S3 + z * (S4 + z * (S5 + z * S6)));
|
||||
if (iy == 0)
|
||||
return x + v * (S1 + z * r);
|
||||
else
|
||||
return x - ((z * (half * y - v * r) - y) - v * S1);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Private inline math functions for powerpc.
|
||||
Copyright (C) 2006
|
||||
Copyright (C) 2006, 2011
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@@ -25,11 +25,144 @@
|
||||
#include <ldsodefs.h>
|
||||
#include <dl-procinfo.h>
|
||||
|
||||
#include <math/math_private.h>
|
||||
|
||||
# if __WORDSIZE == 64 || defined _ARCH_PWR4
|
||||
# define __CPU_HAS_FSQRT 1
|
||||
|
||||
#ifndef __ieee754_sqrt
|
||||
# define __ieee754_sqrt(x) \
|
||||
({ double __z; \
|
||||
__asm __volatile ( \
|
||||
" fsqrt %0,%1\n" \
|
||||
: "=f" (__z) \
|
||||
: "f"(x)); \
|
||||
__z; })
|
||||
#endif
|
||||
#ifndef __ieee754_sqrtf
|
||||
# define __ieee754_sqrtf(x) \
|
||||
({ float __z; \
|
||||
__asm __volatile ( \
|
||||
" fsqrts %0,%1\n" \
|
||||
: "=f" (__z) \
|
||||
: "f"(x)); \
|
||||
__z; })
|
||||
#endif
|
||||
|
||||
# else
|
||||
# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
|
||||
# endif // __WORDSIZE == 64 || defined _ARCH_PWR4
|
||||
|
||||
|
||||
#if defined _ARCH_PWR5X
|
||||
|
||||
# ifndef __round
|
||||
# define __round(x) \
|
||||
({ double __z; \
|
||||
__asm __volatile ( \
|
||||
" frin %0,%1\n" \
|
||||
: "=f" (__z) \
|
||||
: "f" (x)); \
|
||||
__z; })
|
||||
# endif
|
||||
# ifndef __roundf
|
||||
# define __roundf(x) \
|
||||
({ float __z; \
|
||||
__asm __volatile ( \
|
||||
" frin %0,%1\n" \
|
||||
" frsp %0,%0\n" \
|
||||
: "=f" (__z) \
|
||||
: "f" (x)); \
|
||||
__z; })
|
||||
# endif
|
||||
|
||||
# ifndef __trunc
|
||||
# define __trunc(x) \
|
||||
({ double __z; \
|
||||
__asm __volatile ( \
|
||||
" friz %0,%1\n" \
|
||||
: "=f" (__z) \
|
||||
: "f" (x)); \
|
||||
__z; })
|
||||
# endif
|
||||
# ifndef __truncf
|
||||
# define __truncf(x) \
|
||||
({ float __z; \
|
||||
__asm __volatile ( \
|
||||
" friz %0,%1\n" \
|
||||
" frsp %0,%0\n" \
|
||||
: "=f" (__z) \
|
||||
: "f" (x)); \
|
||||
__z; })
|
||||
# endif
|
||||
|
||||
# ifndef __ceil
|
||||
# define __ceil(x) \
|
||||
({ double __z; \
|
||||
__asm __volatile ( \
|
||||
" frip %0,%1\n" \
|
||||
: "=f" (__z) \
|
||||
: "f" (x)); \
|
||||
__z; })
|
||||
# endif
|
||||
# ifndef __ceilf
|
||||
# define __ceilf(x) \
|
||||
({ float __z; \
|
||||
__asm __volatile ( \
|
||||
" frip %0,%1\n" \
|
||||
" frsp %0,%0\n" \
|
||||
: "=f" (__z) \
|
||||
: "f" (x)); \
|
||||
__z; })
|
||||
# endif
|
||||
|
||||
# ifndef __floor
|
||||
# define __floor(x) \
|
||||
({ double __z; \
|
||||
__asm __volatile ( \
|
||||
" frim %0,%1\n" \
|
||||
: "=f" (__z) \
|
||||
: "f" (x)); \
|
||||
__z; })
|
||||
# endif
|
||||
# ifndef __floorf
|
||||
# define __floorf(x) \
|
||||
({ float __z; \
|
||||
__asm __volatile ( \
|
||||
" frim %0,%1\n" \
|
||||
" frsp %0,%0\n" \
|
||||
: "=f" (__z) \
|
||||
: "f" (x)); \
|
||||
__z; })
|
||||
# endif
|
||||
|
||||
#endif /* defined _ARCH_PWR5X */
|
||||
|
||||
|
||||
#if defined _ARCH_PWR6
|
||||
|
||||
# ifndef __copysign
|
||||
# define __copysign(x, y) \
|
||||
({ double __z; \
|
||||
__asm __volatile ( \
|
||||
" fcpsgn %0,%1,%2\n" \
|
||||
: "=f" (__z) \
|
||||
: "f" (y), "f" (x)); \
|
||||
__z; })
|
||||
# endif
|
||||
# ifndef __copysignf
|
||||
# define __copysignf(x, y) \
|
||||
({ float __z; \
|
||||
__asm __volatile ( \
|
||||
" fcpsgn %0,%1,%2\n" \
|
||||
" frsp %0,%0\n" \
|
||||
: "=f" (__z) \
|
||||
: "f" (y), "f" (x)); \
|
||||
__z; })
|
||||
# endif
|
||||
|
||||
#endif /* defined _ARCH_PWR6 */
|
||||
|
||||
|
||||
# ifndef __LIBC_INTERNAL_MATH_INLINES
|
||||
extern double __slow_ieee754_sqrt (double);
|
||||
@@ -78,6 +211,4 @@ __ieee754_sqrtf (float __x)
|
||||
}
|
||||
#endif /* __LIBC_INTERNAL_MATH_INLINES */
|
||||
|
||||
#include <math/math_private.h>
|
||||
|
||||
#endif /* _PPC_MATH_PRIVATE_H_ */
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/* s_cosf.c -- float version of s_cos.c.
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const float one = 1.0;
|
||||
static const float pio4 = 7.8539801e-1;
|
||||
|
||||
float
|
||||
__cosf (float x)
|
||||
{
|
||||
float y[2], z = 0.0;
|
||||
float ix;
|
||||
int32_t n;
|
||||
|
||||
ix = __builtin_fabsf (x);
|
||||
|
||||
/* |x| ~< pi/4 */
|
||||
if (ix <= pio4)
|
||||
{
|
||||
return __kernel_cosf (x, z);
|
||||
/* cos(Inf or NaN) is NaN */
|
||||
}
|
||||
else if (isnanf (ix))
|
||||
{
|
||||
return x - x;
|
||||
}
|
||||
else if (isinff (ix))
|
||||
{
|
||||
__set_errno (EDOM);
|
||||
return x - x;
|
||||
}
|
||||
|
||||
/* argument reduction needed */
|
||||
else
|
||||
{
|
||||
n = __ieee754_rem_pio2f (x, y);
|
||||
switch (n & 3)
|
||||
{
|
||||
case 0:
|
||||
return __kernel_cosf (y[0], y[1]);
|
||||
case 1:
|
||||
return -__kernel_sinf (y[0], y[1], 1);
|
||||
case 2:
|
||||
return -__kernel_cosf (y[0], y[1]);
|
||||
default:
|
||||
return __kernel_sinf (y[0], y[1], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
weak_alias (__cosf, cosf)
|
||||
@@ -0,0 +1,112 @@
|
||||
/* Bitwise manipulation over float. Function prototypes.
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
|
||||
|
||||
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 _FLOAT_BITWISE_
|
||||
#define _FLOAT_BITWISE_ 1
|
||||
|
||||
#include "math_private.h"
|
||||
|
||||
/* Returns (int)(num & 0x7FFFFFF0 == value) */
|
||||
static inline
|
||||
int __float_and_test28 (float num, float value)
|
||||
{
|
||||
float ret;
|
||||
#ifdef _ARCH_PWR7
|
||||
vector int mask = (vector int) {
|
||||
0x7ffffffe, 0x00000000, 0x00000000, 0x0000000
|
||||
};
|
||||
__asm__ (
|
||||
/* the 'f' constrain is use on mask because we just need
|
||||
* to compare floats, not full vector */
|
||||
"xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
|
||||
);
|
||||
#else
|
||||
int32_t inum;
|
||||
GET_FLOAT_WORD(inum, num);
|
||||
inum = (inum & 0x7ffffff0);
|
||||
SET_FLOAT_WORD(ret, inum);
|
||||
#endif
|
||||
return (ret == value);
|
||||
}
|
||||
|
||||
/* Returns (int)(num & 0x7FFFFF00 == value) */
|
||||
static inline
|
||||
int __float_and_test24 (float num, float value)
|
||||
{
|
||||
float ret;
|
||||
#ifdef _ARCH_PWR7
|
||||
vector int mask = (vector int) {
|
||||
0x7fffffe0, 0x00000000, 0x00000000, 0x0000000
|
||||
};
|
||||
__asm__ (
|
||||
"xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
|
||||
);
|
||||
#else
|
||||
int32_t inum;
|
||||
GET_FLOAT_WORD(inum, num);
|
||||
inum = (inum & 0x7fffff00);
|
||||
SET_FLOAT_WORD(ret, inum);
|
||||
#endif
|
||||
return (ret == value);
|
||||
}
|
||||
|
||||
/* Returns (float)(num & 0x7F800000) */
|
||||
static inline
|
||||
float __float_and8 (float num)
|
||||
{
|
||||
float ret;
|
||||
#ifdef _ARCH_PWR7
|
||||
vector int mask = (vector int) {
|
||||
0x7ff00000, 0x00000000, 0x00000000, 0x00000000
|
||||
};
|
||||
__asm__ (
|
||||
"xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
|
||||
);
|
||||
#else
|
||||
int32_t inum;
|
||||
GET_FLOAT_WORD(inum, num);
|
||||
inum = (inum & 0x7f800000);
|
||||
SET_FLOAT_WORD(ret, inum);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Returns ((int32_t)(num & 0x7F800000) >> 23) */
|
||||
static inline
|
||||
int32_t __float_get_exp (float num)
|
||||
{
|
||||
int32_t inum;
|
||||
#ifdef _ARCH_PWR7
|
||||
float ret;
|
||||
vector int mask = (vector int) {
|
||||
0x7ff00000, 0x00000000, 0x00000000, 0x00000000
|
||||
};
|
||||
__asm__ (
|
||||
"xxland %x0,%x1,%x2" : "=f" (ret) : "f" (num), "f" (mask)
|
||||
);
|
||||
GET_FLOAT_WORD(inum, ret);
|
||||
#else
|
||||
GET_FLOAT_WORD(inum, num);
|
||||
inum = inum & 0x7f800000;
|
||||
#endif
|
||||
return inum >> 23;
|
||||
}
|
||||
|
||||
#endif /* s_float_bitwise.h */
|
||||
@@ -0,0 +1,70 @@
|
||||
/* s_sinf.c -- float version of s_sin.c.
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
static const float pio4 = 7.8539801e-1;
|
||||
|
||||
float
|
||||
__sinf (float x)
|
||||
{
|
||||
float y[2], z = 0.0;
|
||||
float ix;
|
||||
int32_t n;
|
||||
|
||||
ix = __builtin_fabsf (x);
|
||||
|
||||
/* |x| ~< pi/4 */
|
||||
if (ix <= pio4)
|
||||
{
|
||||
return __kernel_sinf (x, z, 0);
|
||||
/* sin(Inf or NaN) is NaN */
|
||||
}
|
||||
else if (isnanf (ix))
|
||||
{
|
||||
return x - x;
|
||||
}
|
||||
else if (isinff (ix))
|
||||
{
|
||||
__set_errno (EDOM);
|
||||
return x - x;
|
||||
}
|
||||
|
||||
/* argument reduction needed */
|
||||
else
|
||||
{
|
||||
n = __ieee754_rem_pio2f (x, y);
|
||||
switch (n & 3)
|
||||
{
|
||||
case 0:
|
||||
return __kernel_sinf (y[0], y[1], 1);
|
||||
case 1:
|
||||
return __kernel_cosf (y[0], y[1]);
|
||||
case 2:
|
||||
return -__kernel_sinf (y[0], y[1], 1);
|
||||
default:
|
||||
return -__kernel_cosf (y[0], y[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
weak_alias (__sinf, sinf)
|
||||
@@ -0,0 +1,5 @@
|
||||
#include <locale/localeinfo.h>
|
||||
|
||||
--
|
||||
|
||||
LOCALE_CTYPE_TOLOWER offsetof (struct __locale_struct, __ctype_tolower)
|
||||
@@ -0,0 +1,119 @@
|
||||
/* Copy memory to memory until the specified number of bytes
|
||||
has been copied. Overlap is handled correctly.
|
||||
Copyright (C) 1991-2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Torbjorn Granlund (tege@sics.se).
|
||||
|
||||
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 <string.h>
|
||||
#include <memcopy.h>
|
||||
#include <pagecopy.h>
|
||||
|
||||
/* All this is so that bcopy.c can #include
|
||||
this file after defining some things. */
|
||||
#ifndef a1
|
||||
#define a1 dest /* First arg is DEST. */
|
||||
#define a1const
|
||||
#define a2 src /* Second arg is SRC. */
|
||||
#define a2const const
|
||||
#undef memmove
|
||||
#endif
|
||||
#if !defined(RETURN) || !defined(rettype)
|
||||
#define RETURN(s) return (s) /* Return DEST. */
|
||||
#define rettype void *
|
||||
#endif
|
||||
|
||||
#ifndef MEMMOVE
|
||||
#define MEMMOVE memmove
|
||||
#endif
|
||||
|
||||
rettype
|
||||
MEMMOVE (a1, a2, len)
|
||||
a1const void *a1;
|
||||
a2const void *a2;
|
||||
size_t len;
|
||||
{
|
||||
unsigned long int dstp = (long int) dest;
|
||||
unsigned long int srcp = (long int) src;
|
||||
|
||||
/* If there is no overlap between ranges, call the builtin memcpy. */
|
||||
if (dstp >= srcp + len || srcp > dstp + len)
|
||||
__builtin_memcpy (dest, src, len);
|
||||
|
||||
/* This test makes the forward copying code be used whenever possible.
|
||||
Reduces the working set. */
|
||||
else if (dstp - srcp >= len) /* *Unsigned* compare! */
|
||||
{
|
||||
/* Copy from the beginning to the end. */
|
||||
|
||||
/* If there not too few bytes to copy, use word copy. */
|
||||
if (len >= OP_T_THRES)
|
||||
{
|
||||
/* Copy just a few bytes to make DSTP aligned. */
|
||||
len -= (-dstp) % OPSIZ;
|
||||
BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
|
||||
|
||||
/* Copy whole pages from SRCP to DSTP by virtual address
|
||||
manipulation, as much as possible. */
|
||||
|
||||
PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
|
||||
|
||||
/* Copy from SRCP to DSTP taking advantage of the known
|
||||
alignment of DSTP. Number of bytes remaining is put
|
||||
in the third argument, i.e. in LEN. This number may
|
||||
vary from machine to machine. */
|
||||
|
||||
WORD_COPY_FWD (dstp, srcp, len, len);
|
||||
|
||||
/* Fall out and copy the tail. */
|
||||
}
|
||||
|
||||
/* There are just a few bytes to copy. Use byte memory operations. */
|
||||
BYTE_COPY_FWD (dstp, srcp, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Copy from the end to the beginning. */
|
||||
srcp += len;
|
||||
dstp += len;
|
||||
|
||||
/* If there not too few bytes to copy, use word copy. */
|
||||
if (len >= OP_T_THRES)
|
||||
{
|
||||
/* Copy just a few bytes to make DSTP aligned. */
|
||||
len -= dstp % OPSIZ;
|
||||
BYTE_COPY_BWD (dstp, srcp, dstp % OPSIZ);
|
||||
|
||||
/* Copy from SRCP to DSTP taking advantage of the known
|
||||
alignment of DSTP. Number of bytes remaining is put
|
||||
in the third argument, i.e. in LEN. This number may
|
||||
vary from machine to machine. */
|
||||
|
||||
WORD_COPY_BWD (dstp, srcp, len, len);
|
||||
|
||||
/* Fall out and copy the tail. */
|
||||
}
|
||||
|
||||
/* There are just a few bytes to copy. Use byte memory operations. */
|
||||
BYTE_COPY_BWD (dstp, srcp, len);
|
||||
}
|
||||
|
||||
RETURN (dest);
|
||||
}
|
||||
#ifndef memmove
|
||||
libc_hidden_builtin_def (memmove)
|
||||
#endif
|
||||
@@ -5,6 +5,11 @@ ifeq ($(with-fp),no)
|
||||
sysdep-LDFLAGS += -msoft-float
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),gmon)
|
||||
sysdep_routines += ppc-mcount
|
||||
static-only-routines += ppc-mcount
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),misc)
|
||||
sysdep_routines += gprsave0 gprrest0 gprsave1 gprrest1
|
||||
endif
|
||||
|
||||
@@ -8,6 +8,9 @@ libc {
|
||||
__fixsfdi; __fixunssfdi;
|
||||
__floatdidf; __floatdisf;
|
||||
}
|
||||
GLIBC_PRIVATE {
|
||||
__mcount_internal;
|
||||
}
|
||||
}
|
||||
|
||||
libm {
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/* Round to int floating-point values. PowerPC32 version.
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
|
||||
|
||||
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., 1 Franklin Street, Fifth Floor, Boston MA
|
||||
02110-1301 USA. */
|
||||
|
||||
/* This has been coded in assembler because GCC makes such a mess of it
|
||||
when it's coded in C. */
|
||||
|
||||
#include <sysdep.h>
|
||||
#include <math_ldbl_opt.h>
|
||||
|
||||
|
||||
/* double [fp1] nearbyint(double [fp1] x) */
|
||||
|
||||
.section .rodata.cst4,"aM",@progbits,4
|
||||
.align 2
|
||||
.LC0: /* 2**52 */
|
||||
.long 0x59800000 /* TWO52: 2**52 */
|
||||
|
||||
.section ".text"
|
||||
ENTRY (__nearbyint)
|
||||
#ifdef SHARED
|
||||
mflr r11
|
||||
cfi_register(lr,r11)
|
||||
bcl 20,31,1f
|
||||
1: mflr r9
|
||||
addis r9,r9,.LC0-1b@ha
|
||||
lfs fp13,.LC0-1b@l(r9)
|
||||
mtlr r11
|
||||
cfi_same_value (lr)
|
||||
#else
|
||||
lis r9,.LC0@ha
|
||||
lfs fp13,.LC0@l(r9)
|
||||
#endif
|
||||
fabs fp0,fp1
|
||||
fsub fp12,fp13,fp13 /* generate 0.0 */
|
||||
fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52 */
|
||||
bgelr cr7
|
||||
fcmpu cr7,fp1,fp12 /* if (x > 0.0 */
|
||||
ble cr7,L(lessthanzero)
|
||||
mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
|
||||
fadd fp0,fp1,fp13 /* x += TWO52 */
|
||||
fsub fp1,fp0,fp13 /* x -= TWO52 */
|
||||
fabs fp1,fp1 /* if (x == 0.0 */
|
||||
mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
|
||||
blr
|
||||
L(lessthanzero):
|
||||
bgelr cr7
|
||||
mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
|
||||
fsub fp0,fp13,fp1 /* x -= TWO52 */
|
||||
fsub fp0,fp0,fp13 /* x += TWO52 */
|
||||
fneg fp1,fp0 /* if (x == 0.0) */
|
||||
mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
|
||||
blr
|
||||
END (__nearbyint)
|
||||
|
||||
weak_alias (__nearbyint, nearbyint)
|
||||
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
weak_alias (__nearbyint, nearbyintl)
|
||||
strong_alias (__nearbyint, __nearbyintl)
|
||||
#endif
|
||||
#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
|
||||
compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_0)
|
||||
#endif
|
||||
@@ -0,0 +1,70 @@
|
||||
/* Round to int floating-point values. PowerPC32 version.
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
|
||||
|
||||
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., 1 Franklin Street, Fifth Floor, Boston MA
|
||||
02110-1301 USA. */
|
||||
|
||||
/* This has been coded in assembler because GCC makes such a mess of it
|
||||
when it's coded in C. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
|
||||
/* float [fp1] nearbyintf(float [fp1] x) */
|
||||
|
||||
.section .rodata.cst4,"aM",@progbits,4
|
||||
.align 2
|
||||
.LC0:
|
||||
.long 0x4B000000 /* TWO23: 2**23 */
|
||||
|
||||
.section ".text"
|
||||
ENTRY (__nearbyintf)
|
||||
#ifdef SHARED
|
||||
mflr r11
|
||||
cfi_register(lr,r11)
|
||||
bcl 20,31,1f
|
||||
1: mflr r9
|
||||
addis r9,r9,.LC0-1b@ha
|
||||
lfs fp13,.LC0-1b@l(r9)
|
||||
mtlr r11
|
||||
cfi_same_value (lr)
|
||||
#else
|
||||
lis r9,.LC0@ha
|
||||
lfs fp13,.LC0@l(r9)
|
||||
#endif
|
||||
fabs fp0,fp1
|
||||
fsub fp12,fp13,fp13 /* generate 0.0 */
|
||||
fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23 */
|
||||
bgelr cr7
|
||||
fcmpu cr7,fp1,fp12 /* if (x > 0.0 */
|
||||
ble cr7,L(lessthanzero)
|
||||
mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
|
||||
fadds fp0,fp1,fp13 /* x += TWO23 */
|
||||
fsubs fp1,fp0,fp13 /* x -= TWO23 */
|
||||
mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
|
||||
blr
|
||||
L(lessthanzero):
|
||||
bgelr cr7
|
||||
mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
|
||||
fsubs fp0,fp13,fp1 /* x -= TWO23 */
|
||||
fsubs fp0,fp0,fp13 /* x += TWO23 */
|
||||
fneg fp1,fp0 /* if (x == 0.0) */
|
||||
mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
|
||||
blr
|
||||
END (__nearbyintf)
|
||||
|
||||
weak_alias (__nearbyintf, nearbyintf)
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Optimized strcmp implementation for PowerPC32.
|
||||
Copyright (C) 2003, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2006, 2011 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
|
||||
@@ -139,30 +139,31 @@ L(u1):
|
||||
bdz L(u4)
|
||||
cmpw rWORD1, rWORD2
|
||||
beq- cr1, L(u4)
|
||||
bne- L(u4)
|
||||
lbzu rWORD3, 1(rSTR1)
|
||||
lbzu rWORD4, 1(rSTR2)
|
||||
bne- L(u4)
|
||||
cmpwi cr1, rWORD3, 0
|
||||
bdz L(u3)
|
||||
cmpw rWORD3, rWORD4
|
||||
beq- cr1, L(u3)
|
||||
bne- L(u3)
|
||||
lbzu rWORD1, 1(rSTR1)
|
||||
lbzu rWORD2, 1(rSTR2)
|
||||
bne- L(u3)
|
||||
cmpwi cr1, rWORD1, 0
|
||||
bdz L(u4)
|
||||
cmpw rWORD1, rWORD2
|
||||
beq- cr1, L(u4)
|
||||
bne- L(u4)
|
||||
lbzu rWORD3, 1(rSTR1)
|
||||
lbzu rWORD4, 1(rSTR2)
|
||||
bne- L(u4)
|
||||
cmpwi cr1, rWORD3, 0
|
||||
bdz L(u3)
|
||||
cmpw rWORD3, rWORD4
|
||||
beq- cr1, L(u3)
|
||||
bne- L(u3)
|
||||
lbzu rWORD1, 1(rSTR1)
|
||||
lbzu rWORD2, 1(rSTR2)
|
||||
beq+ L(u1)
|
||||
b L(u1)
|
||||
|
||||
L(u3): sub rRTN, rWORD3, rWORD4
|
||||
blr
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* isnanf(). PowerPC32 version.
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008, 2011 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,8 +39,7 @@ EALIGN (__isnanf, 4, 0)
|
||||
L(NaN):
|
||||
li r3,1 /* else return 1 */
|
||||
blr
|
||||
END (__isnan)
|
||||
END (__isnanf)
|
||||
|
||||
hidden_def (__isnanf)
|
||||
weak_alias (__isnanf, isnanf)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* _memcopy.c -- subroutines for memory copy functions.
|
||||
Copyright (C) 1991, 1996, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991-2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Torbjorn Granlund (tege@sics.se).
|
||||
Updated for POWER6 by Steven Munroe (sjmunroe@us.ibm.com).
|
||||
@@ -66,6 +66,20 @@ _wordcopy_fwd_aligned (dstp, srcp, len)
|
||||
DSTP should be aligned for memory operations on `op_t's, but SRCP must
|
||||
*not* be aligned. */
|
||||
|
||||
#define fwd_align_merge(align) \
|
||||
do \
|
||||
{ \
|
||||
a1 = ((op_t *) srcp)[1]; \
|
||||
a2 = ((op_t *) srcp)[2]; \
|
||||
((op_t *) dstp)[0] = MERGE (a0, align*8, a1, (32-align*8)); \
|
||||
((op_t *) dstp)[1] = MERGE (a1, align*8, a2, (32-align*8)); \
|
||||
a0 = a2; \
|
||||
srcp += 2 * OPSIZ; \
|
||||
dstp += 2 * OPSIZ; \
|
||||
len -= 2; \
|
||||
} \
|
||||
while (len != 0)
|
||||
|
||||
void
|
||||
_wordcopy_fwd_dest_aligned (dstp, srcp, len)
|
||||
long int dstp;
|
||||
@@ -102,54 +116,7 @@ _wordcopy_fwd_dest_aligned (dstp, srcp, len)
|
||||
len -= 1;
|
||||
}
|
||||
|
||||
switch (align)
|
||||
{
|
||||
case 1:
|
||||
do
|
||||
{
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a2 = ((op_t *) srcp)[2];
|
||||
((op_t *) dstp)[0] = MERGE (a0, 8, a1, (32-8));
|
||||
((op_t *) dstp)[1] = MERGE (a1, 8, a2, (32-8));
|
||||
a0 = a2;
|
||||
|
||||
srcp += 2 * OPSIZ;
|
||||
dstp += 2 * OPSIZ;
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 2:
|
||||
do
|
||||
{
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a2 = ((op_t *) srcp)[2];
|
||||
((op_t *) dstp)[0] = MERGE (a0, 16, a1, (32-16));
|
||||
((op_t *) dstp)[1] = MERGE (a1, 16, a2, (32-16));
|
||||
a0 = a2;
|
||||
|
||||
srcp += 2 * OPSIZ;
|
||||
dstp += 2 * OPSIZ;
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 3:
|
||||
do
|
||||
{
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a2 = ((op_t *) srcp)[2];
|
||||
((op_t *) dstp)[0] = MERGE (a0, 24, a1, (32-24));
|
||||
((op_t *) dstp)[1] = MERGE (a1, 24, a2, (32-24));
|
||||
a0 = a2;
|
||||
|
||||
srcp += 2 * OPSIZ;
|
||||
dstp += 2 * OPSIZ;
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
}
|
||||
fwd_align_merge (align);
|
||||
|
||||
}
|
||||
|
||||
@@ -192,6 +159,20 @@ _wordcopy_bwd_aligned (dstp, srcp, len)
|
||||
while (len != 0);
|
||||
}
|
||||
|
||||
#define bwd_align_merge(align) \
|
||||
do \
|
||||
{ \
|
||||
srcp -= 2 * OPSIZ; \
|
||||
dstp -= 2 * OPSIZ; \
|
||||
a1 = ((op_t *) srcp)[1]; \
|
||||
a0 = ((op_t *) srcp)[0]; \
|
||||
((op_t *) dstp)[1] = MERGE (a1, align*8, a2, (32-align*8)); \
|
||||
((op_t *) dstp)[0] = MERGE (a0, align*8, a1, (32-align*8)); \
|
||||
a2 = a0; \
|
||||
len -= 2; \
|
||||
} \
|
||||
while (len != 0)
|
||||
|
||||
/* _wordcopy_bwd_dest_aligned -- Copy block finishing right
|
||||
before SRCP to block finishing right before DSTP with LEN `op_t'
|
||||
words (not LEN bytes!). DSTP should be aligned for memory
|
||||
@@ -233,55 +214,5 @@ _wordcopy_bwd_dest_aligned (dstp, srcp, len)
|
||||
len -= 1;
|
||||
}
|
||||
|
||||
switch (align)
|
||||
{
|
||||
case 1:
|
||||
do
|
||||
{
|
||||
srcp -= 2 * OPSIZ;
|
||||
dstp -= 2 * OPSIZ;
|
||||
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a0 = ((op_t *) srcp)[0];
|
||||
((op_t *) dstp)[1] = MERGE (a1, 8, a2, (32-8));
|
||||
((op_t *) dstp)[0] = MERGE (a0, 8, a1, (32-8));
|
||||
a2 = a0;
|
||||
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 2:
|
||||
do
|
||||
{
|
||||
srcp -= 2 * OPSIZ;
|
||||
dstp -= 2 * OPSIZ;
|
||||
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a0 = ((op_t *) srcp)[0];
|
||||
((op_t *) dstp)[1] = MERGE (a1, 16, a2, (32-16));
|
||||
((op_t *) dstp)[0] = MERGE (a0, 16, a1, (32-16));
|
||||
a2 = a0;
|
||||
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 3:
|
||||
do
|
||||
{
|
||||
srcp -= 2 * OPSIZ;
|
||||
dstp -= 2 * OPSIZ;
|
||||
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a0 = ((op_t *) srcp)[0];
|
||||
((op_t *) dstp)[1] = MERGE (a1, 24, a2, (32-24));
|
||||
((op_t *) dstp)[0] = MERGE (a0, 24, a1, (32-24));
|
||||
a2 = a0;
|
||||
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
}
|
||||
bwd_align_merge (align);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
ifeq ($(subdir),string)
|
||||
CFLAGS-strncase.c += -funroll-loops
|
||||
CFLAGS-strncase_l.c += -funroll-loops
|
||||
endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Optimized memcpy implementation for PowerPC32/POWER7.
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010, 2011 Free Software Foundation, Inc.
|
||||
Contributed by Luis Machado <luisgpm@br.ibm.com>.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@@ -116,24 +116,82 @@ L(copy_GE_32_aligned_cont):
|
||||
stfd 6,0(3)
|
||||
addi 10,3,8
|
||||
|
||||
L(aligned_copy):
|
||||
/* Main aligned copy loop. Copies up to 128-bytes at a time. */
|
||||
.align 4
|
||||
4: /* Main aligned copy loop. Copies 32-bytes at a time. */
|
||||
lfd 6,0(11)
|
||||
lfd 7,8(11)
|
||||
lfd 8,16(11)
|
||||
lfd 0,24(11)
|
||||
addi 11,11,32
|
||||
4:
|
||||
/* check for any 32-byte or 64-byte lumps that are outside of a
|
||||
nice 128-byte range. R8 contains the number of 32-byte
|
||||
lumps, so drop this into the CR, and use the SO/EQ bits to help
|
||||
handle the 32- or 64- byte lumps. Then handle the rest with an
|
||||
unrolled 128-bytes-at-a-time copy loop. */
|
||||
mtocrf 1,8
|
||||
li 6,16 # 16() index
|
||||
li 7,32 # 32() index
|
||||
li 8,48 # 48() index
|
||||
|
||||
L(aligned_32byte):
|
||||
/* if the SO bit (indicating a 32-byte lump) is not set, move along. */
|
||||
bns cr7,L(aligned_64byte)
|
||||
lxvd2x 6,0,11
|
||||
lxvd2x 7,11,6
|
||||
addi 11,11,32
|
||||
stxvd2x 6,0,10
|
||||
stxvd2x 7,10,6
|
||||
addi 10,10,32
|
||||
|
||||
L(aligned_64byte):
|
||||
/* if the EQ bit (indicating a 64-byte lump) is not set, move along. */
|
||||
bne cr7,L(aligned_128setup)
|
||||
lxvd2x 6,0,11
|
||||
lxvd2x 7,11,6
|
||||
lxvd2x 8,11,7
|
||||
lxvd2x 9,11,8
|
||||
addi 11,11,64
|
||||
stxvd2x 6,0,10
|
||||
stxvd2x 7,10,6
|
||||
stxvd2x 8,10,7
|
||||
stxvd2x 9,10,8
|
||||
addi 10,10,64
|
||||
|
||||
L(aligned_128setup):
|
||||
/* Set up for the 128-byte at a time copy loop. */
|
||||
srwi 8,31,7
|
||||
cmpwi 8,0 # Any 4x lumps left?
|
||||
beq 3f # if not, move along.
|
||||
lxvd2x 6,0,11
|
||||
lxvd2x 7,11,6
|
||||
mtctr 8 # otherwise, load the ctr and begin.
|
||||
li 8,48 # 48() index
|
||||
b L(aligned_128loop)
|
||||
|
||||
L(aligned_128head):
|
||||
/* for the 2nd + iteration of this loop. */
|
||||
lxvd2x 6,0,11
|
||||
lxvd2x 7,11,6
|
||||
L(aligned_128loop):
|
||||
lxvd2x 8,11,7
|
||||
lxvd2x 9,11,8
|
||||
stxvd2x 6,0,10
|
||||
addi 11,11,64
|
||||
stxvd2x 7,10,6
|
||||
stxvd2x 8,10,7
|
||||
stxvd2x 9,10,8
|
||||
lxvd2x 6,0,11
|
||||
lxvd2x 7,11,6
|
||||
addi 10,10,64
|
||||
lxvd2x 8,11,7
|
||||
lxvd2x 9,11,8
|
||||
addi 11,11,64
|
||||
stxvd2x 6,0,10
|
||||
stxvd2x 7,10,6
|
||||
stxvd2x 8,10,7
|
||||
stxvd2x 9,10,8
|
||||
addi 10,10,64
|
||||
bdnz L(aligned_128head)
|
||||
|
||||
stfd 6,0(10)
|
||||
stfd 7,8(10)
|
||||
stfd 8,16(10)
|
||||
stfd 0,24(10)
|
||||
addi 10,10,32
|
||||
bdnz 4b
|
||||
3:
|
||||
|
||||
/* Check for tail bytes. */
|
||||
|
||||
clrrwi 0,31,3
|
||||
mtcrf 0x01,31
|
||||
beq cr6,0f
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/* Optimized strcasecmp implementation for PowerPC32.
|
||||
Copyright (C) 2011 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>
|
||||
#include <bp-sym.h>
|
||||
#include <bp-asm.h>
|
||||
#include <locale-defines.h>
|
||||
|
||||
/* int [r3] strcasecmp (const char *s1 [r3], const char *s2 [r4] )
|
||||
|
||||
or if defined USE_IN_EXTENDED_LOCALE_MODEL:
|
||||
|
||||
int [r3] strcasecmp_l (const char *s1 [r3], const char *s2 [r4],
|
||||
__locale_t loc [r5]) */
|
||||
|
||||
#ifndef STRCMP
|
||||
# define __STRCMP __strcasecmp
|
||||
# define STRCMP strcasecmp
|
||||
#endif
|
||||
|
||||
ENTRY (BP_SYM (__STRCMP))
|
||||
|
||||
#define rRTN r3 /* Return value */
|
||||
#define rSTR1 r5 /* 1st string */
|
||||
#define rSTR2 r4 /* 2nd string */
|
||||
#define rLOCARG r5 /* 3rd argument: locale_t */
|
||||
#define rCHAR1 r6 /* Byte readed from 1st string */
|
||||
#define rCHAR2 r7 /* Byte readed from 2nd string */
|
||||
#define rADDR1 r8 /* Address of tolower(rCHAR1) */
|
||||
#define rADDR2 r12 /* Address of tolower(rCHAR2) */
|
||||
#define rLWR1 r8 /* Byte tolower(rCHAR1) */
|
||||
#define rLWR2 r12 /* Byte tolower(rCHAR2) */
|
||||
#define rTMP r0
|
||||
#define rGOT r9 /* Address of the Global Offset Table */
|
||||
#define rLOC r11 /* Default locale address */
|
||||
|
||||
cmpw cr7, r3, r4
|
||||
#ifndef USE_IN_EXTENDED_LOCALE_MODEL
|
||||
# ifdef SHARED
|
||||
mflr rTMP
|
||||
bcl 20,31,.L1
|
||||
.L1: mflr rGOT
|
||||
addis rGOT, rGOT, _GLOBAL_OFFSET_TABLE_-.L1@ha
|
||||
addi rGOT, rGOT, _GLOBAL_OFFSET_TABLE_-.L1@l
|
||||
lwz rLOC, __libc_tsd_LOCALE@got@tprel(rGOT)
|
||||
add rLOC, rLOC, __libc_tsd_LOCALE@tls
|
||||
lwz rLOC, 0(rLOC)
|
||||
mtlr rTMP
|
||||
# else
|
||||
lis rTMP,_GLOBAL_OFFSET_TABLE_@ha
|
||||
la rLOC,_GLOBAL_OFFSET_TABLE_@l(rTMP)
|
||||
lwz rLOC, __libc_tsd_LOCALE@got@tprel(rGOT)
|
||||
add rLOC, rLOC, __libc_tsd_LOCALE@tls
|
||||
lwz rLOC, 0(rLOC)
|
||||
# endif /* SHARED */
|
||||
#else
|
||||
mr rLOC, rLOCARG
|
||||
#endif
|
||||
mr rSTR1, rRTN
|
||||
lwz rLOC, LOCALE_CTYPE_TOLOWER(rLOC)
|
||||
li rRTN, 0
|
||||
beqlr cr7
|
||||
|
||||
/* Unrolling loop for POWER: loads are done with 'lbz' plus
|
||||
offset and string descriptors are only updated in the end
|
||||
of loop unrolling. */
|
||||
|
||||
L(loop):
|
||||
lbz rCHAR1, 0(rSTR1) /* Load char from s1 */
|
||||
lbz rCHAR2, 0(rSTR2) /* Load char from s2 */
|
||||
sldi rADDR1, rCHAR1, 2 /* Calculate address for tolower(*s1) */
|
||||
sldi rADDR2, rCHAR2, 2 /* Calculate address for tolower(*s2) */
|
||||
lwzx rLWR1, rLOC, rADDR1 /* Load tolower(*s1) */
|
||||
lwzx rLWR2, rLOC, rADDR2 /* Load tolower(*s2) */
|
||||
cmpwi cr7, rCHAR1, 0 /* *s1 == '\0' ? */
|
||||
subf. r3, rLWR2, rLWR1
|
||||
bnelr
|
||||
beqlr cr7
|
||||
lbz rCHAR1, 1(rSTR1)
|
||||
lbz rCHAR2, 1(rSTR2)
|
||||
sldi rADDR1, rCHAR1, 2
|
||||
sldi rADDR2, rCHAR2, 2
|
||||
lwzx rLWR1, rLOC, rADDR1
|
||||
lwzx rLWR2, rLOC, rADDR2
|
||||
cmpwi cr7, rCHAR1, 0
|
||||
subf. r3, rLWR2, rLWR1
|
||||
bnelr
|
||||
beqlr cr7
|
||||
lbz rCHAR1, 2(rSTR1)
|
||||
lbz rCHAR2, 2(rSTR2)
|
||||
sldi rADDR1, rCHAR1, 2
|
||||
sldi rADDR2, rCHAR2, 2
|
||||
lwzx rLWR1, rLOC, rADDR1
|
||||
lwzx rLWR2, rLOC, rADDR2
|
||||
cmpwi cr7, rCHAR1, 0
|
||||
subf. r3, rLWR2, rLWR1
|
||||
bnelr
|
||||
beqlr cr7
|
||||
lbz rCHAR1, 3(rSTR1)
|
||||
lbz rCHAR2, 3(rSTR2)
|
||||
/* Increment both string descriptors */
|
||||
addi rSTR1, rSTR1, 4
|
||||
addi rSTR2, rSTR2, 4
|
||||
sldi rADDR1, rCHAR1, 2
|
||||
sldi rADDR2, rCHAR2, 2
|
||||
lwzx rLWR1, rLOC, rADDR1
|
||||
lwzx rLWR2, rLOC, rADDR2
|
||||
cmpwi cr7, rCHAR1, 0
|
||||
subf. r3, rLWR2, rLWR1
|
||||
bnelr
|
||||
bne cr7,L(loop)
|
||||
blr
|
||||
END (BP_SYM (__STRCMP))
|
||||
|
||||
weak_alias (BP_SYM (__STRCMP), BP_SYM (STRCMP))
|
||||
libc_hidden_builtin_def (__STRCMP)
|
||||
@@ -0,0 +1,5 @@
|
||||
#define USE_IN_EXTENDED_LOCALE_MODEL
|
||||
#define STRCMP strcasecmp_l
|
||||
#define __STRCMP __strcasecmp_l
|
||||
|
||||
#include "strcasecmp.S"
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Optimized strcmp implementation for POWER7/PowerPC32.
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010, 2011 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
|
||||
@@ -27,7 +27,7 @@
|
||||
const char *s2 [r4],
|
||||
size_t size [r5]) */
|
||||
|
||||
EALIGN (BP_SYM(strncmp),4,0)
|
||||
EALIGN (BP_SYM(strncmp),5,0)
|
||||
|
||||
#define rTMP r0
|
||||
#define rRTN r3
|
||||
@@ -47,9 +47,11 @@ EALIGN (BP_SYM(strncmp),4,0)
|
||||
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
|
||||
|
||||
dcbt 0,rSTR1
|
||||
nop
|
||||
or rTMP,rSTR2,rSTR1
|
||||
lis r7F7F,0x7f7f
|
||||
dcbt 0,rSTR2
|
||||
nop
|
||||
clrlwi. rTMP,rTMP,30
|
||||
cmplwi cr1,rN,0
|
||||
lis rFEFE,-0x101
|
||||
@@ -141,30 +143,31 @@ L(u1):
|
||||
bdz L(u4)
|
||||
cmpw rWORD1,rWORD2
|
||||
beq cr1,L(u4)
|
||||
bne L(u4)
|
||||
lbzu rWORD3,1(rSTR1)
|
||||
lbzu rWORD4,1(rSTR2)
|
||||
bne L(u4)
|
||||
cmpwi cr1,rWORD3,0
|
||||
bdz L(u3)
|
||||
cmpw rWORD3,rWORD4
|
||||
beq cr1,L(u3)
|
||||
bne L(u3)
|
||||
lbzu rWORD1,1(rSTR1)
|
||||
lbzu rWORD2,1(rSTR2)
|
||||
bne L(u3)
|
||||
cmpwi cr1,rWORD1,0
|
||||
bdz L(u4)
|
||||
cmpw rWORD1,rWORD2
|
||||
beq cr1,L(u4)
|
||||
bne L(u4)
|
||||
lbzu rWORD3,1(rSTR1)
|
||||
lbzu rWORD4,1(rSTR2)
|
||||
bne L(u4)
|
||||
cmpwi cr1,rWORD3,0
|
||||
bdz L(u3)
|
||||
cmpw rWORD3,rWORD4
|
||||
beq cr1,L(u3)
|
||||
bne L(u3)
|
||||
lbzu rWORD1,1(rSTR1)
|
||||
lbzu rWORD2,1(rSTR2)
|
||||
beq L(u1)
|
||||
b L(u1)
|
||||
|
||||
L(u3): sub rRTN,rWORD3,rWORD4
|
||||
blr
|
||||
|
||||
@@ -58,8 +58,7 @@ ENTRY(_mcount)
|
||||
stw r4, 44(r1)
|
||||
cfi_offset (lr, -4)
|
||||
stw r5, 8(r1)
|
||||
bl __mcount_internal@local
|
||||
nop
|
||||
bl JUMPTARGET(__mcount_internal)
|
||||
/* Restore the registers... */
|
||||
lwz r6, 8(r1)
|
||||
lwz r0, 44(r1)
|
||||
|
||||
@@ -12,7 +12,10 @@ endif
|
||||
|
||||
# These flags prevent FPU or Altivec registers from being used,
|
||||
# for code called in contexts that is not allowed to touch those registers.
|
||||
# Stupid GCC requires us to pass all these ridiculous switches.
|
||||
# Stupid GCC requires us to pass all these ridiculous switches. We need to
|
||||
# pass the -mno-* switches as well to prevent the compiler from attempting
|
||||
# to emit altivec or vsx instructions, especially when the registers aren't
|
||||
# available.
|
||||
no-special-regs := $(sort $(foreach n,40 41 50 51 60 61 62 63 \
|
||||
$(foreach m,2 3 4 5 6 7 8 9, \
|
||||
3$m 4$m 5$m),\
|
||||
@@ -20,7 +23,7 @@ no-special-regs := $(sort $(foreach n,40 41 50 51 60 61 62 63 \
|
||||
$(sort $(foreach n,$(foreach m,0 1 2 3 4 5 6 7 8 9,\
|
||||
$m 1$m 2$m) 30 31,\
|
||||
-ffixed-v$n)) \
|
||||
-ffixed-vrsave -ffixed-vscr
|
||||
-ffixed-vrsave -ffixed-vscr -mno-altivec -mno-vsx
|
||||
|
||||
ifeq ($(subdir),csu)
|
||||
sysdep_routines += hp-timing
|
||||
@@ -28,7 +31,7 @@ elide-routines.os += hp-timing
|
||||
ifneq ($(elf),no)
|
||||
# The initfini generation code doesn't work in the presence of -fPIC, so
|
||||
# we use -fpic instead which is much better.
|
||||
CFLAGS-initfini.s += -fpic -O1
|
||||
CFLAGS-initfini.s += -fpic -O1 -fno-inline
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -42,4 +45,5 @@ ifeq ($(subdir),gmon)
|
||||
# Compiling with -msoft-float ensures that fp regs are not used
|
||||
# for moving memory around.
|
||||
CFLAGS-mcount.c += $(no-special-regs)
|
||||
sysdep_routines += ppc-mcount
|
||||
endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Double-precision floating point square root.
|
||||
Copyright (C) 1997, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 2002-2004, 2006, 2011 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
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <math.h>
|
||||
#include <math_private.h>
|
||||
|
||||
#undef __ieee754_sqrt
|
||||
double
|
||||
__ieee754_sqrt (double x)
|
||||
{
|
||||
@@ -27,3 +28,4 @@ __ieee754_sqrt (double x)
|
||||
__asm __volatile ("fsqrt %0,%1" : "=f" (z) : "f" (x));
|
||||
return z;
|
||||
}
|
||||
strong_alias (__ieee754_sqrt, __sqrt_finite)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Single-precision floating point square root.
|
||||
Copyright (C) 1997, 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 2003, 2004, 2006, 2011 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
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <math.h>
|
||||
#include <math_private.h>
|
||||
|
||||
#undef __ieee754_sqrtf
|
||||
float
|
||||
__ieee754_sqrtf (float x)
|
||||
{
|
||||
@@ -27,3 +28,4 @@ __ieee754_sqrtf (float x)
|
||||
__asm ("fsqrts %0,%1" : "=f" (z) : "f" (x));
|
||||
return z;
|
||||
}
|
||||
strong_alias (__ieee754_sqrtf, __sqrtf_finite)
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/* Round to int floating-point values. PowerPC64 version.
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
/* This has been coded in assembler because GCC makes such a mess of it
|
||||
when it's coded in C. */
|
||||
|
||||
#include <sysdep.h>
|
||||
#include <math_ldbl_opt.h>
|
||||
|
||||
|
||||
/* double [fp1] nearbyint(double [fp1] x) */
|
||||
|
||||
.section ".toc","aw"
|
||||
.LC0: /* 2**52 */
|
||||
.tc FD_43300000_0[TC],0x4330000000000000
|
||||
.section ".text"
|
||||
|
||||
EALIGN (__nearbyint, 4, 0)
|
||||
CALL_MCOUNT 0
|
||||
fabs fp0,fp1
|
||||
lfd fp13,.LC0@toc(2)
|
||||
fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
|
||||
bgelr cr7
|
||||
fsub fp12,fp13,fp13 /* generate 0.0 */
|
||||
fcmpu cr7,fp1,fp12 /* if (x > 0.0) */
|
||||
ble cr7, L(lessthanzero)
|
||||
mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
|
||||
fadd fp1,fp1,fp13 /* x+= TWO52 */
|
||||
fsub fp1,fp1,fp13 /* x-= TWO52 */
|
||||
fabs fp1,fp1 /* if (x == 0.0) */
|
||||
mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
|
||||
blr /* x = 0.0; */
|
||||
L(lessthanzero):
|
||||
bgelr cr7 /* if (x < 0.0) */
|
||||
mtfsb0 4*cr7+lt
|
||||
fsub fp1,fp1,fp13 /* x -= TWO52 */
|
||||
fadd fp1,fp1,fp13 /* x += TWO52 */
|
||||
fnabs fp1,fp1 /* if (x == 0.0) */
|
||||
mtfsb0 4*cr1+eq
|
||||
blr /* x = -0.0; */
|
||||
END (__nearbyint)
|
||||
|
||||
weak_alias (__nearbyint, nearbyint)
|
||||
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
weak_alias (__nearbyint, nearbyint)
|
||||
strong_alias (__nearbyint, __nearbyintl)
|
||||
#endif
|
||||
#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
|
||||
compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_0)
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
/* Round to int floating-point values. PowerPC64 version.
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
/* This has been coded in assembler because GCC makes such a mess of it
|
||||
when it's coded in C. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
|
||||
/* float [fp1] nearbyintf(float [fp1]) */
|
||||
|
||||
.section ".toc","aw"
|
||||
.LC0: /* 2**23 */
|
||||
.tc FD_4b000000_0[TC],0x4b00000000000000
|
||||
.section ".text"
|
||||
|
||||
EALIGN (__nearbyintf, 4, 0)
|
||||
CALL_MCOUNT 0
|
||||
fabs fp0,fp1
|
||||
lfs fp13,.LC0@toc(2)
|
||||
fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
|
||||
bgelr cr7
|
||||
fsubs fp12,fp13,fp13 /* generate 0.0 */
|
||||
fcmpu cr7,fp1,fp12 /* if (x > 0.0) */
|
||||
ble cr7, L(lessthanzero)
|
||||
mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
|
||||
fadds fp1,fp1,fp13 /* x += TWO23 */
|
||||
fsubs fp1,fp1,fp13 /* x -= TWO23 */
|
||||
fabs fp1,fp1 /* if (x == 0.0) */
|
||||
mtfsb0 4*cr1+eq /* Clear pending FE_INEXACT exception */
|
||||
blr /* x = 0.0; */
|
||||
L(lessthanzero):
|
||||
bgelr cr7 /* if (x < 0.0) */
|
||||
mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
|
||||
fsubs fp1,fp1,fp13 /* x -= TWO23 */
|
||||
fadds fp1,fp1,fp13 /* x += TWO23 */
|
||||
fnabs fp1,fp1 /* if (x == 0.0) */
|
||||
mtfsb0 4*cr1+eq /* Clear pending FE_INEXACT exception */
|
||||
blr /* x = -0.0; */
|
||||
END (__nearbyintf)
|
||||
|
||||
weak_alias (__nearbyintf, nearbyintf)
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Optimized strcmp implementation for PowerPC64.
|
||||
Copyright (C) 2003, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2006, 2011 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
|
||||
@@ -143,30 +143,31 @@ L(u1):
|
||||
bdz L(u4)
|
||||
cmpd rWORD1, rWORD2
|
||||
beq- cr1, L(u4)
|
||||
bne- L(u4)
|
||||
lbzu rWORD3, 1(rSTR1)
|
||||
lbzu rWORD4, 1(rSTR2)
|
||||
bne- L(u4)
|
||||
cmpdi cr1, rWORD3, 0
|
||||
bdz L(u3)
|
||||
cmpd rWORD3, rWORD4
|
||||
beq- cr1, L(u3)
|
||||
bne- L(u3)
|
||||
lbzu rWORD1, 1(rSTR1)
|
||||
lbzu rWORD2, 1(rSTR2)
|
||||
bne- L(u3)
|
||||
cmpdi cr1, rWORD1, 0
|
||||
bdz L(u4)
|
||||
cmpd rWORD1, rWORD2
|
||||
beq- cr1, L(u4)
|
||||
bne- L(u4)
|
||||
lbzu rWORD3, 1(rSTR1)
|
||||
lbzu rWORD4, 1(rSTR2)
|
||||
bne- L(u4)
|
||||
cmpdi cr1, rWORD3, 0
|
||||
bdz L(u3)
|
||||
cmpd rWORD3, rWORD4
|
||||
beq- cr1, L(u3)
|
||||
bne- L(u3)
|
||||
lbzu rWORD1, 1(rSTR1)
|
||||
lbzu rWORD2, 1(rSTR2)
|
||||
beq+ L(u1)
|
||||
b L(u1)
|
||||
|
||||
L(u3): sub rRTN, rWORD3, rWORD4
|
||||
blr
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* _memcopy.c -- subroutines for memory copy functions.
|
||||
Copyright (C) 1991, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991-2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Torbjorn Granlund (tege@sics.se).
|
||||
|
||||
@@ -60,6 +60,21 @@ _wordcopy_fwd_aligned (dstp, srcp, len)
|
||||
while (len != 0);
|
||||
}
|
||||
|
||||
#define fwd_align_merge(align) \
|
||||
do \
|
||||
{ \
|
||||
a1 = ((op_t *) srcp)[1]; \
|
||||
a2 = ((op_t *) srcp)[2]; \
|
||||
((op_t *) dstp)[0] = MERGE (a0, align*8, a1, (64-align*8)); \
|
||||
((op_t *) dstp)[1] = MERGE (a1, align*8, a2, (64-align*8)); \
|
||||
a0 = a2; \
|
||||
srcp += 2 * OPSIZ; \
|
||||
dstp += 2 * OPSIZ; \
|
||||
len -= 2; \
|
||||
} \
|
||||
while (len != 0)
|
||||
|
||||
|
||||
/* _wordcopy_fwd_dest_aligned -- Copy block beginning at SRCP to
|
||||
block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
|
||||
DSTP should be aligned for memory operations on `op_t's, but SRCP must
|
||||
@@ -101,114 +116,7 @@ _wordcopy_fwd_dest_aligned (dstp, srcp, len)
|
||||
len -= 1;
|
||||
}
|
||||
|
||||
switch (align)
|
||||
{
|
||||
case 1:
|
||||
do
|
||||
{
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a2 = ((op_t *) srcp)[2];
|
||||
((op_t *) dstp)[0] = MERGE (a0, 8, a1, (64-8));
|
||||
((op_t *) dstp)[1] = MERGE (a1, 8, a2, (64-8));
|
||||
a0 = a2;
|
||||
|
||||
srcp += 2 * OPSIZ;
|
||||
dstp += 2 * OPSIZ;
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 2:
|
||||
do
|
||||
{
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a2 = ((op_t *) srcp)[2];
|
||||
((op_t *) dstp)[0] = MERGE (a0, 16, a1, (64-16));
|
||||
((op_t *) dstp)[1] = MERGE (a1, 16, a2, (64-16));
|
||||
a0 = a2;
|
||||
|
||||
srcp += 2 * OPSIZ;
|
||||
dstp += 2 * OPSIZ;
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 3:
|
||||
do
|
||||
{
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a2 = ((op_t *) srcp)[2];
|
||||
((op_t *) dstp)[0] = MERGE (a0, 24, a1, (64-24));
|
||||
((op_t *) dstp)[1] = MERGE (a1, 24, a2, (64-24));
|
||||
a0 = a2;
|
||||
|
||||
srcp += 2 * OPSIZ;
|
||||
dstp += 2 * OPSIZ;
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 4:
|
||||
do
|
||||
{
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a2 = ((op_t *) srcp)[2];
|
||||
((op_t *) dstp)[0] = MERGE (a0, 32, a1, (64-32));
|
||||
((op_t *) dstp)[1] = MERGE (a1, 32, a2, (64-32));
|
||||
a0 = a2;
|
||||
|
||||
srcp += 2 * OPSIZ;
|
||||
dstp += 2 * OPSIZ;
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 5:
|
||||
do
|
||||
{
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a2 = ((op_t *) srcp)[2];
|
||||
((op_t *) dstp)[0] = MERGE (a0, 40, a1, (64-40));
|
||||
((op_t *) dstp)[1] = MERGE (a1, 40, a2, (64-40));
|
||||
a0 = a2;
|
||||
|
||||
srcp += 2 * OPSIZ;
|
||||
dstp += 2 * OPSIZ;
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 6:
|
||||
do
|
||||
{
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a2 = ((op_t *) srcp)[2];
|
||||
((op_t *) dstp)[0] = MERGE (a0, 48, a1, (64-48));
|
||||
((op_t *) dstp)[1] = MERGE (a1, 48, a2, (64-48));
|
||||
a0 = a2;
|
||||
|
||||
srcp += 2 * OPSIZ;
|
||||
dstp += 2 * OPSIZ;
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 7:
|
||||
do
|
||||
{
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a2 = ((op_t *) srcp)[2];
|
||||
((op_t *) dstp)[0] = MERGE (a0, 56, a1, (64-56));
|
||||
((op_t *) dstp)[1] = MERGE (a1, 56, a2, (64-56));
|
||||
a0 = a2;
|
||||
|
||||
srcp += 2 * OPSIZ;
|
||||
dstp += 2 * OPSIZ;
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
}
|
||||
fwd_align_merge (align);
|
||||
|
||||
}
|
||||
|
||||
@@ -251,6 +159,20 @@ _wordcopy_bwd_aligned (dstp, srcp, len)
|
||||
while (len != 0);
|
||||
}
|
||||
|
||||
#define bwd_align_merge(align) \
|
||||
do \
|
||||
{ \
|
||||
srcp -= 2 * OPSIZ; \
|
||||
dstp -= 2 * OPSIZ; \
|
||||
a1 = ((op_t *) srcp)[1]; \
|
||||
a0 = ((op_t *) srcp)[0]; \
|
||||
((op_t *) dstp)[1] = MERGE (a1, align*8, a2, (64-align*8)); \
|
||||
((op_t *) dstp)[0] = MERGE (a0, align*8, a1, (64-align*8)); \
|
||||
a2 = a0; \
|
||||
len -= 2; \
|
||||
} \
|
||||
while (len != 0)
|
||||
|
||||
/* _wordcopy_bwd_dest_aligned -- Copy block finishing right
|
||||
before SRCP to block finishing right before DSTP with LEN `op_t'
|
||||
words (not LEN bytes!). DSTP should be aligned for memory
|
||||
@@ -292,119 +214,5 @@ _wordcopy_bwd_dest_aligned (dstp, srcp, len)
|
||||
len -= 1;
|
||||
}
|
||||
|
||||
switch (align)
|
||||
{
|
||||
case 1:
|
||||
do
|
||||
{
|
||||
srcp -= 2 * OPSIZ;
|
||||
dstp -= 2 * OPSIZ;
|
||||
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a0 = ((op_t *) srcp)[0];
|
||||
((op_t *) dstp)[1] = MERGE (a1, 8, a2, (64-8));
|
||||
((op_t *) dstp)[0] = MERGE (a0, 8, a1, (64-8));
|
||||
a2 = a0;
|
||||
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 2:
|
||||
do
|
||||
{
|
||||
srcp -= 2 * OPSIZ;
|
||||
dstp -= 2 * OPSIZ;
|
||||
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a0 = ((op_t *) srcp)[0];
|
||||
((op_t *) dstp)[1] = MERGE (a1, 16, a2, (64-16));
|
||||
((op_t *) dstp)[0] = MERGE (a0, 16, a1, (64-16));
|
||||
a2 = a0;
|
||||
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 3:
|
||||
do
|
||||
{
|
||||
srcp -= 2 * OPSIZ;
|
||||
dstp -= 2 * OPSIZ;
|
||||
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a0 = ((op_t *) srcp)[0];
|
||||
((op_t *) dstp)[1] = MERGE (a1, 24, a2, (64-24));
|
||||
((op_t *) dstp)[0] = MERGE (a0, 24, a1, (64-24));
|
||||
a2 = a0;
|
||||
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 4:
|
||||
do
|
||||
{
|
||||
srcp -= 2 * OPSIZ;
|
||||
dstp -= 2 * OPSIZ;
|
||||
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a0 = ((op_t *) srcp)[0];
|
||||
((op_t *) dstp)[1] = MERGE (a1, 32, a2, (64-32));
|
||||
((op_t *) dstp)[0] = MERGE (a0, 32, a1, (64-32));
|
||||
a2 = a0;
|
||||
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 5:
|
||||
do
|
||||
{
|
||||
srcp -= 2 * OPSIZ;
|
||||
dstp -= 2 * OPSIZ;
|
||||
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a0 = ((op_t *) srcp)[0];
|
||||
((op_t *) dstp)[1] = MERGE (a1, 40, a2, (64-40));
|
||||
((op_t *) dstp)[0] = MERGE (a0, 40, a1, (64-40));
|
||||
a2 = a0;
|
||||
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 6:
|
||||
do
|
||||
{
|
||||
srcp -= 2 * OPSIZ;
|
||||
dstp -= 2 * OPSIZ;
|
||||
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a0 = ((op_t *) srcp)[0];
|
||||
((op_t *) dstp)[1] = MERGE (a1, 48, a2, (64-48));
|
||||
((op_t *) dstp)[0] = MERGE (a0, 48, a1, (64-48));
|
||||
a2 = a0;
|
||||
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
case 7:
|
||||
do
|
||||
{
|
||||
srcp -= 2 * OPSIZ;
|
||||
dstp -= 2 * OPSIZ;
|
||||
|
||||
a1 = ((op_t *) srcp)[1];
|
||||
a0 = ((op_t *) srcp)[0];
|
||||
((op_t *) dstp)[1] = MERGE (a1, 56, a2, (64-56));
|
||||
((op_t *) dstp)[0] = MERGE (a0, 56, a1, (64-56));
|
||||
a2 = a0;
|
||||
|
||||
len -= 2;
|
||||
}
|
||||
while (len != 0);
|
||||
break;
|
||||
}
|
||||
bwd_align_merge (align);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
ifeq ($(subdir),elf)
|
||||
# Prevent the use of VSX registers and insns in _dl_start, which under -O3
|
||||
# optimization may require a TOC reference before relocations are resolved.
|
||||
CFLAGS-rtld.c += -mno-vsx
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),string)
|
||||
CFLAGS-strncase.c += -funroll-loops
|
||||
CFLAGS-strncase_l.c += -funroll-loops
|
||||
endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Optimized memcpy implementation for PowerPC64/POWER7.
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010, 2011 Free Software Foundation, Inc.
|
||||
Contributed by Luis Machado <luisgpm@br.ibm.com>.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@@ -115,23 +115,81 @@ L(copy_GE_32_aligned_cont):
|
||||
std 6,0(3)
|
||||
addi 10,3,8
|
||||
|
||||
/* Main aligned copy loop. Copies 32-bytes at a time. */
|
||||
L(aligned_copy):
|
||||
/* Main aligned copy loop. Copies up to 128-bytes at a time. */
|
||||
.align 4
|
||||
4:
|
||||
ld 6,0(11)
|
||||
ld 7,8(11)
|
||||
ld 8,16(11)
|
||||
ld 0,24(11)
|
||||
addi 11,11,32
|
||||
/* check for any 32-byte or 64-byte lumps that are outside of a
|
||||
nice 128-byte range. R8 contains the number of 32-byte
|
||||
lumps, so drop this into the CR, and use the SO/EQ bits to help
|
||||
handle the 32- or 64- byte lumps. Then handle the rest with an
|
||||
unrolled 128-bytes-at-a-time copy loop. */
|
||||
mtocrf 1,8
|
||||
li 6,16 # 16() index
|
||||
li 7,32 # 32() index
|
||||
li 8,48 # 48() index
|
||||
|
||||
L(aligned_32byte):
|
||||
/* if the SO bit (indicating a 32-byte lump) is not set, move along. */
|
||||
bns cr7,L(aligned_64byte)
|
||||
lxvd2x 6,0,11
|
||||
lxvd2x 7,11,6
|
||||
addi 11,11,32
|
||||
stxvd2x 6,0,10
|
||||
stxvd2x 7,10,6
|
||||
addi 10,10,32
|
||||
|
||||
L(aligned_64byte):
|
||||
/* if the EQ bit (indicating a 64-byte lump) is not set, move along. */
|
||||
bne cr7,L(aligned_128setup)
|
||||
lxvd2x 6,0,11
|
||||
lxvd2x 7,11,6
|
||||
lxvd2x 8,11,7
|
||||
lxvd2x 9,11,8
|
||||
addi 11,11,64
|
||||
stxvd2x 6,0,10
|
||||
stxvd2x 7,10,6
|
||||
stxvd2x 8,10,7
|
||||
stxvd2x 9,10,8
|
||||
addi 10,10,64
|
||||
|
||||
L(aligned_128setup):
|
||||
/* Set up for the 128-byte at a time copy loop. */
|
||||
srdi 8,31,7
|
||||
cmpdi 8,0 # Any 4x lumps left?
|
||||
beq 3f # if not, move along.
|
||||
lxvd2x 6,0,11
|
||||
lxvd2x 7,11,6
|
||||
mtctr 8 # otherwise, load the ctr and begin.
|
||||
li 8,48 # 48() index
|
||||
b L(aligned_128loop)
|
||||
|
||||
L(aligned_128head):
|
||||
/* for the 2nd + iteration of this loop. */
|
||||
lxvd2x 6,0,11
|
||||
lxvd2x 7,11,6
|
||||
L(aligned_128loop):
|
||||
lxvd2x 8,11,7
|
||||
lxvd2x 9,11,8
|
||||
stxvd2x 6,0,10
|
||||
addi 11,11,64
|
||||
stxvd2x 7,10,6
|
||||
stxvd2x 8,10,7
|
||||
stxvd2x 9,10,8
|
||||
lxvd2x 6,0,11
|
||||
lxvd2x 7,11,6
|
||||
addi 10,10,64
|
||||
lxvd2x 8,11,7
|
||||
lxvd2x 9,11,8
|
||||
addi 11,11,64
|
||||
stxvd2x 6,0,10
|
||||
stxvd2x 7,10,6
|
||||
stxvd2x 8,10,7
|
||||
stxvd2x 9,10,8
|
||||
addi 10,10,64
|
||||
bdnz L(aligned_128head)
|
||||
|
||||
std 6,0(10)
|
||||
std 7,8(10)
|
||||
std 8,16(10)
|
||||
std 0,24(10)
|
||||
addi 10,10,32
|
||||
bdnz 4b
|
||||
3:
|
||||
|
||||
/* Check for tail bytes. */
|
||||
rldicr 0,31,0,60
|
||||
mtcrf 0x01,31
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
/* Optimized strcasecmp implementation for PowerPC64.
|
||||
Copyright (C) 2011 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>
|
||||
#include <bp-sym.h>
|
||||
#include <bp-asm.h>
|
||||
#include <locale-defines.h>
|
||||
|
||||
/* int [r3] strcasecmp (const char *s1 [r3], const char *s2 [r4] )
|
||||
|
||||
or if defined USE_IN_EXTENDED_LOCALE_MODEL:
|
||||
|
||||
int [r3] strcasecmp_l (const char *s1 [r3], const char *s2 [r4],
|
||||
__locale_t loc [r5]) */
|
||||
|
||||
#ifndef STRCMP
|
||||
# define __STRCMP __strcasecmp
|
||||
# define STRCMP strcasecmp
|
||||
#endif
|
||||
|
||||
ENTRY (BP_SYM (__STRCMP))
|
||||
CALL_MCOUNT 2
|
||||
|
||||
#define rRTN r3 /* Return value */
|
||||
#define rSTR1 r5 /* 1st string */
|
||||
#define rSTR2 r4 /* 2nd string */
|
||||
#define rLOCARG r5 /* 3rd argument: locale_t */
|
||||
#define rCHAR1 r6 /* Byte readed from 1st string */
|
||||
#define rCHAR2 r7 /* Byte readed from 2nd string */
|
||||
#define rADDR1 r8 /* Address of tolower(rCHAR1) */
|
||||
#define rADDR2 r12 /* Address of tolower(rCHAR2) */
|
||||
#define rLWR1 r8 /* Word tolower(rCHAR1) */
|
||||
#define rLWR2 r12 /* Word tolower(rCHAR2) */
|
||||
#define rTMP r9
|
||||
#define rLOC r11 /* Default locale address */
|
||||
|
||||
cmpd cr7, r3, r4
|
||||
#ifndef USE_IN_EXTENDED_LOCALE_MODEL
|
||||
ld rTMP, __libc_tsd_LOCALE@got@tprel(r2)
|
||||
add rLOC, rTMP, __libc_tsd_LOCALE@tls
|
||||
ld rLOC, 0(rLOC)
|
||||
#else
|
||||
mr rLOC, rLOCARG
|
||||
#endif
|
||||
ld rLOC, LOCALE_CTYPE_TOLOWER(rLOC)
|
||||
mr rSTR1, rRTN
|
||||
li rRTN, 0
|
||||
beqlr cr7
|
||||
|
||||
|
||||
/* Unrolling loop for POWER: loads are done with 'lbz' plus
|
||||
offset and string descriptors are only updated in the end
|
||||
of loop unrolling. */
|
||||
|
||||
lbz rCHAR1, 0(rSTR1) /* Load char from s1 */
|
||||
lbz rCHAR2, 0(rSTR2) /* Load char from s2 */
|
||||
L(loop):
|
||||
cmpdi rCHAR1, 0 /* *s1 == '\0' ? */
|
||||
sldi rADDR1, rCHAR1, 2 /* Calculate address for tolower(*s1) */
|
||||
sldi rADDR2, rCHAR2, 2 /* Calculate address for tolower(*s2) */
|
||||
lwzx rLWR1, rLOC, rADDR1 /* Load tolower(*s1) */
|
||||
lwzx rLWR2, rLOC, rADDR2 /* Load tolower(*s2) */
|
||||
cmpw cr1, rLWR1, rLWR2 /* r = tolower(*s1) == tolower(*s2) ? */
|
||||
crorc 4*cr1+eq,eq,4*cr1+eq /* (*s1 != '\0') || (r == 1) */
|
||||
beq cr1, L(done)
|
||||
lbz rCHAR1, 1(rSTR1)
|
||||
lbz rCHAR2, 1(rSTR2)
|
||||
cmpdi rCHAR1, 0
|
||||
sldi rADDR1, rCHAR1, 2
|
||||
sldi rADDR2, rCHAR2, 2
|
||||
lwzx rLWR1, rLOC, rADDR1
|
||||
lwzx rLWR2, rLOC, rADDR2
|
||||
cmpw cr1, rLWR1, rLWR2
|
||||
crorc 4*cr1+eq,eq,4*cr1+eq
|
||||
beq cr1, L(done)
|
||||
lbz rCHAR1, 2(rSTR1)
|
||||
lbz rCHAR2, 2(rSTR2)
|
||||
cmpdi rCHAR1, 0
|
||||
sldi rADDR1, rCHAR1, 2
|
||||
sldi rADDR2, rCHAR2, 2
|
||||
lwzx rLWR1, rLOC, rADDR1
|
||||
lwzx rLWR2, rLOC, rADDR2
|
||||
cmpw cr1, rLWR1, rLWR2
|
||||
crorc 4*cr1+eq,eq,4*cr1+eq
|
||||
beq cr1, L(done)
|
||||
lbz rCHAR1, 3(rSTR1)
|
||||
lbz rCHAR2, 3(rSTR2)
|
||||
cmpdi rCHAR1, 0
|
||||
/* Increment both string descriptors */
|
||||
addi rSTR1, rSTR1, 4
|
||||
addi rSTR2, rSTR2, 4
|
||||
sldi rADDR1, rCHAR1, 2
|
||||
sldi rADDR2, rCHAR2, 2
|
||||
lwzx rLWR1, rLOC, rADDR1
|
||||
lwzx rLWR2, rLOC, rADDR2
|
||||
cmpw cr1, rLWR1, rLWR2
|
||||
crorc 4*cr1+eq,eq,4*cr1+eq
|
||||
beq cr1,L(done)
|
||||
lbz rCHAR1, 0(rSTR1) /* Load char from s1 */
|
||||
lbz rCHAR2, 0(rSTR2) /* Load char from s2 */
|
||||
b L(loop)
|
||||
L(done):
|
||||
subf r0, rLWR2, rLWR1
|
||||
extsw rRTN, r0
|
||||
blr
|
||||
END (BP_SYM (__STRCMP))
|
||||
|
||||
weak_alias (BP_SYM (__STRCMP), BP_SYM (STRCMP))
|
||||
libc_hidden_builtin_def (__STRCMP)
|
||||
@@ -0,0 +1,5 @@
|
||||
#define USE_IN_EXTENDED_LOCALE_MODEL
|
||||
#define STRCMP strcasecmp_l
|
||||
#define __STRCMP __strcasecmp_l
|
||||
|
||||
#include "strcasecmp.S"
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Optimized strcmp implementation for POWER7/PowerPC64.
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010, 2011 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
|
||||
@@ -27,7 +27,7 @@
|
||||
const char *s2 [r4],
|
||||
size_t size [r5]) */
|
||||
|
||||
EALIGN (BP_SYM(strncmp),4,0)
|
||||
EALIGN (BP_SYM(strncmp),5,0)
|
||||
CALL_MCOUNT 3
|
||||
|
||||
#define rTMP r0
|
||||
@@ -48,9 +48,11 @@ EALIGN (BP_SYM(strncmp),4,0)
|
||||
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
|
||||
|
||||
dcbt 0,rSTR1
|
||||
nop
|
||||
or rTMP,rSTR2,rSTR1
|
||||
lis r7F7F,0x7f7f
|
||||
dcbt 0,rSTR2
|
||||
nop
|
||||
clrldi. rTMP,rTMP,61
|
||||
cmpldi cr1,rN,0
|
||||
lis rFEFE,-0x101
|
||||
@@ -145,30 +147,31 @@ L(u1):
|
||||
bdz L(u4)
|
||||
cmpd rWORD1,rWORD2
|
||||
beq cr1,L(u4)
|
||||
bne L(u4)
|
||||
lbzu rWORD3,1(rSTR1)
|
||||
lbzu rWORD4,1(rSTR2)
|
||||
bne L(u4)
|
||||
cmpdi cr1,rWORD3,0
|
||||
bdz L(u3)
|
||||
cmpd rWORD3,rWORD4
|
||||
beq cr1,L(u3)
|
||||
bne L(u3)
|
||||
lbzu rWORD1,1(rSTR1)
|
||||
lbzu rWORD2,1(rSTR2)
|
||||
bne L(u3)
|
||||
cmpdi cr1,rWORD1,0
|
||||
bdz L(u4)
|
||||
cmpd rWORD1,rWORD2
|
||||
beq cr1,L(u4)
|
||||
bne L(u4)
|
||||
lbzu rWORD3,1(rSTR1)
|
||||
lbzu rWORD4,1(rSTR2)
|
||||
bne L(u4)
|
||||
cmpdi cr1,rWORD3,0
|
||||
bdz L(u3)
|
||||
cmpd rWORD3,rWORD4
|
||||
beq cr1,L(u3)
|
||||
bne L(u3)
|
||||
lbzu rWORD1,1(rSTR1)
|
||||
lbzu rWORD2,1(rSTR2)
|
||||
beq L(u1)
|
||||
b L(u1)
|
||||
|
||||
L(u3): sub rRTN,rWORD3,rWORD4
|
||||
blr
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Thread-local storage handling in the ELF dynamic linker. s390 version.
|
||||
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2004, 2011 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
|
||||
@@ -72,6 +72,9 @@ __tls_get_offset:\n\
|
||||
# define __TLS_GET_ADDR(__ti) \
|
||||
({ extern char _GLOBAL_OFFSET_TABLE_[] attribute_hidden; \
|
||||
(void *) __tls_get_offset ((char *) (__ti) - _GLOBAL_OFFSET_TABLE_) \
|
||||
+ (unsigned long) __builtin_thread_pointer (); })
|
||||
+ (unsigned long) __builtin_thread_pointer (); })
|
||||
|
||||
#endif
|
||||
|
||||
/* Value used for dtv entries for which the allocation is delayed. */
|
||||
#define TLS_DTV_UNALLOCATED ((void *) -1l)
|
||||
|
||||
+4
-1
@@ -1,5 +1,5 @@
|
||||
/* Thread-local storage handling in the ELF dynamic linker. SH version.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2011 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
|
||||
@@ -27,3 +27,6 @@ typedef struct
|
||||
|
||||
|
||||
extern void *__tls_get_addr (tls_index *ti);
|
||||
|
||||
/* Value used for dtv entries for which the allocation is delayed. */
|
||||
#define TLS_DTV_UNALLOCATED ((void *) -1l)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Thread-local storage handling in the ELF dynamic linker. SPARC version.
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2011 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
|
||||
@@ -27,3 +27,6 @@ typedef struct
|
||||
|
||||
|
||||
extern void *__tls_get_addr (tls_index *ti);
|
||||
|
||||
/* Value used for dtv entries for which the allocation is delayed. */
|
||||
#define TLS_DTV_UNALLOCATED ((void *) -1l)
|
||||
|
||||
@@ -3,5 +3,6 @@ libc {
|
||||
__vdso_get_tbfreq;
|
||||
__vdso_clock_gettime;
|
||||
__vdso_clock_getres;
|
||||
__vdso_getcpu;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ extern void *__vdso_clock_getres;
|
||||
|
||||
extern void *__vdso_get_tbfreq;
|
||||
|
||||
extern void *__vdso_getcpu;
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _LIBC_VDSO_H */
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/* Optional code to distinguish library flavors.
|
||||
Copyright (C) 2010, 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Peter Bergner <bergner@vnet.ibm.com>
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifndef _DL_LIBRECON_H
|
||||
|
||||
#include <string.h>
|
||||
#include <sysdeps/unix/sysv/linux/dl-librecon.h>
|
||||
|
||||
/* Recognizing extra environment variables. */
|
||||
#define EXTRA_LD_ENVVARS_11 \
|
||||
if (memcmp (envline, "AT_PLATFORM", 11) == 0) \
|
||||
{ \
|
||||
int platformlen = strlen (&envline[12]); \
|
||||
GLRO(dl_platformlen) = platformlen; \
|
||||
if (platformlen > 0) \
|
||||
{ \
|
||||
GLRO(dl_platform) = &envline[12]; \
|
||||
break; \
|
||||
} \
|
||||
GLRO(dl_platform) = NULL; \
|
||||
break; \
|
||||
}
|
||||
|
||||
/* Extra unsecure variables. The names are all stuffed in a single
|
||||
string which means they have to be terminated with a '\0' explicitly. */
|
||||
#define EXTRA_UNSECURE_ENVVARS \
|
||||
"LD_AT_PLATFORM\0"
|
||||
|
||||
#endif /* dl-librecon.h */
|
||||
@@ -27,6 +27,7 @@ void *__vdso_gettimeofday attribute_hidden;
|
||||
void *__vdso_clock_gettime;
|
||||
void *__vdso_clock_getres;
|
||||
void *__vdso_get_tbfreq;
|
||||
void *__vdso_getcpu;
|
||||
|
||||
|
||||
static inline void
|
||||
@@ -41,6 +42,8 @@ _libc_vdso_platform_setup (void)
|
||||
__vdso_clock_getres = _dl_vdso_vsym ("__kernel_clock_getres", &linux2615);
|
||||
|
||||
__vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_vdso_get_tbfreq", &linux2615);
|
||||
|
||||
__vdso_getcpu = _dl_vdso_vsym ("__kernel_getcpu", &linux2615);
|
||||
}
|
||||
|
||||
# define VDSO_SETUP _libc_vdso_platform_setup
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Selective file content synch'ing.
|
||||
Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2007, 2009, 2011 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
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sysdep.h>
|
||||
#include <sysdep-cancel.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
|
||||
@@ -29,7 +29,17 @@
|
||||
int
|
||||
sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
|
||||
{
|
||||
return INLINE_SYSCALL (sync_file_range2, 4, fd, flags, from, to);
|
||||
if (SINGLE_THREAD_P)
|
||||
return INLINE_SYSCALL (sync_file_range2, 4, fd, flags, from, to);
|
||||
|
||||
int result;
|
||||
int oldtype = LIBC_CANCEL_ASYNC ();
|
||||
|
||||
result = INLINE_SYSCALL (sync_file_range2, 4, fd, flags, from, to);
|
||||
|
||||
LIBC_CANCEL_RESET (oldtype);
|
||||
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
int
|
||||
|
||||
@@ -172,7 +172,7 @@
|
||||
: "r9", "r10", "r11", "r12", \
|
||||
"cr0", "ctr", "lr", "memory"); \
|
||||
err = (long int) r0; \
|
||||
(int) r3; \
|
||||
r3; \
|
||||
})
|
||||
|
||||
#undef INLINE_SYSCALL
|
||||
@@ -219,7 +219,7 @@
|
||||
: "r9", "r10", "r11", "r12", \
|
||||
"cr0", "ctr", "memory"); \
|
||||
err = r0; \
|
||||
(int) r3; \
|
||||
r3; \
|
||||
})
|
||||
#define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||
INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/* Copyright (C) 2013 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, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sched.h>
|
||||
#include <sysdep.h>
|
||||
#include <bits/libc-vdso.h>
|
||||
|
||||
|
||||
int
|
||||
sched_getcpu (void)
|
||||
{
|
||||
unsigned int cpu;
|
||||
int r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL);
|
||||
|
||||
return r == -1 ? r : cpu;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
ifeq ($(subdir),misc)
|
||||
tests += tst-writev
|
||||
|
||||
# Time enough for a large writev syscall to complete.
|
||||
tst-writev-ENV = TIMEOUTFACTOR="10"
|
||||
endif
|
||||
@@ -0,0 +1,107 @@
|
||||
/* Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ryan S. Arnold <rsa@us.ibm.com>, 2011.
|
||||
|
||||
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 <fcntl.h>
|
||||
#include <paths.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
|
||||
/* The purpose of this test is to verify that the INTERNAL_[V]SYSCALL_NCS
|
||||
macros on 64-bit platforms don't cast the return type to (int) which would
|
||||
erroneously sign extend the return value should the high bit of the bottom
|
||||
half of the word be '1'. */
|
||||
|
||||
#if 0
|
||||
/* Used to test the non power-of-2 code path. */
|
||||
#undef IOV_MAX
|
||||
#define IOV_MAX 1000
|
||||
#endif
|
||||
|
||||
/* writev() should report that it has written EXPECTED number of bytes. */
|
||||
#define EXPECTED ((size_t) INT32_MAX + 1)
|
||||
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
struct iovec iv[IOV_MAX];
|
||||
/* POSIX doesn't guarantee that IOV_MAX is pow of 2 but we're optimistic. */
|
||||
size_t bufsz = EXPECTED / IOV_MAX;
|
||||
size_t bufrem = EXPECTED % IOV_MAX;
|
||||
|
||||
/* If there's a remainder then IOV_MAX probably isn't a power of 2 and we
|
||||
need to make bufsz bigger so that the last iovec, iv[IOV_MAX-1], is free
|
||||
for the remainder. */
|
||||
if (bufrem)
|
||||
{
|
||||
bufsz = bufsz + 1;
|
||||
bufrem = EXPECTED - (bufsz * (IOV_MAX - 1));
|
||||
}
|
||||
|
||||
/* We writev to /dev/null since we're just testing writev's return value. */
|
||||
int fd = open (_PATH_DEVNULL, O_WRONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
printf ("Unable to open /dev/null for writing.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
iv[0].iov_base = malloc (bufsz);
|
||||
if (iv[0].iov_base == NULL)
|
||||
{
|
||||
printf ("malloc (%zu) failed.\n", bufsz);
|
||||
close (fd);
|
||||
return -1;
|
||||
}
|
||||
iv[0].iov_len = bufsz;
|
||||
|
||||
/* We optimistically presume that there isn't a remainder and set all iovec
|
||||
instances to the same base and len as the first instance. */
|
||||
for (int i = 1; i < IOV_MAX; i++)
|
||||
{
|
||||
/* We don't care what the data is so reuse the allocation from iv[0]; */
|
||||
iv[i].iov_base = iv[0].iov_base;
|
||||
iv[i].iov_len = iv[0].iov_len;
|
||||
}
|
||||
|
||||
/* If there is a remainder then we correct the last iov_len. */
|
||||
if (bufrem)
|
||||
iv[IOV_MAX - 1].iov_len = bufrem;
|
||||
|
||||
/* Write junk to /dev/null with the writev syscall in order to get a return
|
||||
of INT32_MAX+1 bytes to verify that the INTERNAL_SYSCALL wrappers aren't
|
||||
mangling the result if the signbit of a 32-bit number is set. */
|
||||
ssize_t ret = writev (fd, iv, IOV_MAX);
|
||||
|
||||
free (iv[0].iov_base);
|
||||
close (fd);
|
||||
|
||||
if (ret != (ssize_t) EXPECTED)
|
||||
{
|
||||
printf ("writev() return value: %zd != EXPECTED: %zd\n", ret, EXPECTED);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Thread-local storage handling in the ELF dynamic linker. x86-64 version.
|
||||
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2005, 2011 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
|
||||
@@ -27,3 +27,6 @@ typedef struct dl_tls_index
|
||||
|
||||
|
||||
extern void *__tls_get_addr (tls_index *ti);
|
||||
|
||||
/* Value used for dtv entries for which the allocation is delayed. */
|
||||
#define TLS_DTV_UNALLOCATED ((void *) -1l)
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
ud2
|
||||
|
||||
.section .text.ssse3,"ax",@progbits
|
||||
#if defined SHARED && !defined NOT_IN_libc
|
||||
#if !defined USE_AS_BCOPY
|
||||
ENTRY (MEMCPY_CHK)
|
||||
cmpq %rdx, %rcx
|
||||
jb HIDDEN_JUMPTARGET (__chk_fail)
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
ud2
|
||||
|
||||
.section .text.ssse3,"ax",@progbits
|
||||
#if defined SHARED && !defined NOT_IN_libc
|
||||
#if !defined USE_AS_BCOPY
|
||||
ENTRY (MEMCPY_CHK)
|
||||
cmpq %rdx, %rcx
|
||||
jb HIDDEN_JUMPTARGET (__chk_fail)
|
||||
|
||||
Reference in New Issue
Block a user