summaryrefslogtreecommitdiff
path: root/libc/ports
diff options
context:
space:
mode:
Diffstat (limited to 'libc/ports')
-rw-r--r--libc/ports/ChangeLog.alpha31
-rw-r--r--libc/ports/ChangeLog.am3320
-rw-r--r--libc/ports/ChangeLog.arm25
-rw-r--r--libc/ports/ChangeLog.hppa62
-rw-r--r--libc/ports/ChangeLog.ia6431
-rw-r--r--libc/ports/ChangeLog.linux-generic18
-rw-r--r--libc/ports/ChangeLog.m68k24
-rw-r--r--libc/ports/ChangeLog.mips74
-rw-r--r--libc/ports/ChangeLog.powerpc19
-rw-r--r--libc/ports/ChangeLog.tile55
-rw-r--r--libc/ports/sysdeps/alpha/fpu/bits/fenv.h55
-rw-r--r--libc/ports/sysdeps/alpha/fpu/fclrexcpt.c3
-rw-r--r--libc/ports/sysdeps/alpha/tininess.h1
-rw-r--r--libc/ports/sysdeps/am33/fpu/bits/fenv.h32
-rw-r--r--libc/ports/sysdeps/am33/fpu/fclrexcpt.c3
-rw-r--r--libc/ports/sysdeps/am33/tininess.h1
-rw-r--r--libc/ports/sysdeps/arm/bits/fenv.h47
-rw-r--r--libc/ports/sysdeps/arm/fclrexcpt.c1
-rw-r--r--libc/ports/sysdeps/hppa/fpu/bits/fenv.h51
-rw-r--r--libc/ports/sysdeps/hppa/fpu/fclrexcpt.c3
-rw-r--r--libc/ports/sysdeps/hppa/tininess.h1
-rw-r--r--libc/ports/sysdeps/ia64/bits/fenv.h54
-rw-r--r--libc/ports/sysdeps/ia64/fpu/fclrexcpt.c3
-rw-r--r--libc/ports/sysdeps/ia64/tininess.h1
-rw-r--r--libc/ports/sysdeps/m68k/fpu/bits/fenv.h45
-rw-r--r--libc/ports/sysdeps/m68k/fpu/fclrexcpt.c3
-rw-r--r--libc/ports/sysdeps/mips/bits/fenv.h45
-rw-r--r--libc/ports/sysdeps/mips/fpu/fclrexcpt.c3
-rw-r--r--libc/ports/sysdeps/mips/memcpy.S704
-rw-r--r--libc/ports/sysdeps/mips/mips64/memcpy.S138
-rw-r--r--libc/ports/sysdeps/mips/tininess.h1
-rw-r--r--libc/ports/sysdeps/powerpc/nofpu/fclrexcpt.c3
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/405/memset.S12
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/476/memset.S154
-rw-r--r--libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fclrexcpt.c1
-rw-r--r--libc/ports/sysdeps/tile/bits/fenv.h7
-rw-r--r--libc/ports/sysdeps/tile/crti.S23
-rw-r--r--libc/ports/sysdeps/tile/dl-machine.h4
-rw-r--r--libc/ports/sysdeps/tile/dl-runtime.c107
-rw-r--r--libc/ports/sysdeps/tile/libm-test-ulps68
-rw-r--r--libc/ports/sysdeps/tile/math_private.h32
-rw-r--r--libc/ports/sysdeps/tile/memcopy.h27
-rw-r--r--libc/ports/sysdeps/tile/nptl/pthread_spin_unlock.c33
-rw-r--r--libc/ports/sysdeps/tile/start.S23
-rw-r--r--libc/ports/sysdeps/tile/tilegx/Makefile18
-rw-r--r--libc/ports/sysdeps/tile/tilegx/memcpy.c200
-rw-r--r--libc/ports/sysdeps/tile/wordcopy.c449
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h241
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h14
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/generic/bits/fcntl.h291
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/generic/sysctl.c1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/generic/ustat.c1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h273
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/hppa/sysdep.h84
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h274
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h280
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/Makefile43
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/configure106
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/configure.in44
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/Makefile1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/Makefile1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist5
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/Makefile1
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h12
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist2
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/Makefile4
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h30
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c37
-rw-r--r--libc/ports/sysdeps/unix/sysv/linux/tile/init-first.c34
70 files changed, 2626 insertions, 1870 deletions
diff --git a/libc/ports/ChangeLog.alpha b/libc/ports/ChangeLog.alpha
index 8ddde9f25..ca446c8a8 100644
--- a/libc/ports/ChangeLog.alpha
+++ b/libc/ports/ChangeLog.alpha
@@ -1,3 +1,34 @@
+2012-11-03 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/alpha/fpu/fclrexcpt.c (feclearexcept): Add
+ libm_hidden_ver.
+
+ [BZ #3439]
+ * sysdeps/alpha/fpu/bits/fenv.h (FE_DENORMAL): Define macro to
+ integer constant usable in #if and use that to give value to enum
+ constant.
+ (FE_INEXACT): Likewise.
+ (FE_UNDERFLOW): Likewise.
+ (FE_OVERFLOW): Likewise.
+ (FE_DIVBYZERO): Likewise.
+ (FE_INVALID): Likewise.
+ (FE_ALL_EXCEPT): Likewise.
+ (FE_TOWARDZERO): Likewise.
+ (FE_DOWNWARD): Likewise.
+ (FE_TONEAREST): Likewise.
+ (FE_UPWARD): Likewise.
+
+2012-11-01 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Remove all
+ definitions and declarations that are provided by
+ <bits/fcntl-linux.h> and include <bits/fcntl-linux.h>.
+
+2012-10-30 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #14047]
+ * sysdeps/alpha/tininess.h: New file.
+
2012-10-19 Roland McGrath <roland@hack.frob.com>
* sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
diff --git a/libc/ports/ChangeLog.am33 b/libc/ports/ChangeLog.am33
index e8243c532..4e6d40b4c 100644
--- a/libc/ports/ChangeLog.am33
+++ b/libc/ports/ChangeLog.am33
@@ -1,3 +1,23 @@
+2012-11-03 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/am33/fpu/fclrexcpt.c (feclearexcept): Add
+ libm_hidden_ver.
+
+ [BZ #3439]
+ * sysdeps/am33/fpu/bits/fenv.h (FE_INEXACT): Define macro to
+ integer constant usable in #if and use that to give value to enum
+ constant.
+ (FE_UNDERFLOW): Likewise.
+ (FE_OVERFLOW): Likewise.
+ (FE_DIVBYZERO): Likewise.
+ (FE_INVALID): Likewise.
+ (FE_TONEAREST): Likewise.
+
+2012-10-30 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #14047]
+ * sysdeps/am33/tininess.h: New file.
+
2012-10-09 Roland McGrath <roland@hack.frob.com>
* sysdeps/unix/sysv/linux/am33/configure: Regenerated.
diff --git a/libc/ports/ChangeLog.arm b/libc/ports/ChangeLog.arm
index 0b76f5ed2..c5e5f367f 100644
--- a/libc/ports/ChangeLog.arm
+++ b/libc/ports/ChangeLog.arm
@@ -1,3 +1,28 @@
+2012-11-05 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
+ (lll_futex_timed_wait_bitset): New macro.
+
+ [BZ #14805]
+ * sysdeps/arm/bits/fenv.h (FE_DFL_ENV): Use cast to const fenv_t *.
+
+2012-11-03 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/arm/fclrexcpt.c (feclearexcept): Add libm_hidden_ver.
+
+ [BZ #3439]
+ * sysdeps/arm/bits/fenv.h (FE_INVALID): Define macro to integer
+ constant usable in #if and use that to give value to enum
+ constant.
+ (FE_DIVBYZERO): Likewise.
+ (FE_OVERFLOW): Likewise.
+ (FE_UNDERFLOW): Likewise.
+ (FE_INEXACT): Likewise.
+ (FE_TONEAREST): Likewise.
+ (FE_UPWARD): Likewise.
+ (FE_DOWNWARD): Likewise.
+ (FE_TOWARDZERO): Likewise.
+
2012-10-22 Roland McGrath <roland@hack.frob.com>
* sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
diff --git a/libc/ports/ChangeLog.hppa b/libc/ports/ChangeLog.hppa
index 2bfd5d481..201dd01de 100644
--- a/libc/ports/ChangeLog.hppa
+++ b/libc/ports/ChangeLog.hppa
@@ -1,3 +1,65 @@
+2012-11-05 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #14805]
+ * sysdeps/hppa/fpu/bits/fenv.h (FE_DFL_ENV): Use cast to const
+ fenv_t *.
+ (FE_NOMASK_ENV): Likewise.
+
+2012-11-03 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/hppa/fpu/fclrexcpt.c (feclearexcept): Add
+ libm_hidden_def.
+
+ [BZ #3439]
+ * sysdeps/hppa/fpu/bits/fenv.h (FE_INVALID): Define macro to
+ integer constant usable in #if and use that to give value to enum
+ constant.
+ (FE_DIVBYZERO): Likewise.
+ (FE_OVERFLOW): Likewise.
+ (FE_UNDERFLOW): Likewise.
+ (FE_INEXACT): Likewise.
+ (FE_TONEAREST): Likewise.
+ (FE_TOWARDZERO): Likewise.
+ (FE_UPWARD): Likewise.
+ (FE_DOWNWARD): Likewise.
+
+2012-10-30 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #14047]
+ * sysdeps/hppa/tininess.h: New file.
+
+2012-10-29 Carlos O'Donell <carlos@systemhalted.org>
+
+ * sysdeps/unix/sysv/linux/hppa/sysdep.h (ENTRY): Add cfi_startproc.
+ Use .cfi_offset for rp store.
+ (ENTRY_LEAF): Likewise.
+ (END) Add cfi_Endproc.
+ (DO_CALL): Add cfi directives.
+
+ * sysdeps/unix/sysv/linux/hppa/sysdep.h: Document register clobbering.
+ [PIC](TREG, SAVE_PIC, LOAD_PIC, TREG_ASM, SAVE_ASM_PIC, LOAD_ASM_PIC
+ CLOB_TREG, PIC_REG_DEF, PIC_REG_USE): Move...
+ (TREG, SAVE_PIC, LOAD_PIC, TREG_ASM, SAVE_ASM_PIC, LOAD_ASM_PIC
+ CLOB_TREG, PIC_REG_DEF, PIC_REG_USE): ... to here.
+ [!PIC](TREG, SAVE_PIC, LOAD_PIC, TREG_ASM, SAVE_ASM_PIC, LOAD_ASM_PIC
+ CLOB_TREG, PIC_REG_DEF, PIC_REG_USE): Remove.
+ (TREG): Use r4.
+
+ * sysdeps/unix/sysv/linux/hppa/sysdep.h: Don't include sys/syscall.h.
+ Document nop removal.
+ (PSEUDO): Remove nop.
+ (PSEUDO_NOERRNO): Likeise.
+ (PSEUDO_ERRVAL): Likewise.
+
+ * sysdeps/unix/sysv/linux/hppa/sysdep.h: Remove trailing whitespace.
+
+2012-10-26 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/unix/sysv/linux/hppa/bits/fcntl.h: Remove all
+ definitions and declarations that are provided by
+ <bits/fcntl-linux.h> and include <bits/fcntl-linux.h>.
+ (__O_PATH): Define.
+
2012-10-24 Joseph Myers <joseph@codesourcery.com>
* sysdeps/hppa/nptl/Makefile (tst-oddstacklimit-ENV): Remove.
diff --git a/libc/ports/ChangeLog.ia64 b/libc/ports/ChangeLog.ia64
index 8d8f4dcd7..0b3361af0 100644
--- a/libc/ports/ChangeLog.ia64
+++ b/libc/ports/ChangeLog.ia64
@@ -1,3 +1,34 @@
+2012-11-03 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/ia64/fpu/fclrexcpt.c (feclearexcept): Add
+ libm_hidden_def.
+
+ [BZ #3439]
+ * sysdeps/ia64/bits/fenv.h (FE_INEXACT): Define macro to integer
+ constant usable in #if and use that to give value to enum
+ constant.
+ (FE_UNDERFLOW): Likewise.
+ (FE_OVERFLOW): Likewise.
+ (FE_DIVBYZERO): Likewise.
+ (FE_UNNORMAL): Likewise.
+ (FE_INVALID): Likewise.
+ (FE_ALL_EXCEPT): Likewise.
+ (FE_TOWARDZERO): Likewise.
+ (FE_UPWARD): Likewise.
+ (FE_DOWNWARD): Likewise.
+ (FE_TONEAREST): Likewise.
+
+2012-10-30 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #14047]
+ * sysdeps/ia64/tininess.h: New file.
+
+2012-10-25 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/unix/sysv/linux/ia64/bits/fcntl.h: Remove all
+ definitions and declarations that are provided by
+ <bits/fcntl-linux.h> and include <bits/fcntl-linux.h>.
+
2012-10-19 Roland McGrath <roland@hack.frob.com>
* sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
diff --git a/libc/ports/ChangeLog.linux-generic b/libc/ports/ChangeLog.linux-generic
index efbf3992a..d3f0e5b75 100644
--- a/libc/ports/ChangeLog.linux-generic
+++ b/libc/ports/ChangeLog.linux-generic
@@ -1,3 +1,21 @@
+2012-11-04 Thomas Schwinge <thomas@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/generic/sysctl.c: Don't include
+ <stub-tag.h>.
+ * sysdeps/unix/sysv/linux/generic/ustat.c: Likewise.
+
+2012-10-27 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/unix/sysv/linux/generic/bits/fcntl.h: (__O_LARGEFILE)
+ [__WORDSIZE != 64]: Do not define, take value from
+ <bits/fcntl-linux.h>.
+
+2012-10-23 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/unix/sysv/linux/generic/bits/fcntl.h: Remove all
+ definitions and declarations that are provided by
+ <bits/fcntl-linux.h> and include <bits/fcntl-linux.h>.
+
2012-10-01 Roland McGrath <roland@hack.frob.com>
* sysdeps/unix/sysv/linux/generic/bits/typesizes.h
diff --git a/libc/ports/ChangeLog.m68k b/libc/ports/ChangeLog.m68k
index dda8cf7ee..206702e1f 100644
--- a/libc/ports/ChangeLog.m68k
+++ b/libc/ports/ChangeLog.m68k
@@ -1,3 +1,27 @@
+2012-11-03 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/m68k/fpu/fclrexcpt.c (feclearexcept): Add
+ libm_hidden_ver.
+
+ [BZ #3439]
+ * sysdeps/m68k/fpu/bits/fenv.h (FE_INEXACT): Define macro to
+ integer constant usable in #if and use that to give value to enum
+ constant.
+ (FE_DIVBYZERO): Likewise.
+ (FE_UNDERFLOW): Likewise.
+ (FE_OVERFLOW): Likewise.
+ (FE_INVALID): Likewise.
+ (FE_TONEAREST): Likewise.
+ (FE_TOWARDZERO): Likewise.
+ (FE_DOWNWARD): Likewise.
+ (FE_UPWARD): Likewise.
+
+2012-10-25 Andreas Jaeger <aj@suse.de>
+
+ * sysdeps/unix/sysv/linux/m68k/bits/fcntl.h: Remove all
+ definitions and declarations that are provided by
+ <bits/fcntl-linux.h> and include <bits/fcntl-linux.h>.
+
2012-10-19 Roland McGrath <roland@hack.frob.com>
* sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist:
diff --git a/libc/ports/ChangeLog.mips b/libc/ports/ChangeLog.mips
index a6aecad24..8dc4893b0 100644
--- a/libc/ports/ChangeLog.mips
+++ b/libc/ports/ChangeLog.mips
@@ -1,3 +1,77 @@
+2012-11-05 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h
+ (lll_futex_timed_wait_bitset): New macro.
+
+2012-11-04 Thomas Schwinge <thomas@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c: Don't
+ include <stub-tag.h>.
+
+2012-11-03 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/mips/fpu/fclrexcpt.c (feclearexcept): Add
+ libm_hidden_def.
+
+ [BZ #3439]
+ * sysdeps/mips/bits/fenv.h (FE_INEXACT): Define macro to integer
+ constant usable in #if and use that to give value to enum
+ constant.
+ (FE_UNDERFLOW): Likewise.
+ (FE_OVERFLOW): Likewise.
+ (FE_DIVBYZERO): Likewise.
+ (FE_INVALID): Likewise.
+ (FE_TONEAREST): Likewise.
+ (FE_TOWARDZERO): Likewise.
+ (FE_UPWARD): Likewise.
+ (FE_DOWNWARD): Likewise.
+
+2012-11-01 Thomas Schwinge <thomas@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/mips/configure: Regenerate.
+
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist
+ (GLIBC_2.17): Add clock_* symbols.
+
+2012-10-31 Steve Ellcey <sellcey@mips.com>
+
+ * sysdeps/mips/memcpy.S: Add prefetching and more unrolling, make
+ it work in 32 or 64 bit modes.
+ * sysdeps/mips/mips64/memcpy.S: Remove.
+
+2012-10-30 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #14047]
+ * sysdeps/mips/tininess.h: New file.
+
+2012-10-29 Steve Ellcey <sellcey@mips.com>
+
+ * sysdeps/unix/sysv/linux/mips/mips32/Makefile: Remove.
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/Makefile: Remove.
+ * sysdeps/unix/sysv/linux/mips/mips64/n64/Makefile: Remove.
+ * sysdeps/unix/sysv/linux/mips/configure.in: Create default_abi.make.
+ * sysdeps/unix/sysv/linux/mips/configure: Regenerate.
+ * sysdeps/unix/sysv/linux/mips/Makefile: Include default_abi.make.
+ (abi-variants): Add hard and soft float versions.
+ (abi-o32-options): Remove.
+ (abi-o32-condition): Remove.
+ (abi-n32-options): Remove.
+ (abi-n32-condition): Remove.
+ (abi-n64-options): Remove.
+ (abi-n64-condition): Remove.
+ (abi-o32_soft-options): New.
+ (abi-o32_soft-condition): New.
+ (abi-o32_hard-options): New.
+ (abi-o32_hard-condition): New.
+ (abi-n32_soft-options): New.
+ (abi-n32_soft-condition): New.
+ (abi-n32_hard-options): New.
+ (abi-n32_hard-condition): New.
+ (abi-n64_soft-options): New.
+ (abi-n64_soft-condition): New.
+ (abi-n64_hard-options): New.
+ (abi-n64_hard-condition): New.
+
2012-10-19 Roland McGrath <roland@hack.frob.com>
* sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
diff --git a/libc/ports/ChangeLog.powerpc b/libc/ports/ChangeLog.powerpc
index 642e7165c..a6fd7821f 100644
--- a/libc/ports/ChangeLog.powerpc
+++ b/libc/ports/ChangeLog.powerpc
@@ -1,3 +1,22 @@
+2012-11-03 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/powerpc/nofpu/fclrexcpt.c (feclearexcept): Add
+ libm_hidden_ver.
+
+2012-10-31 Andreas Schwab <schwab@linux-m68k.org>
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist:
+ Fix sort order.
+
+2012-10-30 Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
+ Ryan S. Arnold <rsa@linux.vnet.ibm.com>
+
+ [BZ #14595]
+ * sysdeps/powerpc/powerpc32/476/memset.S: New file copied from
+ 405/memset.S to preserve 128-byte cacheline size.
+ * sysdeps/powerpc/powerpc32/405/memset.S (memset): Fix cacheline size
+ to 32-bytes for 405, 440, and 464 processors.
+
2012-10-19 Roland McGrath <roland@hack.frob.com>
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
diff --git a/libc/ports/ChangeLog.tile b/libc/ports/ChangeLog.tile
index 93c99ac69..06f24c27e 100644
--- a/libc/ports/ChangeLog.tile
+++ b/libc/ports/ChangeLog.tile
@@ -1,3 +1,58 @@
+2012-11-06 Chris Metcalf <cmetcalf@tilera.com>
+
+ * sysdeps/tile/nptl/pthread_spin_unlock.c: New file.
+
+2012-11-05 Chris Metcalf <cmetcalf@tilera.com>
+
+ * sysdeps/tile/math_private.h: Provide additional no-op defines
+ for exception and rounding macros.
+
+ * sysdeps/tile/tilegx/Makefile: Generate Makefile fragment to determine
+ whether to build elf-init.c and gmon-start.c with -mcmodel=large.
+ * sysdeps/tile/crti.S: Support large memory model.
+ * sysdeps/tile/start.S: Likewise.
+
+2012-11-02 Chris Metcalf <cmetcalf@tilera.com>
+
+ * sysdeps/tile/dl-runtime.c (_dl_after_load): Handle simulator
+ notification better for dlopen() of relative paths.
+
+ * sysdeps/tile/tilegx/memcpy.c (__memcpy): Optimize.
+ * sysdeps/tile/memcopy.h: New file.
+ * sysdeps/tile/wordcopy.c: New file.
+
+2012-11-03 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #3439]
+ * sysdeps/tile/bits/fenv.h (FE_TONEAREST): Define macro to integer
+ constant usable in #if and use that to give value to enum
+ constant.
+
+2012-11-03 Chris Metcalf <cmetcalf@tilera.com>
+
+ * sysdeps/tile/libm-test-ulps: Account for new tests.
+
+2012-10-30 Chris Metcalf <cmetcalf@tilera.com>
+
+ * sysdeps/tile/dl-machine.h: Use new DL_AFTER_LOAD macro
+ and rename _dl_arch_map_object to _dl_after_load.
+ * sysdeps/tile/dl-runtime.c: Rename _dl_arch_map_object
+ to _dl_after_load and remove spurious DL_UNMAP definition.
+
+ * sysdeps/unix/sysv/linux/tile/init-first.c: Use better #include.
+ * sysdeps/unix/sysv/linux/tile/gettimeofday.c: Use gettimeofday
+ aliases that match existing tile ABI.
+
+ * sysdeps/tile/libm-test-ulps: Account for new tests.
+
+2012-10-26 Chris Metcalf <cmetcalf@tilera.com>
+
+ * sysdeps/unix/sysv/linux/tile/Makefile (sysdep_routines):
+ Include dl-vdso.
+ * sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h: New file.
+ * sysdeps/unix/sysv/linux/tile/gettimeofday.c: New file.
+ * sysdeps/unix/sysv/linux/tile/init-first.c: New file.
+
2012-10-19 Roland McGrath <roland@hack.frob.com>
* sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist:
diff --git a/libc/ports/sysdeps/alpha/fpu/bits/fenv.h b/libc/ports/sysdeps/alpha/fpu/bits/fenv.h
index 2ddbaa15f..9edbe7682 100644
--- a/libc/ports/sysdeps/alpha/fpu/bits/fenv.h
+++ b/libc/ports/sysdeps/alpha/fpu/bits/fenv.h
@@ -36,27 +36,34 @@
enum
{
#ifdef __USE_GNU
- FE_DENORMAL = 1UL << 22,
-#define FE_DENORMAL FE_DENORMAL
+ FE_DENORMAL =
+#define FE_DENORMAL (1 << 22)
+ FE_DENORMAL,
#endif
- FE_INEXACT = 1UL << 21,
-#define FE_INEXACT FE_INEXACT
+ FE_INEXACT =
+#define FE_INEXACT (1 << 21)
+ FE_INEXACT,
- FE_UNDERFLOW = 1UL << 20,
-#define FE_UNDERFLOW FE_UNDERFLOW
+ FE_UNDERFLOW =
+#define FE_UNDERFLOW (1 << 20)
+ FE_UNDERFLOW,
- FE_OVERFLOW = 1UL << 19,
-#define FE_OVERFLOW FE_OVERFLOW
+ FE_OVERFLOW =
+#define FE_OVERFLOW (1 << 19)
+ FE_OVERFLOW,
- FE_DIVBYZERO = 1UL << 18,
-#define FE_DIVBYZERO FE_DIVBYZERO
+ FE_DIVBYZERO =
+#define FE_DIVBYZERO (1 << 18)
+ FE_DIVBYZERO,
- FE_INVALID = 1UL << 17,
-#define FE_INVALID FE_INVALID
+ FE_INVALID =
+#define FE_INVALID (1 << 17)
+ FE_INVALID,
- FE_ALL_EXCEPT = 0x3f << 17
-#define FE_ALL_EXCEPT FE_ALL_EXCEPT
+ FE_ALL_EXCEPT =
+#define FE_ALL_EXCEPT (0x3f << 17)
+ FE_ALL_EXCEPT
};
/* Alpha chips support all four defined rouding modes.
@@ -70,17 +77,21 @@ enum
enum
{
- FE_TOWARDZERO = 0,
-#define FE_TOWARDZERO FE_TOWARDZERO
+ FE_TOWARDZERO =
+#define FE_TOWARDZERO 0
+ FE_TOWARDZERO,
- FE_DOWNWARD = 1,
-#define FE_DOWNWARD FE_DOWNWARD
+ FE_DOWNWARD =
+#define FE_DOWNWARD 1
+ FE_DOWNWARD,
- FE_TONEAREST = 2,
-#define FE_TONEAREST FE_TONEAREST
+ FE_TONEAREST =
+#define FE_TONEAREST 2
+ FE_TONEAREST,
- FE_UPWARD = 3,
-#define FE_UPWARD FE_UPWARD
+ FE_UPWARD =
+#define FE_UPWARD 3
+ FE_UPWARD,
};
#ifdef __USE_GNU
diff --git a/libc/ports/sysdeps/alpha/fpu/fclrexcpt.c b/libc/ports/sysdeps/alpha/fpu/fclrexcpt.c
index 2d2bd94db..84596529c 100644
--- a/libc/ports/sysdeps/alpha/fpu/fclrexcpt.c
+++ b/libc/ports/sysdeps/alpha/fpu/fclrexcpt.c
@@ -1,5 +1,5 @@
/* Clear given exceptions in current floating-point environment.
- Copyright (C) 1997,99,2000,01 Free Software Foundation, Inc.
+ Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>, 1997.
@@ -43,4 +43,5 @@ strong_alias (__feclearexcept, __old_feclearexcept)
compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
#endif
+libm_hidden_ver (__feclearexcept, feclearexcept)
versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
diff --git a/libc/ports/sysdeps/alpha/tininess.h b/libc/ports/sysdeps/alpha/tininess.h
new file mode 100644
index 000000000..1db37790f
--- /dev/null
+++ b/libc/ports/sysdeps/alpha/tininess.h
@@ -0,0 +1 @@
+#define TININESS_AFTER_ROUNDING 1
diff --git a/libc/ports/sysdeps/am33/fpu/bits/fenv.h b/libc/ports/sysdeps/am33/fpu/bits/fenv.h
index d3a89982b..b0e60e931 100644
--- a/libc/ports/sysdeps/am33/fpu/bits/fenv.h
+++ b/libc/ports/sysdeps/am33/fpu/bits/fenv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Alexandre Oliva <aoliva@redhat.com>
based on the corresponding file in the mips port.
@@ -26,16 +26,21 @@
positions of the appropriate bits in the FPCR register. */
enum
{
- FE_INEXACT = 0x01,
-#define FE_INEXACT FE_INEXACT
- FE_UNDERFLOW = 0x02,
-#define FE_UNDERFLOW FE_UNDERFLOW
- FE_OVERFLOW = 0x04,
-#define FE_OVERFLOW FE_OVERFLOW
- FE_DIVBYZERO = 0x08,
-#define FE_DIVBYZERO FE_DIVBYZERO
- FE_INVALID = 0x10,
-#define FE_INVALID FE_INVALID
+ FE_INEXACT =
+#define FE_INEXACT 0x01
+ FE_INEXACT,
+ FE_UNDERFLOW =
+#define FE_UNDERFLOW 0x02
+ FE_UNDERFLOW,
+ FE_OVERFLOW =
+#define FE_OVERFLOW 0x04
+ FE_OVERFLOW,
+ FE_DIVBYZERO =
+#define FE_DIVBYZERO 0x08
+ FE_DIVBYZERO,
+ FE_INVALID =
+#define FE_INVALID 0x10
+ FE_INVALID,
};
#define FE_ALL_EXCEPT \
@@ -45,8 +50,9 @@ enum
reserved to represent other rounding modes. */
enum
{
- FE_TONEAREST = 0x00000,
-#define FE_TONEAREST FE_TONEAREST
+ FE_TONEAREST =
+#define FE_TONEAREST 0x00000
+ FE_TONEAREST,
};
diff --git a/libc/ports/sysdeps/am33/fpu/fclrexcpt.c b/libc/ports/sysdeps/am33/fpu/fclrexcpt.c
index 2b15f45a6..492ea38ba 100644
--- a/libc/ports/sysdeps/am33/fpu/fclrexcpt.c
+++ b/libc/ports/sysdeps/am33/fpu/fclrexcpt.c
@@ -1,5 +1,5 @@
/* Clear given exceptions in current floating-point environment.
- Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Alexandre Oliva <aoliva@redhat.com>
based on corresponding file in the MIPS port.
@@ -48,4 +48,5 @@ __feclearexcept (int excepts)
return 0;
}
+libm_hidden_ver (__feclearexcept, feclearexcept)
versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
diff --git a/libc/ports/sysdeps/am33/tininess.h b/libc/ports/sysdeps/am33/tininess.h
new file mode 100644
index 000000000..1db37790f
--- /dev/null
+++ b/libc/ports/sysdeps/am33/tininess.h
@@ -0,0 +1 @@
+#define TININESS_AFTER_ROUNDING 1
diff --git a/libc/ports/sysdeps/arm/bits/fenv.h b/libc/ports/sysdeps/arm/bits/fenv.h
index 006ccf528..bc4a3ee53 100644
--- a/libc/ports/sysdeps/arm/bits/fenv.h
+++ b/libc/ports/sysdeps/arm/bits/fenv.h
@@ -22,16 +22,21 @@
/* Define bits representing exceptions in the FPU status word. */
enum
{
- FE_INVALID = 1,
-#define FE_INVALID FE_INVALID
- FE_DIVBYZERO = 2,
-#define FE_DIVBYZERO FE_DIVBYZERO
- FE_OVERFLOW = 4,
-#define FE_OVERFLOW FE_OVERFLOW
- FE_UNDERFLOW = 8,
-#define FE_UNDERFLOW FE_UNDERFLOW
- FE_INEXACT = 16,
-#define FE_INEXACT FE_INEXACT
+ FE_INVALID =
+#define FE_INVALID 1
+ FE_INVALID,
+ FE_DIVBYZERO =
+#define FE_DIVBYZERO 2
+ FE_DIVBYZERO,
+ FE_OVERFLOW =
+#define FE_OVERFLOW 4
+ FE_OVERFLOW,
+ FE_UNDERFLOW =
+#define FE_UNDERFLOW 8
+ FE_UNDERFLOW,
+ FE_INEXACT =
+#define FE_INEXACT 16
+ FE_INEXACT,
};
/* Amount to shift by to convert an exception to a mask bit. */
@@ -44,14 +49,18 @@ enum
/* VFP supports all of the four defined rounding modes. */
enum
{
- FE_TONEAREST = 0,
-#define FE_TONEAREST FE_TONEAREST
- FE_UPWARD = 0x400000,
-#define FE_UPWARD FE_UPWARD
- FE_DOWNWARD = 0x800000,
-#define FE_DOWNWARD FE_DOWNWARD
- FE_TOWARDZERO = 0xc00000
-#define FE_TOWARDZERO FE_TOWARDZERO
+ FE_TONEAREST =
+#define FE_TONEAREST 0
+ FE_TONEAREST,
+ FE_UPWARD =
+#define FE_UPWARD 0x400000
+ FE_UPWARD,
+ FE_DOWNWARD =
+#define FE_DOWNWARD 0x800000
+ FE_DOWNWARD,
+ FE_TOWARDZERO =
+#define FE_TOWARDZERO 0xc00000
+ FE_TOWARDZERO
};
/* Type representing exception flags. */
@@ -65,7 +74,7 @@ typedef struct
fenv_t;
/* If the default argument is used we use this value. */
-#define FE_DFL_ENV ((fenv_t *) -1l)
+#define FE_DFL_ENV ((const fenv_t *) -1l)
#ifdef __USE_GNU
/* Floating-point environment where none of the exceptions are masked. */
diff --git a/libc/ports/sysdeps/arm/fclrexcpt.c b/libc/ports/sysdeps/arm/fclrexcpt.c
index 23435fba7..fb106a5cc 100644
--- a/libc/ports/sysdeps/arm/fclrexcpt.c
+++ b/libc/ports/sysdeps/arm/fclrexcpt.c
@@ -54,4 +54,5 @@ strong_alias (__feclearexcept, __old_feclearexcept)
compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
#endif
+libm_hidden_ver (__feclearexcept, feclearexcept)
versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
diff --git a/libc/ports/sysdeps/hppa/fpu/bits/fenv.h b/libc/ports/sysdeps/hppa/fpu/bits/fenv.h
index 6af5ddeef..49e30185a 100644
--- a/libc/ports/sysdeps/hppa/fpu/bits/fenv.h
+++ b/libc/ports/sysdeps/hppa/fpu/bits/fenv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Huggins-Daines <dhd@debian.org>
@@ -26,16 +26,21 @@
27 bits). */
enum
{
- FE_INVALID = 1<<4, /* V */
-#define FE_INVALID FE_INVALID
- FE_DIVBYZERO = 1<<3, /* Z */
-#define FE_DIVBYZERO FE_DIVBYZERO
- FE_OVERFLOW = 1<<2, /* O */
-#define FE_OVERFLOW FE_OVERFLOW
- FE_UNDERFLOW = 1<<1, /* U */
-#define FE_UNDERFLOW FE_UNDERFLOW
- FE_INEXACT = 1<<0, /* I */
-#define FE_INEXACT FE_INEXACT
+ FE_INVALID =
+#define FE_INVALID (1<<4) /* V */
+ FE_INVALID,
+ FE_DIVBYZERO =
+#define FE_DIVBYZERO (1<<3) /* Z */
+ FE_DIVBYZERO,
+ FE_OVERFLOW =
+#define FE_OVERFLOW (1<<2) /* O */
+ FE_OVERFLOW,
+ FE_UNDERFLOW =
+#define FE_UNDERFLOW (1<<1) /* U */
+ FE_UNDERFLOW,
+ FE_INEXACT =
+#define FE_INEXACT (1<<0) /* I */
+ FE_INEXACT,
};
#define FE_ALL_EXCEPT \
@@ -46,14 +51,18 @@ enum
register for the appropriate macros. */
enum
{
- FE_TONEAREST = 0 << 9,
-#define FE_TONEAREST FE_TONEAREST
- FE_TOWARDZERO = 1 << 9,
-#define FE_TOWARDZERO FE_TOWARDZERO
- FE_UPWARD = 2 << 9,
-#define FE_UPWARD FE_UPWARD
- FE_DOWNWARD = 3 << 9,
-#define FE_DOWNWARD FE_DOWNWARD
+ FE_TONEAREST =
+#define FE_TONEAREST (0 << 9)
+ FE_TONEAREST,
+ FE_TOWARDZERO =
+#define FE_TOWARDZERO (1 << 9)
+ FE_TOWARDZERO,
+ FE_UPWARD =
+#define FE_UPWARD (2 << 9)
+ FE_UPWARD,
+ FE_DOWNWARD =
+#define FE_DOWNWARD (3 << 9)
+ FE_DOWNWARD,
};
/* Type representing exception flags. */
@@ -74,9 +83,9 @@ typedef struct
} fenv_t;
/* If the default argument is used we use this value. */
-#define FE_DFL_ENV ((fenv_t *) -1)
+#define FE_DFL_ENV ((const fenv_t *) -1)
#ifdef __USE_GNU
/* Floating-point environment where none of the exceptions are masked. */
-# define FE_NOMASK_ENV ((fenv_t *) -2)
+# define FE_NOMASK_ENV ((const fenv_t *) -2)
#endif
diff --git a/libc/ports/sysdeps/hppa/fpu/fclrexcpt.c b/libc/ports/sysdeps/hppa/fpu/fclrexcpt.c
index 5d1e59310..bbc2c7080 100644
--- a/libc/ports/sysdeps/hppa/fpu/fclrexcpt.c
+++ b/libc/ports/sysdeps/hppa/fpu/fclrexcpt.c
@@ -1,5 +1,5 @@
/* Clear given exceptions in current floating-point environment.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Huggins-Daines <dhd@debian.org>, 2000
@@ -33,3 +33,4 @@ feclearexcept (int excepts)
/* Success. */
return 0;
}
+libm_hidden_def (feclearexcept)
diff --git a/libc/ports/sysdeps/hppa/tininess.h b/libc/ports/sysdeps/hppa/tininess.h
new file mode 100644
index 000000000..1db37790f
--- /dev/null
+++ b/libc/ports/sysdeps/hppa/tininess.h
@@ -0,0 +1 @@
+#define TININESS_AFTER_ROUNDING 1
diff --git a/libc/ports/sysdeps/ia64/bits/fenv.h b/libc/ports/sysdeps/ia64/bits/fenv.h
index 342605d8c..7b5a75315 100644
--- a/libc/ports/sysdeps/ia64/bits/fenv.h
+++ b/libc/ports/sysdeps/ia64/bits/fenv.h
@@ -25,43 +25,53 @@
enum
{
- FE_INEXACT = 1UL << 5,
-#define FE_INEXACT FE_INEXACT
+ FE_INEXACT =
+#define FE_INEXACT (1 << 5)
+ FE_INEXACT,
- FE_UNDERFLOW = 1UL << 4,
-#define FE_UNDERFLOW FE_UNDERFLOW
+ FE_UNDERFLOW =
+#define FE_UNDERFLOW (1 << 4)
+ FE_UNDERFLOW,
- FE_OVERFLOW = 1UL << 3,
-#define FE_OVERFLOW FE_OVERFLOW
+ FE_OVERFLOW =
+#define FE_OVERFLOW (1 << 3)
+ FE_OVERFLOW,
- FE_DIVBYZERO = 1UL << 2,
-#define FE_DIVBYZERO FE_DIVBYZERO
+ FE_DIVBYZERO =
+#define FE_DIVBYZERO (1 << 2)
+ FE_DIVBYZERO,
- FE_UNNORMAL = 1UL << 1,
-#define FE_UNNORMAL FE_UNNORMAL
+ FE_UNNORMAL =
+#define FE_UNNORMAL (1 << 1)
+ FE_UNNORMAL,
- FE_INVALID = 1UL << 0,
-#define FE_INVALID FE_INVALID
+ FE_INVALID =
+#define FE_INVALID (1 << 0)
+ FE_INVALID,
FE_ALL_EXCEPT =
- (FE_INEXACT | FE_UNDERFLOW | FE_OVERFLOW | FE_DIVBYZERO | FE_UNNORMAL | FE_INVALID)
-#define FE_ALL_EXCEPT FE_ALL_EXCEPT
+#define FE_ALL_EXCEPT (FE_INEXACT | FE_UNDERFLOW | FE_OVERFLOW | FE_DIVBYZERO | FE_UNNORMAL | FE_INVALID)
+ FE_ALL_EXCEPT
};
enum
{
- FE_TOWARDZERO = 3,
-#define FE_TOWARDZERO FE_TOWARDZERO
+ FE_TOWARDZERO =
+#define FE_TOWARDZERO 3
+ FE_TOWARDZERO,
- FE_UPWARD = 2,
-#define FE_UPWARD FE_UPWARD
+ FE_UPWARD =
+#define FE_UPWARD 2
+ FE_UPWARD,
- FE_DOWNWARD = 1,
-#define FE_DOWNWARD FE_DOWNWARD
+ FE_DOWNWARD =
+#define FE_DOWNWARD 1
+ FE_DOWNWARD,
- FE_TONEAREST = 0,
-#define FE_TONEAREST FE_TONEAREST
+ FE_TONEAREST =
+#define FE_TONEAREST 0
+ FE_TONEAREST,
};
diff --git a/libc/ports/sysdeps/ia64/fpu/fclrexcpt.c b/libc/ports/sysdeps/ia64/fpu/fclrexcpt.c
index 84f83277b..c099fd35a 100644
--- a/libc/ports/sysdeps/ia64/fpu/fclrexcpt.c
+++ b/libc/ports/sysdeps/ia64/fpu/fclrexcpt.c
@@ -1,5 +1,5 @@
/* Clear given exceptions in current floating-point environment.
- Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999 and
Jes Sorensen <Jes.Sorensen@cern.ch>, 2000
@@ -36,3 +36,4 @@ feclearexcept (int excepts)
/* success */
return 0;
}
+libm_hidden_def (feclearexcept)
diff --git a/libc/ports/sysdeps/ia64/tininess.h b/libc/ports/sysdeps/ia64/tininess.h
new file mode 100644
index 000000000..1db37790f
--- /dev/null
+++ b/libc/ports/sysdeps/ia64/tininess.h
@@ -0,0 +1 @@
+#define TININESS_AFTER_ROUNDING 1
diff --git a/libc/ports/sysdeps/m68k/fpu/bits/fenv.h b/libc/ports/sysdeps/m68k/fpu/bits/fenv.h
index c98365acd..584514c5d 100644
--- a/libc/ports/sysdeps/m68k/fpu/bits/fenv.h
+++ b/libc/ports/sysdeps/m68k/fpu/bits/fenv.h
@@ -24,16 +24,21 @@
the appropriate bits in the FPSR Accrued Exception Byte. */
enum
{
- FE_INEXACT = 1 << 3,
-#define FE_INEXACT FE_INEXACT
- FE_DIVBYZERO = 1 << 4,
-#define FE_DIVBYZERO FE_DIVBYZERO
- FE_UNDERFLOW = 1 << 5,
-#define FE_UNDERFLOW FE_UNDERFLOW
- FE_OVERFLOW = 1 << 6,
-#define FE_OVERFLOW FE_OVERFLOW
- FE_INVALID = 1 << 7
-#define FE_INVALID FE_INVALID
+ FE_INEXACT =
+#define FE_INEXACT (1 << 3)
+ FE_INEXACT,
+ FE_DIVBYZERO =
+#define FE_DIVBYZERO (1 << 4)
+ FE_DIVBYZERO,
+ FE_UNDERFLOW =
+#define FE_UNDERFLOW (1 << 5)
+ FE_UNDERFLOW,
+ FE_OVERFLOW =
+#define FE_OVERFLOW (1 << 6)
+ FE_OVERFLOW,
+ FE_INVALID =
+#define FE_INVALID (1 << 7)
+ FE_INVALID
};
#define FE_ALL_EXCEPT \
@@ -44,14 +49,18 @@ enum
appropriate macros. */
enum
{
- FE_TONEAREST = 0,
-#define FE_TONEAREST FE_TONEAREST
- FE_TOWARDZERO = 1 << 4,
-#define FE_TOWARDZERO FE_TOWARDZERO
- FE_DOWNWARD = 2 << 4,
-#define FE_DOWNWARD FE_DOWNWARD
- FE_UPWARD = 3 << 4
-#define FE_UPWARD FE_UPWARD
+ FE_TONEAREST =
+#define FE_TONEAREST 0
+ FE_TONEAREST,
+ FE_TOWARDZERO =
+#define FE_TOWARDZERO (1 << 4)
+ FE_TOWARDZERO,
+ FE_DOWNWARD =
+#define FE_DOWNWARD (2 << 4)
+ FE_DOWNWARD,
+ FE_UPWARD =
+#define FE_UPWARD (3 << 4)
+ FE_UPWARD
};
diff --git a/libc/ports/sysdeps/m68k/fpu/fclrexcpt.c b/libc/ports/sysdeps/m68k/fpu/fclrexcpt.c
index ceda99cb9..cfc8d9e25 100644
--- a/libc/ports/sysdeps/m68k/fpu/fclrexcpt.c
+++ b/libc/ports/sysdeps/m68k/fpu/fclrexcpt.c
@@ -1,5 +1,5 @@
/* Clear given exceptions in current floating-point environment.
- Copyright (C) 1997,99,2000,01 Free Software Foundation, Inc.
+ Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
@@ -46,4 +46,5 @@ strong_alias (__feclearexcept, __old_feclearexcept)
compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
#endif
+libm_hidden_ver (__feclearexcept, feclearexcept)
versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
diff --git a/libc/ports/sysdeps/mips/bits/fenv.h b/libc/ports/sysdeps/mips/bits/fenv.h
index bc87b15ec..4e03c97c1 100644
--- a/libc/ports/sysdeps/mips/bits/fenv.h
+++ b/libc/ports/sysdeps/mips/bits/fenv.h
@@ -24,16 +24,21 @@
of the appropriate bits in the FPU control word. */
enum
{
- FE_INEXACT = 0x04,
-#define FE_INEXACT FE_INEXACT
- FE_UNDERFLOW = 0x08,
-#define FE_UNDERFLOW FE_UNDERFLOW
- FE_OVERFLOW = 0x10,
-#define FE_OVERFLOW FE_OVERFLOW
- FE_DIVBYZERO = 0x20,
-#define FE_DIVBYZERO FE_DIVBYZERO
- FE_INVALID = 0x40,
-#define FE_INVALID FE_INVALID
+ FE_INEXACT =
+#define FE_INEXACT 0x04
+ FE_INEXACT,
+ FE_UNDERFLOW =
+#define FE_UNDERFLOW 0x08
+ FE_UNDERFLOW,
+ FE_OVERFLOW =
+#define FE_OVERFLOW 0x10
+ FE_OVERFLOW,
+ FE_DIVBYZERO =
+#define FE_DIVBYZERO 0x20
+ FE_DIVBYZERO,
+ FE_INVALID =
+#define FE_INVALID 0x40
+ FE_INVALID,
};
#define FE_ALL_EXCEPT \
@@ -44,14 +49,18 @@ enum
for the appropriate macros. */
enum
{
- FE_TONEAREST = 0x0,
-#define FE_TONEAREST FE_TONEAREST
- FE_TOWARDZERO = 0x1,
-#define FE_TOWARDZERO FE_TOWARDZERO
- FE_UPWARD = 0x2,
-#define FE_UPWARD FE_UPWARD
- FE_DOWNWARD = 0x3
-#define FE_DOWNWARD FE_DOWNWARD
+ FE_TONEAREST =
+#define FE_TONEAREST 0x0
+ FE_TONEAREST,
+ FE_TOWARDZERO =
+#define FE_TOWARDZERO 0x1
+ FE_TOWARDZERO,
+ FE_UPWARD =
+#define FE_UPWARD 0x2
+ FE_UPWARD,
+ FE_DOWNWARD =
+#define FE_DOWNWARD 0x3
+ FE_DOWNWARD
};
diff --git a/libc/ports/sysdeps/mips/fpu/fclrexcpt.c b/libc/ports/sysdeps/mips/fpu/fclrexcpt.c
index f97d89260..f4709b4d2 100644
--- a/libc/ports/sysdeps/mips/fpu/fclrexcpt.c
+++ b/libc/ports/sysdeps/mips/fpu/fclrexcpt.c
@@ -1,5 +1,5 @@
/* Clear given exceptions in current floating-point environment.
- Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1998.
@@ -44,3 +44,4 @@ feclearexcept (int excepts)
/* Success. */
return 0;
}
+libm_hidden_def (feclearexcept)
diff --git a/libc/ports/sysdeps/mips/memcpy.S b/libc/ports/sysdeps/mips/memcpy.S
index 753f67ca1..abb07f9ee 100644
--- a/libc/ports/sysdeps/mips/memcpy.S
+++ b/libc/ports/sysdeps/mips/memcpy.S
@@ -1,6 +1,5 @@
-/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
+/* Copyright (C) 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -16,119 +15,616 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
+#ifdef ANDROID_CHANGES
+#include "machine/asm.h"
+#include "machine/regdef.h"
+#define USE_MEMMOVE_FOR_OVERLAP
+#define PREFETCH_LOAD_HINT PREFETCH_HINT_LOAD_STREAMED
+#define PREFETCH_STORE_HINT PREFETCH_HINT_PREPAREFORSTORE
+#elif _LIBC
#include <sysdep.h>
+#include <regdef.h>
+#include <sys/asm.h>
+#define PREFETCH_LOAD_HINT PREFETCH_HINT_LOAD_STREAMED
+#define PREFETCH_STORE_HINT PREFETCH_HINT_STORE_STREAMED
+#elif _COMPILING_NEWLIB
+#include "machine/asm.h"
+#include "machine/regdef.h"
+#define PREFETCH_LOAD_HINT PREFETCH_HINT_LOAD_STREAMED
+#define PREFETCH_STORE_HINT PREFETCH_HINT_STORE_STREAMED
+#else
+#include <regdef.h>
+#include <sys/asm.h>
+#endif
+
+#if (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \
+ (_MIPS_ISA == _MIPS_ISA_MIPS32) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
+#ifndef DISABLE_PREFETCH
+#define USE_PREFETCH
+#endif
+#endif
+
+#if (_MIPS_SIM == _ABI64) || (_MIPS_SIM == _ABIN32)
+#ifndef DISABLE_DOUBLE
+#define USE_DOUBLE
+#endif
+#endif
+
+
+
+/* Some asm.h files do not have the L macro definition. */
+#ifndef L
+#if _MIPS_SIM == _ABIO32
+# define L(label) $L ## label
+#else
+# define L(label) .L ## label
+#endif
+#endif
+
+/* Some asm.h files do not have the PTR_ADDIU macro definition. */
+#ifndef PTR_ADDIU
+#ifdef USE_DOUBLE
+#define PTR_ADDIU daddiu
+#else
+#define PTR_ADDIU addiu
+#endif
+#endif
+
+/* Some asm.h files do not have the PTR_SRA macro definition. */
+#ifndef PTR_SRA
+#ifdef USE_DOUBLE
+#define PTR_SRA dsra
+#else
+#define PTR_SRA sra
+#endif
+#endif
+
+
+/*
+ * Using PREFETCH_HINT_LOAD_STREAMED instead of PREFETCH_LOAD on load
+ * prefetches appears to offer a slight preformance advantage.
+ *
+ * Using PREFETCH_HINT_PREPAREFORSTORE instead of PREFETCH_STORE
+ * or PREFETCH_STORE_STREAMED offers a large performance advantage
+ * but PREPAREFORSTORE has some special restrictions to consider.
+ *
+ * Prefetch with the 'prepare for store' hint does not copy a memory
+ * location into the cache, it just allocates a cache line and zeros
+ * it out. This means that if you do not write to the entire cache
+ * line before writing it out to memory some data will get zero'ed out
+ * when the cache line is written back to memory and data will be lost.
+ *
+ * Also if you are using this memcpy to copy overlapping buffers it may
+ * not behave correctly when using the 'prepare for store' hint. If you
+ * use the 'prepare for store' prefetch on a memory area that is in the
+ * memcpy source (as well as the memcpy destination), then you will get
+ * some data zero'ed out before you have a chance to read it and data will
+ * be lost.
+ *
+ * If you are going to use this memcpy routine with the 'prepare for store'
+ * prefetch you may want to set USE_MEMMOVE_FOR_OVERLAP in order to avoid
+ * the problem of running memcpy on overlapping buffers.
+ *
+ * There are ifdef'ed sections of this memcpy to make sure that it does not
+ * do prefetches on cache lines that are not going to be completely written.
+ * This code is only needed and only used when PREFETCH_STORE_HINT is set to
+ * PREFETCH_HINT_PREPAREFORSTORE. This code assumes that cache lines are
+ * 32 bytes and if the cache line is larger it will not work correctly.
+ */
+#ifdef USE_PREFETCH
+# define PREFETCH_HINT_LOAD 0
+# define PREFETCH_HINT_STORE 1
+# define PREFETCH_HINT_LOAD_STREAMED 4
+# define PREFETCH_HINT_STORE_STREAMED 5
+# define PREFETCH_HINT_LOAD_RETAINED 6
+# define PREFETCH_HINT_STORE_RETAINED 7
+# define PREFETCH_HINT_WRITEBACK_INVAL 25
+# define PREFETCH_HINT_PREPAREFORSTORE 30
+
+/*
+ * If we have not picked out what hints to use at this point use the
+ * standard load and store prefetch hints.
+ */
+#ifndef PREFETCH_STORE_HINT
+# define PREFETCH_STORE_HINT PREFETCH_HINT_STORE
+#endif
+#ifndef PREFETCH_LOAD_HINT
+# define PREFETCH_LOAD_HINT PREFETCH_HINT_LOAD
+#endif
-/* void *memcpy(void *s1, const void *s2, size_t n); */
+/*
+ * We double everything when USE_DOUBLE is true so we do 2 prefetches to
+ * get 64 bytes in that case. The assumption is that each individual
+ * prefetch brings in 32 bytes.
+ */
+#ifdef USE_DOUBLE
+# define PREFETCH_CHUNK 64
+# define PREFETCH_FOR_LOAD(chunk, reg) \
+ pref PREFETCH_LOAD_HINT, (chunk)*32(reg); \
+ pref PREFETCH_LOAD_HINT, ((chunk)+1)*32(reg)
+# define PREFETCH_FOR_STORE(chunk, reg) \
+ pref PREFETCH_STORE_HINT, (chunk)*32(reg); \
+ pref PREFETCH_STORE_HINT, ((chunk)+1)*32(reg)
+#else
+# define PREFETCH_CHUNK 32
+# define PREFETCH_FOR_LOAD(chunk, reg) \
+ pref PREFETCH_LOAD_HINT, (chunk)*32(reg)
+# define PREFETCH_FOR_STORE(chunk, reg) \
+ pref PREFETCH_STORE_HINT, (chunk)*32(reg)
+#endif
+# define PREFETCH_LIMIT (5 * PREFETCH_CHUNK)
+#else /* USE_PREFETCH not defined */
+# define PREFETCH_FOR_LOAD(offset, reg)
+# define PREFETCH_FOR_STORE(offset, reg)
+#endif
+
+/* Allow the routine to be named something else if desired. */
+#ifndef MEMCPY_NAME
+#define MEMCPY_NAME memcpy
+#endif
+/* We use these 32/64 bit registers as temporaries to do the copying. */
+#define REG0 t0
+#define REG1 t1
+#define REG2 t2
+#define REG3 t3
+#if _MIPS_SIM == _ABIO32
+# define REG4 t4
+# define REG5 t5
+# define REG6 t6
+# define REG7 t7
+#else
+# define REG4 ta0
+# define REG5 ta1
+# define REG6 ta2
+# define REG7 ta3
+#endif
+
+/* We load/store 64 bits at a time when USE_DOUBLE is true.
+ * The C_ prefix stands for CHUNK and is used to avoid macro name
+ * conflicts with system header files. */
+
+#ifdef USE_DOUBLE
+# define C_ST sd
+# define C_LD ld
+#if __MIPSEB
+# define C_LDHI ldl /* high part is left in big-endian */
+# define C_STHI sdl /* high part is left in big-endian */
+# define C_LDLO ldr /* low part is right in big-endian */
+# define C_STLO sdr /* low part is right in big-endian */
+#else
+# define C_LDHI ldr /* high part is right in little-endian */
+# define C_STHI sdr /* high part is right in little-endian */
+# define C_LDLO ldl /* low part is left in little-endian */
+# define C_STLO sdl /* low part is left in little-endian */
+#endif
+#else
+# define C_ST sw
+# define C_LD lw
#if __MIPSEB
-# define LWHI lwl /* high part is left in big-endian */
-# define SWHI swl /* high part is left in big-endian */
-# define LWLO lwr /* low part is right in big-endian */
-# define SWLO swr /* low part is right in big-endian */
+# define C_LDHI lwl /* high part is left in big-endian */
+# define C_STHI swl /* high part is left in big-endian */
+# define C_LDLO lwr /* low part is right in big-endian */
+# define C_STLO swr /* low part is right in big-endian */
#else
-# define LWHI lwr /* high part is right in little-endian */
-# define SWHI swr /* high part is right in little-endian */
-# define LWLO lwl /* low part is left in little-endian */
-# define SWLO swl /* low part is left in little-endian */
+# define C_LDHI lwr /* high part is right in little-endian */
+# define C_STHI swr /* high part is right in little-endian */
+# define C_LDLO lwl /* low part is left in little-endian */
+# define C_STLO swl /* low part is left in little-endian */
+#endif
#endif
-ENTRY (memcpy)
+/* Bookkeeping values for 32 vs. 64 bit mode. */
+#ifdef USE_DOUBLE
+# define NSIZE 8
+# define NSIZEMASK 0x3f
+# define NSIZEDMASK 0x7f
+#else
+# define NSIZE 4
+# define NSIZEMASK 0x1f
+# define NSIZEDMASK 0x3f
+#endif
+#define UNIT(unit) ((unit)*NSIZE)
+#define UNITM1(unit) (((unit)*NSIZE)-1)
+
+#ifdef ANDROID_CHANGES
+LEAF(MEMCPY_NAME, 0)
+#else
+LEAF(MEMCPY_NAME)
+#endif
+ .set nomips16
.set noreorder
+/*
+ * Below we handle the case where memcpy is called with overlapping src and dst.
+ * Although memcpy is not required to handle this case, some parts of Android
+ * like Skia rely on such usage. We call memmove to handle such cases.
+ */
+#ifdef USE_MEMMOVE_FOR_OVERLAP
+ PTR_SUBU t0,a0,a1
+ PTR_SRA t2,t0,31
+ xor t1,t0,t2
+ PTR_SUBU t0,t1,t2
+ sltu t2,t0,a2
+ beq t2,zero,L(memcpy)
+ la t9,memmove
+ jr t9
+ nop
+L(memcpy):
+#endif
+/*
+ * If the size is less then 2*NSIZE (8 or 16), go to L(lastb). Regardless of
+ * size, copy dst pointer to v0 for the return value.
+ */
+ slti t2,a2,(2 * NSIZE)
+ bne t2,zero,L(lastb)
+ move v0,a0
+/*
+ * If src and dst have different alignments, go to L(unaligned), if they
+ * have the same alignment (but are not actually aligned) do a partial
+ * load/store to make them aligned. If they are both already aligned
+ * we can start copying at L(aligned).
+ */
+ xor t8,a1,a0
+ andi t8,t8,(NSIZE-1) /* t8 is a0/a1 word-displacement */
+ bne t8,zero,L(unaligned)
+ PTR_SUBU a3, zero, a0
+
+ andi a3,a3,(NSIZE-1) /* copy a3 bytes to align a0/a1 */
+ beq a3,zero,L(aligned) /* if a3=0, it is already aligned */
+ PTR_SUBU a2,a2,a3 /* a2 is the remining bytes count */
- slti t0, a2, 8 # Less than 8?
- bne t0, zero, L(last8)
- move v0, a0 # Setup exit value before too late
-
- xor t0, a1, a0 # Find a0/a1 displacement
- andi t0, 0x3
- bne t0, zero, L(shift) # Go handle the unaligned case
- subu t1, zero, a1
- andi t1, 0x3 # a0/a1 are aligned, but are we
- beq t1, zero, L(chk8w) # starting in the middle of a word?
- subu a2, t1
- LWHI t0, 0(a1) # Yes we are... take care of that
- addu a1, t1
- SWHI t0, 0(a0)
- addu a0, t1
-
-L(chk8w):
- andi t0, a2, 0x1f # 32 or more bytes left?
- beq t0, a2, L(chk1w)
- subu a3, a2, t0 # Yes
- addu a3, a1 # a3 = end address of loop
- move a2, t0 # a2 = what will be left after loop
-L(lop8w):
- lw t0, 0(a1) # Loop taking 8 words at a time
- lw t1, 4(a1)
- lw t2, 8(a1)
- lw t3, 12(a1)
- lw t4, 16(a1)
- lw t5, 20(a1)
- lw t6, 24(a1)
- lw t7, 28(a1)
- addiu a0, 32
- addiu a1, 32
- sw t0, -32(a0)
- sw t1, -28(a0)
- sw t2, -24(a0)
- sw t3, -20(a0)
- sw t4, -16(a0)
- sw t5, -12(a0)
- sw t6, -8(a0)
- bne a1, a3, L(lop8w)
- sw t7, -4(a0)
-
-L(chk1w):
- andi t0, a2, 0x3 # 4 or more bytes left?
- beq t0, a2, L(last8)
- subu a3, a2, t0 # Yes, handle them one word at a time
- addu a3, a1 # a3 again end address
- move a2, t0
-L(lop1w):
- lw t0, 0(a1)
- addiu a0, 4
- addiu a1, 4
- bne a1, a3, L(lop1w)
- sw t0, -4(a0)
-
-L(last8):
- blez a2, L(lst8e) # Handle last 8 bytes, one at a time
- addu a3, a2, a1
-L(lst8l):
- lb t0, 0(a1)
- addiu a0, 1
- addiu a1, 1
- bne a1, a3, L(lst8l)
- sb t0, -1(a0)
-L(lst8e):
- jr ra # Bye, bye
+ C_LDHI t8,0(a1)
+ PTR_ADDU a1,a1,a3
+ C_STHI t8,0(a0)
+ PTR_ADDU a0,a0,a3
+
+/*
+ * Now dst/src are both aligned to (word or double word) aligned addresses
+ * Set a2 to count how many bytes we have to copy after all the 64/128 byte
+ * chunks are copied and a3 to the dst pointer after all the 64/128 byte
+ * chunks have been copied. We will loop, incrementing a0 and a1 until a0
+ * equals a3.
+ */
+
+L(aligned):
+ andi t8,a2,NSIZEDMASK /* any whole 64-byte/128-byte chunks? */
+ beq a2,t8,L(chkw) /* if a2==t8, no 64-byte/128-byte chunks */
+ PTR_SUBU a3,a2,t8 /* subtract from a2 the reminder */
+ PTR_ADDU a3,a0,a3 /* Now a3 is the final dst after loop */
+
+/* When in the loop we may prefetch with the 'prepare to store' hint,
+ * in this case the a0+x should not be past the "t0-32" address. This
+ * means: for x=128 the last "safe" a0 address is "t0-160". Alternatively,
+ * for x=64 the last "safe" a0 address is "t0-96" In the current version we
+ * will use "prefetch hint,128(a0)", so "t0-160" is the limit.
+ */
+#if defined(USE_PREFETCH) && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ PTR_ADDU t0,a0,a2 /* t0 is the "past the end" address */
+ PTR_SUBU t9,t0,PREFETCH_LIMIT /* t9 is the "last safe pref" address */
+#endif
+ PREFETCH_FOR_LOAD (0, a1)
+ PREFETCH_FOR_LOAD (1, a1)
+ PREFETCH_FOR_LOAD (2, a1)
+ PREFETCH_FOR_STORE (1, a0)
+#if defined(USE_PREFETCH) && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ sltu v1,t9,a0 /* If a0 > t9 don't use next prefetch */
+ bgtz v1,L(loop16w)
nop
+#endif
+ PREFETCH_FOR_STORE (2, a0)
+L(loop16w):
+ PREFETCH_FOR_LOAD (3, a1)
+ C_LD t0,UNIT(0)(a1)
+#if defined(USE_PREFETCH) && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ bgtz v1,L(skip_pref30_96)
+#endif
+ C_LD t1,UNIT(1)(a1)
+ PREFETCH_FOR_STORE (3, a0)
+L(skip_pref30_96):
+ C_LD REG2,UNIT(2)(a1)
+ C_LD REG3,UNIT(3)(a1)
+ C_LD REG4,UNIT(4)(a1)
+ C_LD REG5,UNIT(5)(a1)
+ C_LD REG6,UNIT(6)(a1)
+ C_LD REG7,UNIT(7)(a1)
+ PREFETCH_FOR_LOAD (4, a1)
+
+ C_ST t0,UNIT(0)(a0)
+ C_ST t1,UNIT(1)(a0)
+ C_ST REG2,UNIT(2)(a0)
+ C_ST REG3,UNIT(3)(a0)
+ C_ST REG4,UNIT(4)(a0)
+ C_ST REG5,UNIT(5)(a0)
+ C_ST REG6,UNIT(6)(a0)
+ C_ST REG7,UNIT(7)(a0)
+
+ C_LD t0,UNIT(8)(a1)
+#if defined(USE_PREFETCH) && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ bgtz v1,L(skip_pref30_128)
+#endif
+ C_LD t1,UNIT(9)(a1)
+ PREFETCH_FOR_STORE (4, a0)
+L(skip_pref30_128):
+ C_LD REG2,UNIT(10)(a1)
+ C_LD REG3,UNIT(11)(a1)
+ C_LD REG4,UNIT(12)(a1)
+ C_LD REG5,UNIT(13)(a1)
+ C_LD REG6,UNIT(14)(a1)
+ C_LD REG7,UNIT(15)(a1)
+ PREFETCH_FOR_LOAD (5, a1)
+ C_ST t0,UNIT(8)(a0)
+ C_ST t1,UNIT(9)(a0)
+ C_ST REG2,UNIT(10)(a0)
+ C_ST REG3,UNIT(11)(a0)
+ C_ST REG4,UNIT(12)(a0)
+ C_ST REG5,UNIT(13)(a0)
+ C_ST REG6,UNIT(14)(a0)
+ C_ST REG7,UNIT(15)(a0)
+ PTR_ADDIU a0,a0,UNIT(16) /* adding 64/128 to dest */
+#if defined(USE_PREFETCH) && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ sltu v1,t9,a0
+#endif
+ bne a0,a3,L(loop16w)
+ PTR_ADDIU a1,a1,UNIT(16) /* adding 64/128 to src */
+ move a2,t8
-L(shift):
- subu a3, zero, a0 # Src and Dest unaligned
- andi a3, 0x3 # (unoptimized case...)
- beq a3, zero, L(shft1)
- subu a2, a3 # a2 = bytes left
- LWHI t0, 0(a1) # Take care of first odd part
- LWLO t0, 3(a1)
- addu a1, a3
- SWHI t0, 0(a0)
- addu a0, a3
-L(shft1):
- andi t0, a2, 0x3
- subu a3, a2, t0
- addu a3, a1
-L(shfth):
- LWHI t1, 0(a1) # Limp through, word by word
- LWLO t1, 3(a1)
- addiu a0, 4
- addiu a1, 4
- bne a1, a3, L(shfth)
- sw t1, -4(a0)
- b L(last8) # Handle anything which may be left
- move a2, t0
+/* Here we have src and dest word-aligned but less than 64-bytes or
+ * 128 bytes to go. Check for a 32(64) byte chunk and copy if if there
+ * is one. Otherwise jump down to L(chk1w) to handle the tail end of
+ * the copy.
+ */
+L(chkw):
+ PREFETCH_FOR_LOAD (0, a1)
+ andi t8,a2,NSIZEMASK /* Is there a 32-byte/64-byte chunk. */
+ /* The t8 is the reminder count past 32-bytes */
+ beq a2,t8,L(chk1w) /* When a2=t8, no 32-byte chunk */
+ nop
+ C_LD t0,UNIT(0)(a1)
+ C_LD t1,UNIT(1)(a1)
+ C_LD REG2,UNIT(2)(a1)
+ C_LD REG3,UNIT(3)(a1)
+ C_LD REG4,UNIT(4)(a1)
+ C_LD REG5,UNIT(5)(a1)
+ C_LD REG6,UNIT(6)(a1)
+ C_LD REG7,UNIT(7)(a1)
+ PTR_ADDIU a1,a1,UNIT(8)
+ C_ST t0,UNIT(0)(a0)
+ C_ST t1,UNIT(1)(a0)
+ C_ST REG2,UNIT(2)(a0)
+ C_ST REG3,UNIT(3)(a0)
+ C_ST REG4,UNIT(4)(a0)
+ C_ST REG5,UNIT(5)(a0)
+ C_ST REG6,UNIT(6)(a0)
+ C_ST REG7,UNIT(7)(a0)
+ PTR_ADDIU a0,a0,UNIT(8)
+
+/*
+ * Here we have less then 32(64) bytes to copy. Set up for a loop to
+ * copy one word (or double word) at a time. Set a2 to count how many
+ * bytes we have to copy after all the word (or double word) chunks are
+ * copied and a3 to the dst pointer after all the (d)word chunks have
+ * been copied. We will loop, incrementing a0 and a1 until a0 equals a3.
+ */
+L(chk1w):
+ andi a2,t8,(NSIZE-1) /* a2 is the reminder past one (d)word chunks */
+ beq a2,t8,L(lastb)
+ PTR_SUBU a3,t8,a2 /* a3 is count of bytes in one (d)word chunks */
+ PTR_ADDU a3,a0,a3 /* a3 is the dst address after loop */
+
+/* copying in words (4-byte or 8-byte chunks) */
+L(wordCopy_loop):
+ C_LD REG3,UNIT(0)(a1)
+ PTR_ADDIU a1,a1,UNIT(1)
+ PTR_ADDIU a0,a0,UNIT(1)
+ bne a0,a3,L(wordCopy_loop)
+ C_ST REG3,UNIT(-1)(a0)
+
+/* Copy the last 8 (or 16) bytes */
+L(lastb):
+ blez a2,L(leave)
+ PTR_ADDU a3,a0,a2 /* a3 is the last dst address */
+L(lastbloop):
+ lb v1,0(a1)
+ PTR_ADDIU a1,a1,1
+ PTR_ADDIU a0,a0,1
+ bne a0,a3,L(lastbloop)
+ sb v1,-1(a0)
+L(leave):
+ j ra
+ nop
+/*
+ * UNALIGNED case, got here with a3 = "negu a0"
+ * This code is nearly identical to the aligned code above
+ * but only the destination (not the source) gets aligned
+ * so we need to do partial loads of the source followed
+ * by normal stores to the destination (once we have aligned
+ * the destination).
+ */
+
+L(unaligned):
+ andi a3,a3,(NSIZE-1) /* copy a3 bytes to align a0/a1 */
+ beqz a3,L(ua_chk16w) /* if a3=0, it is already aligned */
+ PTR_SUBU a2,a2,a3 /* a2 is the remining bytes count */
+
+ C_LDHI v1,UNIT(0)(a1)
+ C_LDLO v1,UNITM1(1)(a1)
+ PTR_ADDU a1,a1,a3
+ C_STHI v1,UNIT(0)(a0)
+ PTR_ADDU a0,a0,a3
+
+/*
+ * Now the destination (but not the source) is aligned
+ * Set a2 to count how many bytes we have to copy after all the 64/128 byte
+ * chunks are copied and a3 to the dst pointer after all the 64/128 byte
+ * chunks have been copied. We will loop, incrementing a0 and a1 until a0
+ * equals a3.
+ */
+
+L(ua_chk16w):
+ andi t8,a2,NSIZEDMASK /* any whole 64-byte/128-byte chunks? */
+ beq a2,t8,L(ua_chkw) /* if a2==t8, no 64-byte/128-byte chunks */
+ PTR_SUBU a3,a2,t8 /* subtract from a2 the reminder */
+ PTR_ADDU a3,a0,a3 /* Now a3 is the final dst after loop */
+
+#if defined(USE_PREFETCH) && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ PTR_ADDU t0,a0,a2 /* t0 is the "past the end" address */
+ PTR_SUBU t9,t0,PREFETCH_LIMIT /* t9 is the "last safe pref" address */
+#endif
+ PREFETCH_FOR_LOAD (0, a1)
+ PREFETCH_FOR_LOAD (1, a1)
+ PREFETCH_FOR_LOAD (2, a1)
+ PREFETCH_FOR_STORE (1, a0)
+#if defined(USE_PREFETCH) && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ sltu v1,t9,a0
+ bgtz v1,L(ua_loop16w) /* skip prefetch for too short arrays */
+ nop
+#endif
+ PREFETCH_FOR_STORE (2, a0)
+L(ua_loop16w):
+ PREFETCH_FOR_LOAD (3, a1)
+ C_LDHI t0,UNIT(0)(a1)
+ C_LDLO t0,UNITM1(1)(a1)
+ C_LDHI t1,UNIT(1)(a1)
+#if defined(USE_PREFETCH) && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ bgtz v1,L(ua_skip_pref30_96)
+#endif
+ C_LDLO t1,UNITM1(2)(a1)
+ PREFETCH_FOR_STORE (3, a0)
+L(ua_skip_pref30_96):
+ C_LDHI REG2,UNIT(2)(a1)
+ C_LDLO REG2,UNITM1(3)(a1)
+ C_LDHI REG3,UNIT(3)(a1)
+ C_LDLO REG3,UNITM1(4)(a1)
+ C_LDHI REG4,UNIT(4)(a1)
+ C_LDLO REG4,UNITM1(5)(a1)
+ C_LDHI REG5,UNIT(5)(a1)
+ C_LDLO REG5,UNITM1(6)(a1)
+ C_LDHI REG6,UNIT(6)(a1)
+ C_LDLO REG6,UNITM1(7)(a1)
+ C_LDHI REG7,UNIT(7)(a1)
+ C_LDLO REG7,UNITM1(8)(a1)
+ PREFETCH_FOR_LOAD (4, a1)
+ C_ST t0,UNIT(0)(a0)
+ C_ST t1,UNIT(1)(a0)
+ C_ST REG2,UNIT(2)(a0)
+ C_ST REG3,UNIT(3)(a0)
+ C_ST REG4,UNIT(4)(a0)
+ C_ST REG5,UNIT(5)(a0)
+ C_ST REG6,UNIT(6)(a0)
+ C_ST REG7,UNIT(7)(a0)
+ C_LDHI t0,UNIT(8)(a1)
+ C_LDLO t0,UNITM1(9)(a1)
+ C_LDHI t1,UNIT(9)(a1)
+#if defined(USE_PREFETCH) && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ bgtz v1,L(ua_skip_pref30_128)
+#endif
+ C_LDLO t1,UNITM1(10)(a1)
+ PREFETCH_FOR_STORE (4, a0)
+L(ua_skip_pref30_128):
+ C_LDHI REG2,UNIT(10)(a1)
+ C_LDLO REG2,UNITM1(11)(a1)
+ C_LDHI REG3,UNIT(11)(a1)
+ C_LDLO REG3,UNITM1(12)(a1)
+ C_LDHI REG4,UNIT(12)(a1)
+ C_LDLO REG4,UNITM1(13)(a1)
+ C_LDHI REG5,UNIT(13)(a1)
+ C_LDLO REG5,UNITM1(14)(a1)
+ C_LDHI REG6,UNIT(14)(a1)
+ C_LDLO REG6,UNITM1(15)(a1)
+ C_LDHI REG7,UNIT(15)(a1)
+ C_LDLO REG7,UNITM1(16)(a1)
+ PREFETCH_FOR_LOAD (5, a1)
+ C_ST t0,UNIT(8)(a0)
+ C_ST t1,UNIT(9)(a0)
+ C_ST REG2,UNIT(10)(a0)
+ C_ST REG3,UNIT(11)(a0)
+ C_ST REG4,UNIT(12)(a0)
+ C_ST REG5,UNIT(13)(a0)
+ C_ST REG6,UNIT(14)(a0)
+ C_ST REG7,UNIT(15)(a0)
+ PTR_ADDIU a0,a0,UNIT(16) /* adding 64/128 to dest */
+#if defined(USE_PREFETCH) && (PREFETCH_STORE_HINT == PREFETCH_HINT_PREPAREFORSTORE)
+ sltu v1,t9,a0
+#endif
+ bne a0,a3,L(ua_loop16w)
+ PTR_ADDIU a1,a1,UNIT(16) /* adding 64/128 to src */
+ move a2,t8
+
+/* Here we have src and dest word-aligned but less than 64-bytes or
+ * 128 bytes to go. Check for a 32(64) byte chunk and copy if if there
+ * is one. Otherwise jump down to L(ua_chk1w) to handle the tail end of
+ * the copy. */
+
+L(ua_chkw):
+ PREFETCH_FOR_LOAD (0, a1)
+ andi t8,a2,NSIZEMASK /* Is there a 32-byte/64-byte chunk. */
+ /* t8 is the reminder count past 32-bytes */
+ beq a2,t8,L(ua_chk1w) /* When a2=t8, no 32-byte chunk */
+ nop
+ C_LDHI t0,UNIT(0)(a1)
+ C_LDLO t0,UNITM1(1)(a1)
+ C_LDHI t1,UNIT(1)(a1)
+ C_LDLO t1,UNITM1(2)(a1)
+ C_LDHI REG2,UNIT(2)(a1)
+ C_LDLO REG2,UNITM1(3)(a1)
+ C_LDHI REG3,UNIT(3)(a1)
+ C_LDLO REG3,UNITM1(4)(a1)
+ C_LDHI REG4,UNIT(4)(a1)
+ C_LDLO REG4,UNITM1(5)(a1)
+ C_LDHI REG5,UNIT(5)(a1)
+ C_LDLO REG5,UNITM1(6)(a1)
+ C_LDHI REG6,UNIT(6)(a1)
+ C_LDLO REG6,UNITM1(7)(a1)
+ C_LDHI REG7,UNIT(7)(a1)
+ C_LDLO REG7,UNITM1(8)(a1)
+ PTR_ADDIU a1,a1,UNIT(8)
+ C_ST t0,UNIT(0)(a0)
+ C_ST t1,UNIT(1)(a0)
+ C_ST REG2,UNIT(2)(a0)
+ C_ST REG3,UNIT(3)(a0)
+ C_ST REG4,UNIT(4)(a0)
+ C_ST REG5,UNIT(5)(a0)
+ C_ST REG6,UNIT(6)(a0)
+ C_ST REG7,UNIT(7)(a0)
+ PTR_ADDIU a0,a0,UNIT(8)
+/*
+ * Here we have less then 32(64) bytes to copy. Set up for a loop to
+ * copy one word (or double word) at a time.
+ */
+L(ua_chk1w):
+ andi a2,t8,(NSIZE-1) /* a2 is the reminder past one (d)word chunks */
+ beq a2,t8,L(ua_smallCopy)
+ PTR_SUBU a3,t8,a2 /* a3 is count of bytes in one (d)word chunks */
+ PTR_ADDU a3,a0,a3 /* a3 is the dst address after loop */
+
+/* copying in words (4-byte or 8-byte chunks) */
+L(ua_wordCopy_loop):
+ C_LDHI v1,UNIT(0)(a1)
+ C_LDLO v1,UNITM1(1)(a1)
+ PTR_ADDIU a1,a1,UNIT(1)
+ PTR_ADDIU a0,a0,UNIT(1)
+ bne a0,a3,L(ua_wordCopy_loop)
+ C_ST v1,UNIT(-1)(a0)
+
+/* Copy the last 8 (or 16) bytes */
+L(ua_smallCopy):
+ beqz a2,L(leave)
+ PTR_ADDU a3,a0,a2 /* a3 is the last dst address */
+L(ua_smallCopy_loop):
+ lb v1,0(a1)
+ PTR_ADDIU a1,a1,1
+ PTR_ADDIU a0,a0,1
+ bne a0,a3,L(ua_smallCopy_loop)
+ sb v1,-1(a0)
+
+ j ra
+ nop
+
+ .set at
.set reorder
-END (memcpy)
-libc_hidden_builtin_def (memcpy)
+END(MEMCPY_NAME)
+#ifdef _LIBC
+libc_hidden_builtin_def (MEMCPY_NAME)
+#endif
diff --git a/libc/ports/sysdeps/mips/mips64/memcpy.S b/libc/ports/sysdeps/mips/mips64/memcpy.S
deleted file mode 100644
index 49ef34d0c..000000000
--- a/libc/ports/sysdeps/mips/mips64/memcpy.S
+++ /dev/null
@@ -1,138 +0,0 @@
-/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
- Ported to mips3 n32/n64 by Alexandre Oliva <aoliva@redhat.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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <sys/asm.h>
-
-
-/* void *memcpy(void *s1, const void *s2, size_t n);
-
- This could probably be optimized further. */
-
-#if __MIPSEB
-# define LDHI ldl /* high part is left in big-endian */
-# define SDHI sdl /* high part is left in big-endian */
-# define LDLO ldr /* low part is right in big-endian */
-# define SDLO sdr /* low part is right in big-endian */
-#else
-# define LDHI ldr /* high part is right in little-endian */
-# define SDHI sdr /* high part is right in little-endian */
-# define LDLO ldl /* low part is left in little-endian */
-# define SDLO sdl /* low part is left in little-endian */
-#endif
-
-ENTRY (memcpy)
- .set noreorder
-
- slti t0, a2, 16 # Less than 16?
- bne t0, zero, L(last16)
- move v0, a0 # Setup exit value before too late
-
- xor t0, a1, a0 # Find a0/a1 displacement
- andi t0, 0x7
- bne t0, zero, L(shift) # Go handle the unaligned case
- PTR_SUBU t1, zero, a1
- andi t1, 0x7 # a0/a1 are aligned, but are we
- beq t1, zero, L(chk8w) # starting in the middle of a word?
- PTR_SUBU a2, t1
- LDHI t0, 0(a1) # Yes we are... take care of that
- PTR_ADDU a1, t1
- SDHI t0, 0(a0)
- PTR_ADDU a0, t1
-
-L(chk8w):
- andi t0, a2, 0x3f # 64 or more bytes left?
- beq t0, a2, L(chk1w)
- PTR_SUBU a3, a2, t0 # Yes
- PTR_ADDU a3, a1 # a3 = end address of loop
- move a2, t0 # a2 = what will be left after loop
-L(lop8w):
- ld t0, 0(a1) # Loop taking 8 words at a time
- ld t1, 8(a1)
- ld t2, 16(a1)
- ld t3, 24(a1)
- ld ta0, 32(a1)
- ld ta1, 40(a1)
- ld ta2, 48(a1)
- ld ta3, 56(a1)
- PTR_ADDIU a0, 64
- PTR_ADDIU a1, 64
- sd t0, -64(a0)
- sd t1, -56(a0)
- sd t2, -48(a0)
- sd t3, -40(a0)
- sd ta0, -32(a0)
- sd ta1, -24(a0)
- sd ta2, -16(a0)
- bne a1, a3, L(lop8w)
- sd ta3, -8(a0)
-
-L(chk1w):
- andi t0, a2, 0x7 # 8 or more bytes left?
- beq t0, a2, L(last16)
- PTR_SUBU a3, a2, t0 # Yes, handle them one dword at a time
- PTR_ADDU a3, a1 # a3 again end address
- move a2, t0
-L(lop1w):
- ld t0, 0(a1)
- PTR_ADDIU a0, 8
- PTR_ADDIU a1, 8
- bne a1, a3, L(lop1w)
- sd t0, -8(a0)
-
-L(last16):
- blez a2, L(lst16e) # Handle last 16 bytes, one at a time
- PTR_ADDU a3, a2, a1
-L(lst16l):
- lb t0, 0(a1)
- PTR_ADDIU a0, 1
- PTR_ADDIU a1, 1
- bne a1, a3, L(lst16l)
- sb t0, -1(a0)
-L(lst16e):
- jr ra # Bye, bye
- nop
-
-L(shift):
- PTR_SUBU a3, zero, a0 # Src and Dest unaligned
- andi a3, 0x7 # (unoptimized case...)
- beq a3, zero, L(shft1)
- PTR_SUBU a2, a3 # a2 = bytes left
- LDHI t0, 0(a1) # Take care of first odd part
- LDLO t0, 7(a1)
- PTR_ADDU a1, a3
- SDHI t0, 0(a0)
- PTR_ADDU a0, a3
-L(shft1):
- andi t0, a2, 0x7
- PTR_SUBU a3, a2, t0
- PTR_ADDU a3, a1
-L(shfth):
- LDHI t1, 0(a1) # Limp through, dword by dword
- LDLO t1, 7(a1)
- PTR_ADDIU a0, 8
- PTR_ADDIU a1, 8
- bne a1, a3, L(shfth)
- sd t1, -8(a0)
- b L(last16) # Handle anything which may be left
- move a2, t0
-
- .set reorder
-END (memcpy)
-libc_hidden_builtin_def (memcpy)
diff --git a/libc/ports/sysdeps/mips/tininess.h b/libc/ports/sysdeps/mips/tininess.h
new file mode 100644
index 000000000..1db37790f
--- /dev/null
+++ b/libc/ports/sysdeps/mips/tininess.h
@@ -0,0 +1 @@
+#define TININESS_AFTER_ROUNDING 1
diff --git a/libc/ports/sysdeps/powerpc/nofpu/fclrexcpt.c b/libc/ports/sysdeps/powerpc/nofpu/fclrexcpt.c
index 768fd8ff8..f4b9016ea 100644
--- a/libc/ports/sysdeps/powerpc/nofpu/fclrexcpt.c
+++ b/libc/ports/sysdeps/powerpc/nofpu/fclrexcpt.c
@@ -1,5 +1,5 @@
/* Clear floating-point exceptions (soft-float edition).
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002-2012 Free Software Foundation, Inc.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
This file is part of the GNU C Library.
@@ -33,4 +33,5 @@ strong_alias (__feclearexcept, __old_feclearexcept)
compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
#endif
+libm_hidden_ver (__feclearexcept, feclearexcept)
versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/405/memset.S b/libc/ports/sysdeps/powerpc/powerpc32/405/memset.S
index e132ce365..c2ee6c593 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/405/memset.S
+++ b/libc/ports/sysdeps/powerpc/powerpc32/405/memset.S
@@ -1,5 +1,5 @@
-/* Optimized memset implementation for PowerPC476.
- Copyright (C) 2010 Free Software Foundation, Inc.
+/* Optimized memset for PowerPC405,440,464 (32-byte cacheline).
+ Copyright (C) 2012 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
@@ -104,7 +104,7 @@ L(use_dcbz):
add r3,r3,r7
L(skip_string_loop):
- clrlwi r8,r6,25
+ clrlwi r8,r6,27
srwi. r8,r8,4
beq L(dcbz_pre_loop)
mtctr r8
@@ -119,14 +119,14 @@ L(word_loop):
bdnz L(word_loop)
L(dcbz_pre_loop):
- srwi r6,r5,7
+ srwi r6,r5,5
mtctr r6
addi r7,0,0
L(dcbz_loop):
dcbz r3,r7
- addi r3,r3,0x80
- subi r5,r5,0x80
+ addi r3,r3,0x20
+ subi r5,r5,0x20
bdnz L(dcbz_loop)
srwi. r6,r5,4
beq L(postword2_count_loop)
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/476/memset.S b/libc/ports/sysdeps/powerpc/powerpc32/476/memset.S
new file mode 100644
index 000000000..8b5750442
--- /dev/null
+++ b/libc/ports/sysdeps/powerpc/powerpc32/476/memset.S
@@ -0,0 +1,154 @@
+/* Optimized memset for PowerPC476 (128-byte cacheline).
+ Copyright (C) 2010 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 <sysdep.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
+
+/* memset
+
+ r3:destination address and return address
+ r4:source integer to copy
+ r5:byte count
+ r11:sources integer to copy in all 32 bits of reg
+ r12:temp return address
+
+ Save return address in r12
+ If destinationn is unaligned and count is greater tha 255 bytes
+ set 0-3 bytes to make destination aligned
+ If count is greater tha 255 bytes and setting zero to memory
+ use dbcz to set memeory when we can
+ otherwsie do the follwoing
+ If 16 or more words to set we use 16 word copy loop.
+ Finaly we set 0-15 extra bytes with string store. */
+
+EALIGN (BP_SYM (memset), 5, 0)
+ rlwinm r11,r4,0,24,31
+ rlwimi r11,r4,8,16,23
+ rlwimi r11,r11,16,0,15
+ addi r12,r3,0
+ cmpwi r5,0x00FF
+ ble L(preword8_count_loop)
+ cmpwi r4,0x00
+ beq L(use_dcbz)
+ neg r6,r3
+ clrlwi. r6,r6,30
+ beq L(preword8_count_loop)
+ addi r8,0,1
+ mtctr r6
+ subi r3,r3,1
+
+L(unaligned_bytecopy_loop):
+ stbu r11,0x1(r3)
+ subf. r5,r8,r5
+ beq L(end_memset)
+ bdnz L(unaligned_bytecopy_loop)
+ addi r3,r3,1
+
+L(preword8_count_loop):
+ srwi. r6,r5,4
+ beq L(preword2_count_loop)
+ mtctr r6
+ addi r3,r3,-4
+ mr r8,r11
+ mr r9,r11
+ mr r10,r11
+
+L(word8_count_loop_no_dcbt):
+ stwu r8,4(r3)
+ stwu r9,4(r3)
+ subi r5,r5,0x10
+ stwu r10,4(r3)
+ stwu r11,4(r3)
+ bdnz L(word8_count_loop_no_dcbt)
+ addi r3,r3,4
+
+L(preword2_count_loop):
+ clrlwi. r7,r5,28
+ beq L(end_memset)
+ mr r8,r11
+ mr r9,r11
+ mr r10,r11
+ mtxer r7
+ stswx r8,0,r3
+
+L(end_memset):
+ addi r3,r12,0
+ blr
+
+L(use_dcbz):
+ neg r6,r3
+ clrlwi. r7,r6,28
+ beq L(skip_string_loop)
+ mr r8,r11
+ mr r9,r11
+ mr r10,r11
+ subf r5,r7,r5
+ mtxer r7
+ stswx r8,0,r3
+ add r3,r3,r7
+
+L(skip_string_loop):
+ clrlwi r8,r6,25
+ srwi. r8,r8,4
+ beq L(dcbz_pre_loop)
+ mtctr r8
+
+L(word_loop):
+ stw r11,0(r3)
+ subi r5,r5,0x10
+ stw r11,4(r3)
+ stw r11,8(r3)
+ stw r11,12(r3)
+ addi r3,r3,0x10
+ bdnz L(word_loop)
+
+L(dcbz_pre_loop):
+ srwi r6,r5,7
+ mtctr r6
+ addi r7,0,0
+
+L(dcbz_loop):
+ dcbz r3,r7
+ addi r3,r3,0x80
+ subi r5,r5,0x80
+ bdnz L(dcbz_loop)
+ srwi. r6,r5,4
+ beq L(postword2_count_loop)
+ mtctr r6
+
+L(postword8_count_loop):
+ stw r11,0(r3)
+ subi r5,r5,0x10
+ stw r11,4(r3)
+ stw r11,8(r3)
+ stw r11,12(r3)
+ addi r3,r3,0x10
+ bdnz L(postword8_count_loop)
+
+L(postword2_count_loop):
+ clrlwi. r7,r5,28
+ beq L(end_memset)
+ mr r8,r11
+ mr r9,r11
+ mr r10,r11
+ mtxer r7
+ stswx r8,0,r3
+ b L(end_memset)
+END (BP_SYM (memset))
+libc_hidden_builtin_def (memset)
diff --git a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fclrexcpt.c b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fclrexcpt.c
index 685e66c82..d937ec0dd 100644
--- a/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fclrexcpt.c
+++ b/libc/ports/sysdeps/powerpc/powerpc32/e500/fpu/fclrexcpt.c
@@ -44,4 +44,5 @@ strong_alias (__feclearexcept, __old_feclearexcept)
compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
#endif
+libm_hidden_ver (__feclearexcept, feclearexcept)
versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
diff --git a/libc/ports/sysdeps/tile/bits/fenv.h b/libc/ports/sysdeps/tile/bits/fenv.h
index 7638e8cc5..6b045353c 100644
--- a/libc/ports/sysdeps/tile/bits/fenv.h
+++ b/libc/ports/sysdeps/tile/bits/fenv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
@@ -30,8 +30,9 @@ enum
{
__FE_UNDEFINED = 0,
- FE_TONEAREST = 1,
-#define FE_TONEAREST FE_TONEAREST
+ FE_TONEAREST =
+#define FE_TONEAREST 1
+ FE_TONEAREST,
};
/* Type representing exception flags (if there were any). */
diff --git a/libc/ports/sysdeps/tile/crti.S b/libc/ports/sysdeps/tile/crti.S
index ccb4464bb..467816c78 100644
--- a/libc/ports/sysdeps/tile/crti.S
+++ b/libc/ports/sysdeps/tile/crti.S
@@ -70,16 +70,17 @@ _init:
#if PREINIT_FUNCTION_WEAK
lnk r2
0:
-#ifdef __tilegx__
+# ifdef __tilegx__
+ moveli r1, hw2_last(_GLOBAL_OFFSET_TABLE_ - 0b)
{
- moveli r1, hw1_last(_GLOBAL_OFFSET_TABLE_ - 0b)
+ shl16insli r1, r1, hw1(_GLOBAL_OFFSET_TABLE_ - 0b)
moveli r0, hw1_last_got(PREINIT_FUNCTION)
}
{
shl16insli r1, r1, hw0(_GLOBAL_OFFSET_TABLE_ - 0b)
shl16insli r0, r0, hw0_got(PREINIT_FUNCTION)
}
-#else
+# else
{
moveli r1, lo16(_GLOBAL_OFFSET_TABLE_ - 0b)
moveli r0, got_lo16(PREINIT_FUNCTION)
@@ -88,13 +89,25 @@ _init:
auli r1, r1, ha16(_GLOBAL_OFFSET_TABLE_ - 0b)
auli r0, r0, got_ha16(PREINIT_FUNCTION)
}
-#endif
+# endif
ADD_PTR r0, r0, r1
ADD_PTR r0, r0, r2
LD_PTR r0, r0
BEQZ r0, .Lno_weak_fn
-#endif
+ jalr r0
+#elif defined(__tilegx__)
+ /* Since we are calling from the start of the object to the PLT,
+ call by loading the full address into a register. */
+ lnk r2
+0:
+ moveli r0, hw2_last_plt(PREINIT_FUNCTION - 0b)
+ shl16insli r0, r0, hw1_plt(PREINIT_FUNCTION - 0b)
+ shl16insli r0, r0, hw0_plt(PREINIT_FUNCTION - 0b)
+ add r0, r0, r2
+ jalr r0
+#else
jal plt(PREINIT_FUNCTION)
+#endif
.Lno_weak_fn:
.section .fini,"ax",@progbits
diff --git a/libc/ports/sysdeps/tile/dl-machine.h b/libc/ports/sysdeps/tile/dl-machine.h
index c4413f9e8..09a299358 100644
--- a/libc/ports/sysdeps/tile/dl-machine.h
+++ b/libc/ports/sysdeps/tile/dl-machine.h
@@ -253,8 +253,8 @@ elf_machine_plt_value (struct link_map *map, const ElfW(Rela) *reloc,
}
/* Support notifying the simulator about new objects. */
-void internal_function _dl_arch_map_object (struct link_map *l);
-#define _dl_arch_map_object _dl_arch_map_object
+void internal_function _dl_after_load (struct link_map *l);
+#define DL_AFTER_LOAD _dl_after_load
/* Names of the architecture-specific auditing callback functions. */
#define ARCH_LA_PLTENTER tile_gnu_pltenter
diff --git a/libc/ports/sysdeps/tile/dl-runtime.c b/libc/ports/sysdeps/tile/dl-runtime.c
index 0aa211db1..e965828af 100644
--- a/libc/ports/sysdeps/tile/dl-runtime.c
+++ b/libc/ports/sysdeps/tile/dl-runtime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
@@ -28,44 +28,119 @@
#include <sys/mman.h>
#include <arch/sim.h>
-/* Support notifying the simulator about new objects. */
+/* Like realpath(), but simplified: no dynamic memory use, no lstat(),
+ no set_errno(), no valid "rpath" on error, etc. This handles some
+ simple cases where the simulator might not have a valid entry for
+ a loaded Elf object, in particular dlopen() with a relative path.
+ For this relatively rare case, one could also imagine using
+ link_map.l_origin to avoid the getcwd() here, but the simpler code
+ here seems like a better solution. */
+static char *
+dl_realpath (const char *name, char *rpath)
+{
+ char *dest;
+ const char *start, *end;
+
+ if (name[0] != '/')
+ {
+ if (!__getcwd (rpath, PATH_MAX))
+ return NULL;
+ dest = __rawmemchr (rpath, '\0');
+ }
+ else
+ {
+ rpath[0] = '/';
+ dest = rpath + 1;
+ }
+
+ for (start = end = name; *start; start = end)
+ {
+ /* Skip sequence of multiple path-separators. */
+ while (*start == '/')
+ ++start;
+
+ /* Find end of path component. */
+ for (end = start; *end && *end != '/'; ++end)
+ /* Nothing. */;
+
+ if (end - start == 0)
+ break;
+ else if (end - start == 1 && start[0] == '.')
+ /* nothing */;
+ else if (end - start == 2 && start[0] == '.' && start[1] == '.')
+ {
+ /* Back up to previous component, ignore if at root already. */
+ if (dest > rpath + 1)
+ while ((--dest)[-1] != '/');
+ }
+ else
+ {
+ if (dest[-1] != '/')
+ *dest++ = '/';
+
+ if (dest + (end - start) >= rpath + PATH_MAX)
+ return NULL;
+
+ dest = __mempcpy (dest, start, end - start);
+ *dest = '\0';
+ }
+ }
+ if (dest > rpath + 1 && dest[-1] == '/')
+ --dest;
+ *dest = '\0';
+
+ return rpath;
+}
+
+/* Support notifying the simulator about new objects. */
void internal_function
-_dl_arch_map_object (struct link_map *l)
+_dl_after_load (struct link_map *l)
{
int shift;
+ char pathbuf[PATH_MAX];
+ char *path;
+
+ /* Don't bother if not in the simulator. */
+ if (__insn_mfspr (SPR_SIM_CONTROL) == 0)
+ return;
-#define DLPUTC(c) __insn_mtspr(SPR_SIM_CONTROL, \
- (SIM_CONTROL_DLOPEN \
- | ((c) << _SIM_CONTROL_OPERATOR_BITS)))
+#define DLPUTC(c) __insn_mtspr (SPR_SIM_CONTROL, \
+ (SIM_CONTROL_DLOPEN \
+ | ((c) << _SIM_CONTROL_OPERATOR_BITS)))
- /* Write the library address in hex. */
+ /* Write the library address in hex. */
DLPUTC ('0');
DLPUTC ('x');
for (shift = (int) sizeof (unsigned long) * 8 - 4; shift >= 0; shift -= 4)
DLPUTC ("0123456789abcdef"[(l->l_map_start >> shift) & 0xF]);
DLPUTC (':');
- /* Write the library path, including the terminating '\0'. */
+ /* Write the library path, including the terminating '\0'. */
+ path = dl_realpath (l->l_name, pathbuf) ?: l->l_name;
for (size_t i = 0;; i++)
{
- DLPUTC (l->l_name[i]);
- if (l->l_name[i] == '\0')
+ DLPUTC (path[i]);
+ if (path[i] == '\0')
break;
}
#undef DLPUTC
}
-/* Support notifying the simulator about removed objects prior to munmap(). */
+/* Support notifying the simulator about removed objects prior to munmap(). */
void internal_function
_dl_unmap (struct link_map *l)
{
int shift;
-#define DLPUTC(c) __insn_mtspr(SPR_SIM_CONTROL, \
- (SIM_CONTROL_DLCLOSE \
- | ((c) << _SIM_CONTROL_OPERATOR_BITS)))
+ /* Don't bother if not in the simulator. */
+ if (__insn_mfspr (SPR_SIM_CONTROL) == 0)
+ return;
- /* Write the library address in hex. */
+#define DLPUTC(c) __insn_mtspr (SPR_SIM_CONTROL, \
+ (SIM_CONTROL_DLCLOSE \
+ | ((c) << _SIM_CONTROL_OPERATOR_BITS)))
+
+ /* Write the library address in hex. */
DLPUTC ('0');
DLPUTC ('x');
for (shift = (int) sizeof (unsigned long) * 8 - 4; shift >= 0; shift -= 4)
@@ -75,5 +150,3 @@ _dl_unmap (struct link_map *l)
__munmap ((void *) l->l_map_start, l->l_map_end - l->l_map_start);
}
-
-#define DL_UNMAP(map) _dl_unmap (map)
diff --git a/libc/ports/sysdeps/tile/libm-test-ulps b/libc/ports/sysdeps/tile/libm-test-ulps
index 43d1e99d3..584e57089 100644
--- a/libc/ports/sysdeps/tile/libm-test-ulps
+++ b/libc/ports/sysdeps/tile/libm-test-ulps
@@ -490,6 +490,9 @@ ifloat: 1
Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
float: 1
ifloat: 1
+Test "Real part of: clog (0x0.ffffffp0 + 0x0.ffffffp-100 i) == -5.960464655174753498633255797994360530379e-8 + 7.888609052210118054117285652827862296732e-31 i":
+float: 1
+ifloat: 1
Test "Real part of: clog (0x1.000566p0 + 0x1.234p-10 i) == 8.298731898331237038231468223024422855654e-5 + 1.110938609507128729312743251313024793990e-3 i":
float: 1
ifloat: 1
@@ -511,6 +514,9 @@ ifloat: 1
Test "Real part of: clog (0x1p-149 - 0x1.fp+127 i) == 88.69109041335841930424871526389807508374 - pi/2 i":
float: 1
ifloat: 1
+Test "Imaginary part of: clog (0x2818p-15 + 0x798fp-15 i) == 1.5366822245016167178749091974664853785194e-08 + 1.2522014929038946066987318471922169174157 i":
+float: 1
+ifloat: 1
Test "Real part of: clog (1.0 + 0x1.234566p-10 i) == 6.172834701221959432440126967147726538097e-7 + 1.111110564353742042376451655136933182201e-3 i":
float: 1
ifloat: 1
@@ -595,6 +601,14 @@ ifloat: 1
Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
float: 1
ifloat: 1
+Test "Real part of: clog10 (0x0.fffffffffffff8p0 + 0x0.fffffffffffff8p-1000 i) == -4.821637332766435821255375046554377090472e-17 + 4.053112396770095089737411317782466262176e-302 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x0.ffffffp0 + 0x0.ffffffp-100 i) == -2.588596909321764128428416045209904492216e-8 + 3.425979381266895667295625489912064603415e-31 i":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-10 i) == 3.604093470239754109961125085078190708674e-5 + 4.824745078422174667425851670822596859720e-4 i":
float: 1
ifloat: 1
@@ -621,6 +635,21 @@ ifloat: 1
Test "Real part of: clog10 (0x1.fffffep+127 + 1.0 i) == 38.53183941910362389414093724045094697423 + 1.276276851248440096917018665609900318458e-39 i":
float: 1
ifloat: 1
+Test "Real part of: clog10 (0x10673dd0f2481p-51 + 0x7ef1d17cefbd2p-51 i) == 1.3918041236396763648388478552321724382899e-29 + 0.6263795733790237053262025311642907438291 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i) == 2.2081507730821788480616336165447731164865e-32 + 0.5484039935757001196548030312819898864760 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i) == 2.2081507730821788480616336165447731164865e-32 + 0.5484039935757001196548030312819898864760 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x164c74eea876p-45 + 0x16f393482f77p-45 i) == -1.3155760824064879362415202279780039150764e-26 + 0.3473590599762514228227328130640352044313 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x1a6p-10 + 0x3a5p-10 i) == -6.2126412844802358329771948751248003038444e-07 + 0.4977135139537443711784513409096950995985 i":
+double: 1
+idouble: 1
Test "Imaginary part of: clog10 (0x1p-1074 + 0x1.fp+1023 i) == 308.2409272754311106024666378243768099991 + 0.6821881769209206737428918127156778851051 i":
double: 1
idouble: 1
@@ -670,6 +699,41 @@ double: 1
float: 1
idouble: 1
ifloat: 1
+Test "Real part of: clog10 (0x2818p-15 + 0x798fp-15 i) == 6.6737261053986614395049481326819059203910e-09 + 0.5438241985991753781478398141908629586460 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x2818p-15 + 0x798fp-15 i) == 6.6737261053986614395049481326819059203910e-09 + 0.5438241985991753781478398141908629586460 i":
+float: 1
+ifloat: 1
+Test "Real part of: clog10 (0x2dd46725bp-35 + 0x7783a1284p-35 i) == 1.9312741086596516918394613098872836703188e-20 + 0.5231613813514771042838490538484014771862 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i) == -1.9440841725722970687903291200493082253766e-13 + 0.5193774116724956222518530053006822210323 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i) == -1.9440841725722970687903291200493082253766e-13 + 0.5193774116724956222518530053006822210323 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0x4447d7175p-35 + 0x6c445e00ap-35 i) == -6.4375803621988389731799033530075237868110e-21 + 0.4378257977686804492768642780897650927167 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x5b06b680ea2ccp-52 + 0xef452b965da9fp-52 i) == 3.6079845358966994996207055940336690133424e-30 + 0.5243112258263349992771652393178033846555 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0x9b57bp-20 + 0xcb7b4p-20 i) == -1.7182001068739620267773842120965071561416e-11 + 0.3990121149225253562859800593935899629087 i":
+double: 1
+idouble: 1
+Test "Real part of: clog10 (0xf2p-10 + 0x3e3p-10 i) == 2.6921240173351112953324592659528481616879e-06 + 0.5785726025799636431142862788413361783862 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0xf2p-10 + 0x3e3p-10 i) == 2.6921240173351112953324592659528481616879e-06 + 0.5785726025799636431142862788413361783862 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (0xfe961079616p-45 + 0x1bc37e09e6d1p-45 i) == 2.3329549194675052736016290082882121135546e-26 + 0.4561756099441139182878993697611751382976 i":
+double: 1
+idouble: 1
Test "Imaginary part of: clog10 (1.0 + 0x1.234566p-10 i) == 2.680828048441605163181684680300513080769e-7 + 4.825491868832381486767558728169977751564e-4 i":
double: 1
idouble: 1
@@ -1482,9 +1546,9 @@ ifloat: 1
Function: Real part of "clog10":
double: 2
-float: 1
+float: 2
idouble: 2
-ifloat: 1
+ifloat: 2
Function: Imaginary part of "clog10":
double: 1
diff --git a/libc/ports/sysdeps/tile/math_private.h b/libc/ports/sysdeps/tile/math_private.h
index 858db4a05..90dcc3f86 100644
--- a/libc/ports/sysdeps/tile/math_private.h
+++ b/libc/ports/sysdeps/tile/math_private.h
@@ -1,13 +1,31 @@
#ifndef _MATH_PRIVATE_H
+/* Internally, we suppress any use of exception or rounding other
+ than what is supported by the hardware. This does mean that some
+ code will silently fail to report exceptions, set rounding mode
+ as expected, etc., but it allows math code to compile that otherwise
+ wouldn't (such as math/s_fma.c) and so is valuable.
+
+ We intentionally ignore the "exception" arguments of functions that
+ take an exception, since we can't even evaluate the argument
+ without causing a build failure. The extra level of statement
+ expression wrapping avoids "statement with no effect" warnings.
+ Since the callers don't check for errors anyway, we just claim
+ success in every case.
+
+ The overrides for libc_ functions must happen before we include
+ the generic math_private.h, and the overrides for regular
+ <fenv.h> functions must happen afterwards, to avoid clashing with
+ the declarations of those functions. */
+
+#define libc_fesetround(rnd) ({ 0; })
+#define libc_fetestexcept(exc) ({ 0; })
+#define libc_feholdexcept_setround(env, exc) ({ (void) (env); 0; })
+#define libc_feupdateenv_test(env, exc) ({ (void) (env); 0; })
+
#include_next <math_private.h>
-/* We have no exception support, so feraiseexcept() must be a no-op.
- And since we don't define FE_INVALID, FE_DIVBYZERO, etc., we
- must ignore the argument of feraiseexcept() as well. we return
- "1" to indicate we failed to raise an exception, though none of
- the callers in glibc actually care. The extra level of statement
- expression wrapping avoids "statement with no effect" warnings. */
-#define feraiseexcept(excepts) ({ 1; })
+#define feraiseexcept(excepts) ({ 0; })
+#define feclearexcept(exc) ({ 0; })
#endif
diff --git a/libc/ports/sysdeps/tile/memcopy.h b/libc/ports/sysdeps/tile/memcopy.h
new file mode 100644
index 000000000..2bc3fce68
--- /dev/null
+++ b/libc/ports/sysdeps/tile/memcopy.h
@@ -0,0 +1,27 @@
+/* memcopy.h -- definitions for memory copy functions. Tile version.
+ Copyright (C) 2012 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 <sysdeps/generic/memcopy.h>
+#include <bits/wordsize.h>
+
+/* Support more efficient copying on tilegx32, which supports
+ long long as a native 64-bit type. */
+#if defined (__tilegx__) && __WORDSIZE == 32
+# undef op_t
+# define op_t unsigned long long int
+#endif
diff --git a/libc/ports/sysdeps/tile/nptl/pthread_spin_unlock.c b/libc/ports/sysdeps/tile/nptl/pthread_spin_unlock.c
new file mode 100644
index 000000000..260f6fae9
--- /dev/null
+++ b/libc/ports/sysdeps/tile/nptl/pthread_spin_unlock.c
@@ -0,0 +1,33 @@
+/* pthread_spin_unlock -- unlock a spin lock. Tile version.
+ Copyright (C) 2012 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 "pthreadP.h"
+#include <atomic.h>
+
+int
+pthread_spin_unlock (pthread_spinlock_t *lock)
+{
+#ifdef __tilegx__
+ /* Use exchange() to bypass the write buffer. */
+ atomic_exchange_rel (lock, 0);
+#else
+ atomic_full_barrier ();
+ *lock = 0;
+#endif
+ return 0;
+}
diff --git a/libc/ports/sysdeps/tile/start.S b/libc/ports/sysdeps/tile/start.S
index 999bb535c..54f015f4d 100644
--- a/libc/ports/sysdeps/tile/start.S
+++ b/libc/ports/sysdeps/tile/start.S
@@ -126,27 +126,37 @@ _start:
moveli r0, hw2_last(main - .Lmy_pc)
}
{
- moveli r3, hw2_last(__libc_csu_init - .Lmy_pc)
shl16insli r0, r0, hw1(main - .Lmy_pc)
+ moveli r3, hw2_last(__libc_csu_init - .Lmy_pc)
}
{
- shl16insli r3, r3, hw1(__libc_csu_init - .Lmy_pc)
shl16insli r0, r0, hw0(main - .Lmy_pc)
+ shl16insli r3, r3, hw1(__libc_csu_init - .Lmy_pc)
}
{
+ ADD_PTR r0, r0, r13
shl16insli r3, r3, hw0(__libc_csu_init - .Lmy_pc)
+ }
+ {
+ moveli r12, hw2_last_plt(__libc_start_main - .Lmy_pc)
+ ADD_PTR r3, r3, r13
+ }
+ {
+ shl16insli r12, r12, hw1_plt(__libc_start_main - .Lmy_pc)
moveli r4, hw2_last(__libc_csu_fini - .Lmy_pc)
}
{
- ADD_PTR r0, r0, r13
+ shl16insli r12, r12, hw0_plt(__libc_start_main - .Lmy_pc)
shl16insli r4, r4, hw1(__libc_csu_fini - .Lmy_pc)
}
{
- ADD_PTR r3, r3, r13
+ ADD_PTR r12, r12, r13
shl16insli r4, r4, hw0(__libc_csu_fini - .Lmy_pc)
}
{
ADD_PTR r4, r4, r13
+ jalr r12
+ }
#else
addli r0, r13, lo16(main - .Lmy_pc)
}
@@ -160,13 +170,12 @@ _start:
}
{
auli r4, r4, ha16(__libc_csu_fini - .Lmy_pc)
-
-#endif
-
/* Call the user's main function, and exit with its value.
But let the libc call main. */
j plt(__libc_start_main)
}
+#endif
+
{
/* Tell backtracer to give up (_start has no caller). */
info INFO_OP_CANNOT_BACKTRACE
diff --git a/libc/ports/sysdeps/tile/tilegx/Makefile b/libc/ports/sysdeps/tile/tilegx/Makefile
new file mode 100644
index 000000000..d3a0e970a
--- /dev/null
+++ b/libc/ports/sysdeps/tile/tilegx/Makefile
@@ -0,0 +1,18 @@
+include $(common-objpfx)cflags-mcmodel-large.mk
+
+$(common-objpfx)cflags-mcmodel-large.mk: $(common-objpfx)config.make
+ mcmodel=no; \
+ $(CC) -S -o /dev/null -xc /dev/null -mcmodel=large && mcmodel=yes; \
+ echo "cflags-mcmodel-large = $$mcmodel" > $@
+
+ifeq ($(subdir),csu)
+ifeq (yes,$(cflags-mcmodel-large))
+# elf-init.c is in libc_nonshared.o (the end of the shared object) but
+# must reach the _init symbol at the very start of the shared object.
+CFLAGS-elf-init.c += -mcmodel=large
+
+# __gmon_start__ is at the very start of the shared object when linked
+# with profiling, but calls to libc.so via the PLT at the very end.
+CFLAGS-gmon-start.c += -mcmodel=large
+endif
+endif
diff --git a/libc/ports/sysdeps/tile/tilegx/memcpy.c b/libc/ports/sysdeps/tile/tilegx/memcpy.c
index dd6e30dd6..5b015f39d 100644
--- a/libc/ports/sysdeps/tile/tilegx/memcpy.c
+++ b/libc/ports/sysdeps/tile/tilegx/memcpy.c
@@ -19,11 +19,9 @@
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
+#include <memcopy.h>
#include <arch/chip.h>
-/* Must be 8 bytes in size. */
-#define word_t uint64_t
-
/* How many cache lines ahead should we prefetch? */
#define PREFETCH_LINES_AHEAD 3
@@ -34,8 +32,8 @@ __memcpy (void *__restrict dstv, const void *__restrict srcv, size_t n)
const char *__restrict src1 = (const char *) srcv;
const char *__restrict src1_end;
const char *__restrict prefetch;
- word_t *__restrict dst8; /* 8-byte pointer to destination memory. */
- word_t final; /* Final bytes to write to trailing word, if any */
+ op_t *__restrict dst8; /* 8-byte pointer to destination memory. */
+ op_t final; /* Final bytes to write to trailing word, if any */
long i;
if (n < 16)
@@ -55,101 +53,169 @@ __memcpy (void *__restrict dstv, const void *__restrict srcv, size_t n)
{
__insn_prefetch (prefetch);
prefetch += CHIP_L2_LINE_SIZE ();
- prefetch = (prefetch > src1_end) ? prefetch : src1;
+ prefetch = (prefetch < src1_end) ? prefetch : src1;
}
/* Copy bytes until dst is word-aligned. */
- for (; (uintptr_t) dst1 & (sizeof (word_t) - 1); n--)
+ for (; (uintptr_t) dst1 & (sizeof (op_t) - 1); n--)
*dst1++ = *src1++;
/* 8-byte pointer to destination memory. */
- dst8 = (word_t *) dst1;
+ dst8 = (op_t *) dst1;
- if (__builtin_expect ((uintptr_t) src1 & (sizeof (word_t) - 1), 0))
+ if (__builtin_expect ((uintptr_t) src1 & (sizeof (op_t) - 1), 0))
{
- /* Misaligned copy. Copy 8 bytes at a time, but don't bother
- with other fanciness.
- TODO: Consider prefetching and using wh64 as well. */
+ /* Misaligned copy. Use glibc's _wordcopy_fwd_dest_aligned, but
+ inline it to avoid prologue/epilogue. TODO: Consider
+ prefetching and using wh64 as well. */
+ void * srci;
+ op_t a0, a1, a2, a3;
+ long int dstp = (long int) dst1;
+ long int srcp = (long int) src1;
+ long int len = n / OPSIZ;
- /* Create an aligned src8. */
- const word_t *__restrict src8 =
- (const word_t *) ((uintptr_t) src1 & -sizeof (word_t));
- word_t b;
+ /* Save the initial source pointer so we know the number of
+ bytes to shift for merging two unaligned results. */
+ srci = (void *) srcp;
- word_t a = *src8++;
- for (; n >= sizeof (word_t); n -= sizeof (word_t))
- {
- b = *src8++;
- a = __insn_dblalign (a, b, src1);
- *dst8++ = a;
- a = b;
- }
+ /* Make SRCP aligned by rounding it down to the beginning of the
+ `op_t' it points in the middle of. */
+ srcp &= -OPSIZ;
+
+ switch (len % 4)
+ {
+ case 2:
+ a1 = ((op_t *) srcp)[0];
+ a2 = ((op_t *) srcp)[1];
+ len += 2;
+ srcp += 2 * OPSIZ;
+ goto do1;
+ case 3:
+ a0 = ((op_t *) srcp)[0];
+ a1 = ((op_t *) srcp)[1];
+ len += 1;
+ srcp += 2 * OPSIZ;
+ goto do2;
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return dstv;
+ a3 = ((op_t *) srcp)[0];
+ a0 = ((op_t *) srcp)[1];
+ len += 0;
+ srcp += 2 * OPSIZ;
+ goto do3;
+ case 1:
+ a2 = ((op_t *) srcp)[0];
+ a3 = ((op_t *) srcp)[1];
+ srcp += 2 * OPSIZ;
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do4; /* No-op. */
+ }
+ do
+ {
+ do4:
+ a0 = ((op_t *) srcp)[0];
+ a2 = __insn_dblalign (a2, a3, srci);
+ ((op_t *) dstp)[0] = a2;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ do3:
+ a1 = ((op_t *) srcp)[0];
+ a3 = __insn_dblalign (a3, a0, srci);
+ ((op_t *) dstp)[0] = a3;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ do2:
+ a2 = ((op_t *) srcp)[0];
+ a0 = __insn_dblalign (a0, a1, srci);
+ ((op_t *) dstp)[0] = a0;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ do1:
+ a3 = ((op_t *) srcp)[0];
+ a1 = __insn_dblalign (a1, a2, srci);
+ ((op_t *) dstp)[0] = a1;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ len -= 4;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ ((op_t *) dstp)[0] = __insn_dblalign (a2, a3, srci);
+
+ n = n % OPSIZ;
if (n == 0)
- return dstv;
+ return dstv;
- b = ((const char *) src8 <= src1_end) ? *src8 : 0;
+ a0 = ((const char *) srcp <= src1_end) ? ((op_t *) srcp)[0] : 0;
- /* Final source bytes to write to trailing partial word, if any. */
- final = __insn_dblalign (a, b, src1);
+ final = __insn_dblalign (a3, a0, srci);
+ dst8 = (op_t *)(dstp + OPSIZ);
}
else
{
/* Aligned copy. */
- const word_t *__restrict src8 = (const word_t *) src1;
+ const op_t *__restrict src8 = (const op_t *) src1;
/* src8 and dst8 are both word-aligned. */
if (n >= CHIP_L2_LINE_SIZE ())
{
/* Copy until 'dst' is cache-line-aligned. */
for (; (uintptr_t) dst8 & (CHIP_L2_LINE_SIZE () - 1);
- n -= sizeof (word_t))
+ n -= sizeof (op_t))
*dst8++ = *src8++;
- /* If copying to self, return. The test is cheap enough
- that we do it despite the fact that the memcpy() contract
- doesn't require us to support overlapping dst and src.
- This is the most common case of overlap, and any close
- overlap will cause corruption due to the wh64 below.
- This case is particularly important since the compiler
- will emit memcpy() calls for aggregate copies even if it
- can't prove that src != dst. */
- if (__builtin_expect (dst8 == src8, 0))
- return dstv;
-
for (; n >= CHIP_L2_LINE_SIZE ();)
- {
- __insn_wh64 (dst8);
-
- /* Prefetch and advance to next line to prefetch, but
- don't go past the end. */
- __insn_prefetch (prefetch);
- prefetch += CHIP_L2_LINE_SIZE ();
- prefetch = (prefetch > src1_end) ? prefetch :
- (const char *) src8;
-
- /* Copy an entire cache line. Manually unrolled to
- avoid idiosyncracies of compiler unrolling. */
-#define COPY_WORD(offset) ({ dst8[offset] = src8[offset]; n -= 8; })
- COPY_WORD (0);
- COPY_WORD (1);
- COPY_WORD (2);
- COPY_WORD (3);
- COPY_WORD (4);
- COPY_WORD (5);
- COPY_WORD (6);
- COPY_WORD (7);
+ {
+ op_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
+
+ /* Prefetch and advance to next line to prefetch, but
+ don't go past the end. */
+ __insn_prefetch (prefetch);
+ prefetch += CHIP_L2_LINE_SIZE ();
+ prefetch = (prefetch < src1_end) ? prefetch :
+ (const char *) src8;
+
+ /* Do all the loads before wh64. This is necessary if
+ [src8, src8+7] and [dst8, dst8+7] share the same
+ cache line and dst8 <= src8, as can be the case when
+ called from memmove, or with code tested on x86 whose
+ memcpy always works with forward copies. */
+ tmp0 = *src8++;
+ tmp1 = *src8++;
+ tmp2 = *src8++;
+ tmp3 = *src8++;
+ tmp4 = *src8++;
+ tmp5 = *src8++;
+ tmp6 = *src8++;
+ tmp7 = *src8++;
+
+ __insn_wh64 (dst8);
+
+ *dst8++ = tmp0;
+ *dst8++ = tmp1;
+ *dst8++ = tmp2;
+ *dst8++ = tmp3;
+ *dst8++ = tmp4;
+ *dst8++ = tmp5;
+ *dst8++ = tmp6;
+ *dst8++ = tmp7;
+
+ n -= 64;
+ }
#if CHIP_L2_LINE_SIZE() != 64
# error "Fix code that assumes particular L2 cache line size."
#endif
-
- dst8 += CHIP_L2_LINE_SIZE () / sizeof (word_t);
- src8 += CHIP_L2_LINE_SIZE () / sizeof (word_t);
- }
}
- for (; n >= sizeof (word_t); n -= sizeof (word_t))
+ for (; n >= sizeof (op_t); n -= sizeof (op_t))
*dst8++ = *src8++;
if (__builtin_expect (n == 0, 1))
diff --git a/libc/ports/sysdeps/tile/wordcopy.c b/libc/ports/sysdeps/tile/wordcopy.c
new file mode 100644
index 000000000..f978d8fdc
--- /dev/null
+++ b/libc/ports/sysdeps/tile/wordcopy.c
@@ -0,0 +1,449 @@
+/* wordcopy.c -- subroutines for memory copy functions. Tile version.
+ Copyright (C) 1991-2012 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/>. */
+
+/* To optimize for tile, we make the following changes from the
+ default glibc version:
+ - Use the double align instruction instead of the MERGE macro.
+ - Since we don't have offset addressing mode, make sure the loads /
+ stores in the inner loop always have indices of 0.
+ - Use post-increment addresses in the inner loops, which yields
+ better scheduling. */
+
+/* BE VERY CAREFUL IF YOU CHANGE THIS CODE...! */
+
+#include <stddef.h>
+#include <memcopy.h>
+
+/* Provide the appropriate dblalign builtin to shift two registers
+ based on the alignment of a pointer held in a third register. */
+#ifdef __tilegx__
+#define DBLALIGN __insn_dblalign
+#else
+#define DBLALIGN __insn_dword_align
+#endif
+
+/* _wordcopy_fwd_aligned -- Copy block beginning at SRCP to
+ block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
+ Both SRCP and DSTP should be aligned for memory operations on `op_t's. */
+
+void
+_wordcopy_fwd_aligned (dstp, srcp, len)
+ long int dstp;
+ long int srcp;
+ size_t len;
+{
+ op_t a0, a1;
+
+ switch (len % 8)
+ {
+ case 2:
+ a0 = ((op_t *) srcp)[0];
+ srcp += OPSIZ;
+ len += 6;
+ goto do1;
+ case 3:
+ a1 = ((op_t *) srcp)[0];
+ srcp += OPSIZ;
+ len += 5;
+ goto do2;
+ case 4:
+ a0 = ((op_t *) srcp)[0];
+ srcp += OPSIZ;
+ len += 4;
+ goto do3;
+ case 5:
+ a1 = ((op_t *) srcp)[0];
+ srcp += OPSIZ;
+ len += 3;
+ goto do4;
+ case 6:
+ a0 = ((op_t *) srcp)[0];
+ srcp += OPSIZ;
+ len += 2;
+ goto do5;
+ case 7:
+ a1 = ((op_t *) srcp)[0];
+ srcp += OPSIZ;
+ len += 1;
+ goto do6;
+
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ a0 = ((op_t *) srcp)[0];
+ srcp += OPSIZ;
+ goto do7;
+ case 1:
+ a1 = ((op_t *) srcp)[0];
+ srcp += OPSIZ;
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do8; /* No-op. */
+ }
+
+ do
+ {
+ do8:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a1;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ do7:
+ a1 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a0;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ do6:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a1;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ do5:
+ a1 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a0;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ do4:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a1;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ do3:
+ a1 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a0;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ do2:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a1;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ do1:
+ a1 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a0;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+
+ len -= 8;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ ((op_t *) dstp)[0] = a1;
+}
+
+/* _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
+ *not* be aligned. */
+
+void
+_wordcopy_fwd_dest_aligned (dstp, srcp, len)
+ long int dstp;
+ long int srcp;
+ size_t len;
+{
+ void * srci;
+ op_t a0, a1, a2, a3;
+
+ /* Save the initial source pointer so we know the number of bytes to
+ shift for merging two unaligned results. */
+ srci = (void *) srcp;
+
+ /* Make SRCP aligned by rounding it down to the beginning of the `op_t'
+ it points in the middle of. */
+ srcp &= -OPSIZ;
+
+ switch (len % 4)
+ {
+ case 2:
+ a1 = ((op_t *) srcp)[0];
+ a2 = ((op_t *) srcp)[1];
+ len += 2;
+ srcp += 2 * OPSIZ;
+ goto do1;
+ case 3:
+ a0 = ((op_t *) srcp)[0];
+ a1 = ((op_t *) srcp)[1];
+ len += 1;
+ srcp += 2 * OPSIZ;
+ goto do2;
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ a3 = ((op_t *) srcp)[0];
+ a0 = ((op_t *) srcp)[1];
+ len += 0;
+ srcp += 2 * OPSIZ;
+ goto do3;
+ case 1:
+ a2 = ((op_t *) srcp)[0];
+ a3 = ((op_t *) srcp)[1];
+ srcp += 2 * OPSIZ;
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do4; /* No-op. */
+ }
+
+ do
+ {
+ do4:
+ a0 = ((op_t *) srcp)[0];
+ a2 = DBLALIGN (a2, a3, srci);
+ ((op_t *) dstp)[0] = a2;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ do3:
+ a1 = ((op_t *) srcp)[0];
+ a3 = DBLALIGN (a3, a0, srci);
+ ((op_t *) dstp)[0] = a3;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ do2:
+ a2 = ((op_t *) srcp)[0];
+ a0 = DBLALIGN (a0, a1, srci);
+ ((op_t *) dstp)[0] = a0;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ do1:
+ a3 = ((op_t *) srcp)[0];
+ a1 = DBLALIGN (a1, a2, srci);
+ ((op_t *) dstp)[0] = a1;
+ srcp += OPSIZ;
+ dstp += OPSIZ;
+ len -= 4;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ ((op_t *) dstp)[0] = DBLALIGN (a2, a3, srci);
+}
+
+/* _wordcopy_bwd_aligned -- Copy block finishing right before
+ SRCP to block finishing right before DSTP with LEN `op_t' words
+ (not LEN bytes!). Both SRCP and DSTP should be aligned for memory
+ operations on `op_t's. */
+
+void
+_wordcopy_bwd_aligned (dstp, srcp, len)
+ long int dstp;
+ long int srcp;
+ size_t len;
+{
+ op_t a0, a1;
+ long int srcp1;
+
+ srcp1 = srcp - 1 * OPSIZ;
+ srcp -= 2 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+
+ switch (len % 8)
+ {
+ case 2:
+ a0 = ((op_t *) srcp1)[0];
+ len += 6;
+ goto do1;
+ case 3:
+ a1 = ((op_t *) srcp1)[0];
+ len += 5;
+ goto do2;
+ case 4:
+ a0 = ((op_t *) srcp1)[0];
+ len += 4;
+ goto do3;
+ case 5:
+ a1 = ((op_t *) srcp1)[0];
+ len += 3;
+ goto do4;
+ case 6:
+ a0 = ((op_t *) srcp1)[0];
+ len += 2;
+ goto do5;
+ case 7:
+ a1 = ((op_t *) srcp1)[0];
+ len += 1;
+ goto do6;
+
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ a0 = ((op_t *) srcp1)[0];
+ goto do7;
+ case 1:
+ a1 = ((op_t *) srcp1)[0];
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do8; /* No-op. */
+ }
+
+ do
+ {
+ do8:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a1;
+ srcp -= OPSIZ;
+ dstp -= OPSIZ;
+ do7:
+ a1 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a0;
+ srcp -= OPSIZ;
+ dstp -= OPSIZ;
+ do6:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a1;
+ srcp -= OPSIZ;
+ dstp -= OPSIZ;
+ do5:
+ a1 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a0;
+ srcp -= OPSIZ;
+ dstp -= OPSIZ;
+ do4:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a1;
+ srcp -= OPSIZ;
+ dstp -= OPSIZ;
+ do3:
+ a1 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a0;
+ srcp -= OPSIZ;
+ dstp -= OPSIZ;
+ do2:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a1;
+ srcp -= OPSIZ;
+ dstp -= OPSIZ;
+ do1:
+ a1 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a0;
+ srcp -= OPSIZ;
+ dstp -= OPSIZ;
+
+ len -= 8;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ ((op_t *) dstp)[0] = a1;
+}
+
+/* _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
+ operations on `op_t', but SRCP must *not* be aligned. */
+
+void
+_wordcopy_bwd_dest_aligned (dstp, srcp, len)
+ long int dstp;
+ long int srcp;
+ size_t len;
+{
+ void * srci;
+ op_t a0, a1, a2, a3;
+ op_t b0, b1, b2, b3;
+
+ /* Save the initial source pointer so we know the number of bytes to
+ shift for merging two unaligned results. */
+ srci = (void *) srcp;
+
+ /* Make SRCP aligned by rounding it down to the beginning of the op_t
+ it points in the middle of. */
+ srcp &= -OPSIZ;
+ srcp += OPSIZ;
+
+ switch (len % 4)
+ {
+ case 2:
+ srcp -= 3 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ b2 = ((op_t *) srcp)[2];
+ b1 = a1 = ((op_t *) srcp)[1];
+ len += 2;
+ goto do1;
+ case 3:
+ srcp -= 3 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ b3 = ((op_t *) srcp)[2];
+ b2 = a2 = ((op_t *) srcp)[1];
+ len += 1;
+ goto do2;
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ srcp -= 3 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ b0 = ((op_t *) srcp)[2];
+ b3 = a3 = ((op_t *) srcp)[1];
+ goto do3;
+ case 1:
+ srcp -= 3 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ b1 = ((op_t *) srcp)[2];
+ b0 = a0 = ((op_t *) srcp)[1];
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do4; /* No-op. */
+ }
+
+ do
+ {
+ do4:
+ b3 = a3 = ((op_t *) srcp)[0];
+ a0 = DBLALIGN (a0, b1, srci);
+ ((op_t *) dstp)[0] = a0;
+ srcp -= OPSIZ;
+ dstp -= OPSIZ;
+ do3:
+ b2 = a2 = ((op_t *) srcp)[0];
+ a3 = DBLALIGN (a3, b0, srci);
+ ((op_t *) dstp)[0] = a3;
+ srcp -= OPSIZ;
+ dstp -= OPSIZ;
+ do2:
+ b1 = a1 = ((op_t *) srcp)[0];
+ a2 = DBLALIGN (a2, b3, srci);
+ ((op_t *) dstp)[0] = a2;
+ srcp -= OPSIZ;
+ dstp -= OPSIZ;
+ do1:
+ b0 = a0 = ((op_t *) srcp)[0];
+ a1 = DBLALIGN (a1, b2, srci);
+ ((op_t *) dstp)[0] = a1;
+ srcp -= OPSIZ;
+ dstp -= OPSIZ;
+
+ len -= 4;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ a0 = DBLALIGN (a0, b1, srci);
+ ((op_t *) dstp)[0] = a0;
+}
diff --git a/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
index 4c5507114..2d5f20b46 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
@@ -20,18 +20,6 @@
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
-#include <sys/types.h>
-#ifdef __USE_GNU
-# include <bits/uio.h>
-#endif
-
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
- located on an ext2 file system */
-#define O_ACCMODE 0003
-#define O_RDONLY 00
-#define O_WRONLY 01
-#define O_RDWR 02
#define O_CREAT 01000 /* not fcntl */
#define O_TRUNC 02000 /* not fcntl */
#define O_EXCL 04000 /* not fcntl */
@@ -39,41 +27,21 @@
#define O_NONBLOCK 00004
#define O_APPEND 00010
-#define O_NDELAY O_NONBLOCK
#define O_SYNC 020040000
-#define O_FSYNC O_SYNC
-#define O_ASYNC 020000 /* fcntl, for BSD compatibility */
-#ifdef __USE_XOPEN2K8
-# define O_DIRECTORY 0100000 /* Must be a directory. */
-# define O_NOFOLLOW 0200000 /* Do not follow links. */
-# define O_CLOEXEC 010000000 /* Set close_on_exec. */
-#endif
-#ifdef __USE_GNU
-# define O_DIRECT 02000000 /* Direct disk access. */
-# define O_NOATIME 04000000 /* Do not set atime. */
-# define O_PATH 040000000 /* Resolve pathname but do not open file. */
-#endif
+#define __O_DIRECTORY 0100000 /* Must be a directory. */
+#define __O_NOFOLLOW 0200000 /* Do not follow links. */
+#define __O_CLOEXEC 010000000 /* Set close_on_exec. */
+
+#define __O_DIRECT 02000000 /* Direct disk access. */
+#define __O_NOATIME 04000000 /* Do not set atime. */
+#define __O_PATH 040000000 /* Resolve pathname but do not open file. */
-#ifdef __USE_LARGEFILE64
/* Not necessary, files are always with 64bit off_t. */
-# define O_LARGEFILE 0
-#endif
+#define __O_LARGEFILE 0
-/* For now Linux has synchronisity options for data and read operations.
- We define the symbols here but let them do the same as O_SYNC since
- this is a superset. */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC 040000 /* Synchronize data. */
-# define O_RSYNC O_SYNC /* Synchronize read operations. */
-#endif
+#define __O_DSYNC 040000 /* Synchronize data. */
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
#define F_GETLK 7 /* Get record locking info. */
#define F_SETLK 8 /* Set record locking info (non-blocking). */
#define F_SETLKW 9 /* Set record locking info (blocking). */
@@ -81,32 +49,8 @@
#define F_SETLK64 F_SETLK /* Set record locking info (non-blocking). */
#define F_SETLKW64 F_SETLKW /* Set record locking info (blocking). */
-#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
-# define F_SETOWN 5 /* Get owner of socket (receiver of SIGIO). */
-# define F_GETOWN 6 /* Set owner of socket (receiver of SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG 10 /* Set number of signal to be sent. */
-# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE 1024 /* Set a lease. */
-# define F_GETLEASE 1025 /* Enquire what lease is active. */
-# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
-#endif
-#ifdef __USE_XOPEN2K8
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set. */
-#endif
-
-/* for F_[GET|SET]FD */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+#define __F_SETOWN 5 /* Get owner of socket (receiver of SIGIO). */
+#define __F_GETOWN 6 /* Set owner of socket (receiver of SIGIO). */
/* For posix fcntl() and `l_type' field of a `struct flock' for lockf() */
#define F_RDLCK 1 /* Read lock. */
@@ -117,33 +61,6 @@
#define F_EXLCK 16 /* or 3 */
#define F_SHLCK 32 /* or 4 */
-/* Operations for bsd flock(), also used by the kernel implementation */
-#ifdef __USE_BSD
-# define LOCK_SH 1 /* shared lock */
-# define LOCK_EX 2 /* exclusive lock */
-# define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-# define LOCK_UN 8 /* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND 32 /* This is a mandatory flock: */
-# define LOCK_READ 64 /* ... which allows concurrent read operations. */
-# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
-# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY. */
-# define DN_ACCESS 0x00000001 /* File accessed. */
-# define DN_MODIFY 0x00000002 /* File modified. */
-# define DN_CREATE 0x00000004 /* File created. */
-# define DN_DELETE 0x00000008 /* File removed. */
-# define DN_RENAME 0x00000010 /* File renamed. */
-# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
-#endif
-
/* We don't need to support __USE_FILE_OFFSET64. */
struct flock
{
@@ -165,137 +82,5 @@ struct flock64
};
#endif
-#ifdef __USE_GNU
-/* Owner types. */
-enum __pid_type
- {
- F_OWNER_TID = 0, /* Kernel thread. */
- F_OWNER_PID, /* Process. */
- F_OWNER_PGRP, /* Process group. */
- F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
- };
-
-/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
-struct f_owner_ex
- {
- enum __pid_type type; /* Owner type of ID. */
- __pid_t pid; /* ID of owner. */
- };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
- BSD systems which did not managed to hide these kernel macros. */
-#ifdef __USE_BSD
-# define FAPPEND O_APPEND
-# define FFSYNC O_FSYNC
-# define FASYNC O_ASYNC
-# define FNONBLOCK O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif /* Use BSD. */
-
-/* Advise to `posix_fadvise'. */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-#endif
-
-
-#ifdef __USE_GNU
-/* Flags for SYNC_FILE_RANGE. */
-# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
- in the range before performing the
- write. */
-# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
- dirty pages in the range which are
- not presently under writeback. */
-# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
- the range after performing the
- write. */
-
-/* Flags for SPLICE and VMSPLICE. */
-# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
-# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
- (but we may still block on the fd
- we splice from/to). */
-# define SPLICE_F_MORE 4 /* Expect more data. */
-# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
-
-/* File handle structure. */
-struct file_handle
-{
- unsigned int handle_bytes;
- int handle_type;
- /* File identifier. */
- unsigned char f_handle[0];
-};
-
-/* Maximum handle size (for now). */
-# define MAX_HANDLE_SZ 128
-#endif
-
-__BEGIN_DECLS
-
-#ifdef __USE_GNU
-
-/* Provide kernel hint to read ahead. */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
- __THROW;
-
-
-/* Selective file content synch'ing. */
-extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
- unsigned int __flags);
-
-
-/* Splice address range into a pipe. */
-extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
- size_t __count, unsigned int __flags);
-
-/* Splice two files together. */
-extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
- __off64_t *__offout, size_t __len,
- unsigned int __flags);
-
-/* In-kernel implementation of tee for pipe buffers. */
-extern ssize_t tee (int __fdin, int __fdout, size_t __len,
- unsigned int __flags);
-
-/* Reserve storage for the data of the file associated with FD.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-# ifndef __USE_FILE_OFFSET64
-extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
-# else
-# ifdef __REDIRECT
-extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
- __off64_t __len),
- fallocate64);
-# else
-# define fallocate fallocate64
-# endif
-# endif
-# ifdef __USE_LARGEFILE64
-extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
- __off64_t __len);
-# endif
-
-/* Map file name to file handle. */
-extern int name_to_handle_at (int __dfd, const char *__name,
- struct file_handle *__handle, int *__mnt_id,
- int __flags) __THROW;
-
-/* Open file using the file handle.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
- int __flags);
-
-#endif
-
-__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
index 5811361e3..9d1218273 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2012 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
@@ -86,6 +86,18 @@
__ret; \
})
+#define lll_futex_timed_wait_bitset(futexp, val, timespec, clockbit, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ int __op = FUTEX_WAIT_BITSET | clockbit; \
+ __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \
+ __lll_private_flag (__op, private), \
+ (val), (timespec), NULL /* Unused. */, \
+ FUTEX_BITSET_MATCH_ANY); \
+ __ret; \
+ })
+
#define lll_futex_wake(futexp, nr, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
diff --git a/libc/ports/sysdeps/unix/sysv/linux/generic/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/generic/bits/fcntl.h
index a8f20bd0b..56a914b7e 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/generic/bits/fcntl.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/generic/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for the generic Linux ABI.
- Copyright (C) 2011 Free Software Foundation, Inc.
+ Copyright (C) 2011-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
@@ -21,147 +21,10 @@
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
-#include <sys/types.h>
#include <bits/wordsize.h>
-#ifdef __USE_GNU
-# include <bits/uio.h>
-#endif
-
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
- located on a few file systems. */
-#define O_ACCMODE 0003
-#define O_RDONLY 00
-#define O_WRONLY 01
-#define O_RDWR 02
-#define O_CREAT 0100 /* not fcntl */
-#define O_EXCL 0200 /* not fcntl */
-#define O_NOCTTY 0400 /* not fcntl */
-#define O_TRUNC 01000 /* not fcntl */
-#define O_APPEND 02000
-#define O_NONBLOCK 04000
-#define O_NDELAY O_NONBLOCK
-#define O_SYNC 04010000
-#define O_FSYNC O_SYNC
-#define O_ASYNC 020000
-#ifdef __USE_XOPEN2K8
-# define O_DIRECTORY 0200000 /* Must be a directory. */
-# define O_NOFOLLOW 0400000 /* Do not follow links. */
-# define O_CLOEXEC 02000000 /* Set close_on_exec. */
-#endif
-#ifdef __USE_GNU
-# define O_DIRECT 040000 /* Direct disk access. */
-# define O_NOATIME 01000000 /* Do not set atime. */
-# define O_PATH 010000000 /* Resolve pathname but do not open file. */
-#endif
-
-/* For now Linux has synchronisity options for data and read operations.
- We define the symbols here but let them do the same as O_SYNC since
- this is a superset. */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC 010000 /* Synchronize data. */
-# define O_RSYNC O_SYNC /* Synchronize read operations. */
-#endif
-
-#ifdef __USE_LARGEFILE64
-# if __WORDSIZE == 64
-# define O_LARGEFILE 0
-# else
-# define O_LARGEFILE 0100000
-# endif
-#endif
-
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
#if __WORDSIZE == 64
-# define F_GETLK 5 /* Get record locking info. */
-# define F_SETLK 6 /* Set record locking info (non-blocking). */
-# define F_SETLKW 7 /* Set record locking info (blocking). */
-/* Not necessary, we always have 64-bit offsets. */
-# define F_GETLK64 5 /* Get record locking info. */
-# define F_SETLK64 6 /* Set record locking info (non-blocking). */
-# define F_SETLKW64 7 /* Set record locking info (blocking). */
-#else
-# ifndef __USE_FILE_OFFSET64
-# define F_GETLK 5 /* Get record locking info. */
-# define F_SETLK 6 /* Set record locking info (non-blocking). */
-# define F_SETLKW 7 /* Set record locking info (blocking). */
-# else
-# define F_GETLK F_GETLK64 /* Get record locking info. */
-# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
-# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
-# endif
-# define F_GETLK64 12 /* Get record locking info. */
-# define F_SETLK64 13 /* Set record locking info (non-blocking). */
-# define F_SETLKW64 14 /* Set record locking info (blocking). */
-#endif
-
-#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
-# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
-# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG 10 /* Set number of signal to be sent. */
-# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE 1024 /* Set a lease. */
-# define F_GETLEASE 1025 /* Enquire what lease is active. */
-# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
-#endif
-#ifdef __USE_XOPEN2K8
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set. */
-#endif
-
-/* For F_[GET|SET]FD. */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
-#define F_RDLCK 0 /* Read lock. */
-#define F_WRLCK 1 /* Write lock. */
-#define F_UNLCK 2 /* Remove lock. */
-
-/* For old implementation of bsd flock(). */
-#define F_EXLCK 4 /* or 3 */
-#define F_SHLCK 8 /* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation. */
-# define LOCK_SH 1 /* shared lock */
-# define LOCK_EX 2 /* exclusive lock */
-# define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-# define LOCK_UN 8 /* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND 32 /* This is a mandatory flock: */
-# define LOCK_READ 64 /* ... which allows concurrent read operations. */
-# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
-# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY. */
-# define DN_ACCESS 0x00000001 /* File accessed. */
-# define DN_MODIFY 0x00000002 /* File modified. */
-# define DN_CREATE 0x00000004 /* File created. */
-# define DN_DELETE 0x00000008 /* File removed. */
-# define DN_RENAME 0x00000010 /* File renamed. */
-# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
+# define __O_LARGEFILE 0
#endif
struct flock
@@ -189,151 +52,5 @@ struct flock64
};
#endif
-#ifdef __USE_GNU
-/* Owner types. */
-enum __pid_type
- {
- F_OWNER_TID = 0, /* Kernel thread. */
- F_OWNER_PID, /* Process. */
- F_OWNER_PGRP, /* Process group. */
- F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
- };
-
-/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
-struct f_owner_ex
- {
- enum __pid_type type; /* Owner type of ID. */
- __pid_t pid; /* ID of owner. */
- };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
- BSD systems which did not managed to hide these kernel macros. */
-#ifdef __USE_BSD
-# define FAPPEND O_APPEND
-# define FFSYNC O_FSYNC
-# define FASYNC O_ASYNC
-# define FNONBLOCK O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif /* Use BSD. */
-
-/* Advise to `posix_fadvise'. */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-#endif
-
-
-#ifdef __USE_GNU
-/* Flags for SYNC_FILE_RANGE. */
-# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
- in the range before performing the
- write. */
-# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
- dirty pages in the range which are
- not presently under writeback. */
-# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
- the range after performing the
- write. */
-
-/* Flags for SPLICE and VMSPLICE. */
-# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
-# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
- (but we may still block on the fd
- we splice from/to). */
-# define SPLICE_F_MORE 4 /* Expect more data. */
-# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
-
-
-/* File handle structure. */
-struct file_handle
-{
- unsigned int handle_bytes;
- int handle_type;
- /* File identifier. */
- unsigned char f_handle[0];
-};
-
-/* Maximum handle size (for now). */
-# define MAX_HANDLE_SZ 128
-#endif
-
-__BEGIN_DECLS
-
-#ifdef __USE_GNU
-
-/* Provide kernel hint to read ahead. */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
- __THROW;
-
-
-/* Selective file content synch'ing.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
- unsigned int __flags);
-
-
-/* Splice address range into a pipe.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
- size_t __count, unsigned int __flags);
-
-/* Splice two files together.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
- __off64_t *__offout, size_t __len,
- unsigned int __flags);
-
-/* In-kernel implementation of tee for pipe buffers.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t tee (int __fdin, int __fdout, size_t __len,
- unsigned int __flags);
-
-/* Reserve storage for the data of the file associated with FD.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-# ifndef __USE_FILE_OFFSET64
-extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
-# else
-# ifdef __REDIRECT
-extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
- __off64_t __len),
- fallocate64);
-# else
-# define fallocate fallocate64
-# endif
-# endif
-# ifdef __USE_LARGEFILE64
-extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
- __off64_t __len);
-# endif
-
-
-/* Map file name to file handle. */
-extern int name_to_handle_at (int __dfd, const char *__name,
- struct file_handle *__handle, int *__mnt_id,
- int __flags) __THROW;
-
-/* Open file using the file handle.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
- int __flags);
-
-#endif /* use GNU */
-
-__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/generic/sysctl.c b/libc/ports/sysdeps/unix/sysv/linux/generic/sysctl.c
index 0bdb78660..0212e1a8a 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/generic/sysctl.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/generic/sysctl.c
@@ -30,4 +30,3 @@ sysctl (int *name, int nlen, void *oldval, size_t *oldlenp,
return -1;
}
stub_warning (sysctl)
-#include <stub-tag.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/generic/ustat.c b/libc/ports/sysdeps/unix/sysv/linux/generic/ustat.c
index 7611e82f0..d6a23090c 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/generic/ustat.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/generic/ustat.c
@@ -30,4 +30,3 @@ ustat (dev_t dev, struct ustat *ubuf)
return -1;
}
stub_warning (ustat)
-#include <stub-tag.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h
index c0e949eea..47a7ed285 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h
@@ -1,6 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995-1999, 2000, 2002, 2004, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1995-2012 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,134 +20,41 @@
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
-#include <sys/types.h>
-#ifdef __USE_GNU
-# include <bits/uio.h>
-#endif
-
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
- located on a few file systems. */
-#define O_ACCMODE 0003
-#define O_RDONLY 00
-#define O_WRONLY 01
-#define O_RDWR 02
#define O_CREAT 00000400 /* not fcntl */
#define O_EXCL 00002000 /* not fcntl */
#define O_NOCTTY 00400000 /* not fcntl */
-#define O_TRUNC 00001000 /* not fcntl */
#define O_APPEND 00000010
#define O_NONBLOCK 00200004 /* HPUX has separate NDELAY & NONBLOCK */
-#define O_NDELAY O_NONBLOCK
-#define O_SYNC 00100000
-#define O_FSYNC O_SYNC
-#define O_ASYNC 020000
-#define O_BLKSEEK 00000100 /* HPUX only */
+#define __O_DSYNC 01000000
+#define __O_RSYNC 02000000 /* HPUX only */
+#define __O_SYNC 01000000
+#define O_SYNC (__O_SYNC|__O_DSYNC)
-#ifdef __USE_XOPEN2K8
-# define O_DIRECTORY 000010000 /* Must be a directory. */
-# define O_NOFOLLOW 000000200 /* Do not follow links. */
-# define O_CLOEXEC 010000000 /* Set close_on_exec. */
-#endif
-#ifdef __USE_GNU
-# define O_DIRECT 040000 /* Direct disk access. */
-# define O_NOATIME 004000000 /* Do not set atime. */
-#endif
+#define O_BLKSEEK 00000100 /* HPUX only */
-/* For now Linux has synchronisity options for data and read operations.
- We define the symbols here but let them do the same as O_SYNC since
- this is a superset. */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC 01000000 /* HPUX only */
-# define O_RSYNC 02000000 /* HPUX only */
-#endif
+#define __O_DIRECTORY 000010000 /* Must be a directory. */
+#define __O_NOFOLLOW 000000200 /* Do not follow links. */
+#define __O_CLOEXEC 010000000 /* Set close_on_exec. */
+#define __O_NOATIME 004000000 /* Do not set atime. */
+#define __O_PATH 020000000
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE 00004000
-#endif
+#define __O_LARGEFILE 00004000
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
-#ifndef __USE_FILE_OFFSET64
-# define F_GETLK 5 /* Get record locking info. */
-# define F_SETLK 6 /* Set record locking info (non-blocking). */
-# define F_SETLKW 7 /* Set record locking info (blocking). */
-#else
-# define F_GETLK F_GETLK64 /* Get record locking info. */
-# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
-# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
-#endif
#define F_GETLK64 8 /* Get record locking info. */
#define F_SETLK64 9 /* Set record locking info (non-blocking). */
#define F_SETLKW64 10 /* Set record locking info (blocking). */
-#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
-# define F_GETOWN 11 /* Get owner of socket (receiver of SIGIO). */
-# define F_SETOWN 12 /* Set owner of socket (receiver of SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG 13 /* Set number of signal to be sent. */
-# define F_GETSIG 14 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE 1024 /* Set a lease. */
-# define F_GETLEASE 1025 /* Enquire what lease is active. */
-# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
-#endif
-#ifdef __USE_XOPEN2K8
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set. */
-#endif
+#define __F_GETOWN 11 /* Get owner of socket (receiver of SIGIO). */
+#define __F_SETOWN 12 /* Set owner of socket (receiver of SIGIO). */
-/* For F_[GET|SET]FD. */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+#define __F_SETSIG 13 /* Set number of signal to be sent. */
+#define __F_GETSIG 14 /* Get number of signal to be sent. */
/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
#define F_RDLCK 1 /* Read lock. */
#define F_WRLCK 2 /* Write lock. */
#define F_UNLCK 3 /* Remove lock. */
-/* For old implementation of bsd flock(). */
-#define F_EXLCK 4 /* or 3 */
-#define F_SHLCK 8 /* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation. */
-# define LOCK_SH 1 /* shared lock */
-# define LOCK_EX 2 /* exclusive lock */
-# define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-# define LOCK_UN 8 /* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND 32 /* This is a mandatory flock: */
-# define LOCK_READ 64 /* ... which allows concurrent read operations. */
-# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
-# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY. */
-# define DN_ACCESS 0x00000001 /* File accessed. */
-# define DN_MODIFY 0x00000002 /* File modified. */
-# define DN_CREATE 0x00000004 /* File created. */
-# define DN_DELETE 0x00000008 /* File removed. */
-# define DN_RENAME 0x00000010 /* File renamed. */
-# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
-#endif
-
struct flock
{
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
@@ -174,148 +80,5 @@ struct flock64
};
#endif
-#ifdef __USE_GNU
-/* Owner types. */
-enum __pid_type
- {
- F_OWNER_TID = 0, /* Kernel thread. */
- F_OWNER_PID, /* Process. */
- F_OWNER_PGRP, /* Process group. */
- F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
- };
-
-/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
-struct f_owner_ex
- {
- enum __pid_type type; /* Owner type of ID. */
- __pid_t pid; /* ID of owner. */
- };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
- BSD systems which did not managed to hide these kernel macros. */
-#ifdef __USE_BSD
-# define FAPPEND O_APPEND
-# define FFSYNC O_FSYNC
-# define FASYNC O_ASYNC
-# define FNONBLOCK O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif /* Use BSD. */
-
-/* Advise to `posix_fadvise'. */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-#endif
-
-
-#ifdef __USE_GNU
-/* Flags for SYNC_FILE_RANGE. */
-# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
- in the range before performing the
- write. */
-# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
- dirty pages in the range which are
- not presently under writeback. */
-# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
- the range after performing the
- write. */
-
-/* Flags for SPLICE and VMSPLICE. */
-# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
-# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
- (but we may still block on the fd
- we splice from/to). */
-# define SPLICE_F_MORE 4 /* Expect more data. */
-# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
-
-
-/* File handle structure. */
-struct file_handle
-{
- unsigned int handle_bytes;
- int handle_type;
- /* File identifier. */
- unsigned char f_handle[0];
-};
-
-/* Maximum handle size (for now). */
-# define MAX_HANDLE_SZ 128
-#endif
-
-__BEGIN_DECLS
-
-#ifdef __USE_GNU
-
-/* Provide kernel hint to read ahead. */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
- __THROW;
-
-
-/* Selective file content synch'ing. */
-extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
- unsigned int __flags);
-
-
-/* Splice address range into a pipe.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
- size_t __count, unsigned int __flags);
-
-/* Splice two files together.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
- __off64_t *__offout, size_t __len,
- unsigned int __flags);
-
-/* In-kernel implementation of tee for pipe buffers.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t tee (int __fdin, int __fdout, size_t __len,
- unsigned int __flags);
-
-/* Reserve storage for the data of the file associated with FD.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-# ifndef __USE_FILE_OFFSET64
-extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
-# else
-# ifdef __REDIRECT
-extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
- __off64_t __len),
- fallocate64);
-# else
-# define fallocate fallocate64
-# endif
-# endif
-# ifdef __USE_LARGEFILE64
-extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
- __off64_t __len);
-# endif
-
-
-/* Map file name to file handle. */
-extern int name_to_handle_at (int __dfd, const char *__name,
- struct file_handle *__handle, int *__mnt_id,
- int __flags) __THROW;
-
-/* Open file using the file handle.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
- int __flags);
-
-#endif
-
-__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/hppa/sysdep.h b/libc/ports/sysdeps/unix/sysv/linux/hppa/sysdep.h
index 83dd599c6..1825d315b 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/hppa/sysdep.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/hppa/sysdep.h
@@ -1,6 +1,5 @@
/* Assembler macros for PA-RISC.
- Copyright (C) 1999, 2001, 2002, 2003, 2007
- Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999.
Linux/PA-RISC changes by Philipp Rumpf, <prumpf@tux.org>, March 2000.
@@ -21,7 +20,6 @@
#include <asm/unistd.h>
#include <sysdeps/generic/sysdep.h>
-#include <sys/syscall.h>
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
#ifndef __ASSEMBLER__
@@ -29,37 +27,33 @@
#endif
#undef ASM_LINE_SEP
-#define ASM_LINE_SEP !
+#define ASM_LINE_SEP !
#undef SYS_ify
#define SYS_ify(syscall_name) (__NR_##syscall_name)
-/* WARNING: TREG must be a callee saves register so
- that it doesn't have to be restored after a call
+/* The vfork, fork, and clone syscalls clobber r19
+ * and r21. We list r21 as either clobbered or as an
+ * input to a 6-argument syscall. We must save and
+ * restore r19 in both PIC and non-PIC cases.
+ */
+/* WARNING: TREG must be a callee saves register so
+ that it doesn't have to be restored after a call
to another function */
-#ifdef PIC
-# define TREG %r3
-# define SAVE_PIC(SREG) copy %r19, SREG ASM_LINE_SEP
-# define LOAD_PIC(LREG) copy LREG, %r19 ASM_LINE_SEP
+#define TREG 4
+#define SAVE_PIC(SREG) \
+ copy %r19, SREG ASM_LINE_SEP \
+ .cfi_register 19, SREG
+#define LOAD_PIC(LREG) \
+ copy LREG , %r19 ASM_LINE_SEP \
+ .cfi_restore 19
/* Inline assembly defines */
-# define TREG_ASM "%r4" /* Cant clobber r3, it holds framemarker */
-# define SAVE_ASM_PIC " copy %%r19, %" TREG_ASM "\n"
-# define LOAD_ASM_PIC " copy %" TREG_ASM ", %%r19\n"
-# define CLOB_TREG TREG_ASM ,
-# define PIC_REG_DEF register unsigned long __r19 asm("r19");
-# define PIC_REG_USE , "r" (__r19)
-#else
-# define TREG %r3
-# define SAVE_PIC(SREG) nop ASM_LINE_SEP
-# define LOAD_PIC(LREG) nop ASM_LINE_SEP
-/* Inline assembly defines */
-# define TREG_ASM
-# define SAVE_ASM_PIC "nop \n"
-# define LOAD_ASM_PIC "nop \n"
-# define CLOB_TREG
-# define PIC_REG_DEF
-# define PIC_REG_USE
-#endif
+#define TREG_ASM "%r4" /* Cant clobber r3, it holds framemarker */
+#define SAVE_ASM_PIC " copy %%r19, %" TREG_ASM "\n"
+#define LOAD_ASM_PIC " copy %" TREG_ASM ", %%r19\n"
+#define CLOB_TREG TREG_ASM ,
+#define PIC_REG_DEF register unsigned long __r19 asm("r19");
+#define PIC_REG_USE , "r" (__r19)
#ifdef __ASSEMBLER__
@@ -126,12 +120,14 @@
.align ALIGNARG(4) ASM_LINE_SEP \
.export C_SYMBOL_NAME(name) ASM_LINE_SEP \
.type C_SYMBOL_NAME(name),@function ASM_LINE_SEP \
+ cfi_startproc ASM_LINE_SEP \
C_LABEL(name) ASM_LINE_SEP \
.PROC ASM_LINE_SEP \
.CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=3 ASM_LINE_SEP \
.ENTRY ASM_LINE_SEP \
/* SAVE_RP says we do */ ASM_LINE_SEP \
stw %rp, -20(%sr0,%sp) ASM_LINE_SEP \
+ .cfi_offset 2, -20 ASM_LINE_SEP \
/*FIXME: Call mcount? (carefull with stack!) */
/* Some syscall wrappers do not call other functions, and
@@ -141,22 +137,25 @@
.align ALIGNARG(4) ASM_LINE_SEP \
.export C_SYMBOL_NAME(name) ASM_LINE_SEP \
.type C_SYMBOL_NAME(name),@function ASM_LINE_SEP \
+ cfi_startproc ASM_LINE_SEP \
C_LABEL(name) ASM_LINE_SEP \
.PROC ASM_LINE_SEP \
.CALLINFO FRAME=64,NO_CALLS,SAVE_RP,ENTRY_GR=3 ASM_LINE_SEP \
.ENTRY ASM_LINE_SEP \
/* SAVE_RP says we do */ ASM_LINE_SEP \
stw %rp, -20(%sr0,%sp) ASM_LINE_SEP \
+ .cfi_offset 2, -20 ASM_LINE_SEP \
/*FIXME: Call mcount? (carefull with stack!) */
#undef END
#define END(name) \
.EXIT ASM_LINE_SEP \
.PROCEND ASM_LINE_SEP \
+ cfi_endproc ASM_LINE_SEP \
.size C_SYMBOL_NAME(name), .-C_SYMBOL_NAME(name) ASM_LINE_SEP
-/* If compiled for profiling, call `mcount' at the start
- of each function. No, don't bother. gcc will put the
+/* If compiled for profiling, call `mcount' at the start
+ of each function. No, don't bother. gcc will put the
call in for us. */
#define CALL_MCOUNT /* Do nothing. */
@@ -169,9 +168,7 @@
which means
ENTRY(name)
DO_CALL(...)
- nop
- bv 0(2)
- nop
+ bv,n 0(2)
*/
#define PSEUDO(name, syscall_name, args) \
@@ -179,8 +176,7 @@
/* If necc. load args from stack */ ASM_LINE_SEP \
DOARGS_##args ASM_LINE_SEP \
DO_CALL (syscall_name, args) ASM_LINE_SEP \
- UNDOARGS_##args ASM_LINE_SEP \
- nop ASM_LINE_SEP
+ UNDOARGS_##args ASM_LINE_SEP
#define ret \
/* Return value set by ERRNO code */ ASM_LINE_SEP \
@@ -195,8 +191,7 @@
ENTRY_LEAF (name) ASM_LINE_SEP \
DOARGS_##args ASM_LINE_SEP \
DO_CALL_NOERRNO (syscall_name, args) ASM_LINE_SEP \
- UNDOARGS_##args ASM_LINE_SEP \
- nop ASM_LINE_SEP
+ UNDOARGS_##args ASM_LINE_SEP
#define ret_NOERRNO ret
@@ -210,8 +205,7 @@
ENTRY_LEAF (name) ASM_LINE_SEP \
DOARGS_##args ASM_LINE_SEP \
DO_CALL_ERRVAL (syscall_name, args) ASM_LINE_SEP \
- UNDOARGS_##args ASM_LINE_SEP \
- nop ASM_LINE_SEP
+ UNDOARGS_##args ASM_LINE_SEP
#define ret_ERRVAL ret
@@ -289,8 +283,12 @@
#define DO_CALL(syscall_name, args) \
/* Create a frame */ ASM_LINE_SEP \
stwm TREG, 64(%sp) ASM_LINE_SEP \
+ .cfi_offset TREG, 0 ASM_LINE_SEP \
+ .cfi_adjust_cfa_offset 64 ASM_LINE_SEP \
stw %sp, -4(%sp) ASM_LINE_SEP \
+ .cfi_offset 30, -4 ASM_LINE_SEP \
stw %r19, -32(%sp) ASM_LINE_SEP \
+ .cfi_offset 19, -32 ASM_LINE_SEP \
/* Save r19 */ ASM_LINE_SEP \
SAVE_PIC(TREG) ASM_LINE_SEP \
/* Do syscall, delay loads # */ ASM_LINE_SEP \
@@ -313,8 +311,10 @@
L(pre_end): ASM_LINE_SEP \
/* Restore our frame, restoring TREG */ ASM_LINE_SEP \
ldwm -64(%sp), TREG ASM_LINE_SEP \
+ .cfi_adjust_cfa_offset -64 ASM_LINE_SEP \
/* Restore return pointer */ ASM_LINE_SEP \
- ldw -20(%sp),%rp ASM_LINE_SEP
+ ldw -20(%sp),%rp ASM_LINE_SEP \
+ .cfi_restore 2 ASM_LINE_SEP
/* We do nothing with the return, except hand it back to someone else */
#undef DO_CALL_NOERRNO
@@ -386,13 +386,13 @@ L(pre_end): ASM_LINE_SEP \
/* INTERNAL_SYSCALL_DECL - Allows us to setup some function static
value to use within the context of the syscall
INTERNAL_SYSCALL_ERROR_P - Returns 0 if it wasn't an error, 1 otherwise
- You are allowed to use the syscall result (val) and the DECL error
+ You are allowed to use the syscall result (val) and the DECL error
variable to determine what went wrong.
INTERLAL_SYSCALL_ERRNO - Munges the val/err pair into the error number.
In our case we just flip the sign. */
#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err)
+#define INTERNAL_SYSCALL_DECL(err)
#undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
diff --git a/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
index 51965b710..990ae73bc 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
@@ -1,6 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux/IA64.
- Copyright (C) 1999, 2000, 2004, 2006, 2007, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 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,132 +20,14 @@
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
-
-#include <sys/types.h>
-#ifdef __USE_GNU
-# include <bits/uio.h>
-#endif
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
- located on a few file systems. */
-#define O_ACCMODE 0003
-#define O_RDONLY 00
-#define O_WRONLY 01
-#define O_RDWR 02
-#define O_CREAT 0100 /* not fcntl */
-#define O_EXCL 0200 /* not fcntl */
-#define O_NOCTTY 0400 /* not fcntl */
-#define O_TRUNC 01000 /* not fcntl */
-#define O_APPEND 02000
-#define O_NONBLOCK 04000
-#define O_NDELAY O_NONBLOCK
-#define O_SYNC 04010000
-#define O_FSYNC O_SYNC
-#define O_ASYNC 020000
-
-#ifdef __USE_XOPEN2K8
-# define O_DIRECTORY 0200000 /* must be a directory */
-# define O_NOFOLLOW 0400000 /* don't follow links */
-# define O_CLOEXEC 02000000 /* Set close_on_exec. */
-#endif
-#ifdef __USE_GNU
-# define O_DIRECT 040000
-# define O_NOATIME 01000000 /* Do not set atime. */
-# define O_PATH 010000000 /* Resolve pathname but do not open file. */
-#endif
-
-#ifdef __USE_LARGEFILE64
/* Not necessary, files are always with 64bit off_t. */
-# define O_LARGEFILE 0
-#endif
-
-/* For now Linux has synchronisity options for data and read operations.
- We define the symbols here but let them do the same as O_SYNC since
- this is a superset. */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC 010000 /* Synchronize data. */
-# define O_RSYNC O_SYNC /* Synchronize read operations. */
-#endif
-
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
-#define F_GETLK 5 /* Get record locking info. */
-#define F_SETLK 6 /* Set record locking info (non-blocking). */
-#define F_SETLKW 7 /* Set record locking info (blocking). */
+#define __O_LARGEFILE 0
/* Not necessary, we always have 64-bit offsets. */
#define F_GETLK64 5 /* Get record locking info. */
#define F_SETLK64 6 /* Set record locking info (non-blocking). */
#define F_SETLKW64 7 /* Set record locking info (blocking). */
-#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
-# define F_SETOWN 8 /* Get owner (process receiving SIGIO). */
-# define F_GETOWN 9 /* Set owner (process receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG 10 /* Set number of signal to be sent. */
-# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE 1024 /* Set a lease. */
-# define F_GETLEASE 1025 /* Enquire what lease is active. */
-# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
-#endif
-#ifdef __USE_XOPEN2K8
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set. */
-#endif
-
-/* For F_[GET|SET]FD. */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
-#define F_RDLCK 0 /* Read lock. */
-#define F_WRLCK 1 /* Write lock. */
-#define F_UNLCK 2 /* Remove lock. */
-
-/* for old implementation of bsd flock () */
-#define F_EXLCK 4 /* or 3 */
-#define F_SHLCK 8 /* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation */
-# define LOCK_SH 1 /* shared lock */
-# define LOCK_EX 2 /* exclusive lock */
-# define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-# define LOCK_UN 8 /* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND 32 /* This is a mandatory flock: */
-# define LOCK_READ 64 /* ... which allows concurrent read operations. */
-# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
-# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
-#endif
-
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY. */
-# define DN_ACCESS 0x00000001 /* File accessed. */
-# define DN_MODIFY 0x00000002 /* File modified. */
-# define DN_CREATE 0x00000004 /* File created. */
-# define DN_DELETE 0x00000008 /* File removed. */
-# define DN_RENAME 0x00000010 /* File renamed. */
-# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
-#endif
-
/* We don't need to support __USE_FILE_OFFSET64. */
struct flock
{
@@ -168,152 +49,5 @@ struct flock64
};
#endif
-#ifdef __USE_GNU
-/* Owner types. */
-enum __pid_type
- {
- F_OWNER_TID = 0, /* Kernel thread. */
- F_OWNER_PID, /* Process. */
- F_OWNER_PGRP, /* Process group. */
- F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
- };
-
-/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
-struct f_owner_ex
- {
- enum __pid_type type; /* Owner type of ID. */
- __pid_t pid; /* ID of owner. */
- };
-#endif
-
-
-/* Define some more compatibility macros to be backward compatible with
- BSD systems which did not managed to hide these kernel macros. */
-#ifdef __USE_BSD
-# define FAPPEND O_APPEND
-# define FFSYNC O_FSYNC
-# define FASYNC O_ASYNC
-# define FNONBLOCK O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif /* Use BSD. */
-
-/* Advise to `posix_fadvise'. */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-#endif
-
-
-#ifdef __USE_GNU
-/* Flags for SYNC_FILE_RANGE. */
-# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
- in the range before performing the
- write. */
-# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
- dirty pages in the range which are
- not presently under writeback. */
-# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
- the range after performing the
- write. */
-
-/* Flags for SPLICE and VMSPLICE. */
-# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
-# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
- (but we may still block on the fd
- we splice from/to). */
-# define SPLICE_F_MORE 4 /* Expect more data. */
-# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
-
-
-/* File handle structure. */
-struct file_handle
-{
- unsigned int handle_bytes;
- int handle_type;
- /* File identifier. */
- unsigned char f_handle[0];
-};
-
-/* Maximum handle size (for now). */
-# define MAX_HANDLE_SZ 128
-#endif
-
-__BEGIN_DECLS
-
-#ifdef __USE_GNU
-
-/* Provide kernel hint to read ahead. */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
- __THROW;
-
-
-/* Selective file content synch'ing.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
- unsigned int __flags);
-
-
-/* Splice address range into a pipe.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
- size_t __count, unsigned int __flags);
-
-/* Splice two files together.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
- __off64_t *__offout, size_t __len,
- unsigned int __flags);
-
-/* In-kernel implementation of tee for pipe buffers.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t tee (int __fdin, int __fdout, size_t __len,
- unsigned int __flags);
-
-/* Reserve storage for the data of the file associated with FD.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-# ifndef __USE_FILE_OFFSET64
-extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
-# else
-# ifdef __REDIRECT
-extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
- __off64_t __len),
- fallocate64);
-# else
-# define fallocate fallocate64
-# endif
-# endif
-# ifdef __USE_LARGEFILE64
-extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
- __off64_t __len);
-# endif
-
-
-/* Map file name to file handle. */
-extern int name_to_handle_at (int __dfd, const char *__name,
- struct file_handle *__handle, int *__mnt_id,
- int __flags) __THROW;
-
-/* Open file using the file handle.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
- int __flags);
-
-#endif
-
-__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h b/libc/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
index 946cfa2ca..04f8a1c1b 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 2000, 2004, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2000-2012 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,133 +20,10 @@
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
-#include <sys/types.h>
-#ifdef __USE_GNU
-# include <bits/uio.h>
-#endif
-
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
- located on a few file systems. */
-#define O_ACCMODE 0003
-#define O_RDONLY 00
-#define O_WRONLY 01
-#define O_RDWR 02
-#define O_CREAT 0100 /* not fcntl */
-#define O_EXCL 0200 /* not fcntl */
-#define O_NOCTTY 0400 /* not fcntl */
-#define O_TRUNC 01000 /* not fcntl */
-#define O_APPEND 02000
-#define O_NONBLOCK 04000
-#define O_NDELAY O_NONBLOCK
-#define O_SYNC 04010000
-#define O_FSYNC O_SYNC
-#define O_ASYNC 020000
-
-#ifdef __USE_XOPEN2K8
-# define O_DIRECTORY 040000 /* Must be a directory. */
-# define O_NOFOLLOW 0100000 /* Do not follow links. */
-# define O_CLOEXEC 02000000 /* Set close_on_exec. */
-#endif
-#ifdef __USE_GNU
-# define O_DIRECT 0200000 /* Direct disk access. */
-# define O_NOATIME 01000000 /* Do not set atime. */
-# define O_PATH 010000000 /* Resolve pathname but do not open file. */
-#endif
-
-/* For now Linux has synchronisity options for data and read operations.
- We define the symbols here but let them do the same as O_SYNC since
- this is a superset. */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC 010000 /* Synchronize data. */
-# define O_RSYNC O_SYNC /* Synchronize read operations. */
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE 0400000
-#endif
-
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
-#ifndef __USE_FILE_OFFSET64
-# define F_GETLK 5 /* Get record locking info. */
-# define F_SETLK 6 /* Set record locking info (non-blocking). */
-# define F_SETLKW 7 /* Set record locking info (blocking). */
-#else
-# define F_GETLK F_GETLK64 /* Get record locking info. */
-# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
-# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
-#endif
-#define F_GETLK64 12 /* Get record locking info. */
-#define F_SETLK64 13 /* Set record locking info (non-blocking). */
-#define F_SETLKW64 14 /* Set record locking info (blocking). */
-
-#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
-# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
-# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG 10 /* Set number of signal to be sent. */
-# define F_GETSIG 11 /* Get number of signal to be sent. */
-# define F_SETOWN_EX 15 /* Get owner (thread receiving SIGIO). */
-# define F_GETOWN_EX 16 /* Set owner (thread receiving SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE 1024 /* Set a lease. */
-# define F_GETLEASE 1025 /* Enquire what lease is active. */
-# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */
-#endif
-#ifdef __USE_XOPEN2K8
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set. */
-#endif
-
-/* For F_[GET|SET]FD. */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
-#define F_RDLCK 0 /* Read lock. */
-#define F_WRLCK 1 /* Write lock. */
-#define F_UNLCK 2 /* Remove lock. */
-
-/* For old implementation of bsd flock(). */
-#define F_EXLCK 4 /* or 3 */
-#define F_SHLCK 8 /* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation. */
-# define LOCK_SH 1 /* shared lock */
-# define LOCK_EX 2 /* exclusive lock */
-# define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-# define LOCK_UN 8 /* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND 32 /* This is a mandatory flock: */
-# define LOCK_READ 64 /* ... which allows concurrent read operations. */
-# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
-# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY. */
-# define DN_ACCESS 0x00000001 /* File accessed. */
-# define DN_MODIFY 0x00000002 /* File modified. */
-# define DN_CREATE 0x00000004 /* File created. */
-# define DN_DELETE 0x00000008 /* File removed. */
-# define DN_RENAME 0x00000010 /* File renamed. */
-# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
-#endif
+#define __O_DIRECTORY 040000 /* Must be a directory. */
+#define __O_NOFOLLOW 0100000 /* Do not follow links. */
+#define __O_DIRECT 0200000 /* Direct disk access. */
+#define __O_LARGEFILE 0400000
struct flock
{
@@ -173,148 +50,5 @@ struct flock64
};
#endif
-#ifdef __USE_GNU
-/* Owner types. */
-enum __pid_type
- {
- F_OWNER_TID = 0, /* Kernel thread. */
- F_OWNER_PID, /* Process. */
- F_OWNER_PGRP, /* Process group. */
- F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name. */
- };
-
-/* Structure to use with F_GETOWN_EX and F_SETOWN_EX. */
-struct f_owner_ex
- {
- enum __pid_type type; /* Owner type of ID. */
- __pid_t pid; /* ID of owner. */
- };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
- BSD systems which did not managed to hide these kernel macros. */
-#ifdef __USE_BSD
-# define FAPPEND O_APPEND
-# define FFSYNC O_FSYNC
-# define FASYNC O_ASYNC
-# define FNONBLOCK O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif /* Use BSD. */
-
-/* Advise to `posix_fadvise'. */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-#endif
-
-
-#ifdef __USE_GNU
-/* Flags for SYNC_FILE_RANGE. */
-# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
- in the range before performing the
- write. */
-# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
- dirty pages in the range which are
- not presently under writeback. */
-# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
- the range after performing the
- write. */
-
-/* Flags for SPLICE and VMSPLICE. */
-# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
-# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
- (but we may still block on the fd
- we splice from/to). */
-# define SPLICE_F_MORE 4 /* Expect more data. */
-# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
-
-
-/* File handle structure. */
-struct file_handle
-{
- unsigned int handle_bytes;
- int handle_type;
- /* File identifier. */
- unsigned char f_handle[0];
-};
-
-/* Maximum handle size (for now). */
-# define MAX_HANDLE_SZ 128
-#endif
-
-__BEGIN_DECLS
-
-#ifdef __USE_GNU
-
-/* Provide kernel hint to read ahead. */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
- __THROW;
-
-
-/* Selective file content synch'ing. */
-extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
- unsigned int __flags);
-
-
-/* Splice address range into a pipe.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
- size_t __count, unsigned int __flags);
-
-/* Splice two files together.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
- __off64_t *__offout, size_t __len,
- unsigned int __flags);
-
-/* In-kernel implementation of tee for pipe buffers.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern ssize_t tee (int __fdin, int __fdout, size_t __len,
- unsigned int __flags);
-
-/* Reserve storage for the data of the file associated with FD.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-# ifndef __USE_FILE_OFFSET64
-extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
-# else
-# ifdef __REDIRECT
-extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
- __off64_t __len),
- fallocate64);
-# else
-# define fallocate fallocate64
-# endif
-# endif
-# ifdef __USE_LARGEFILE64
-extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
- __off64_t __len);
-# endif
-
-
-/* Map file name to file handle. */
-extern int name_to_handle_at (int __dfd, const char *__name,
- struct file_handle *__handle, int *__mnt_id,
- int __flags) __THROW;
-
-/* Open file using the file handle.
-
- This function is a possible cancellation point and therefore not
- marked with __THROW. */
-extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
- int __flags);
-
-#endif
-
-__END_DECLS
+/* Include generic Linux declarations. */
+#include <bits/fcntl-linux.h>
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile b/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile
index 99c554ff6..66ba621da 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/Makefile
@@ -8,15 +8,42 @@ sysdep_routines += cachectl cacheflush sysmips _test_and_set
sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
endif
-# _MIPS_SIM_ABI32 == 1, _MIPS_SIM_NABI32 == 2, _MIPS_SIM_ABI64 == 3
-abi-variants := o32 n32 n64
+# Get value of default-abi.
+include $(common-objpfx)default-abi.make
+
+abi-variants := o32_soft o32_hard n32_soft n32_hard n64_soft n64_hard
+
+ifeq (,$(filter $(default-abi),$(abi-variants)))
+Unknown ABI, must be one of $(abi-variants)
+endif
+
abi-includes := sgidefs.h
-abi-o32-options := -D_MIPS_SIM=1
-abi-o32-condition := _MIPS_SIM == _MIPS_SIM_ABI32
-abi-n32-options := -D_MIPS_SIM=2
-abi-n32-condition := _MIPS_SIM == _MIPS_SIM_NABI32
-abi-n64-options := -D_MIPS_SIM=3
-abi-n64-condition := _MIPS_SIM == _MIPS_SIM_ABI64
+
+# _MIPS_SIM_ABI32 == 1, _MIPS_SIM_NABI32 == 2, _MIPS_SIM_ABI64 == 3
+abi-o32_soft-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
+ -D__mips_soft_float -U__mips_hard_float
+abi-o32_soft-condition := defined(__mips_soft_float) \
+ && (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-o32_hard-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
+ -D__mips_hard_float -U__mips_soft_float
+abi-o32_hard-condition := defined(__mips_hard_float) \
+ && (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-n32_soft-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
+ -D__mips_soft_float -U__mips_hard_float
+abi-n32_soft-condition := defined(__mips_soft_float) \
+ && (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n32_hard-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
+ -D__mips_hard_float -U__mips_soft_float
+abi-n32_hard-condition := defined(__mips_hard_float) \
+ && (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n64_soft-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
+ -D__mips_soft_float -U__mips_hard_float
+abi-n64_soft-condition := defined(__mips_soft_float) \
+ && (_MIPS_SIM == _MIPS_SIM_ABI64)
+abi-n64_hard-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
+ -D__mips_hard_float -U__mips_soft_float
+abi-n64_hard-condition := defined(__mips_hard_float) \
+ && (_MIPS_SIM == _MIPS_SIM_ABI64)
ifeq ($(subdir),elf)
ifeq ($(build-shared),yes)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/configure b/libc/ports/sysdeps/unix/sysv/linux/mips/configure
index 051432df8..cecfc9d84 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/configure
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/configure
@@ -1,6 +1,112 @@
# This file is generated from configure.in by Autoconf. DO NOT EDIT!
# Local configure fragment for sysdeps/unix/sysv/linux/mips.
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #if (_MIPS_SIM != _ABIO32)
+ #error Not O32 ABI
+ #endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libc_mips_abi=o32
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #if (_MIPS_SIM != _ABIN32)
+ #error Not N32 ABI
+ #endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libc_mips_abi=n32
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #if (_MIPS_SIM != _ABI64)
+ #error Not 64 ABI
+ #endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libc_mips_abi=n64
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test -z "$libc_mips_abi"; then
+ as_fn_error $? "could not determine what ABI the compiler is using" "$LINENO" 5
+fi
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #if !defined(__mips_soft_float)
+ #error Not soft ABI
+ #endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libc_mips_float=soft
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #if !defined(__mips_hard_float)
+ #error Not hard ABI
+ #endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libc_mips_float=hard
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test -z "$libc_mips_float"; then
+ as_fn_error $? "could not determine if compiler is using hard or soft floating point ABI" "$LINENO" 5
+fi
+
+echo "default-abi := ${libc_mips_abi}_${libc_mips_float}" > default-abi.make
+
case "$prefix" in
/usr | /usr/)
# 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in b/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in
index 18e8bbc5c..167779eaf 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/configure.in
@@ -2,6 +2,50 @@ sinclude(./aclocal.m4)dnl Autoconf lossage
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
# Local configure fragment for sysdeps/unix/sysv/linux/mips.
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+ #if (_MIPS_SIM != _ABIO32)
+ #error Not O32 ABI
+ #endif])],
+ [libc_mips_abi=o32],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+ #if (_MIPS_SIM != _ABIN32)
+ #error Not N32 ABI
+ #endif])],
+ [libc_mips_abi=n32],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+ #if (_MIPS_SIM != _ABI64)
+ #error Not 64 ABI
+ #endif])],
+ [libc_mips_abi=n64],
+ [])])])
+
+if test -z "$libc_mips_abi"; then
+ AC_MSG_ERROR([could not determine what ABI the compiler is using])
+fi
+
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+ #if !defined(__mips_soft_float)
+ #error Not soft ABI
+ #endif])],
+ [libc_mips_float=soft],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+ #if !defined(__mips_hard_float)
+ #error Not hard ABI
+ #endif])],
+ [libc_mips_float=hard],
+ [])])
+
+if test -z "$libc_mips_float"; then
+ AC_MSG_ERROR([could not determine if compiler is using hard or soft floating point ABI])
+fi
+
+echo "default-abi := ${libc_mips_abi}_${libc_mips_float}" > default-abi.make
+
case "$prefix" in
/usr | /usr/)
# 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/Makefile b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/Makefile
deleted file mode 100644
index 77e91218a..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-default-abi := o32
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c
index 2dc110ba7..1d345efcf 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c
@@ -54,6 +54,4 @@ sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
return -1;
}
stub_warning (sync_file_range)
-
-# include <stub-tag.h>
#endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/Makefile b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/Makefile
deleted file mode 100644
index 2368c4038..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-default-abi := n32
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist
index 2a0e2a2d9..df2e63728 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist
@@ -1392,6 +1392,11 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ clock_getcpuclockid F
+ clock_getres F
+ clock_gettime F
+ clock_nanosleep F
+ clock_settime F
secure_getenv F
GLIBC_2.2
GLIBC_2.2 A
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/Makefile b/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/Makefile
deleted file mode 100644
index fed17ba64..000000000
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-default-abi := n64
diff --git a/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h b/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h
index 9c1701167..9c3d3d16d 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h
+++ b/libc/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h
@@ -86,6 +86,18 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
})
+#define lll_futex_timed_wait_bitset(futexp, val, timespec, clockbit, private) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (__err); \
+ long int __ret; \
+ int __op = FUTEX_WAIT_BITSET | clockbit; \
+ __ret = INTERNAL_SYSCALL (futex, __err, 6, (long) (futexp), \
+ __lll_private_flag (__op, private), \
+ (val), (timespec), NULL /* Unused. */, \
+ FUTEX_BITSET_MATCH_ANY); \
+ INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
+ })
+
#define lll_futex_wake(futexp, nr, private) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
diff --git a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
index f2682b39c..0efc6b55c 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
+++ b/libc/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
@@ -1774,13 +1774,13 @@ GLIBC_2.16
timespec_get F
GLIBC_2.17
GLIBC_2.17 A
+ __ppc_get_timebase_freq F
clock_getcpuclockid F
clock_getres F
clock_gettime F
clock_nanosleep F
clock_settime F
secure_getenv F
- __ppc_get_timebase_freq F
GLIBC_2.2
GLIBC_2.2 A
_IO_adjust_wcolumn F
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/Makefile b/libc/ports/sysdeps/unix/sysv/linux/tile/Makefile
index 0cbfdd0e3..1c0c968dc 100644
--- a/libc/ports/sysdeps/unix/sysv/linux/tile/Makefile
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/Makefile
@@ -13,3 +13,7 @@ sysdep_headers += sys/dataplane.h
sysdep_routines += set_dataplane
endif
+
+ifeq ($(subdir),elf)
+sysdep_routines += dl-vdso
+endif
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h b/libc/ports/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h
new file mode 100644
index 000000000..b972720b3
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h
@@ -0,0 +1,30 @@
+/* Resolve function pointers to VDSO functions.
+ Copyright (C) 2012 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/>. */
+
+
+#ifndef _LIBC_VDSO_H
+#define _LIBC_VDSO_H
+
+#ifdef SHARED
+
+extern long int (*__vdso_gettimeofday) (struct timeval *, void *)
+ attribute_hidden;
+
+#endif
+
+#endif /* _LIBC_VDSO_H */
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c b/libc/ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c
new file mode 100644
index 000000000..92136d54b
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/gettimeofday.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2012 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 <sysdep.h>
+#include <stddef.h>
+#include <sys/time.h>
+#include <time.h>
+#include <bits/libc-vdso.h>
+
+int
+__gettimeofday (struct timeval *tv, struct timezone *tz)
+{
+#ifdef SHARED
+ /* If the vDSO is available we use it. */
+ if (__vdso_gettimeofday != NULL)
+ return __vdso_gettimeofday (tv, tz);
+#endif
+ return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
+}
+
+libc_hidden_def (__gettimeofday)
+weak_alias (__gettimeofday, gettimeofday)
+libc_hidden_weak (gettimeofday)
diff --git a/libc/ports/sysdeps/unix/sysv/linux/tile/init-first.c b/libc/ports/sysdeps/unix/sysv/linux/tile/init-first.c
new file mode 100644
index 000000000..9ff63c1d1
--- /dev/null
+++ b/libc/ports/sysdeps/unix/sysv/linux/tile/init-first.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2012 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/>. */
+
+#ifdef SHARED
+#include <dl-vdso.h>
+#include <bits/libc-vdso.h>
+
+long int (*__vdso_gettimeofday) (struct timeval *, void *) attribute_hidden;
+
+static inline void
+_libc_vdso_platform_setup (void)
+{
+ PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
+ __vdso_gettimeofday = _dl_vdso_vsym ("__vdso_gettimeofday", &linux26);
+}
+
+#define VDSO_SETUP _libc_vdso_platform_setup
+#endif
+
+#include <csu/init-first.c>