This commit is contained in:
Yann E. MORIN" 2009-11-16 20:25:42 +01:00
commit 2df1637271
59 changed files with 4777 additions and 53 deletions

View File

@ -14,6 +14,12 @@ choice
# Don't remove next line # Don't remove next line
# CT_INSERT_VERSION_BELOW # CT_INSERT_VERSION_BELOW
config LIBC_V_2_10_1
bool
prompt "2.10.1 (EXPERIMENTAL)"
depends on EXPERIMENTAL
select LIBC_GLIBC_USE_PORTS
config LIBC_V_2_9 config LIBC_V_2_9
bool bool
prompt "2.9" prompt "2.9"
@ -60,6 +66,7 @@ config LIBC_VERSION
string string
# Don't remove next line # Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW # CT_INSERT_VERSION_STRING_BELOW
default "2.10.1" if LIBC_V_2_10_1
default "2.9" if LIBC_V_2_9 default "2.9" if LIBC_V_2_9
default "2.8" if LIBC_V_2_8 default "2.8" if LIBC_V_2_8
default "2.7" if LIBC_V_2_7 default "2.7" if LIBC_V_2_7

View File

@ -0,0 +1,25 @@
Respect environment CPPFLAGS when we run ./configure so we can inject
random -D things without having to set CFLAGS/ASFLAGS
diff -durN glibc-2.10.1.orig/Makeconfig glibc-2.10.1/Makeconfig
--- glibc-2.10.1.orig/Makeconfig 2009-05-09 23:57:56.000000000 +0200
+++ glibc-2.10.1/Makeconfig 2009-11-13 00:49:41.000000000 +0100
@@ -672,6 +672,7 @@
$(foreach lib,$(libof-$(basename $(@F))) \
$(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
$(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
+CPPFLAGS += $(CPPFLAGS-config)
override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) \
$(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
$(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
diff -durN glibc-2.10.1.orig/config.make.in glibc-2.10.1/config.make.in
--- glibc-2.10.1.orig/config.make.in 2009-05-09 17:59:38.000000000 +0200
+++ glibc-2.10.1/config.make.in 2009-11-13 00:49:41.000000000 +0100
@@ -103,6 +103,7 @@
CXX = @CXX@
BUILD_CC = @BUILD_CC@
CFLAGS = @CFLAGS@
+CPPFLAGS-config = @CPPFLAGS@
ASFLAGS-config = @ASFLAGS_config@
AR = @AR@
RANLIB = @RANLIB@

View File

@ -0,0 +1,39 @@
diff -durN glibc-2.10.1.orig/configure glibc-2.10.1/configure
--- glibc-2.10.1.orig/configure 2009-05-17 14:19:31.000000000 +0200
+++ glibc-2.10.1/configure 2009-11-13 00:49:43.000000000 +0100
@@ -4839,7 +4839,7 @@
ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[3-9]*)
+ 2.1[3-9]*|[2-9].[2-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
@@ -4902,7 +4902,7 @@
ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[3-9]*)
+ 2.1[3-9]*|[2-9].[2-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
diff -durN glibc-2.10.1.orig/configure.in glibc-2.10.1/configure.in
--- glibc-2.10.1.orig/configure.in 2009-04-04 01:51:47.000000000 +0200
+++ glibc-2.10.1/configure.in 2009-11-13 00:49:43.000000000 +0100
@@ -897,10 +897,10 @@
# Accept binutils 2.13 or newer.
AC_CHECK_PROG_VER(AS, $AS, --version,
[GNU assembler.* \([0-9]*\.[0-9.]*\)],
- [2.1[3-9]*], AS=: critic_missing="$critic_missing as")
+ [2.1[3-9]*|[2-9].[2-9]*], AS=: critic_missing="$critic_missing as")
AC_CHECK_PROG_VER(LD, $LD, --version,
[GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
- [2.1[3-9]*], LD=: critic_missing="$critic_missing ld")
+ [2.1[3-9]*|[2-9].[2-9]*], LD=: critic_missing="$critic_missing ld")
# We need the physical current working directory. We cannot use the
# "pwd -P" shell builtin since that's not portable. Instead we try to

View File

@ -0,0 +1,55 @@
revert cfi additions to clone on i386/x86_64 to workaround problems in
gcc's unwinder code. this is not a bug in glibc, it triggers problems
elsewhere. this cfi code does not gain us a whole lot anyways.
http://gcc.gnu.org/ml/gcc/2006-12/msg00293.html
Index: sysdeps/unix/sysv/linux/i386/clone.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/clone.S,v
retrieving revision 1.27
retrieving revision 1.26
diff -u -p -r1.27 -r1.26
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/clone.S glibc-2.10.1/sysdeps/unix/sysv/linux/i386/clone.S
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/clone.S 2006-12-04 00:12:36.000000000 +0100
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/i386/clone.S 2009-11-13 00:49:45.000000000 +0100
@@ -120,9 +120,6 @@
ret
L(thread_start):
- cfi_startproc;
- /* Clearing frame pointer is insufficient, use CFI. */
- cfi_undefined (eip);
/* Note: %esi is zero. */
movl %esi,%ebp /* terminate the stack frame */
#ifdef RESET_PID
@@ -155,7 +152,6 @@
jmp L(haspid)
.previous
#endif
- cfi_endproc;
cfi_startproc
PSEUDO_END (BP_SYM (__clone))
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/x86_64/clone.S glibc-2.10.1/sysdeps/unix/sysv/linux/x86_64/clone.S
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/x86_64/clone.S 2006-12-04 00:12:36.000000000 +0100
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/x86_64/clone.S 2009-11-13 00:49:45.000000000 +0100
@@ -89,9 +89,6 @@
ret
L(thread_start):
- cfi_startproc;
- /* Clearing frame pointer is insufficient, use CFI. */
- cfi_undefined (rip);
/* Clear the frame pointer. The ABI suggests this be done, to mark
the outermost frame obviously. */
xorl %ebp, %ebp
@@ -116,7 +113,6 @@
/* Call exit with return value from function call. */
movq %rax, %rdi
call HIDDEN_JUMPTARGET (_exit)
- cfi_endproc;
cfi_startproc;
PSEUDO_END (BP_SYM (__clone))

View File

@ -0,0 +1,55 @@
Fix building on x86 when older linux headers lack __NR_fallocate define.
URL: http://bugs.gentoo.org/274269
Reported-by: Mikael Magnusson <mikachu@gmail.com>
2009-11-09 Mike Frysinger <vapier@gentoo.org>
* sysdeps/unix/sysv/linux/i386/fallocate.c: Include errno.h.
(fallocate): Return ENOSYS if __NR_fallocate is not defined.
* sysdeps/unix/sysv/linux/i386/fallocate64.c: Likewise.
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate.c glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate.c
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate.c 2009-03-02 17:11:06.000000000 +0100
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate.c 2009-11-13 00:49:47.000000000 +0100
@@ -16,6 +16,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <errno.h>
#include <fcntl.h>
#include <sysdep.h>
@@ -28,5 +29,10 @@
int
fallocate (int fd, int mode, __off_t offset, __off_t len)
{
+#ifdef __NR_fallocate
return __call_fallocate (fd, mode, offset, len);
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
}
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate64.c glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate64.c
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/i386/fallocate64.c 2009-03-02 17:10:29.000000000 +0100
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/i386/fallocate64.c 2009-11-13 00:49:47.000000000 +0100
@@ -16,6 +16,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <errno.h>
#include <fcntl.h>
#include <sysdep.h>
@@ -28,5 +29,10 @@
int
__fallocate64_l64 (int fd, int mode, __off64_t offset, __off64_t len)
{
+#ifdef __NR_fallocate
return __call_fallocate (fd, mode, offset, len);
+#else
+ __set_errno (ENOSYS);
+ return -1;
+#endif
}

View File

@ -0,0 +1,16 @@
do not bother running ldconfig on DESTDIR. it wants to write the temp cache
file outside of the chroot. doesnt matter anyways as we wont use the cache
results (portage will rebuild cache), so running ldconfig is simply a waste
of time.
diff -durN glibc-2.10.1.orig/Makefile glibc-2.10.1/Makefile
--- glibc-2.10.1.orig/Makefile 2009-04-23 20:23:03.000000000 +0200
+++ glibc-2.10.1/Makefile 2009-11-13 00:49:49.000000000 +0100
@@ -116,6 +116,7 @@
rm -f $(symbolic-link-list)
install:
+dont-bother-with-destdir:
-test ! -x $(common-objpfx)elf/ldconfig || LC_ALL=C LANGUAGE=C \
$(common-objpfx)elf/ldconfig $(addprefix -r ,$(install_root)) \
$(slibdir) $(libdir)

View File

@ -0,0 +1,85 @@
grab some updates from FreeBSD
http://bugs.gentoo.org/201979
diff -durN glibc-2.10.1.orig/misc/sys/queue.h glibc-2.10.1/misc/sys/queue.h
diff -durN glibc-2.10.1.orig/misc/sys/queue.h glibc-2.10.1/misc/sys/queue.h
--- glibc-2.10.1.orig/misc/sys/queue.h 2008-03-05 06:50:30.000000000 +0100
+++ glibc-2.10.1/misc/sys/queue.h 2009-11-13 00:49:51.000000000 +0100
@@ -136,6 +136,11 @@
(var); \
(var) = ((var)->field.le_next))
+#define LIST_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = LIST_FIRST((head)); \
+ (var) && ((tvar) = LIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
/*
* List access methods.
*/
@@ -197,6 +202,16 @@
#define SLIST_FOREACH(var, head, field) \
for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = SLIST_FIRST((head)); \
+ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
+ for ((varp) = &SLIST_FIRST((head)); \
+ ((var) = *(varp)) != NULL; \
+ (varp) = &SLIST_NEXT((var), field))
+
/*
* Singly-linked List access methods.
*/
@@ -242,6 +257,12 @@
(head)->stqh_last = &(elm)->field.stqe_next; \
} while (/*CONSTCOND*/0)
+#define STAILQ_LAST(head, type, field) \
+ (STAILQ_EMPTY((head)) ? \
+ NULL : \
+ ((struct type *)(void *) \
+ ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
+
#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
(head)->stqh_last = &(elm)->field.stqe_next; \
@@ -271,6 +292,11 @@
(var); \
(var) = ((var)->field.stqe_next))
+#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = STAILQ_FIRST((head)); \
+ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+
#define STAILQ_CONCAT(head1, head2) do { \
if (!STAILQ_EMPTY((head2))) { \
*(head1)->stqh_last = (head2)->stqh_first; \
@@ -437,11 +463,21 @@
(var); \
(var) = ((var)->field.tqe_next))
+define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = TAILQ_FIRST((head)); \
+ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
(var); \
(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
+ for ((var) = TAILQ_LAST((head), headname); \
+ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
+ (var) = (tvar))
+
#define TAILQ_CONCAT(head1, head2, field) do { \
if (!TAILQ_EMPTY(head2)) { \
*(head1)->tqh_last = (head2)->tqh_first; \

View File

@ -0,0 +1,24 @@
If we're using a cvs snapshot which updates the source files, and
perl isn't installed yet, then we can't regen the docs. Not a big
deal, so just whine a little and continue on our merry way.
http://bugs.gentoo.org/60132
diff -durN glibc-2.10.1.orig/manual/Makefile glibc-2.10.1/manual/Makefile
--- glibc-2.10.1.orig/manual/Makefile 2006-01-08 07:43:47.000000000 +0100
+++ glibc-2.10.1/manual/Makefile 2009-11-13 00:49:54.000000000 +0100
@@ -104,9 +104,14 @@
libm-err.texi: stamp-libm-err
stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
$(dir)/libm-test-ulps))
+ifneq ($(PERL),no)
pwd=`pwd`; \
$(PERL) $< $$pwd/.. > libm-err-tmp
$(move-if-change) libm-err-tmp libm-err.texi
+else
+ echo "Unable to rebuild math docs, no perl installed"
+ touch libm-err.texi
+endif
touch $@
# Generate Texinfo files from the C source for the example programs.

View File

@ -0,0 +1,69 @@
#! /bin/sh -e
# DP: Description: Fix localedef segfault when run under exec-shield,
# PaX or similar. (#231438, #198099)
# DP: Dpatch Author: James Troup <james@nocrew.org>
# DP: Patch Author: (probably) Jakub Jelinek <jakub@redhat.com>
# DP: Upstream status: Unknown
# DP: Status Details: Unknown
# DP: Date: 2004-03-16
if [ $# -ne 2 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
-unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
diff -durN glibc-2.10.1.orig/locale/programs/3level.h glibc-2.10.1/locale/programs/3level.h
--- glibc-2.10.1.orig/locale/programs/3level.h 2007-07-16 02:54:59.000000000 +0200
+++ glibc-2.10.1/locale/programs/3level.h 2009-11-13 00:49:56.000000000 +0100
@@ -203,6 +203,42 @@
}
}
}
+
+/* GCC ATM seems to do a poor job with pointers to nested functions passed
+ to inlined functions. Help it a little bit with this hack. */
+#define wchead_table_iterate(tp, fn) \
+do \
+ { \
+ struct wchead_table *t = (tp); \
+ uint32_t index1; \
+ for (index1 = 0; index1 < t->level1_size; index1++) \
+ { \
+ uint32_t lookup1 = t->level1[index1]; \
+ if (lookup1 != ((uint32_t) ~0)) \
+ { \
+ uint32_t lookup1_shifted = lookup1 << t->q; \
+ uint32_t index2; \
+ for (index2 = 0; index2 < (1 << t->q); index2++) \
+ { \
+ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
+ if (lookup2 != ((uint32_t) ~0)) \
+ { \
+ uint32_t lookup2_shifted = lookup2 << t->p; \
+ uint32_t index3; \
+ for (index3 = 0; index3 < (1 << t->p); index3++) \
+ { \
+ struct element_t *lookup3 \
+ = t->level3[index3 + lookup2_shifted]; \
+ if (lookup3 != NULL) \
+ fn ((((index1 << t->q) + index2) << t->p) + index3, \
+ lookup3); \
+ } \
+ } \
+ } \
+ } \
+ } \
+ } while (0)
+
#endif
#ifndef NO_FINALIZE

View File

@ -0,0 +1,39 @@
ripped from SuSE
if /etc/resolv.conf is updated, then make sure applications
already running get the updated information.
http://bugs.gentoo.org/177416
diff -durN glibc-2.10.1.orig/resolv/res_libc.c glibc-2.10.1/resolv/res_libc.c
--- glibc-2.10.1.orig/resolv/res_libc.c 2009-02-07 05:27:42.000000000 +0100
+++ glibc-2.10.1/resolv/res_libc.c 2009-11-13 00:49:59.000000000 +0100
@@ -22,6 +22,7 @@
#include <arpa/nameser.h>
#include <resolv.h>
#include <bits/libc-lock.h>
+#include <sys/stat.h>
/* The following bit is copied from res_data.c (where it is #ifdef'ed
@@ -95,6 +96,20 @@
__res_maybe_init (res_state resp, int preinit)
{
if (resp->options & RES_INIT) {
+ static time_t last_mtime, last_check;
+ time_t now;
+ struct stat statbuf;
+
+ time (&now);
+ if (now != last_check) {
+ last_check = now;
+ if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
+ last_mtime = statbuf.st_mtime;
+ atomicinclock (lock);
+ atomicinc (__res_initstamp);
+ atomicincunlock (lock);
+ }
+ }
if (__res_initstamp != resp->_u._ext.initstamp) {
if (resp->nscount > 0)
__res_iclose (resp, true);

View File

@ -0,0 +1,39 @@
sniped from Debian
http://bugs.gentoo.org/289615
2009-10-27 Aurelien Jarno <aurelien@aurel32.net>
* locale/programs/locarchive.c: use MMAP_SHARED to reserve memory
used later with MMAP_FIXED | MMAP_SHARED to cope with different
alignment restrictions.
diff -durN glibc-2.10.1.orig/locale/programs/locarchive.c glibc-2.10.1/locale/programs/locarchive.c
--- glibc-2.10.1.orig/locale/programs/locarchive.c 2009-04-27 16:07:47.000000000 +0200
+++ glibc-2.10.1/locale/programs/locarchive.c 2009-11-13 00:50:01.000000000 +0100
@@ -134,7 +134,7 @@
size_t reserved = RESERVE_MMAP_SIZE;
int xflags = 0;
if (total < reserved
- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
+ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
-1, 0)) != MAP_FAILED))
xflags = MAP_FIXED;
else
@@ -396,7 +396,7 @@
size_t reserved = RESERVE_MMAP_SIZE;
int xflags = 0;
if (total < reserved
- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
+ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
-1, 0)) != MAP_FAILED))
xflags = MAP_FIXED;
else
@@ -614,7 +614,7 @@
int xflags = 0;
void *p;
if (st.st_size < reserved
- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
+ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
-1, 0)) != MAP_FAILED))
xflags = MAP_FIXED;
else

View File

@ -0,0 +1,28 @@
ripped from Debian
sysdeps/unix/sysv/linux/posix_fadvise.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/posix_fadvise.c glibc-2.10.1/sysdeps/unix/sysv/linux/posix_fadvise.c
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/posix_fadvise.c 2003-08-17 02:36:22.000000000 +0200
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/posix_fadvise.c 2009-11-13 00:50:03.000000000 +0100
@@ -35,6 +35,19 @@
return INTERNAL_SYSCALL_ERRNO (ret, err);
return 0;
#else
+# ifdef __NR_fadvise64_64
+ INTERNAL_SYSCALL_DECL (err);
+ int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
+ __LONG_LONG_PAIR ((long) (offset >> 31),
+ (long) offset),
+ __LONG_LONG_PAIR ((long) (len >> 31),
+ (long) len),
+ advise);
+ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+# else
return ENOSYS;
+# endif
#endif
}

View File

@ -0,0 +1,66 @@
ripped from Debian
this change was made to generic __nexttowardf, but not the long double version
2008-05-05 Aurelien Jarno <aurelien@aurel32.net>
* sysdeps/ieee754/ldbl-128/s_nexttowardf.c: Include float.h.
(__nexttowardf): Use math_opt_barrier and
math_force_eval macros. If FLT_EVAL_METHOD is not 0, force
x to float using asm.
sysdeps/ieee754/ldbl-128/s_nexttowardf.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff -durN glibc-2.10.1.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c glibc-2.10.1/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
--- glibc-2.10.1.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c 1999-07-14 02:09:42.000000000 +0200
+++ glibc-2.10.1/sysdeps/ieee754/ldbl-128/s_nexttowardf.c 2009-11-13 00:50:06.000000000 +0100
@@ -19,7 +19,8 @@
#endif
#include "math.h"
-#include "math_private.h"
+#include <math_private.h>
+#include <float.h>
#ifdef __STDC__
float __nexttowardf(float x, long double y)
@@ -44,10 +45,12 @@
return x+y;
if((long double) x==y) return y; /* x=y, return y */
if(ix==0) { /* x == 0 */
- float x2;
+ float u;
SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
- x2 = x*x;
- if(x2==x) return x2; else return x; /* raise underflow flag */
+ u = math_opt_barrier (x);
+ u = u * u;
+ math_force_eval (u); /* raise underflow flag */
+ return x;
}
if(hx>=0) { /* x > 0 */
if(hy<0||(ix>>23)>(iy>>48)-0x3f80
@@ -67,13 +70,16 @@
}
}
hy = hx&0x7f800000;
- if(hy>=0x7f800000) return x+x; /* overflow */
+ if(hy>=0x7f800000) {
+ x = x+x; /* overflow */
+ if (FLT_EVAL_METHOD != 0)
+ /* Force conversion to float. */
+ asm ("" : "+m"(x));
+ return x;
+ }
if(hy<0x00800000) { /* underflow */
- float x2 = x*x;
- if(x2!=x) { /* raise underflow flag */
- SET_FLOAT_WORD(x2,hx);
- return x2;
- }
+ float u = x*x;
+ math_force_eval (u); /* raise underflow flag */
}
SET_FLOAT_WORD(x,hx);
return x;

View File

@ -0,0 +1,24 @@
http://sources.redhat.com/ml/binutils/2004-04/msg00665.html
fixes building on some architectures (like m68k/arm/cris/etc...) because
it does the right thing
diff -durN glibc-2.10.1.orig/include/libc-symbols.h glibc-2.10.1/include/libc-symbols.h
--- glibc-2.10.1.orig/include/libc-symbols.h 2009-03-14 00:51:46.000000000 +0100
+++ glibc-2.10.1/include/libc-symbols.h 2009-11-13 00:50:07.000000000 +0100
@@ -239,12 +239,12 @@
# define __make_section_unallocated(section_string)
# endif
-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
+/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus
section attributes on what looks like a comment to the assembler. */
# ifdef HAVE_SECTION_QUOTES
-# define __sec_comment "\"\n\t#\""
+# define __sec_comment "\"\n#APP\n\t#\""
# else
-# define __sec_comment "\n\t#"
+# define __sec_comment "\n#APP\n\t#"
# endif
# define link_warning(symbol, msg) \
__make_section_unallocated (".gnu.warning." #symbol) \

View File

@ -0,0 +1,36 @@
http://bugs.gentoo.org/196245
http://sourceware.org/ml/libc-alpha/2006-05/msg00017.html
Attached is a patch to add __attribute__ ((noinline)) to
call_gmon_start.
Without this patch, the sec script that processed initfini.s removes a
part of inlined call_gmon_start, causing undefined label errors.
This patch solves the problem by forcing gcc not to inline
call_gmon_start with __attribute__ ((noinline)).
Tested by building for arm-none-lixux-gnueabi. OK to apply?
Kazu Hirata
2006-05-07 Kazu Hirata &lt;kazu@codesourcery.com&gt;
* sysdeps/generic/initfini.c (call_gmon_start): Add
__attribute__ ((noinline)).
Index: sysdeps/generic/initfini.c
===================================================================
diff -durN glibc-2.10.1.orig/sysdeps/generic/initfini.c glibc-2.10.1/sysdeps/generic/initfini.c
--- glibc-2.10.1.orig/sysdeps/generic/initfini.c 2007-06-17 20:02:40.000000000 +0200
+++ glibc-2.10.1/sysdeps/generic/initfini.c 2009-11-13 00:50:09.000000000 +0100
@@ -70,7 +70,7 @@
/* The beginning of _init: */
asm ("\n/*@_init_PROLOG_BEGINS*/");
-static void
+static void __attribute__ ((noinline))
call_gmon_start(void)
{
extern void __gmon_start__ (void) __attribute__ ((weak)); /*weak_extern (__gmon_start__);*/

View File

@ -0,0 +1,17 @@
many ports hit this warning:
../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
../sysdeps/unix/sysv/linux/check_native.c:46: warning: implicit declaration of function 'memset'
snipped from suse
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/check_native.c glibc-2.10.1/sysdeps/unix/sysv/linux/check_native.c
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/check_native.c 2007-11-24 04:12:17.000000000 +0100
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/check_native.c 2009-11-13 00:50:11.000000000 +0100
@@ -23,6 +23,7 @@
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
+#include <string.h>
#include <time.h>
#include <unistd.h>
#include <net/if.h>

View File

@ -0,0 +1,45 @@
From dank@kegel.com
Wed Jun 15 09:12:43 PDT 2005
Fixes
build-glibc/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r'
build-glibc/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent'
... 53 lines deleted ...
build-glibc/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r'
collect2: ld returned 1 exit status
make[2]: *** [/build/gcc-3.4.3-glibc-2.3.5-hdrs-2.6.11.2/i686-unknown-linux-gnu/build-glibc/elf/ldconfig] Error 1
when building glibc with --enable-static-nss.
See http://sources.redhat.com/bugzilla/show_bug.cgi?id=631
diff -durN glibc-2.10.1.orig/Makeconfig glibc-2.10.1/Makeconfig
--- glibc-2.10.1.orig/Makeconfig 2009-11-13 00:49:41.000000000 +0100
+++ glibc-2.10.1/Makeconfig 2009-11-13 00:50:13.000000000 +0100
@@ -509,7 +509,7 @@
# The static libraries.
ifeq (yes,$(build-static))
-link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
+link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(otherlibs) $(common-objpfx)libc.a
else
ifeq (yes,$(build-shared))
# We can try to link the programs with lib*_pic.a...
diff -durN glibc-2.10.1.orig/elf/Makefile glibc-2.10.1/elf/Makefile
--- glibc-2.10.1.orig/elf/Makefile 2009-01-31 01:20:55.000000000 +0100
+++ glibc-2.10.1/elf/Makefile 2009-11-13 00:50:13.000000000 +0100
@@ -121,6 +121,13 @@
install-bin-script = ldd
endif
+ifeq (yes,$(build-static-nss))
+nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
+resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
+otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
+ $(resolvobjdir)/libresolv.a
+endif
+
others = sprof sln
install-bin = sprof
others-static = sln

View File

@ -0,0 +1,54 @@
http://bugs.gentoo.org/250342
http://sources.redhat.com/bugzilla/show_bug.cgi?id=9685
we cant assume sock_cloexec and pipe2 are bound together as the former defines
are found in glibc only while the latter are a combo of kernel headers and
glibc. so if we do a runtime detection of SOCK_CLOEXEC, but pipe2() is a stub
inside of glibc, we hit a problem. for example:
#include <grp.h>
#include <stdio.h>
main()
{
getgrnam("portage");
if (!popen("ls", "r"))
perror("popen()");
}
getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set both
__have_sock_cloexec and __have_pipe2 to true. but if glibc was built against
older kernel headers where __NR_pipe2 does not exist, glibc will have a ENOSYS
stub for it. so popen() will always fail as glibc assumes pipe2() works.
diff -durN glibc-2.10.1.orig/include/unistd.h glibc-2.10.1/include/unistd.h
--- glibc-2.10.1.orig/include/unistd.h 2008-07-27 20:23:17.000000000 +0200
+++ glibc-2.10.1/include/unistd.h 2009-11-13 00:50:15.000000000 +0100
@@ -167,9 +167,6 @@
extern int __pause_nocancel (void) attribute_hidden;
extern int __have_sock_cloexec;
-/* At lot of other functionality became available at the same time as
- SOCK_CLOEXEC. Avoid defining separate variables for all of them
- unless it is really necessary. */
-#define __have_pipe2 __have_sock_cloexec
+extern int __have_pipe2;
#endif
diff -durN glibc-2.10.1.orig/socket/have_sock_cloexec.c glibc-2.10.1/socket/have_sock_cloexec.c
--- glibc-2.10.1.orig/socket/have_sock_cloexec.c 2008-07-25 18:46:23.000000000 +0200
+++ glibc-2.10.1/socket/have_sock_cloexec.c 2009-11-13 00:50:15.000000000 +0100
@@ -16,9 +16,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <fcntl.h>
#include <sys/socket.h>
#include <kernel-features.h>
#if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
int __have_sock_cloexec;
#endif
+
+#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
+int __have_pipe2;
+#endif

View File

@ -0,0 +1,32 @@
diff -durN glibc-2.10.1.orig/localedata/locales/zh_TW glibc-2.10.1/localedata/locales/zh_TW
--- glibc-2.10.1.orig/localedata/locales/zh_TW 2004-11-01 00:42:28.000000000 +0100
+++ glibc-2.10.1/localedata/locales/zh_TW 2009-11-13 00:50:17.000000000 +0100
@@ -1,7 +1,7 @@
comment_char %
escape_char /
%
-% Chinese language locale for Taiwan R.O.C.
+% Chinese language locale for Taiwan
% charmap: BIG5-CP950
%
% Original Author:
@@ -17,7 +17,7 @@
% Reference: http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
LC_IDENTIFICATION
-title "Chinese locale for Taiwan R.O.C."
+title "Chinese locale for Taiwan"
source ""
address ""
contact ""
@@ -25,7 +25,7 @@
tel ""
fax ""
language "Chinese"
-territory "Taiwan R.O.C."
+territory "Taiwan"
revision "0.2"
date "2000-08-02"
%

View File

@ -0,0 +1,115 @@
http://bugs.gentoo.org/show_bug.cgi?id=131815
http://sourceware.org/bugzilla/show_bug.cgi?id=2522
diff -durN glibc-2.10.1.orig/localedata/SUPPORTED glibc-2.10.1/localedata/SUPPORTED
--- glibc-2.10.1.orig/localedata/SUPPORTED 2009-04-18 10:43:52.000000000 +0200
+++ glibc-2.10.1/localedata/SUPPORTED 2009-11-13 00:50:20.000000000 +0100
@@ -72,6 +72,8 @@
ca_ES.UTF-8/UTF-8 \
ca_ES/ISO-8859-1 \
ca_ES@euro/ISO-8859-15 \
+ca_ES.UTF-8@valencia/UTF-8 \
+ca_ES@valencia/ISO-8859-15 \
ca_FR.UTF-8/UTF-8 \
ca_FR/ISO-8859-15 \
ca_IT.UTF-8/UTF-8 \
diff -durN glibc-2.10.1.orig/localedata/locales/ca_ES@valencia glibc-2.10.1/localedata/locales/ca_ES@valencia
--- glibc-2.10.1.orig/localedata/locales/ca_ES@valencia 1970-01-01 01:00:00.000000000 +0100
+++ glibc-2.10.1/localedata/locales/ca_ES@valencia 2009-11-13 00:50:20.000000000 +0100
@@ -0,0 +1,96 @@
+comment_char %
+escape_char /
+%
+% Valencian (southern Catalan) locale for Spain with Euro
+%
+% Note that this locale is almost the same as ca_ES@euro. The point of having
+% a separate locale is only for PO translations, which have a lot of social
+% support and are very appreciated by the Valencian-speaking community.
+%
+% Contact: Jordi Mallach
+% Email: jordi@gnu.org
+% Tel:
+% Fax:
+% Language: ca
+% Territory: ES
+% Option: euro
+% Revision: 1.0
+% Date: 2006-04-06
+% Application: general
+% Users: general
+% Repertoiremap: mnemonic,ds
+% Charset: ISO-8859-15
+% Distribution and use is free, also
+% for commercial purposes.
+
+LC_IDENTIFICATION
+title "Valencian (southern Catalan) locale for Spain with Euro"
+source ""
+address ""
+contact "Jordi Mallach"
+email "jordi@gnu.org"
+tel ""
+fax ""
+language "Catalan"
+territory "Spain"
+revision "1.0"
+date "2006-04-06"
+%
+category "ca_ES@valencia:2006";LC_IDENTIFICATION
+category "ca_ES@valencia:2006";LC_CTYPE
+category "ca_ES@valencia:2006";LC_COLLATE
+category "ca_ES@valencia:2006";LC_MONETARY
+category "ca_ES@valencia:2006";LC_NUMERIC
+category "ca_ES@valencia:2006";LC_TIME
+category "ca_ES@valencia:2006";LC_MESSAGES
+category "ca_ES@valencia:2006";LC_PAPER
+category "ca_ES@valencia:2006";LC_NAME
+category "ca_ES@valencia:2006";LC_ADDRESS
+category "ca_ES@valencia:2006";LC_TELEPHONE
+category "ca_ES@valencia:2006";LC_MEASUREMENT
+
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+END LC_CTYPE
+
+LC_COLLATE
+copy "ca_ES"
+END LC_COLLATE
+
+LC_MONETARY
+copy "ca_ES"
+END LC_MONETARY
+
+LC_NUMERIC
+copy "ca_ES"
+END LC_NUMERIC
+
+LC_TIME
+copy "ca_ES"
+END LC_TIME
+
+LC_MESSAGES
+copy "ca_ES"
+END LC_MESSAGES
+
+LC_PAPER
+copy "ca_ES"
+END LC_PAPER
+
+LC_NAME
+copy "ca_ES"
+END LC_NAME
+
+LC_ADDRESS
+copy "ca_ES"
+END LC_ADDRESS
+
+LC_TELEPHONE
+copy "ca_ES"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+copy "ca_ES"
+END LC_MEASUREMENT

View File

@ -0,0 +1,42 @@
If gcc is configured to generate i686 code or better by default (like
when using the --with-arch=pentium3 configure option), then the __i686
macro will always be defined automatically and thus screw up the
compilation of some .S files.
http://bugs.gentoo.org/131108
http://sourceware.org/ml/libc-alpha/2006-04/msg00090.html
2006-04-25 Mike Frysinger <vapier@gentoo.org>
* sysdeps/i386/sysdep.h (__i686): Undefine.
diff -durN glibc-2.10.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.10.1/nptl/sysdeps/pthread/pt-initfini.c
--- glibc-2.10.1.orig/nptl/sysdeps/pthread/pt-initfini.c 2007-06-17 20:02:01.000000000 +0200
+++ glibc-2.10.1/nptl/sysdeps/pthread/pt-initfini.c 2009-11-13 00:50:22.000000000 +0100
@@ -45,6 +45,9 @@
/* Embed an #include to pull in the alignment and .end directives. */
asm ("\n#include \"defs.h\"");
+/* Embed an #include to pull in asm settings. */
+asm ("\n#ifdef __i686__\n#include <sysdep.h>\n#endif");
+
/* The initial common code ends here. */
asm ("\n/*@HEADER_ENDS*/");
diff -durN glibc-2.10.1.orig/sysdeps/i386/sysdep.h glibc-2.10.1/sysdeps/i386/sysdep.h
--- glibc-2.10.1.orig/sysdeps/i386/sysdep.h 2006-10-28 08:44:03.000000000 +0200
+++ glibc-2.10.1/sysdeps/i386/sysdep.h 2009-11-13 00:50:22.000000000 +0100
@@ -18,6 +18,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+/*
+ * When building for i686 targets or better, gcc automatically defines
+ * '__i686' to '1' for us which causes trouble when using section names
+ * like '__i686.get_pc_thunk.reg'. Since we check for __i686__ in the
+ * code, killing '__i686' shouldn't be a problem.
+ */
+#undef __i686
+
#include <sysdeps/generic/sysdep.h>
#ifdef __ASSEMBLER__

View File

@ -0,0 +1,40 @@
only fork one to assist in stop-start-daemon assumptions about daemon behavior
http://bugs.gentoo.org/190785
diff -durN glibc-2.10.1.orig/nscd/nscd.c glibc-2.10.1/nscd/nscd.c
--- glibc-2.10.1.orig/nscd/nscd.c 2009-02-06 21:10:27.000000000 +0100
+++ glibc-2.10.1/nscd/nscd.c 2009-11-13 00:50:24.000000000 +0100
@@ -182,6 +182,9 @@
if (pid != 0)
exit (0);
+ if (write_pid (_PATH_NSCDPID) < 0)
+ dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
+
int nullfd = open (_PATH_DEVNULL, O_RDWR);
if (nullfd != -1)
{
@@ -231,12 +234,6 @@
for (i = min_close_fd; i < getdtablesize (); i++)
close (i);
- pid = fork ();
- if (pid == -1)
- error (EXIT_FAILURE, errno, _("cannot fork"));
- if (pid != 0)
- exit (0);
-
setsid ();
if (chdir ("/") != 0)
@@ -245,9 +242,6 @@
openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
- if (write_pid (_PATH_NSCDPID) < 0)
- dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
-
if (!init_logfile ())
dbg_log (_("Could not create log file"));

View File

@ -0,0 +1,246 @@
diff -durN glibc-2.10.1.orig/elf/rtld.c glibc-2.10.1/elf/rtld.c
--- glibc-2.10.1.orig/elf/rtld.c 2009-04-17 02:00:08.000000000 +0200
+++ glibc-2.10.1/elf/rtld.c 2009-11-13 00:50:26.000000000 +0100
@@ -384,14 +384,14 @@
know it is available. We do not have to clear the memory if we
do not have to use the temporary bootstrap_map. Global variables
are initialized to zero by default. */
-#ifndef DONT_USE_BOOTSTRAP_MAP
+#if !defined DONT_USE_BOOTSTRAP_MAP
# ifdef HAVE_BUILTIN_MEMSET
__builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
# else
- for (size_t cnt = 0;
- cnt < sizeof (bootstrap_map.l_info) / sizeof (bootstrap_map.l_info[0]);
- ++cnt)
- bootstrap_map.l_info[cnt] = 0;
+ /* Clear the whole bootstrap_map structure */
+ for (char *cnt = (char *)&(bootstrap_map);
+ cnt < ((char *)&(bootstrap_map) + sizeof (bootstrap_map));
+ *cnt++ = '\0');
# endif
# if USE___THREAD
bootstrap_map.l_tls_modid = 0;
diff -durN glibc-2.10.1.orig/include/atomic.h glibc-2.10.1/include/atomic.h
--- glibc-2.10.1.orig/include/atomic.h 2009-02-09 00:49:53.000000000 +0100
+++ glibc-2.10.1/include/atomic.h 2009-11-13 00:50:26.000000000 +0100
@@ -174,7 +174,7 @@
__typeof (*(mem)) __atg5_value = (newvalue); \
\
do \
- __atg5_oldval = *__atg5_memp; \
+ __atg5_oldval = *(volatile __typeof (mem))__atg5_memp; \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
__atg5_oldval), 0)); \
@@ -195,7 +195,7 @@
__typeof (*(mem)) __atg6_value = (value); \
\
do \
- __atg6_oldval = *__atg6_memp; \
+ __atg6_oldval = *(volatile __typeof (mem))__atg6_memp; \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg6_memp, \
__atg6_oldval \
@@ -213,7 +213,7 @@
__typeof (*(mem)) __atg7_value = (value); \
\
do \
- __atg7_oldv = *__atg7_memp; \
+ __atg7_oldv = *(volatile __typeof (mem))__atg7_memp; \
while (__builtin_expect \
(catomic_compare_and_exchange_bool_acq (__atg7_memp, \
__atg7_oldv \
@@ -231,7 +231,7 @@
__typeof (mem) __atg8_memp = (mem); \
__typeof (*(mem)) __atg8_value = (value); \
do { \
- __atg8_oldval = *__atg8_memp; \
+ __atg8_oldval = *(volatile __typeof (mem))__atg8_memp; \
if (__atg8_oldval >= __atg8_value) \
break; \
} while (__builtin_expect \
@@ -248,7 +248,7 @@
__typeof (mem) __atg9_memp = (mem); \
__typeof (*(mem)) __atg9_value = (value); \
do { \
- __atg9_oldv = *__atg9_memp; \
+ __atg9_oldv = *(volatile __typeof (mem))__atg9_memp; \
if (__atg9_oldv >= __atg9_value) \
break; \
} while (__builtin_expect \
@@ -266,7 +266,7 @@
__typeof (mem) __atg10_memp = (mem); \
__typeof (*(mem)) __atg10_value = (value); \
do { \
- __atg10_oldval = *__atg10_memp; \
+ __atg10_oldval = *(volatile __typeof (mem))__atg10_memp; \
if (__atg10_oldval <= __atg10_value) \
break; \
} while (__builtin_expect \
@@ -350,7 +350,7 @@
\
do \
{ \
- __atg11_oldval = *__atg11_memp; \
+ __atg11_oldval = *(volatile __typeof (mem))__atg11_memp; \
if (__builtin_expect (__atg11_oldval <= 0, 0)) \
break; \
} \
@@ -389,7 +389,7 @@
__typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit)); \
\
do \
- __atg14_old = (*__atg14_memp); \
+ __atg14_old = (*(volatile __typeof (mem))__atg14_memp); \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg14_memp, \
__atg14_old | __atg14_mask,\
@@ -407,7 +407,7 @@
__typeof (*(mem)) __atg15_mask = (mask); \
\
do \
- __atg15_old = (*__atg15_memp); \
+ __atg15_old = (*(volatile __typeof (mem))__atg15_memp); \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg15_memp, \
__atg15_old & __atg15_mask, \
@@ -439,7 +439,7 @@
__typeof (*(mem)) __atg16_mask = (mask); \
\
do \
- __atg16_old = (*__atg16_memp); \
+ __atg16_old = (*(volatile __typeof (mem))__atg16_memp); \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg16_memp, \
__atg16_old & __atg16_mask,\
@@ -457,7 +457,7 @@
__typeof (*(mem)) __atg17_mask = (mask); \
\
do \
- __atg17_old = (*__atg17_memp); \
+ __atg17_old = (*(volatile __typeof (mem))__atg17_memp); \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg17_memp, \
__atg17_old | __atg17_mask, \
@@ -473,7 +473,7 @@
__typeof (*(mem)) __atg18_mask = (mask); \
\
do \
- __atg18_old = (*__atg18_memp); \
+ __atg18_old = (*(volatile __typeof (mem))__atg18_memp); \
while (__builtin_expect \
(catomic_compare_and_exchange_bool_acq (__atg18_memp, \
__atg18_old | __atg18_mask,\
@@ -489,7 +489,7 @@
__typeof (*(mem)) __atg19_mask = (mask); \
\
do \
- __atg19_old = (*__atg19_memp); \
+ __atg19_old = (*(volatile __typeof (mem))__atg19_memp); \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg19_memp, \
__atg19_old | __atg19_mask,\
diff -durN glibc-2.10.1.orig/nptl/Makefile glibc-2.10.1/nptl/Makefile
--- glibc-2.10.1.orig/nptl/Makefile 2008-11-12 14:38:23.000000000 +0100
+++ glibc-2.10.1/nptl/Makefile 2009-11-13 00:50:26.000000000 +0100
@@ -262,9 +262,9 @@
# Files which must not be linked with libpthread.
tests-nolibpthread = tst-unload
-# This sets the stack resource limit to 1023kb, which is not a multiple
-# of the page size since every architecture's page size is > 1k.
-tst-oddstacklimit-ENV = ; ulimit -s 1023;
+# This sets the stack resource limit to 8193kb, which is not a multiple
+# of the page size since every architecture's page size is 4096 bytes.
+tst-oddstacklimit-ENV = ; ulimit -s 8193;
distribute = eintr.c tst-cleanup4aux.c
@@ -423,6 +423,35 @@
CFLAGS-tst-cleanupx4.c += -fexceptions
CFLAGS-tst-oncex3.c += -fexceptions
CFLAGS-tst-oncex4.c += -fexceptions
+
+ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
+LDFLAGS-tst-cancelx2 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx3 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx4 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx5 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx6 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx7 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx8 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx9 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx10 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx11 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx12 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx13 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx14 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx15 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx16 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx17 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx18 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx20 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cancelx21 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cleanupx0 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cleanupx1 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cleanupx2 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cleanupx3 += $(ldflags-libgcc_s)
+LDFLAGS-tst-cleanupx4 += $(ldflags-libgcc_s)
+LDFLAGS-tst-oncex3 += $(ldflags-libgcc_s)
+LDFLAGS-tst-oncex4 += $(ldflags-libgcc_s)
+
CFLAGS-tst-align.c += $(stack-align-test-flags)
CFLAGS-tst-align3.c += $(stack-align-test-flags)
CFLAGS-tst-initializers1.c = -W -Wall -Werror
diff -durN glibc-2.10.1.orig/nptl/pthread_barrier_wait.c glibc-2.10.1/nptl/pthread_barrier_wait.c
--- glibc-2.10.1.orig/nptl/pthread_barrier_wait.c 2007-08-01 06:18:50.000000000 +0200
+++ glibc-2.10.1/nptl/pthread_barrier_wait.c 2009-11-13 00:50:26.000000000 +0100
@@ -64,7 +64,7 @@
do
lll_futex_wait (&ibarrier->curr_event, event,
ibarrier->private ^ FUTEX_PRIVATE_FLAG);
- while (event == ibarrier->curr_event);
+ while (event == *(volatile unsigned int *)&ibarrier->curr_event);
}
/* Make sure the init_count is stored locally or in a register. */
diff -durN glibc-2.10.1.orig/nptl/sysdeps/pthread/Makefile glibc-2.10.1/nptl/sysdeps/pthread/Makefile
--- glibc-2.10.1.orig/nptl/sysdeps/pthread/Makefile 2006-02-28 08:09:41.000000000 +0100
+++ glibc-2.10.1/nptl/sysdeps/pthread/Makefile 2009-11-13 00:50:26.000000000 +0100
@@ -41,7 +41,9 @@
ifeq ($(have-forced-unwind),yes)
tests += tst-mqueue8x
+ldflags-libgcc_s = --as-needed -lgcc_s --no-as-needed
CFLAGS-tst-mqueue8x.c += -fexceptions
+LDFLAGS-tst-mqueue8x += $(ldflags-libgcc_s)
endif
endif
diff -durN glibc-2.10.1.orig/stdio-common/Makefile glibc-2.10.1/stdio-common/Makefile
--- glibc-2.10.1.orig/stdio-common/Makefile 2009-04-11 07:29:56.000000000 +0200
+++ glibc-2.10.1/stdio-common/Makefile 2009-11-13 00:50:26.000000000 +0100
@@ -82,7 +82,7 @@
$(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
endif
-CFLAGS-vfprintf.c = -Wno-uninitialized
+CFLAGS-vfprintf.c = -Wno-uninitialized -fno-delayed-branch
CFLAGS-vfwprintf.c = -Wno-uninitialized
CFLAGS-tst-printf.c = -Wno-format
CFLAGS-tstdiomisc.c = -Wno-format
diff -durN glibc-2.10.1.orig/sunrpc/clnt_udp.c glibc-2.10.1/sunrpc/clnt_udp.c
--- glibc-2.10.1.orig/sunrpc/clnt_udp.c 2008-07-26 10:42:44.000000000 +0200
+++ glibc-2.10.1/sunrpc/clnt_udp.c 2009-11-13 00:50:26.000000000 +0100
@@ -462,7 +462,7 @@
while (inlen < 0 && errno == EINTR);
if (inlen < 0)
{
- if (errno == EWOULDBLOCK)
+ if (errno == EWOULDBLOCK || errno == EAGAIN)
continue;
cu->cu_error.re_errno = errno;
return (cu->cu_error.re_status = RPC_CANTRECV);

View File

@ -0,0 +1,29 @@
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/hppa/elf/start.S glibc-2.10.1/glibc-ports-2.10.1/sysdeps/hppa/elf/start.S
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/hppa/elf/start.S 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/hppa/elf/start.S 2009-11-13 00:50:28.000000000 +0100
@@ -96,16 +96,16 @@
#if SHARED
/* load main (1st argument) */
- addil LR'.Lpmain, %r19
- ldw RR'.Lpmain(%r1), %r26
+ addil LT'.Lpmain, %r19
+ ldw RT'.Lpmain(%r1), %r26
ldw 0(%r26),%r26
/* void (*init) (void) (4th argument) */
- addil LR'.Lp__libc_csu_init, %r19
- ldw RR'.Lp__libc_csu_init(%r1), %r23
+ addil LT'.Lp__libc_csu_init, %r19
+ ldw RT'.Lp__libc_csu_init(%r1), %r23
ldw 0(%r23), %r23
/* void (*fini) (void) (5th argument) */
- addil LR'.Lp__libc_csu_fini, %r19
- ldw RR'.Lp__libc_csu_fini(%r1), %r22
+ addil LT'.Lp__libc_csu_fini, %r19
+ ldw RT'.Lp__libc_csu_fini(%r1), %r22
ldw 0(%r22), %r22
#else
/* load main (1st argument) */
diff -durN glibc-2.10.1.orig/ports/sysdeps/hppa/elf/start.S glibc-2.10.1/ports/sysdeps/hppa/elf/start.S

View File

@ -0,0 +1,97 @@
copied from kernel as it is sanitized now
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/m68k/sys/user.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/m68k/sys/user.h 2009-11-13 00:50:31.000000000 +0100
@@ -1,3 +1,90 @@
+#ifndef _SYS_USER_H
+#define _SYS_USER_H
+
+/* Core file format: The core file is written in such a way that gdb
+ can understand it and provide useful information to the user (under
+ linux we use the 'trad-core' bfd). There are quite a number of
+ obstacles to being able to view the contents of the floating point
+ registers, and until these are solved you will not be able to view the
+ contents of them. Actually, you can read in the core file and look at
+ the contents of the user struct to find out what the floating point
+ registers contain.
+ The actual file contents are as follows:
+ UPAGE: 1 page consisting of a user struct that tells gdb what is present
+ in the file. Directly after this is a copy of the task_struct, which
+ is currently not used by gdb, but it may come in useful at some point.
+ All of the registers are stored as part of the upage. The upage should
+ always be only one page.
+ DATA: The data area is stored. We use current->end_text to
+ current->brk to pick up all of the user variables, plus any memory
+ that may have been malloced. No attempt is made to determine if a page
+ is demand-zero or if a page is totally unused, we just cover the entire
+ range. All of the addresses are rounded in such a way that an integral
+ number of pages is written.
+ STACK: We need the stack information in order to get a meaningful
+ backtrace. We need to write the data from (esp) to
+ current->start_stack, so we round each of these off in order to be able
+ to write an integer number of pages.
+ The minimum core file size is 3 pages, or 12288 bytes.
+*/
+
+struct user_m68kfp_struct {
+ unsigned long fpregs[8*3]; /* fp0-fp7 registers */
+ unsigned long fpcntl[3]; /* fp control regs */
+};
+
+/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
+ is still the layout used by user (the new pt_regs doesn't have
+ all registers). */
+struct user_regs_struct {
+ long d1,d2,d3,d4,d5,d6,d7;
+ long a0,a1,a2,a3,a4,a5,a6;
+ long d0;
+ long usp;
+ long orig_d0;
+ short stkadj;
+ short sr;
+ long pc;
+ short fmtvec;
+ short __fill;
+};
+
+
+/* When the kernel dumps core, it starts by dumping the user struct -
+ this will be used by gdb to figure out where the data and stack segments
+ are within the file, and what virtual addresses to use. */
+struct user{
+/* We start with the registers, to mimic the way that "memory" is returned
+ from the ptrace(3,...) function. */
+ struct user_regs_struct regs; /* Where the registers are actually stored */
+/* ptrace does not yet supply these. Someday.... */
+ int u_fpvalid; /* True if math co-processor being used. */
+ /* for this mess. Not yet used. */
+ struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */
+/* The rest of this junk is to help gdb figure out what goes where */
+ unsigned long int u_tsize; /* Text segment size (pages). */
+ unsigned long int u_dsize; /* Data segment size (pages). */
+ unsigned long int u_ssize; /* Stack segment size (pages). */
+ unsigned long start_code; /* Starting virtual address of text. */
+ unsigned long start_stack; /* Starting virtual address of stack area.
+ This is actually the bottom of the stack,
+ the top of the stack is always found in the
+ esp register. */
+ long int signal; /* Signal that caused the core dump. */
+ int reserved; /* No longer used */
+ struct user_regs_struct *u_ar0;
+ /* Used by gdb to help find the values for */
+ /* the registers. */
+ struct user_m68kfp_struct* u_fpstate; /* Math Co-processor pointer. */
+ unsigned long magic; /* To uniquely identify a core file */
+ char u_comm[32]; /* User command that was responsible */
+};
+#define NBPG 4096
+#define UPAGES 1
+#define HOST_TEXT_START_ADDR (u.start_code)
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
+
+#endif
/* Copyright (C) 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h

View File

@ -0,0 +1,66 @@
With latest versions of glibc, a lot of apps failed on a PaX enabled
system with:
cannot enable executable stack as shared object requires: Permission denied
This is due to PaX 'exec-protecting' the stack, and ld.so then trying
to make the stack executable due to some libraries not containing the
PT_GNU_STACK section. Bug #32960. <azarah@gentoo.org> (12 Nov 2003).
Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005).
diff -durN glibc-2.10.1.orig/nptl/allocatestack.c glibc-2.10.1/nptl/allocatestack.c
--- glibc-2.10.1.orig/nptl/allocatestack.c 2009-01-29 21:34:16.000000000 +0100
+++ glibc-2.10.1/nptl/allocatestack.c 2009-11-13 00:50:33.000000000 +0100
@@ -326,7 +326,8 @@
# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
#endif
if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
- return errno;
+ if (errno != EACCES) /* PAX is enabled */
+ return errno;
return 0;
}
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/dl-execstack.c glibc-2.10.1/sysdeps/unix/sysv/linux/dl-execstack.c
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/dl-execstack.c 2006-01-08 09:21:15.000000000 +0100
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/dl-execstack.c 2009-11-13 00:50:33.000000000 +0100
@@ -63,7 +63,10 @@
else
# endif
{
- result = errno;
+ if (errno == EACCES) /* PAX is enabled */
+ result = 0;
+ else
+ result = errno;
goto out;
}
}
@@ -89,7 +92,12 @@
page -= size;
else
{
- if (errno != ENOMEM) /* Unexpected failure mode. */
+ if (errno == EACCES) /* PAX is enabled */
+ {
+ result = 0;
+ goto out;
+ }
+ else if (errno != ENOMEM) /* Unexpected failure mode. */
{
result = errno;
goto out;
@@ -115,7 +123,12 @@
page += size;
else
{
- if (errno != ENOMEM) /* Unexpected failure mode. */
+ if (errno == EACCES) /* PAX is enabled */
+ {
+ result = 0;
+ goto out;
+ }
+ else if (errno != ENOMEM) /* Unexpected failure mode. */
{
result = errno;
goto out;

View File

@ -0,0 +1,32 @@
diff -durN glibc-2.10.1.orig/elf/elf.h glibc-2.10.1/elf/elf.h
--- glibc-2.10.1.orig/elf/elf.h 2009-04-15 02:15:54.000000000 +0200
+++ glibc-2.10.1/elf/elf.h 2009-11-13 00:50:35.000000000 +0100
@@ -572,6 +572,7 @@
#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
+#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */
#define PT_LOSUNW 0x6ffffffa
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
@@ -585,6 +586,18 @@
#define PF_X (1 << 0) /* Segment is executable */
#define PF_W (1 << 1) /* Segment is writable */
#define PF_R (1 << 2) /* Segment is readable */
+#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
+#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
+#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
+#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
+#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
+#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
+#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
+#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
+#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
+#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
+#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
+#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
#define PF_MASKOS 0x0ff00000 /* OS-specific */
#define PF_MASKPROC 0xf0000000 /* Processor-specific */

View File

@ -0,0 +1,193 @@
when glibc runs its tests, it does so by invoking the local library loader.
in Gentoo, we build/run inside of our "sandbox" which itself is linked against
libdl (so that it can load libraries and pull out symbols). the trouble
is that when you upgrade from an older glibc to the new one, often times
internal symbols change name or abi. this is normally OK as you cannot use
libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
we always say "keep all of the glibc libraries from the same build". but
when glibc runs its tests, it uses dynamic paths to point to its new local
copies of libraries. if the test doesnt use libdl, then glibc doesnt add
its path, and when sandbox triggers the loading of libdl, glibc does so
from the host system system. this gets us into the case of all libraries
are from the locally compiled version of glibc except for libdl.so.
Fix by Wormo
http://bugs.gentoo.org/56898
diff -durN glibc-2.10.1.orig/grp/tst_fgetgrent.sh glibc-2.10.1/grp/tst_fgetgrent.sh
--- glibc-2.10.1.orig/grp/tst_fgetgrent.sh 2001-07-06 06:54:46.000000000 +0200
+++ glibc-2.10.1/grp/tst_fgetgrent.sh 2009-11-13 00:50:37.000000000 +0100
@@ -24,7 +24,8 @@
rtld_installed_name=$1; shift
testout=${common_objpfx}/grp/tst_fgetgrent.out
-library_path=${common_objpfx}
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
result=0
diff -durN glibc-2.10.1.orig/iconvdata/run-iconv-test.sh glibc-2.10.1/iconvdata/run-iconv-test.sh
--- glibc-2.10.1.orig/iconvdata/run-iconv-test.sh 2008-05-15 03:59:44.000000000 +0200
+++ glibc-2.10.1/iconvdata/run-iconv-test.sh 2009-11-13 00:50:37.000000000 +0100
@@ -34,7 +34,7 @@
export GCONV_PATH
# We have to have some directories in the library path.
-LIBPATH=$codir:$codir/iconvdata
+LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
# How the start the iconv(1) program.
ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
diff -durN glibc-2.10.1.orig/iconvdata/tst-table.sh glibc-2.10.1/iconvdata/tst-table.sh
--- glibc-2.10.1.orig/iconvdata/tst-table.sh 2002-04-24 23:39:35.000000000 +0200
+++ glibc-2.10.1/iconvdata/tst-table.sh 2009-11-13 00:50:37.000000000 +0100
@@ -59,8 +59,11 @@
irreversible=${charset}.irreversible
fi
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
# iconv in one direction.
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${common_objpfx}elf/ld.so --library-path $library_path \
${objpfx}tst-table-from ${charset} \
> ${objpfx}tst-${charset}.table
diff -durN glibc-2.10.1.orig/intl/tst-codeset.sh glibc-2.10.1/intl/tst-codeset.sh
--- glibc-2.10.1.orig/intl/tst-codeset.sh 2005-04-06 04:18:35.000000000 +0200
+++ glibc-2.10.1/intl/tst-codeset.sh 2009-11-13 00:50:37.000000000 +0100
@@ -37,6 +37,9 @@
LOCPATH=${common_objpfx}localedata
export LOCPATH
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
${common_objpfx}elf/ld.so --library-path $common_objpfx \
${objpfx}tst-codeset > ${objpfx}tst-codeset.out
diff -durN glibc-2.10.1.orig/intl/tst-gettext.sh glibc-2.10.1/intl/tst-gettext.sh
--- glibc-2.10.1.orig/intl/tst-gettext.sh 2004-08-15 21:28:18.000000000 +0200
+++ glibc-2.10.1/intl/tst-gettext.sh 2009-11-13 00:50:37.000000000 +0100
@@ -51,9 +51,12 @@
LOCPATH=${common_objpfx}localedata
export LOCPATH
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
# Now run the test.
MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${common_objpfx}elf/ld.so --library-path $library_path \
${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
exit $?
diff -durN glibc-2.10.1.orig/intl/tst-gettext2.sh glibc-2.10.1/intl/tst-gettext2.sh
--- glibc-2.10.1.orig/intl/tst-gettext2.sh 2005-05-04 19:54:48.000000000 +0200
+++ glibc-2.10.1/intl/tst-gettext2.sh 2009-11-13 00:50:37.000000000 +0100
@@ -65,8 +65,11 @@
LOCPATH=${objpfx}domaindir
export LOCPATH
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
# Now run the test.
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${common_objpfx}elf/ld.so --library-path $library_path \
${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
cmp ${objpfx}tst-gettext2.out - <<EOF
String1 - Lang1: 1st string
diff -durN glibc-2.10.1.orig/intl/tst-translit.sh glibc-2.10.1/intl/tst-translit.sh
--- glibc-2.10.1.orig/intl/tst-translit.sh 2005-05-04 19:56:10.000000000 +0200
+++ glibc-2.10.1/intl/tst-translit.sh 2009-11-13 00:50:37.000000000 +0100
@@ -36,7 +36,10 @@
LOCPATH=${common_objpfx}localedata
export LOCPATH
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
+${common_objpfx}elf/ld.so --library-path $library_path \
${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
exit $?
diff -durN glibc-2.10.1.orig/malloc/tst-mtrace.sh glibc-2.10.1/malloc/tst-mtrace.sh
--- glibc-2.10.1.orig/malloc/tst-mtrace.sh 2005-10-15 01:40:35.000000000 +0200
+++ glibc-2.10.1/malloc/tst-mtrace.sh 2009-11-13 00:50:37.000000000 +0100
@@ -24,9 +24,12 @@
status=0
trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${common_objpfx}elf/ld.so --library-path $library_path \
${common_objpfx}malloc/tst-mtrace || status=1
if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
diff -durN glibc-2.10.1.orig/nptl/tst-tls6.sh glibc-2.10.1/nptl/tst-tls6.sh
--- glibc-2.10.1.orig/nptl/tst-tls6.sh 2003-09-03 00:02:59.000000000 +0200
+++ glibc-2.10.1/nptl/tst-tls6.sh 2009-11-13 00:50:37.000000000 +0100
@@ -5,8 +5,8 @@
rtld_installed_name=$1; shift
logfile=$common_objpfx/nptl/tst-tls6.out
-# We have to find libc and nptl
-library_path=${common_objpfx}:${common_objpfx}nptl
+# We have to find libc and nptl (also libdl in case sandbox is in use)
+library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}/nptl/tst-tls5"
diff -durN glibc-2.10.1.orig/posix/globtest.sh glibc-2.10.1/posix/globtest.sh
--- glibc-2.10.1.orig/posix/globtest.sh 2008-12-06 07:05:39.000000000 +0100
+++ glibc-2.10.1/posix/globtest.sh 2009-11-13 00:50:37.000000000 +0100
@@ -18,7 +18,7 @@
esac
# We have to find the libc and the NSS modules.
-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
+library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
# Since we use `sort' we must make sure to use the same locale everywhere.
LC_ALL=C
diff -durN glibc-2.10.1.orig/posix/tst-getconf.sh glibc-2.10.1/posix/tst-getconf.sh
--- glibc-2.10.1.orig/posix/tst-getconf.sh 2002-09-01 13:11:25.000000000 +0200
+++ glibc-2.10.1/posix/tst-getconf.sh 2009-11-13 00:50:37.000000000 +0100
@@ -10,7 +10,10 @@
else
rtld_installed_name=$1; shift
runit() {
- ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
+
+ # make sure libdl is also in path in case sandbox is in use
+ library_path=${common_objpfx}:${common_objpfx}/dlfcn
+ ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
}
fi
diff -durN glibc-2.10.1.orig/posix/wordexp-tst.sh glibc-2.10.1/posix/wordexp-tst.sh
--- glibc-2.10.1.orig/posix/wordexp-tst.sh 2000-10-20 18:23:30.000000000 +0200
+++ glibc-2.10.1/posix/wordexp-tst.sh 2009-11-13 00:50:37.000000000 +0100
@@ -19,8 +19,11 @@
"
export IFS
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
${common_objpfx}posix/wordexp-test '$*' > ${testout}1
cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
wordexp returned 0

View File

@ -0,0 +1,62 @@
http://sourceware.org/ml/libc-hacker/2002-11/msg00071.html
When fnmatch detects an invalid multibyte character it should fall back to
single byte matching, so that "*" has a chance to match such a string.
Andreas.
2005-04-12 Andreas Schwab <schwab@suse.de>
* posix/fnmatch.c (fnmatch): If conversion to wide character
fails fall back to single byte matching.
Index: posix/fnmatch.c
===================================================================
diff -durN glibc-2.10.1.orig/posix/fnmatch.c glibc-2.10.1/posix/fnmatch.c
--- glibc-2.10.1.orig/posix/fnmatch.c 2007-07-28 22:35:00.000000000 +0200
+++ glibc-2.10.1/posix/fnmatch.c 2009-11-13 00:50:39.000000000 +0100
@@ -327,6 +327,7 @@
# if HANDLE_MULTIBYTE
if (__builtin_expect (MB_CUR_MAX, 1) != 1)
{
+ const char *orig_pattern = pattern;
mbstate_t ps;
size_t n;
const char *p;
@@ -382,10 +383,8 @@
wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
n = mbsrtowcs (wstring, &p, n + 1, &ps);
if (__builtin_expect (n == (size_t) -1, 0))
- /* Something wrong.
- XXX Do we have to set `errno' to something which mbsrtows hasn't
- already done? */
- return -1;
+ /* Something wrong. Fall back to single byte matching. */
+ goto try_singlebyte;
if (p)
{
memset (&ps, '\0', sizeof (ps));
@@ -397,10 +396,8 @@
prepare_wstring:
n = mbsrtowcs (NULL, &string, 0, &ps);
if (__builtin_expect (n == (size_t) -1, 0))
- /* Something wrong.
- XXX Do we have to set `errno' to something which mbsrtows hasn't
- already done? */
- return -1;
+ /* Something wrong. Fall back to single byte matching. */
+ goto try_singlebyte;
wstring = (wchar_t *) alloca ((n + 1) * sizeof (wchar_t));
assert (mbsinit (&ps));
(void) mbsrtowcs (wstring, &string, n + 1, &ps);
@@ -408,6 +405,9 @@
return internal_fnwmatch (wpattern, wstring, wstring + n,
flags & FNM_PERIOD, flags, NULL);
+
+ try_singlebyte:
+ pattern = orig_pattern;
}
# endif /* mbstate_t and mbsrtowcs or _LIBC. */

View File

@ -0,0 +1,14 @@
timezone data has been split into the package sys-libs/timezone-data
diff -durN glibc-2.10.1.orig/Makeconfig glibc-2.10.1/Makeconfig
--- glibc-2.10.1.orig/Makeconfig 2009-11-13 00:50:13.000000000 +0100
+++ glibc-2.10.1/Makeconfig 2009-11-13 00:50:41.000000000 +0100
@@ -919,7 +919,7 @@
stdlib stdio-common libio malloc string wcsmbs time dirent \
grp pwd posix io termios resource misc socket sysvipc gmon \
gnulib iconv iconvdata wctype manual shadow gshadow po argp \
- crypt nss localedata timezone rt conform debug \
+ crypt nss localedata rt conform debug \
$(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
ifndef avoid-generated

View File

@ -0,0 +1,52 @@
A little hack for cross-compiling NPTL
http://sourceware.org/ml/libc-alpha/2005-02/msg00043.html
diff -durN glibc-2.10.1.orig/nptl/sysdeps/pthread/configure glibc-2.10.1/nptl/sysdeps/pthread/configure
--- glibc-2.10.1.orig/nptl/sysdeps/pthread/configure 2009-05-17 14:19:31.000000000 +0200
+++ glibc-2.10.1/nptl/sysdeps/pthread/configure 2009-11-13 00:50:43.000000000 +0100
@@ -78,6 +78,10 @@
fi
{ echo "$as_me:$LINENO: result: $libc_cv_forced_unwind" >&5
echo "${ECHO_T}$libc_cv_forced_unwind" >&6; }
+if test $libc_cv_forced_unwind = no -a $build_cpu != $host_cpu; then
+ echo "$as_me:$LINENO: forcing libc_cv_forced_unwind = yes for cross-compile"
+ libc_cv_forced_unwind=yes
+fi
if test $libc_cv_forced_unwind = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_FORCED_UNWIND 1
@@ -141,6 +145,10 @@
{ echo "$as_me:$LINENO: result: $libc_cv_c_cleanup" >&5
echo "${ECHO_T}$libc_cv_c_cleanup" >&6; }
CFLAGS="$old_CFLAGS"
+ if test $libc_cv_c_cleanup = no -a $build_cpu != $host_cpu; then
+ echo "$as_me:$LINENO: result: forcing libc_cv_c_cleanup = yes for cross-compile"
+ libc_cv_c_cleanup=yes
+ fi
if test $libc_cv_c_cleanup = no; then
{ { echo "$as_me:$LINENO: error: the compiler must support C cleanup handling" >&5
echo "$as_me: error: the compiler must support C cleanup handling" >&2;}
diff -durN glibc-2.10.1.orig/nptl/sysdeps/pthread/configure.in glibc-2.10.1/nptl/sysdeps/pthread/configure.in
--- glibc-2.10.1.orig/nptl/sysdeps/pthread/configure.in 2003-12-03 07:50:01.000000000 +0100
+++ glibc-2.10.1/nptl/sysdeps/pthread/configure.in 2009-11-13 00:50:43.000000000 +0100
@@ -28,6 +28,9 @@
struct _Unwind_Context *context;
_Unwind_GetCFA (context)],
libc_cv_forced_unwind=yes, libc_cv_forced_unwind=no)])
+if test $libc_cv_forced_unwind = no -a $build_cpu != $host_cpu; then
+ libc_cv_forced_unwind=yes
+fi
if test $libc_cv_forced_unwind = yes; then
AC_DEFINE(HAVE_FORCED_UNWIND)
dnl Check for C cleanup handling.
@@ -41,6 +44,9 @@
puts ("test")],
libc_cv_c_cleanup=yes, libc_cv_c_cleanup=no)])
CFLAGS="$old_CFLAGS"
+ if test $libc_cv_c_cleanup = no -a $build_cpu != $host_cpu; then
+ libc_cv_c_cleanup=yes
+ fi
if test $libc_cv_c_cleanup = no; then
AC_MSG_ERROR([the compiler must support C cleanup handling])
fi

View File

@ -0,0 +1,250 @@
http://sources.redhat.com/bugzilla/show_bug.cgi?id=1026
http://sourceware.org/ml/libc-alpha/2005-02/msg00122.html
2005-02-26 GOTO Masanori <gotom@debian.or.jp>
* sysdeps/unix/sysv/linux/kernel-features.h: Define
__ASSUME_STAT64_SYSCALL.
* sysdeps/unix/sysv/linux/alpha/fxstat.c: Check
__ASSUME_STAT64_SYSCALL.
* sysdeps/unix/sysv/linux/alpha/fxstatat.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/lxstat.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/xstat.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/xstatconv.c: Don't define
__libc_missing_axp_stat64 when it's not needed.
* sysdeps/unix/sysv/linux/alpha/xstatconv.h: Likewise.
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstat.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstat.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstat.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstat.c 2009-11-13 00:50:45.000000000 +0100
@@ -35,27 +35,39 @@
__fxstat (int vers, int fd, struct stat *buf)
{
INTERNAL_SYSCALL_DECL (err);
- int result, errno_out;
+ int result;
struct kernel_stat kbuf;
+#if __ASSUME_STAT64_SYSCALL > 0
+ if (vers == _STAT_VER_KERNEL64)
+ {
+ result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+ return -1;
+ }
+#elif defined __NR_fstat64
if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
{
+ int errno_out;
result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return result;
errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
if (errno_out != ENOSYS)
- goto fail;
+ {
+ __set_errno (errno_out);
+ return -1;
+ }
__libc_missing_axp_stat64 = 1;
}
+#endif
result = INTERNAL_SYSCALL (fstat, err, 2, fd, &kbuf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return __xstat_conv (vers, &kbuf, buf);
- errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
-
- fail:
- __set_errno (errno_out);
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
return -1;
}
hidden_def (__fxstat)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstatat.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstatat.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstatat.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/fxstatat.c 2009-11-13 00:50:45.000000000 +0100
@@ -65,6 +65,20 @@
int result, errno_out;
struct kernel_stat kst;
+#if __ASSUME_STAT64_SYSCALL > 0
+ if (vers == _STAT_VER_KERNEL64)
+ {
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ result = INTERNAL_SYSCALL (lstat64, err, 2, file, st);
+ else
+ result = INTERNAL_SYSCALL (stat64, err, 2, file, st);
+
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
+ goto fail;
+ }
+#elif defined __NR_stat64
if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
{
if (flag & AT_SYMLINK_NOFOLLOW)
@@ -79,6 +93,7 @@
goto fail;
__libc_missing_axp_stat64 = 1;
}
+#endif
if (flag & AT_SYMLINK_NOFOLLOW)
result = INTERNAL_SYSCALL (lstat, err, 2, file, &kst);
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/lxstat.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/lxstat.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/lxstat.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/lxstat.c 2009-11-13 00:50:45.000000000 +0100
@@ -35,27 +35,39 @@
__lxstat (int vers, const char *name, struct stat *buf)
{
INTERNAL_SYSCALL_DECL (err);
- int result, errno_out;
+ int result;
struct kernel_stat kbuf;
+#if __ASSUME_STAT64_SYSCALL > 0
+ if (vers == _STAT_VER_KERNEL64)
+ {
+ result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+ return -1;
+ }
+#elif defined __NR_lstat64
if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
{
+ int errno_out;
result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return result;
errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
if (errno_out != ENOSYS)
- goto fail;
+ {
+ __set_errno (errno_out);
+ return -1;
+ }
__libc_missing_axp_stat64 = 1;
}
+#endif
result = INTERNAL_SYSCALL (lstat, err, 2, name, &kbuf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return __xstat_conv (vers, &kbuf, buf);
- errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
-
- fail:
- __set_errno (errno_out);
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
return -1;
}
hidden_def (__lxstat)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstat.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstat.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstat.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstat.c 2009-11-13 00:50:45.000000000 +0100
@@ -35,27 +35,39 @@
__xstat (int vers, const char *name, struct stat *buf)
{
INTERNAL_SYSCALL_DECL (err);
- int result, errno_out;
+ int result;
struct kernel_stat kbuf;
+#if __ASSUME_STAT64_SYSCALL > 0
+ if (vers == _STAT_VER_KERNEL64)
+ {
+ result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
+ if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+ return result;
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+ return -1;
+ }
+#elif defined __NR_stat64
if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
{
+ int errno_out;
result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return result;
errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
if (errno_out != ENOSYS)
- goto fail;
+ {
+ __set_errno (errno_out);
+ return -1;
+ }
__libc_missing_axp_stat64 = 1;
}
+#endif
result = INTERNAL_SYSCALL (stat, err, 2, name, &kbuf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return __xstat_conv (vers, &kbuf, buf);
- errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
-
- fail:
- __set_errno (errno_out);
+ __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
return -1;
}
hidden_def (__xstat)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.c 2009-11-13 00:50:45.000000000 +0100
@@ -22,9 +22,14 @@
#include <sys/stat.h>
#include <kernel_stat.h>
#include <xstatconv.h>
+#include <sys/syscall.h>
+#ifdef __NR_stat64
+# if __ASSUME_STAT64_SYSCALL == 0
int __libc_missing_axp_stat64;
+# endif
+#endif
int
__xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/xstatconv.h 2009-11-13 00:50:45.000000000 +0100
@@ -18,7 +18,12 @@
02111-1307 USA. */
#include <kernel-features.h>
+#include <sys/syscall.h>
+#ifdef __NR_stat64
+# if __ASSUME_STAT64_SYSCALL == 0
extern int __libc_missing_axp_stat64 attribute_hidden;
+# endif
+#endif
extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
attribute_hidden;
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/fxstat.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/fxstat.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/fxstatat.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/fxstatat.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/lxstat.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/lxstat.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/xstat.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/xstat.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.h
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.10.1/sysdeps/unix/sysv/linux/kernel-features.h
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-05-09 08:54:20.000000000 +0200
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
@@ -395,6 +395,11 @@
# define __ASSUME_GETDENTS32_D_TYPE 1
#endif
+/* Starting with version 2.6.4, alpha stat64 syscalls are available. */
+#if __LINUX_KERNEL_VERSION >= 0x020604 && defined __alpha__
+# define __ASSUME_STAT64_SYSCALL 1
+#endif
+
/* Starting with version 2.5.3, the initial location returned by `brk'
after exec is always rounded up to the next page. */
#if __LINUX_KERNEL_VERSION >= 132355

View File

@ -0,0 +1,28 @@
2008-06-07 Mike Frysinger <vapier@gentoo.org>
* sysdeps/unix/sysv/linux/alpha/sys/user.h: Copy page.h definitions
from the kernel header to sys/user.h and remove the #include of
sys/user.h.
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/user.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/user.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/user.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/user.h 2009-11-13 00:50:47.000000000 +0100
@@ -23,7 +23,6 @@
only. Don't read too much into it. Don't use it for anything other
than gdb/strace unless you know what you are doing. */
-#include <asm/page.h>
#include <asm/reg.h>
struct user
@@ -41,6 +40,9 @@
char u_comm[32]; /* user command name */
};
+#define PAGE_SHIFT 13
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE-1))
#define NBPG PAGE_SIZE
#define UPAGES 1
#define HOST_TEXT_START_ADDR (u.start_code)
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/sys/user.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/sys/user.h

View File

@ -0,0 +1,34 @@
2007-03-13 Mike Frysinger <vapier@gentoo.org>
* sysdeps/unix/sysv/linux/alpha/sys/procfs.h: Copy some defines
from alpha's asm/elf.h
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/procfs.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/procfs.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sys/procfs.h 2009-11-13 00:50:49.000000000 +0100
@@ -29,10 +29,23 @@
#include <sys/types.h>
#include <sys/ucontext.h>
#include <sys/user.h>
-#include <asm/elf.h>
__BEGIN_DECLS
+/*
+ * The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
+ * I have no idea why that is so. For now, we just leave it at 33
+ * (32 general regs + processor status word).
+ */
+#define ELF_NGREG 33
+#define ELF_NFPREG 32
+
+typedef unsigned long elf_greg_t;
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+typedef double elf_fpreg_t;
+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
+
struct elf_siginfo
{
int si_signo; /* Signal number. */
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/sys/procfs.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/sys/procfs.h

View File

@ -0,0 +1,14 @@
alpha does not have a __NR_creat
http://bugs.gentoo.org/227275
http://sourceware.org/bugzilla/show_bug.cgi?id=6650
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c glibc-2.10.1/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2007-11-10 20:34:26.000000000 +0100
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/wordsize-64/creat64.c 2009-11-13 00:50:51.000000000 +0100
@@ -1 +1,5 @@
/* Defined as alias for the syscall. */
+#include <sysdep.h>
+#ifndef __NR_creat
+#include "../../../../../io/creat64.c"
+#endif

View File

@ -0,0 +1,14 @@
older verisons of glibc would build dl-sysdep as shared-only and dl-support as
static-only. alpha hooks in a cache variable via dl-auxv.h. newer versions of
glibc build dl-sysdep as both shared and static which means we now have symbol
duplication for static builds with dl-sysdep and dl-support. since dl-sysdep
is both shared/static, there is no point in hooking dl-support anymore, so we
can punt it.
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/dl-support.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/dl-support.c 2009-11-13 00:50:53.000000000 +0100
@@ -1,2 +0,0 @@
-#include "dl-auxv.h"
-#include <elf/dl-support.c>
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/dl-support.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/dl-support.c

View File

@ -0,0 +1,111 @@
http://bugs.gentoo.org/201910
For every arch, PTR_MANGLE and PTR_DEMANGLE defines are in
sysdeps/unix/sysv/linux/<arch>/sysdep.h. But for alpha this is not true. The
defines are in sysdeps/unix/alpha/sysdep.h and unix/sysv/linux/alpha/sysdep.h
includes the first.
This is a patch that fixes the issue and let alpha build, at the expense of
disabling MANGLING in the non PIC case, but googling showed that the issue is
known, and that nobody really cares about it.
Info from: http://sourceware.org/bugzilla/show_bug.cgi?id=5216
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/alpha/sysdep.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/alpha/sysdep.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/alpha/sysdep.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/alpha/sysdep.h 2009-11-13 00:50:55.000000000 +0100
@@ -397,42 +397,4 @@
_sc_ret = _sc_0, _sc_err = _sc_19; \
}
-/* Pointer mangling support. Note that tls access is slow enough that
- we don't deoptimize things by placing the pointer check value there. */
-
-#include <stdint.h>
-
-#if defined NOT_IN_libc && defined IS_IN_rtld
-# ifdef __ASSEMBLER__
-# define PTR_MANGLE(dst, src, tmp) \
- ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
- ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
- xor src, tmp, dst
-# define PTR_MANGLE2(dst, src, tmp) \
- xor src, tmp, dst
-# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
-# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
-# else
-extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
-# define PTR_MANGLE(var) \
- (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
-# define PTR_DEMANGLE(var) PTR_MANGLE(var)
-# endif
-#elif defined PIC
-# ifdef __ASSEMBLER__
-# define PTR_MANGLE(dst, src, tmp) \
- ldq tmp, __pointer_chk_guard; \
- xor src, tmp, dst
-# define PTR_MANGLE2(dst, src, tmp) \
- xor src, tmp, dst
-# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
-# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
-# else
-extern uintptr_t __pointer_chk_guard attribute_relro;
-# define PTR_MANGLE(var) \
- (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
-# define PTR_DEMANGLE(var) PTR_MANGLE(var)
-# endif
-#endif
-
#endif /* ASSEMBLER */
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysdep.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysdep.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysdep.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysdep.h 2009-11-13 00:50:55.000000000 +0100
@@ -98,4 +98,46 @@
INTERNAL_SYSCALL1(name, err_out, nr, args); \
})
+/* Pointer mangling support. Note that tls access is slow enough that
+ we don't deoptimize things by placing the pointer check value there. */
+
+#if defined NOT_IN_libc && defined IS_IN_rtld
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(dst, src, tmp) \
+ ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
+ ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
+ xor src, tmp, dst
+# define PTR_MANGLE2(dst, src, tmp) \
+ xor src, tmp, dst
+# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
+# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
+# else
+extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
+# define PTR_MANGLE(var) \
+ (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
+# define PTR_DEMANGLE(var) PTR_MANGLE(var)
+# endif
+#elif defined PIC
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(dst, src, tmp) \
+ ldq tmp, __pointer_chk_guard; \
+ xor src, tmp, dst
+# define PTR_MANGLE2(dst, src, tmp) \
+ xor src, tmp, dst
+# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
+# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
+# else
+extern uintptr_t __pointer_chk_guard attribute_relro;
+# define PTR_MANGLE(var) \
+ (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
+# define PTR_DEMANGLE(var) PTR_MANGLE(var)
+# endif
+#else
+/* Pointer mangling is not yet supported for static libc on alpha. */
+# ifndef __ASSEMBLER__
+# define PTR_MANGLE(var) (void) (var)
+# define PTR_DEMANGLE(var) (void) (var)
+# endif
+#endif
+
#endif /* _LINUX_ALPHA_SYSDEP_H */
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/alpha/sysdep.h glibc-2.10.1/ports/sysdeps/unix/alpha/sysdep.h
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/sysdep.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/sysdep.h

View File

@ -0,0 +1,56 @@
2006-05-30 Falk Hueffner <falk@debian.org>
* sysdeps/unix/sysv/linux/alpha/ioperm.c: force the architecture
to ev6 in assembly code.
{standard input}: Assembler messages:
{standard input}:341: Error: macro requires $at register while noat in effect
{standard input}:374: Error: macro requires $at register while noat in effect
{standard input}:438: Error: macro requires $at register while noat in effect
{standard input}:471: Error: macro requires $at register while noat in effect
make[3]: *** [/tmp/buildd/glibc-2.3.6/build-tree/alpha-libc/misc/ioperm.o] Error 1
Hrm. gcc puts .arch ev4 into the .s, and this overrides -mev6 for as.
I cannot really think of anything better than
ports/sysdeps/unix/sysv/linux/alpha/ioperm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/ioperm.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/ioperm.c 2009-11-13 00:50:57.000000000 +0100
@@ -178,13 +178,13 @@
static inline void
stb_mb(unsigned char val, unsigned long addr)
{
- __asm__("stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
+ __asm__(".arch ev6; stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val));
}
static inline void
stw_mb(unsigned short val, unsigned long addr)
{
- __asm__("stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
+ __asm__(".arch ev6; stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val));
}
static inline void
@@ -356,7 +356,7 @@
unsigned long int addr = dense_port_to_cpu_addr (port);
unsigned char r;
- __asm__ ("ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
+ __asm__ (".arch ev6; ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr));
return r;
}
@@ -366,7 +366,7 @@
unsigned long int addr = dense_port_to_cpu_addr (port);
unsigned short r;
- __asm__ ("ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
+ __asm__ (".arch ev6; ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr));
return r;
}
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c

View File

@ -0,0 +1,270 @@
http://sources.redhat.com/bugzilla/show_bug.cgi?id=5350
https://bugs.gentoo.org/264335
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceil.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceil.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceil.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceil.c 2009-11-13 00:50:59.000000000 +0100
@@ -27,20 +27,25 @@
double
__ceil (double x)
{
- double two52 = copysign (0x1.0p52, x);
- double r, tmp;
-
- __asm (
+ if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */
+ {
+ double tmp1, new_x;
+
+ new_x = -x;
+ __asm (
#ifdef _IEEE_FP_INEXACT
- "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0"
+ "cvttq/svim %2,%1\n\t"
#else
- "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0"
+ "cvttq/svm %2,%1\n\t"
#endif
- : "=&f"(r), "=&f"(tmp)
- : "f"(-x), "f"(-two52));
+ "cvtqt/m %1,%0\n\t"
+ : "=f"(new_x), "=&f"(tmp1)
+ : "f"(new_x));
- /* Fix up the negation we did above, as well as handling -0 properly. */
- return copysign (r, x);
+ /* Fix up the negation we did above, as well as handling -0 properly. */
+ x = copysign(new_x, x);
+ }
+ return x;
}
weak_alias (__ceil, ceil)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceilf.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceilf.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceilf.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceilf.c 2009-11-13 00:50:59.000000000 +0100
@@ -26,20 +26,30 @@
float
__ceilf (float x)
{
- float two23 = copysignf (0x1.0p23, x);
- float r, tmp;
-
- __asm (
+ if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */
+ {
+ /* Note that Alpha S_Floating is stored in registers in a
+ restricted T_Floating format, so we don't even need to
+ convert back to S_Floating in the end. The initial
+ conversion to T_Floating is needed to handle denormals. */
+
+ float tmp1, tmp2, new_x;
+
+ new_x = -x;
+ __asm ("cvtst/s %3,%2\n\t"
#ifdef _IEEE_FP_INEXACT
- "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0"
+ "cvttq/svim %2,%1\n\t"
#else
- "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0"
+ "cvttq/svm %2,%1\n\t"
#endif
- : "=&f"(r), "=&f"(tmp)
- : "f"(-x), "f"(-two23));
+ "cvtqt/m %1,%0\n\t"
+ : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
+ : "f"(new_x));
- /* Fix up the negation we did above, as well as handling -0 properly. */
- return copysignf (r, x);
+ /* Fix up the negation we did above, as well as handling -0 properly. */
+ x = copysignf(new_x, x);
+ }
+ return x;
}
weak_alias (__ceilf, ceilf)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floor.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floor.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floor.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floor.c 2009-11-13 00:50:59.000000000 +0100
@@ -21,26 +21,32 @@
#include <math_ldbl_opt.h>
-/* Use the -inf rounding mode conversion instructions to implement floor. */
+/* Use the -inf rounding mode conversion instructions to implement
+ floor. We note when the exponent is large enough that the value
+ must be integral, as this avoids unpleasant integer overflows. */
double
__floor (double x)
{
- double two52 = copysign (0x1.0p52, x);
- double r, tmp;
-
- __asm (
+ if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */
+ {
+ double tmp1, new_x;
+
+ __asm (
#ifdef _IEEE_FP_INEXACT
- "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0"
+ "cvttq/svim %2,%1\n\t"
#else
- "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0"
+ "cvttq/svm %2,%1\n\t"
#endif
- : "=&f"(r), "=&f"(tmp)
- : "f"(x), "f"(two52));
+ "cvtqt/m %1,%0\n\t"
+ : "=f"(new_x), "=&f"(tmp1)
+ : "f"(x));
- /* floor(-0) == -0, and in general we'll always have the same
- sign as our input. */
- return copysign (r, x);
+ /* floor(-0) == -0, and in general we'll always have the same
+ sign as our input. */
+ x = copysign(new_x, x);
+ }
+ return x;
}
weak_alias (__floor, floor)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floorf.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floorf.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floorf.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floorf.c 2009-11-13 00:50:59.000000000 +0100
@@ -20,26 +20,37 @@
#include <math.h>
-/* Use the -inf rounding mode conversion instructions to implement floor. */
+/* Use the -inf rounding mode conversion instructions to implement
+ floor. We note when the exponent is large enough that the value
+ must be integral, as this avoids unpleasant integer overflows. */
float
__floorf (float x)
{
- float two23 = copysignf (0x1.0p23, x);
- float r, tmp;
-
- __asm (
+ if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */
+ {
+ /* Note that Alpha S_Floating is stored in registers in a
+ restricted T_Floating format, so we don't even need to
+ convert back to S_Floating in the end. The initial
+ conversion to T_Floating is needed to handle denormals. */
+
+ float tmp1, tmp2, new_x;
+
+ __asm ("cvtst/s %3,%2\n\t"
#ifdef _IEEE_FP_INEXACT
- "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0"
+ "cvttq/svim %2,%1\n\t"
#else
- "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0"
+ "cvttq/svm %2,%1\n\t"
#endif
- : "=&f"(r), "=&f"(tmp)
- : "f"(x), "f"(two23));
+ "cvtqt/m %1,%0\n\t"
+ : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
+ : "f"(x));
- /* floor(-0) == -0, and in general we'll always have the same
- sign as our input. */
- return copysignf (r, x);
+ /* floor(-0) == -0, and in general we'll always have the same
+ sign as our input. */
+ x = copysignf(new_x, x);
+ }
+ return x;
}
weak_alias (__floorf, floorf)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rint.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rint.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rint.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rint.c 2009-11-13 00:50:59.000000000 +0100
@@ -24,15 +24,24 @@
double
__rint (double x)
{
- double two52 = copysign (0x1.0p52, x);
- double r;
-
- r = x + two52;
- r = r - two52;
+ if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */
+ {
+ double tmp1, new_x;
+ __asm (
+#ifdef _IEEE_FP_INEXACT
+ "cvttq/svid %2,%1\n\t"
+#else
+ "cvttq/svd %2,%1\n\t"
+#endif
+ "cvtqt/d %1,%0\n\t"
+ : "=f"(new_x), "=&f"(tmp1)
+ : "f"(x));
- /* rint(-0.1) == -0, and in general we'll always have the same sign
- as our input. */
- return copysign (r, x);
+ /* rint(-0.1) == -0, and in general we'll always have the same
+ sign as our input. */
+ x = copysign(new_x, x);
+ }
+ return x;
}
weak_alias (__rint, rint)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rintf.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rintf.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rintf.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rintf.c 2009-11-13 00:50:59.000000000 +0100
@@ -23,15 +23,30 @@
float
__rintf (float x)
{
- float two23 = copysignf (0x1.0p23, x);
- float r;
+ if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */
+ {
+ /* Note that Alpha S_Floating is stored in registers in a
+ restricted T_Floating format, so we don't even need to
+ convert back to S_Floating in the end. The initial
+ conversion to T_Floating is needed to handle denormals. */
- r = x + two23;
- r = r - two23;
+ float tmp1, tmp2, new_x;
- /* rint(-0.1) == -0, and in general we'll always have the same sign
- as our input. */
- return copysign (r, x);
+ __asm ("cvtst/s %3,%2\n\t"
+#ifdef _IEEE_FP_INEXACT
+ "cvttq/svid %2,%1\n\t"
+#else
+ "cvttq/svd %2,%1\n\t"
+#endif
+ "cvtqt/d %1,%0\n\t"
+ : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
+ : "f"(x));
+
+ /* rint(-0.1) == -0, and in general we'll always have the same
+ sign as our input. */
+ x = copysignf(new_x, x);
+ }
+ return x;
}
weak_alias (__rintf, rintf)
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_ceil.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_ceil.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_ceilf.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_ceilf.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_floor.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_floor.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_floorf.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_floorf.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_rint.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_rint.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_rintf.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_rintf.c

View File

@ -0,0 +1,170 @@
ports/sysdeps/alpha/dl-machine.h | 12 ++++++
ports/sysdeps/alpha/dl-procinfo.c | 64 +++++++++++++++++++++++++++++++++++
ports/sysdeps/alpha/dl-procinfo.h | 68 ++++++++++++++++++++++++++++++++++++++
3 files changed, 144 insertions(+)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-machine.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-machine.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-machine.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-machine.h 2009-11-13 00:51:02.000000000 +0100
@@ -249,6 +249,18 @@
/* The alpha never uses Elf64_Rel relocations. */
#define ELF_MACHINE_NO_REL 1
+/* We define an initialization functions. This is called very early in
+ * _dl_sysdep_start. */
+#define DL_PLATFORM_INIT dl_platform_init ()
+
+static inline void __attribute__ ((unused))
+dl_platform_init (void)
+{
+ if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0')
+ /* Avoid an empty string which would disturb us. */
+ GLRO(dl_platform) = NULL;
+}
+
/* Fix up the instructions of a PLT entry to invoke the function
rather than the dynamic linker. */
static inline Elf64_Addr
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.c 1970-01-01 01:00:00.000000000 +0100
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.c 2009-11-13 00:51:02.000000000 +0100
@@ -0,0 +1,64 @@
+/* Data for Alpha version of processor capability information.
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aurelien Jarno <aurelien@aurel32.net>, 2007.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This information must be kept in sync with the _DL_PLATFORM_COUNT
+ definitions in procinfo.h.
+
+ If anything should be added here check whether the size of each string
+ is still ok with the given array size.
+
+ All the #ifdefs in the definitions are quite irritating but
+ necessary if we want to avoid duplicating the information. There
+ are three different modes:
+
+ - PROCINFO_DECL is defined. This means we are only interested in
+ declarations.
+
+ - PROCINFO_DECL is not defined:
+
+ + if SHARED is defined the file is included in an array
+ initializer. The .element = { ... } syntax is needed.
+
+ + if SHARED is not defined a normal array initialization is
+ needed.
+ */
+
+#ifndef PROCINFO_CLASS
+#define PROCINFO_CLASS
+#endif
+
+#if !defined PROCINFO_DECL && defined SHARED
+ ._dl_alpha_platforms
+#else
+PROCINFO_CLASS const char _dl_alpha_platforms[5][5]
+#endif
+#ifndef PROCINFO_DECL
+= {
+ "ev4", "ev5", "ev56", "ev6", "ev67"
+ }
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
+#undef PROCINFO_DECL
+#undef PROCINFO_CLASS
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.h 1970-01-01 01:00:00.000000000 +0100
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/dl-procinfo.h 2009-11-13 00:51:02.000000000 +0100
@@ -0,0 +1,68 @@
+/* Alpha version of processor capability information handling macros.
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aurelien Jarno <aurelien@aurel32.net>, 2007.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _DL_PROCINFO_H
+#define _DL_PROCINFO_H 1
+
+#include <ldsodefs.h>
+
+
+/* Mask to filter out platforms. */
+#define _DL_HWCAP_PLATFORM (-1ULL)
+
+#define _DL_PLATFORMS_COUNT 5
+
+static inline const char *
+__attribute__ ((unused))
+_dl_platform_string (int idx)
+{
+ return GLRO(dl_alpha_platforms)[idx];
+};
+
+static inline int
+__attribute__ ((unused, always_inline))
+_dl_string_platform (const char *str)
+{
+ int i;
+
+ if (str != NULL)
+ for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
+ {
+ if (strcmp (str, _dl_platform_string (i)) == 0)
+ return i;
+ }
+ return -1;
+};
+
+/* We cannot provide a general printing function. */
+#define _dl_procinfo(word) -1
+
+/* There are no hardware capabilities defined. */
+#define _dl_hwcap_string(idx) ""
+
+/* By default there is no important hardware capability. */
+#define HWCAP_IMPORTANT (0)
+
+/* We don't have any hardware capabilities. */
+#define _DL_HWCAP_COUNT 0
+
+#define _dl_string_hwcap(str) (-1)
+
+#endif /* dl-procinfo.h */
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/dl-machine.h glibc-2.10.1/ports/sysdeps/alpha/dl-machine.h
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/dl-procinfo.c glibc-2.10.1/ports/sysdeps/alpha/dl-procinfo.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/dl-procinfo.h glibc-2.10.1/ports/sysdeps/alpha/dl-procinfo.h

View File

@ -0,0 +1,126 @@
2009-07-25 Aurelien Jarno <aurelien@aurel32.net>
* sysdeps/unix/sysv/linux/kernel-features.h: define
__ASSUME_FDATASYNC.
* sysdeps/unix/sysv/linux/fdatasync.c: New file.
* sysdeps/unix/sysv/linux/Makefile: compile fdatasync.c with
-fexceptions.
* sysdeps/unix/sysv/linux/syscalls.list: Remove fdatasync.
sysdeps/unix/sysv/linux/Makefile | 1
sysdeps/unix/sysv/linux/fdatasync.c | 69 ++++++++++++++++++++++++++++++
sysdeps/unix/sysv/linux/kernel-features.h | 6 ++
sysdeps/unix/sysv/linux/syscalls.list | 1
4 files changed, 76 insertions(+), 1 deletion(-)
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/Makefile glibc-2.10.1/sysdeps/unix/sysv/linux/Makefile
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/Makefile 2009-03-02 17:15:13.000000000 +0100
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/Makefile 2009-11-13 00:51:04.000000000 +0100
@@ -16,6 +16,7 @@
setfsuid setfsgid makedev epoll_pwait signalfd \
eventfd eventfd_read eventfd_write
+CFLAGS-fdatasync.c = -fexceptions
CFLAGS-gethostid.c = -fexceptions
sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/fdatasync.c glibc-2.10.1/sysdeps/unix/sysv/linux/fdatasync.c
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/fdatasync.c 1970-01-01 01:00:00.000000000 +0100
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/fdatasync.c 2009-11-13 00:51:04.000000000 +0100
@@ -0,0 +1,69 @@
+/* fdatasync -- synchronize at least the data part of a file with
+ the underlying media. Linux version.
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#if defined __NR_fdatasync && !defined __ASSUME_FDATASYNC
+static int __have_no_fdatasync;
+#endif
+
+static int
+do_fdatasync (int fd)
+{
+#ifdef __ASSUME_FDATASYNC
+ return INLINE_SYSCALL (fdatasync, 1, fd);
+#elif defined __NR_fdatasync
+ if (!__builtin_expect (__have_no_fdatasync, 0))
+ {
+ int result = INLINE_SYSCALL (fdatasync, 1, fd);
+ if (__builtin_expect (result, 0) != -1 || errno != ENOSYS)
+ return result;
+
+ __have_no_fdatasync = 1;
+ }
+#endif
+ return INLINE_SYSCALL (fsync, 1, fd);
+}
+
+int
+__fdatasync (int fd)
+{
+ if (SINGLE_THREAD_P)
+ return do_fdatasync (fd);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int result = do_fdatasync (fd);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+
+weak_alias (__fdatasync, fdatasync)
+
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/kernel-features.h glibc-2.10.1/sysdeps/unix/sysv/linux/kernel-features.h
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:50:45.000000000 +0100
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/kernel-features.h 2009-11-13 00:51:04.000000000 +0100
@@ -479,6 +479,12 @@
# define __ASSUME_FUTEX_LOCK_PI 1
#endif
+/* Support for fsyncdata syscall was added in 2.6.22 on alpha, but it
+ was already present in 2.0 kernels on other architectures. */
+#if (!defined __alpha || __LINUX_KERNEL_VERSION >= 0x020616)
+# define __ASSUME_FDATASYNC 1
+#endif
+
/* Support for utimensat syscall was added in 2.6.22, on alpha and s390
only after 2.6.22-rc1. */
#if __LINUX_KERNEL_VERSION >= 0x020616 \
diff -durN glibc-2.10.1.orig/sysdeps/unix/sysv/linux/syscalls.list glibc-2.10.1/sysdeps/unix/sysv/linux/syscalls.list
--- glibc-2.10.1.orig/sysdeps/unix/sysv/linux/syscalls.list 2008-08-02 01:29:08.000000000 +0200
+++ glibc-2.10.1/sysdeps/unix/sysv/linux/syscalls.list 2009-11-13 00:51:04.000000000 +0100
@@ -11,7 +11,6 @@
epoll_create1 EXTRA epoll_create1 i:i epoll_create1
epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl
epoll_wait EXTRA epoll_wait Ci:ipii epoll_wait
-fdatasync - fdatasync Ci:i fdatasync
flock - flock i:ii __flock flock
fork - fork i: __libc_fork __fork fork
get_kernel_syms EXTRA get_kernel_syms i:p get_kernel_syms

View File

@ -0,0 +1,31 @@
2009-05-16 Aurelien Jarno <aurelien@aurel32.net>
* sysdeps/unix/sysv/linux/alpha/getsysstats.c (GET_NPROCS_PARSER):
Change parameters and use next_line.
ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getsysstats.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getsysstats.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getsysstats.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getsysstats.c 2009-11-13 00:51:07.000000000 +0100
@@ -20,15 +20,16 @@
/* We need to define a special parser for /proc/cpuinfo. */
-#define GET_NPROCS_PARSER(FP, BUFFER, RESULT) \
+#define GET_NPROCS_PARSER(FD, BUFFER, CP, RE, BUFFER_END, RESULT) \
do \
{ \
/* Find the line that contains the information about the number of \
active cpus. We don't have to fear extremely long lines since \
the kernel will not generate them. 8192 bytes are really enough. \
If there is no "CPUs ..." line then we are on a UP system. */ \
+ char *l; \
(RESULT) = 1; \
- while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL) \
+ while ((l = next_line (FD, BUFFER, &CP, &RE, BUFFER_END)) != NULL) \
if ((sscanf (BUFFER, "cpus active : %d", &(RESULT)) == 1) \
|| (sscanf (BUFFER, "CPUs probed %*d active %d", \
&(RESULT)) == 1)) \
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c

View File

@ -0,0 +1,95 @@
2009-05-15 Aurelien Jarno <aurelien@aurel32.net>
* sysdeps/unix/sysv/linux/alpha/getdents64.c: Adjust include path.
* sysdeps/unix/sysv/linux/alpha/nptl/fork.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/sysconf.c: Likewise.
ports/sysdeps/unix/sysv/linux/alpha/getdents64.c | 2 +-
ports/sysdeps/unix/sysv/linux/alpha/nptl/fork.c | 2 +-
ports/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c | 2 +-
ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c | 2 +-
ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c | 2 +-
ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c | 2 +-
ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c | 2 +-
ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c | 2 +-
ports/sysdeps/unix/sysv/linux/alpha/sysconf.c | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getdents64.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getdents64.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getdents64.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/getdents64.c 2009-11-13 00:51:08.000000000 +0100
@@ -1 +1 @@
-#include "../getdents64.c"
+#include <sysdeps/unix/sysv/linux/getdents64.c>
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/fork.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/fork.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/fork.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/fork.c 2009-11-13 00:51:08.000000000 +0100
@@ -27,4 +27,4 @@
CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, \
NULL, NULL, &THREAD_SELF->tid, NULL)
-#include "../fork.c"
+#include <sysdeps/unix/sysv/linux/fork.c>
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c 2009-11-13 00:51:08.000000000 +0100
@@ -2,4 +2,4 @@
the acquire/release semantics of atomic_exchange_and_add. And even if
we don't do this, we should be using atomic_full_barrier or otherwise. */
#define __lll_rel_instr "mb"
-#include "../sem_post.c"
+#include <nptl/sysdeps/unix/sysv/linux/sem_post.c>
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c 2009-11-13 00:51:08.000000000 +0100
@@ -1 +1 @@
-#include "../x86_64/timer_create.c"
+#include <nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c>
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c 2009-11-13 00:51:08.000000000 +0100
@@ -1 +1 @@
-#include "../x86_64/timer_delete.c"
+#include <nptl/sysdeps/unix/sysv/linux/x86_64/timer_delete.c>
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c 2009-11-13 00:51:08.000000000 +0100
@@ -1 +1 @@
-#include "../x86_64/timer_getoverr.c"
+#include <nptl/sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c>
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c 2009-11-13 00:51:08.000000000 +0100
@@ -1 +1 @@
-#include "../x86_64/timer_gettime.c"
+#include <nptl/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c>
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c 2009-11-13 00:51:08.000000000 +0100
@@ -1 +1 @@
-#include "../x86_64/timer_settime.c"
+#include <nptl/sysdeps/unix/sysv/linux/x86_64/timer_settime.c>
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysconf.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysconf.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysconf.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/sysconf.c 2009-11-13 00:51:08.000000000 +0100
@@ -149,4 +149,4 @@
/* Now the generic Linux version. */
#undef __sysconf
#define __sysconf static linux_sysconf
-#include "../sysconf.c"
+#include <sysdeps/unix/sysv/linux/sysconf.c>
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/getdents64.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/getdents64.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/fork.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/fork.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/sysconf.c glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/sysconf.c

View File

@ -0,0 +1,26 @@
2009-05-19 Aurelien Jarno <aurelien@aurel32.net>
* sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h: Define
FUTEX_WAIT_BITSET, FUTEX_WAKE_BITSET, FUTEX_CLOCK_REALTIME and
FUTEX_BITSET_MATCH_ANY.
ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h | 5 +++++
1 file changed, 5 insertions(+)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h 2009-11-13 00:51:11.000000000 +0100
@@ -37,7 +37,12 @@
#define FUTEX_LOCK_PI 6
#define FUTEX_UNLOCK_PI 7
#define FUTEX_TRYLOCK_PI 8
+#define FUTEX_WAIT_BITSET 9
+#define FUTEX_WAKE_BITSET 10
#define FUTEX_PRIVATE_FLAG 128
+#define FUTEX_CLOCK_REALTIME 256
+
+#define FUTEX_BITSET_MATCH_ANY 0xffffffff
/* Values for 'private' parameter of locking macros. Yes, the
definition seems to be backwards. But it is not. The bit will be
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h

View File

@ -0,0 +1,21 @@
2009-05-26 Aurelien Jarno <aurelien@aurel32.net>
* sysdeps/alpha/Makefile (CFLAGS-rtld.c): add $(PIC-ccflag).
ports/sysdeps/alpha/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/Makefile glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/Makefile
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/Makefile 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/Makefile 2009-11-13 00:51:13.000000000 +0100
@@ -35,7 +35,8 @@
ifeq ($(subdir),elf)
# The ld.so startup code cannot use literals until it self-relocates.
-CFLAGS-rtld.c = -mbuild-constants
+# It uses more than 64k for the small data area.
+CFLAGS-rtld.c = -mbuild-constants $(PIC-ccflag)
endif
# Build everything with full IEEE math support, and with dynamic rounding;
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/Makefile glibc-2.10.1/ports/sysdeps/alpha/Makefile

View File

@ -0,0 +1,121 @@
2009-07-27 Aurelien Jarno <aurelien@aurel32.net>
* sysdeps/alpha/memchr.S: Use prefetch load.
* sysdeps/alpha/alphaev6/memchr.S: Likewise.
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/alphaev6/memchr.S glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/alphaev6/memchr.S
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/alphaev6/memchr.S 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/alphaev6/memchr.S 2009-11-13 00:51:15.000000000 +0100
@@ -127,7 +127,7 @@
cmpbge $31, $1, $2 # E :
bne $2, $found_it # U :
# At least one byte left to process.
- ldq $1, 8($0) # L :
+ ldq $31, 8($0) # L :
subq $5, 1, $18 # E : U L U L
addq $0, 8, $0 # E :
@@ -143,38 +143,38 @@
and $4, 8, $4 # E : odd number of quads?
bne $4, $odd_quad_count # U :
# At least three quads remain to be accessed
- mov $1, $4 # E : L U L U : move prefetched value to correct reg
+ nop # E : L U L U : move prefetched value to correct reg
.align 4
$unrolled_loop:
- ldq $1, 8($0) # L : prefetch $1
- xor $17, $4, $2 # E :
- cmpbge $31, $2, $2 # E :
- bne $2, $found_it # U : U L U L
+ ldq $1, 0($0) # L : load quad
+ xor $17, $1, $2 # E :
+ ldq $31, 8($0) # L : prefetch next quad
+ cmpbge $31, $2, $2 # E : U L U L
+ bne $2, $found_it # U :
addq $0, 8, $0 # E :
nop # E :
nop # E :
- nop # E :
$odd_quad_count:
+ ldq $1, 0($0) # L : load quad
xor $17, $1, $2 # E :
- ldq $4, 8($0) # L : prefetch $4
+ ldq $31, 8($0) # L : prefetch $4
cmpbge $31, $2, $2 # E :
- addq $0, 8, $6 # E :
+ addq $0, 8, $6 # E :
bne $2, $found_it # U :
cmpult $6, $18, $6 # E :
addq $0, 8, $0 # E :
- nop # E :
bne $6, $unrolled_loop # U :
- mov $4, $1 # E : move prefetched value into $1
nop # E :
nop # E :
-
-$final: subq $5, $0, $18 # E : $18 <- number of bytes left to do
nop # E :
+
+$final: ldq $1, 0($0) # L : load last quad
+ subq $5, $0, $18 # E : $18 <- number of bytes left to do
nop # E :
bne $18, $last_quad # U :
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/memchr.S glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/memchr.S
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/memchr.S 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/memchr.S 2009-11-13 00:51:15.000000000 +0100
@@ -119,7 +119,7 @@
# At least one byte left to process.
- ldq t0, 8(v0) # e0 :
+ ldq zero, 8(v0) # e0 : prefetch next quad
subq t4, 1, a2 # .. e1 :
addq v0, 8, v0 #-e0 :
@@ -138,19 +138,19 @@
# At least three quads remain to be accessed
- mov t0, t3 # e0 : move prefetched value to correct reg
-
.align 4
$unrolled_loop:
- ldq t0, 8(v0) #-e0 : prefetch t0
- xor a1, t3, t1 # .. e1 :
- cmpbge zero, t1, t1 # e0 :
- bne t1, $found_it # .. e1 :
+ ldq t0, 0(v0) # e0 : load quad
+ xor a1, t0, t1 # .. e1 :
+ ldq zero, 8(v0) # e0 : prefetch next quad
+ cmpbge zero, t1, t1 # .. e1:
+ bne t1, $found_it # e0 :
- addq v0, 8, v0 #-e0 :
+ addq v0, 8, v0 # e1 :
$odd_quad_count:
+ ldq t0, 0(v0) # e0 : load quad
xor a1, t0, t1 # .. e1 :
- ldq t3, 8(v0) # e0 : prefetch t3
+ ldq zero, 8(v0) # e0 : prefetch next quad
cmpbge zero, t1, t1 # .. e1 :
addq v0, 8, t5 #-e0 :
bne t1, $found_it # .. e1 :
@@ -159,8 +159,8 @@
addq v0, 8, v0 # .. e1 :
bne t5, $unrolled_loop #-e1 :
- mov t3, t0 # e0 : move prefetched value into t0
-$final: subq t4, v0, a2 # .. e1 : a2 <- number of bytes left to do
+$final: ldq t0, 0(v0) # e0 : load last quad
+ subq t4, v0, a2 # .. e1 : a2 <- number of bytes left to do
bne a2, $last_quad # e1 :
$not_found:
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/alphaev6/memchr.S glibc-2.10.1/ports/sysdeps/alpha/alphaev6/memchr.S
diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/memchr.S glibc-2.10.1/ports/sysdeps/alpha/memchr.S

View File

@ -0,0 +1,417 @@
2009-08-16 Aurelien Jarno <aurelien@aurel32.net>
* ports/sysdeps/unix/sysv/linux/alpha/bits/socket.h: New file based on
the generic version, with SOCK_NONBLOCK matching the kernel value.
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/bits/socket.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/bits/socket.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/bits/socket.h 1970-01-01 01:00:00.000000000 +0100
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/alpha/bits/socket.h 2009-11-13 00:51:17.000000000 +0100
@@ -0,0 +1,407 @@
+/* System-specific socket constants and types. Linux version.
+ Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008, 2009
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef __BITS_SOCKET_H
+#define __BITS_SOCKET_H
+
+#ifndef _SYS_SOCKET_H
+# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+#endif
+
+#define __need_size_t
+#include <stddef.h>
+
+#include <sys/types.h>
+
+/* Type for length arguments in socket calls. */
+#ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+# define __socklen_t_defined
+#endif
+
+/* Types of sockets. */
+enum __socket_type
+{
+ SOCK_STREAM = 1, /* Sequenced, reliable, connection-based
+ byte streams. */
+#define SOCK_STREAM SOCK_STREAM
+ SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams
+ of fixed maximum length. */
+#define SOCK_DGRAM SOCK_DGRAM
+ SOCK_RAW = 3, /* Raw protocol interface. */
+#define SOCK_RAW SOCK_RAW
+ SOCK_RDM = 4, /* Reliably-delivered messages. */
+#define SOCK_RDM SOCK_RDM
+ SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based,
+ datagrams of fixed maximum length. */
+#define SOCK_SEQPACKET SOCK_SEQPACKET
+ SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */
+#define SOCK_DCCP SOCK_DCCP
+ SOCK_PACKET = 10, /* Linux specific way of getting packets
+ at the dev level. For writing rarp and
+ other similar things on the user level. */
+#define SOCK_PACKET SOCK_PACKET
+
+ /* Flags to be ORed into the type parameter of socket and socketpair and
+ used for the flags parameter of paccept. */
+
+ SOCK_CLOEXEC = 02000000, /* Atomically set close-on-exec flag for the
+ new descriptor(s). */
+#define SOCK_CLOEXEC SOCK_CLOEXEC
+#undef SOCK_NONBLOCK
+ SOCK_NONBLOCK = 0x40000000 /* Atomically mark descriptor(s) as
+ non-blocking. */
+#define SOCK_NONBLOCK SOCK_NONBLOCK
+};
+
+/* Protocol families. */
+#define PF_UNSPEC 0 /* Unspecified. */
+#define PF_LOCAL 1 /* Local to host (pipes and file-domain). */
+#define PF_UNIX PF_LOCAL /* POSIX name for PF_LOCAL. */
+#define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */
+#define PF_INET 2 /* IP protocol family. */
+#define PF_AX25 3 /* Amateur Radio AX.25. */
+#define PF_IPX 4 /* Novell Internet Protocol. */
+#define PF_APPLETALK 5 /* Appletalk DDP. */
+#define PF_NETROM 6 /* Amateur radio NetROM. */
+#define PF_BRIDGE 7 /* Multiprotocol bridge. */
+#define PF_ATMPVC 8 /* ATM PVCs. */
+#define PF_X25 9 /* Reserved for X.25 project. */
+#define PF_INET6 10 /* IP version 6. */
+#define PF_ROSE 11 /* Amateur Radio X.25 PLP. */
+#define PF_DECnet 12 /* Reserved for DECnet project. */
+#define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */
+#define PF_SECURITY 14 /* Security callback pseudo AF. */
+#define PF_KEY 15 /* PF_KEY key management API. */
+#define PF_NETLINK 16
+#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */
+#define PF_PACKET 17 /* Packet family. */
+#define PF_ASH 18 /* Ash. */
+#define PF_ECONET 19 /* Acorn Econet. */
+#define PF_ATMSVC 20 /* ATM SVCs. */
+#define PF_RDS 21 /* RDS sockets. */
+#define PF_SNA 22 /* Linux SNA Project */
+#define PF_IRDA 23 /* IRDA sockets. */
+#define PF_PPPOX 24 /* PPPoX sockets. */
+#define PF_WANPIPE 25 /* Wanpipe API sockets. */
+#define PF_LLC 26 /* Linux LLC. */
+#define PF_CAN 29 /* Controller Area Network. */
+#define PF_TIPC 30 /* TIPC sockets. */
+#define PF_BLUETOOTH 31 /* Bluetooth sockets. */
+#define PF_IUCV 32 /* IUCV sockets. */
+#define PF_RXRPC 33 /* RxRPC sockets. */
+#define PF_ISDN 34 /* mISDN sockets. */
+#define PF_PHONET 35 /* Phonet sockets. */
+#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */
+#define PF_MAX 37 /* For now.. */
+
+/* Address families. */
+#define AF_UNSPEC PF_UNSPEC
+#define AF_LOCAL PF_LOCAL
+#define AF_UNIX PF_UNIX
+#define AF_FILE PF_FILE
+#define AF_INET PF_INET
+#define AF_AX25 PF_AX25
+#define AF_IPX PF_IPX
+#define AF_APPLETALK PF_APPLETALK
+#define AF_NETROM PF_NETROM
+#define AF_BRIDGE PF_BRIDGE
+#define AF_ATMPVC PF_ATMPVC
+#define AF_X25 PF_X25
+#define AF_INET6 PF_INET6
+#define AF_ROSE PF_ROSE
+#define AF_DECnet PF_DECnet
+#define AF_NETBEUI PF_NETBEUI
+#define AF_SECURITY PF_SECURITY
+#define AF_KEY PF_KEY
+#define AF_NETLINK PF_NETLINK
+#define AF_ROUTE PF_ROUTE
+#define AF_PACKET PF_PACKET
+#define AF_ASH PF_ASH
+#define AF_ECONET PF_ECONET
+#define AF_ATMSVC PF_ATMSVC
+#define AF_RDS PF_RDS
+#define AF_SNA PF_SNA
+#define AF_IRDA PF_IRDA
+#define AF_PPPOX PF_PPPOX
+#define AF_WANPIPE PF_WANPIPE
+#define AF_LLC PF_LLC
+#define AF_CAN PF_CAN
+#define AF_TIPC PF_TIPC
+#define AF_BLUETOOTH PF_BLUETOOTH
+#define AF_IUCV PF_IUCV
+#define AF_RXRPC PF_RXRPC
+#define AF_ISDN PF_ISDN
+#define AF_PHONET PF_PHONET
+#define AF_IEEE802154 PF_IEEE802154
+#define AF_MAX PF_MAX
+
+/* Socket level values. Others are defined in the appropriate headers.
+
+ XXX These definitions also should go into the appropriate headers as
+ far as they are available. */
+#define SOL_RAW 255
+#define SOL_DECNET 261
+#define SOL_X25 262
+#define SOL_PACKET 263
+#define SOL_ATM 264 /* ATM layer (cell level). */
+#define SOL_AAL 265 /* ATM Adaption Layer (packet level). */
+#define SOL_IRDA 266
+
+/* Maximum queue length specifiable by listen. */
+#define SOMAXCONN 128
+
+/* Get the definition of the macro to define the common sockaddr members. */
+#include <bits/sockaddr.h>
+
+/* Structure describing a generic socket address. */
+struct sockaddr
+ {
+ __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */
+ char sa_data[14]; /* Address data. */
+ };
+
+
+/* Structure large enough to hold any socket address (with the historical
+ exception of AF_UNIX). We reserve 128 bytes. */
+#define __ss_aligntype unsigned long int
+#define _SS_SIZE 128
+#define _SS_PADSIZE (_SS_SIZE - (2 * sizeof (__ss_aligntype)))
+
+struct sockaddr_storage
+ {
+ __SOCKADDR_COMMON (ss_); /* Address family, etc. */
+ __ss_aligntype __ss_align; /* Force desired alignment. */
+ char __ss_padding[_SS_PADSIZE];
+ };
+
+
+/* Bits in the FLAGS argument to `send', `recv', et al. */
+enum
+ {
+ MSG_OOB = 0x01, /* Process out-of-band data. */
+#define MSG_OOB MSG_OOB
+ MSG_PEEK = 0x02, /* Peek at incoming messages. */
+#define MSG_PEEK MSG_PEEK
+ MSG_DONTROUTE = 0x04, /* Don't use local routing. */
+#define MSG_DONTROUTE MSG_DONTROUTE
+#ifdef __USE_GNU
+ /* DECnet uses a different name. */
+ MSG_TRYHARD = MSG_DONTROUTE,
+# define MSG_TRYHARD MSG_DONTROUTE
+#endif
+ MSG_CTRUNC = 0x08, /* Control data lost before delivery. */
+#define MSG_CTRUNC MSG_CTRUNC
+ MSG_PROXY = 0x10, /* Supply or ask second address. */
+#define MSG_PROXY MSG_PROXY
+ MSG_TRUNC = 0x20,
+#define MSG_TRUNC MSG_TRUNC
+ MSG_DONTWAIT = 0x40, /* Nonblocking IO. */
+#define MSG_DONTWAIT MSG_DONTWAIT
+ MSG_EOR = 0x80, /* End of record. */
+#define MSG_EOR MSG_EOR
+ MSG_WAITALL = 0x100, /* Wait for a full request. */
+#define MSG_WAITALL MSG_WAITALL
+ MSG_FIN = 0x200,
+#define MSG_FIN MSG_FIN
+ MSG_SYN = 0x400,
+#define MSG_SYN MSG_SYN
+ MSG_CONFIRM = 0x800, /* Confirm path validity. */
+#define MSG_CONFIRM MSG_CONFIRM
+ MSG_RST = 0x1000,
+#define MSG_RST MSG_RST
+ MSG_ERRQUEUE = 0x2000, /* Fetch message from error queue. */
+#define MSG_ERRQUEUE MSG_ERRQUEUE
+ MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */
+#define MSG_NOSIGNAL MSG_NOSIGNAL
+ MSG_MORE = 0x8000, /* Sender will send more. */
+#define MSG_MORE MSG_MORE
+
+ MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file
+ descriptor received through
+ SCM_RIGHTS. */
+#define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC
+ };
+
+
+/* Structure describing messages sent by
+ `sendmsg' and received by `recvmsg'. */
+struct msghdr
+ {
+ void *msg_name; /* Address to send to/receive from. */
+ socklen_t msg_namelen; /* Length of address data. */
+
+ struct iovec *msg_iov; /* Vector of data to send/receive into. */
+ size_t msg_iovlen; /* Number of elements in the vector. */
+
+ void *msg_control; /* Ancillary data (eg BSD filedesc passing). */
+ size_t msg_controllen; /* Ancillary data buffer length.
+ !! The type should be socklen_t but the
+ definition of the kernel is incompatible
+ with this. */
+
+ int msg_flags; /* Flags on received message. */
+ };
+
+/* Structure used for storage of ancillary data object information. */
+struct cmsghdr
+ {
+ size_t cmsg_len; /* Length of data in cmsg_data plus length
+ of cmsghdr structure.
+ !! The type should be socklen_t but the
+ definition of the kernel is incompatible
+ with this. */
+ int cmsg_level; /* Originating protocol. */
+ int cmsg_type; /* Protocol specific type. */
+#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+ __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */
+#endif
+ };
+
+/* Ancillary data object manipulation macros. */
+#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
+#else
+# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
+#endif
+#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
+#define CMSG_FIRSTHDR(mhdr) \
+ ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \
+ ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
+#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
+ & (size_t) ~(sizeof (size_t) - 1))
+#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
+ + CMSG_ALIGN (sizeof (struct cmsghdr)))
+#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
+
+extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
+ struct cmsghdr *__cmsg) __THROW;
+#ifdef __USE_EXTERN_INLINES
+# ifndef _EXTERN_INLINE
+# define _EXTERN_INLINE __extern_inline
+# endif
+_EXTERN_INLINE struct cmsghdr *
+__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
+{
+ if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
+ /* The kernel header does this so there may be a reason. */
+ return 0;
+
+ __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
+ + CMSG_ALIGN (__cmsg->cmsg_len));
+ if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
+ + __mhdr->msg_controllen)
+ || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
+ > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
+ /* No more entries. */
+ return 0;
+ return __cmsg;
+}
+#endif /* Use `extern inline'. */
+
+/* Socket level message types. This must match the definitions in
+ <linux/socket.h>. */
+enum
+ {
+ SCM_RIGHTS = 0x01 /* Transfer file descriptors. */
+#define SCM_RIGHTS SCM_RIGHTS
+#ifdef __USE_GNU
+ , SCM_CREDENTIALS = 0x02 /* Credentials passing. */
+# define SCM_CREDENTIALS SCM_CREDENTIALS
+#endif
+ };
+
+#ifdef __USE_GNU
+/* User visible structure for SCM_CREDENTIALS message */
+struct ucred
+{
+ pid_t pid; /* PID of sending process. */
+ uid_t uid; /* UID of sending process. */
+ gid_t gid; /* GID of sending process. */
+};
+#endif
+
+/* Ugly workaround for unclean kernel headers. */
+#if !defined __USE_MISC && !defined __USE_GNU
+# ifndef FIOGETOWN
+# define __SYS_SOCKET_H_undef_FIOGETOWN
+# endif
+# ifndef FIOSETOWN
+# define __SYS_SOCKET_H_undef_FIOSETOWN
+# endif
+# ifndef SIOCATMARK
+# define __SYS_SOCKET_H_undef_SIOCATMARK
+# endif
+# ifndef SIOCGPGRP
+# define __SYS_SOCKET_H_undef_SIOCGPGRP
+# endif
+# ifndef SIOCGSTAMP
+# define __SYS_SOCKET_H_undef_SIOCGSTAMP
+# endif
+# ifndef SIOCGSTAMPNS
+# define __SYS_SOCKET_H_undef_SIOCGSTAMPNS
+# endif
+# ifndef SIOCSPGRP
+# define __SYS_SOCKET_H_undef_SIOCSPGRP
+# endif
+#endif
+
+/* Get socket manipulation related informations from kernel headers. */
+#include <asm/socket.h>
+
+#if !defined __USE_MISC && !defined __USE_GNU
+# ifdef __SYS_SOCKET_H_undef_FIOGETOWN
+# undef __SYS_SOCKET_H_undef_FIOGETOWN
+# undef FIOGETOWN
+# endif
+# ifdef __SYS_SOCKET_H_undef_FIOSETOWN
+# undef __SYS_SOCKET_H_undef_FIOSETOWN
+# undef FIOSETOWN
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCATMARK
+# undef __SYS_SOCKET_H_undef_SIOCATMARK
+# undef SIOCATMARK
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCGPGRP
+# undef __SYS_SOCKET_H_undef_SIOCGPGRP
+# undef SIOCGPGRP
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMP
+# undef __SYS_SOCKET_H_undef_SIOCGSTAMP
+# undef SIOCGSTAMP
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCGSTAMPNS
+# undef __SYS_SOCKET_H_undef_SIOCGSTAMPNS
+# undef SIOCGSTAMPNS
+# endif
+# ifdef __SYS_SOCKET_H_undef_SIOCSPGRP
+# undef __SYS_SOCKET_H_undef_SIOCSPGRP
+# undef SIOCSPGRP
+# endif
+#endif
+
+/* Structure used to manipulate the SO_LINGER option. */
+struct linger
+ {
+ int l_onoff; /* Nonzero to linger on close. */
+ int l_linger; /* Time to linger. */
+ };
+
+#endif /* bits/socket.h */
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/alpha/bits/socket.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/alpha/bits/socket.h

View File

@ -0,0 +1,415 @@
sniped from suse
Index: sysdeps/powerpc/bits/atomic.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/powerpc/bits/atomic.h,v
retrieving revision 1.17
diff -u -a -p -r1.17 atomic.h
diff -durN glibc-2.10.1.orig/sysdeps/powerpc/bits/atomic.h glibc-2.10.1/sysdeps/powerpc/bits/atomic.h
--- glibc-2.10.1.orig/sysdeps/powerpc/bits/atomic.h 2007-03-26 22:15:28.000000000 +0200
+++ glibc-2.10.1/sysdeps/powerpc/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
@@ -85,14 +85,14 @@
__typeof (*(mem)) __tmp; \
__typeof (mem) __memp = (mem); \
__asm __volatile ( \
- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
+ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
" cmpw %0,%2\n" \
" bne 2f\n" \
- " stwcx. %3,0,%1\n" \
+ " stwcx. %3,%y1\n" \
" bne- 1b\n" \
"2: " __ARCH_ACQ_INSTR \
- : "=&r" (__tmp) \
- : "b" (__memp), "r" (oldval), "r" (newval) \
+ : "=&r" (__tmp), "+Z" (*__memp) \
+ : "r" (oldval), "r" (newval) \
: "cr0", "memory"); \
__tmp; \
})
@@ -102,14 +102,14 @@
__typeof (*(mem)) __tmp; \
__typeof (mem) __memp = (mem); \
__asm __volatile (__ARCH_REL_INSTR "\n" \
- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
+ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
" cmpw %0,%2\n" \
" bne 2f\n" \
- " stwcx. %3,0,%1\n" \
+ " stwcx. %3,%y1\n" \
" bne- 1b\n" \
"2: " \
- : "=&r" (__tmp) \
- : "b" (__memp), "r" (oldval), "r" (newval) \
+ : "=&r" (__tmp), "+Z" (__memp) \
+ : "r" (oldval), "r" (newval) \
: "cr0", "memory"); \
__tmp; \
})
@@ -118,12 +118,12 @@
({ \
__typeof (*mem) __val; \
__asm __volatile ( \
- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
- " stwcx. %3,0,%2\n" \
+ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " stwcx. %2,%y1\n" \
" bne- 1b\n" \
" " __ARCH_ACQ_INSTR \
- : "=&r" (__val), "=m" (*mem) \
- : "b" (mem), "r" (value), "m" (*mem) \
+ : "=&r" (__val), "+Z" (*mem) \
+ : "r" (value) \
: "cr0", "memory"); \
__val; \
})
@@ -132,11 +132,11 @@
({ \
__typeof (*mem) __val; \
__asm __volatile (__ARCH_REL_INSTR "\n" \
- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
- " stwcx. %3,0,%2\n" \
+ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " stwcx. %2,%y1\n" \
" bne- 1b" \
- : "=&r" (__val), "=m" (*mem) \
- : "b" (mem), "r" (value), "m" (*mem) \
+ : "=&r" (__val), "+Z" (*mem) \
+ : "r" (value) \
: "cr0", "memory"); \
__val; \
})
@@ -144,12 +144,12 @@
#define __arch_atomic_exchange_and_add_32(mem, value) \
({ \
__typeof (*mem) __val, __tmp; \
- __asm __volatile ("1: lwarx %0,0,%3\n" \
- " add %1,%0,%4\n" \
- " stwcx. %1,0,%3\n" \
+ __asm __volatile ("1: lwarx %0,%y2\n" \
+ " add %1,%0,%3\n" \
+ " stwcx. %1,%y2\n" \
" bne- 1b" \
- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
- : "b" (mem), "r" (value), "m" (*mem) \
+ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
+ : "r" (value) \
: "cr0", "memory"); \
__val; \
})
@@ -157,12 +157,12 @@
#define __arch_atomic_increment_val_32(mem) \
({ \
__typeof (*(mem)) __val; \
- __asm __volatile ("1: lwarx %0,0,%2\n" \
+ __asm __volatile ("1: lwarx %0,%y1\n" \
" addi %0,%0,1\n" \
- " stwcx. %0,0,%2\n" \
+ " stwcx. %0,%y1\n" \
" bne- 1b" \
- : "=&b" (__val), "=m" (*mem) \
- : "b" (mem), "m" (*mem) \
+ : "=&b" (__val), "+Z" (*mem) \
+ : \
: "cr0", "memory"); \
__val; \
})
@@ -170,27 +170,27 @@
#define __arch_atomic_decrement_val_32(mem) \
({ \
__typeof (*(mem)) __val; \
- __asm __volatile ("1: lwarx %0,0,%2\n" \
+ __asm __volatile ("1: lwarx %0,%y1\n" \
" subi %0,%0,1\n" \
- " stwcx. %0,0,%2\n" \
+ " stwcx. %0,%y1\n" \
" bne- 1b" \
- : "=&b" (__val), "=m" (*mem) \
- : "b" (mem), "m" (*mem) \
+ : "=&b" (__val), "+Z" (*mem) \
+ : \
: "cr0", "memory"); \
__val; \
})
#define __arch_atomic_decrement_if_positive_32(mem) \
({ int __val, __tmp; \
- __asm __volatile ("1: lwarx %0,0,%3\n" \
+ __asm __volatile ("1: lwarx %0,%y2\n" \
" cmpwi 0,%0,0\n" \
" addi %1,%0,-1\n" \
" ble 2f\n" \
- " stwcx. %1,0,%3\n" \
+ " stwcx. %1,%y2\n" \
" bne- 1b\n" \
"2: " __ARCH_ACQ_INSTR \
- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
- : "b" (mem), "m" (*mem) \
+ : "=&b" (__val), "=&r" (__tmp), "+Z" (*mem) \
+ : \
: "cr0", "memory"); \
__val; \
})
diff -durN glibc-2.10.1.orig/sysdeps/powerpc/powerpc32/bits/atomic.h glibc-2.10.1/sysdeps/powerpc/powerpc32/bits/atomic.h
--- glibc-2.10.1.orig/sysdeps/powerpc/powerpc32/bits/atomic.h 2007-03-26 22:15:45.000000000 +0200
+++ glibc-2.10.1/sysdeps/powerpc/powerpc32/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
@@ -44,14 +44,14 @@
({ \
unsigned int __tmp; \
__asm __volatile ( \
- "1: lwarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
+ "1: lwarx %0,%y1" MUTEX_HINT_ACQ "\n" \
" subf. %0,%2,%0\n" \
" bne 2f\n" \
- " stwcx. %3,0,%1\n" \
+ " stwcx. %3,%y1\n" \
" bne- 1b\n" \
"2: " __ARCH_ACQ_INSTR \
- : "=&r" (__tmp) \
- : "b" (mem), "r" (oldval), "r" (newval) \
+ : "=&r" (__tmp), "+Z" (*(mem)) \
+ : "r" (oldval), "r" (newval) \
: "cr0", "memory"); \
__tmp != 0; \
})
@@ -60,14 +60,14 @@
({ \
unsigned int __tmp; \
__asm __volatile (__ARCH_REL_INSTR "\n" \
- "1: lwarx %0,0,%1" MUTEX_HINT_REL "\n" \
+ "1: lwarx %0,%y1" MUTEX_HINT_REL "\n" \
" subf. %0,%2,%0\n" \
" bne 2f\n" \
- " stwcx. %3,0,%1\n" \
+ " stwcx. %3,%y1\n" \
" bne- 1b\n" \
"2: " \
- : "=&r" (__tmp) \
- : "b" (mem), "r" (oldval), "r" (newval) \
+ : "=&r" (__tmp), "+Z" (*(mem)) \
+ : "r" (oldval), "r" (newval) \
: "cr0", "memory"); \
__tmp != 0; \
})
diff -durN glibc-2.10.1.orig/sysdeps/powerpc/powerpc64/bits/atomic.h glibc-2.10.1/sysdeps/powerpc/powerpc64/bits/atomic.h
--- glibc-2.10.1.orig/sysdeps/powerpc/powerpc64/bits/atomic.h 2007-03-26 22:16:03.000000000 +0200
+++ glibc-2.10.1/sysdeps/powerpc/powerpc64/bits/atomic.h 2009-11-13 00:51:19.000000000 +0100
@@ -44,14 +44,14 @@
({ \
unsigned int __tmp, __tmp2; \
__asm __volatile (" clrldi %1,%1,32\n" \
- "1: lwarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
+ "1: lwarx %0,%y2" MUTEX_HINT_ACQ "\n" \
" subf. %0,%1,%0\n" \
" bne 2f\n" \
- " stwcx. %4,0,%2\n" \
+ " stwcx. %4,%y2\n" \
" bne- 1b\n" \
"2: " __ARCH_ACQ_INSTR \
- : "=&r" (__tmp), "=r" (__tmp2) \
- : "b" (mem), "1" (oldval), "r" (newval) \
+ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
+ : "1" (oldval), "r" (newval) \
: "cr0", "memory"); \
__tmp != 0; \
})
@@ -61,14 +61,14 @@
unsigned int __tmp, __tmp2; \
__asm __volatile (__ARCH_REL_INSTR "\n" \
" clrldi %1,%1,32\n" \
- "1: lwarx %0,0,%2" MUTEX_HINT_REL "\n" \
+ "1: lwarx %0,%y2" MUTEX_HINT_REL "\n" \
" subf. %0,%1,%0\n" \
" bne 2f\n" \
- " stwcx. %4,0,%2\n" \
+ " stwcx. %4,%y2\n" \
" bne- 1b\n" \
"2: " \
- : "=&r" (__tmp), "=r" (__tmp2) \
- : "b" (mem), "1" (oldval), "r" (newval) \
+ : "=&r" (__tmp), "=r" (__tmp2), "+Z" (*(mem)) \
+ : "1" (oldval), "r" (newval) \
: "cr0", "memory"); \
__tmp != 0; \
})
@@ -82,14 +82,14 @@
({ \
unsigned long __tmp; \
__asm __volatile ( \
- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
+ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
" subf. %0,%2,%0\n" \
" bne 2f\n" \
- " stdcx. %3,0,%1\n" \
+ " stdcx. %3,%y1\n" \
" bne- 1b\n" \
"2: " __ARCH_ACQ_INSTR \
- : "=&r" (__tmp) \
- : "b" (mem), "r" (oldval), "r" (newval) \
+ : "=&r" (__tmp), "+Z" (*(mem)) \
+ : "r" (oldval), "r" (newval) \
: "cr0", "memory"); \
__tmp != 0; \
})
@@ -98,14 +98,14 @@
({ \
unsigned long __tmp; \
__asm __volatile (__ARCH_REL_INSTR "\n" \
- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
+ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
" subf. %0,%2,%0\n" \
" bne 2f\n" \
- " stdcx. %3,0,%1\n" \
+ " stdcx. %3,%y1\n" \
" bne- 1b\n" \
"2: " \
- : "=&r" (__tmp) \
- : "b" (mem), "r" (oldval), "r" (newval) \
+ : "=&r" (__tmp), "+Z" (*(mem)) \
+ : "r" (oldval), "r" (newval) \
: "cr0", "memory"); \
__tmp != 0; \
})
@@ -115,14 +115,14 @@
__typeof (*(mem)) __tmp; \
__typeof (mem) __memp = (mem); \
__asm __volatile ( \
- "1: ldarx %0,0,%1" MUTEX_HINT_ACQ "\n" \
+ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
" cmpd %0,%2\n" \
" bne 2f\n" \
- " stdcx. %3,0,%1\n" \
+ " stdcx. %3,%y1\n" \
" bne- 1b\n" \
"2: " __ARCH_ACQ_INSTR \
- : "=&r" (__tmp) \
- : "b" (__memp), "r" (oldval), "r" (newval) \
+ : "=&r" (__tmp), "+Z" (*__memp) \
+ : "r" (oldval), "r" (newval) \
: "cr0", "memory"); \
__tmp; \
})
@@ -132,14 +132,14 @@
__typeof (*(mem)) __tmp; \
__typeof (mem) __memp = (mem); \
__asm __volatile (__ARCH_REL_INSTR "\n" \
- "1: ldarx %0,0,%1" MUTEX_HINT_REL "\n" \
+ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
" cmpd %0,%2\n" \
" bne 2f\n" \
- " stdcx. %3,0,%1\n" \
+ " stdcx. %3,%y1\n" \
" bne- 1b\n" \
"2: " \
- : "=&r" (__tmp) \
- : "b" (__memp), "r" (oldval), "r" (newval) \
+ : "=&r" (__tmp), "+Z" (*__memp) \
+ : "r" (oldval), "r" (newval) \
: "cr0", "memory"); \
__tmp; \
})
@@ -148,12 +148,12 @@
({ \
__typeof (*mem) __val; \
__asm __volatile (__ARCH_REL_INSTR "\n" \
- "1: ldarx %0,0,%2" MUTEX_HINT_ACQ "\n" \
- " stdcx. %3,0,%2\n" \
+ "1: ldarx %0,%y1" MUTEX_HINT_ACQ "\n" \
+ " stdcx. %2,%y1\n" \
" bne- 1b\n" \
" " __ARCH_ACQ_INSTR \
- : "=&r" (__val), "=m" (*mem) \
- : "b" (mem), "r" (value), "m" (*mem) \
+ : "=&r" (__val), "+Z" (*(mem)) \
+ : "r" (value) \
: "cr0", "memory"); \
__val; \
})
@@ -162,11 +162,11 @@
({ \
__typeof (*mem) __val; \
__asm __volatile (__ARCH_REL_INSTR "\n" \
- "1: ldarx %0,0,%2" MUTEX_HINT_REL "\n" \
- " stdcx. %3,0,%2\n" \
+ "1: ldarx %0,%y1" MUTEX_HINT_REL "\n" \
+ " stdcx. %2,%y1\n" \
" bne- 1b" \
- : "=&r" (__val), "=m" (*mem) \
- : "b" (mem), "r" (value), "m" (*mem) \
+ : "=&r" (__val), "+Z" (*(mem)) \
+ : "r" (value) \
: "cr0", "memory"); \
__val; \
})
@@ -174,12 +174,12 @@
#define __arch_atomic_exchange_and_add_64(mem, value) \
({ \
__typeof (*mem) __val, __tmp; \
- __asm __volatile ("1: ldarx %0,0,%3\n" \
- " add %1,%0,%4\n" \
- " stdcx. %1,0,%3\n" \
+ __asm __volatile ("1: ldarx %0,%y2\n" \
+ " add %1,%0,%3\n" \
+ " stdcx. %1,%y2\n" \
" bne- 1b" \
- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
- : "b" (mem), "r" (value), "m" (*mem) \
+ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
+ : "r" (value) \
: "cr0", "memory"); \
__val; \
})
@@ -187,12 +187,12 @@
#define __arch_atomic_increment_val_64(mem) \
({ \
__typeof (*(mem)) __val; \
- __asm __volatile ("1: ldarx %0,0,%2\n" \
+ __asm __volatile ("1: ldarx %0,%y1\n" \
" addi %0,%0,1\n" \
- " stdcx. %0,0,%2\n" \
+ " stdcx. %0,%y1\n" \
" bne- 1b" \
- : "=&b" (__val), "=m" (*mem) \
- : "b" (mem), "m" (*mem) \
+ : "=&b" (__val), "+Z" (*(mem)) \
+ : \
: "cr0", "memory"); \
__val; \
})
@@ -200,27 +200,27 @@
#define __arch_atomic_decrement_val_64(mem) \
({ \
__typeof (*(mem)) __val; \
- __asm __volatile ("1: ldarx %0,0,%2\n" \
+ __asm __volatile ("1: ldarx %0,%y1\n" \
" subi %0,%0,1\n" \
- " stdcx. %0,0,%2\n" \
+ " stdcx. %0,%y1\n" \
" bne- 1b" \
- : "=&b" (__val), "=m" (*mem) \
- : "b" (mem), "m" (*mem) \
+ : "=&b" (__val), "+Z" (*(mem)) \
+ : \
: "cr0", "memory"); \
__val; \
})
#define __arch_atomic_decrement_if_positive_64(mem) \
({ int __val, __tmp; \
- __asm __volatile ("1: ldarx %0,0,%3\n" \
+ __asm __volatile ("1: ldarx %0,%y2\n" \
" cmpdi 0,%0,0\n" \
" addi %1,%0,-1\n" \
" ble 2f\n" \
- " stdcx. %1,0,%3\n" \
+ " stdcx. %1,%y2\n" \
" bne- 1b\n" \
"2: " __ARCH_ACQ_INSTR \
- : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \
- : "b" (mem), "m" (*mem) \
+ : "=&b" (__val), "=&r" (__tmp), "+Z" (*(mem)) \
+ : \
: "cr0", "memory"); \
__val; \
})

View File

@ -0,0 +1,374 @@
http://yann.poupet.free.fr/ep93xx/
Add support for the Maverick Crunch FPU on Cirrus EP93XX processor series
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/bits/endian.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/bits/endian.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/bits/endian.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/bits/endian.h 2009-11-13 00:51:22.000000000 +0100
@@ -12,7 +12,7 @@
/* FPA floating point units are always big-endian, irrespective of the
CPU endianness. VFP floating point units use the same endianness
as the rest of the system. */
-#ifdef __VFP_FP__
+#if defined __VFP_FP__ || defined __MAVERICK__
#define __FLOAT_WORD_ORDER __BYTE_ORDER
#else
#define __FLOAT_WORD_ORDER __BIG_ENDIAN
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/__longjmp.S glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/__longjmp.S
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/__longjmp.S 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/__longjmp.S 2009-11-13 00:51:22.000000000 +0100
@@ -30,7 +30,33 @@
movs r0, r1 /* get the return value in place */
moveq r0, #1 /* can't let setjmp() return zero! */
+#ifdef __MAVERICK__
+ cfldrd mvd4, [ip], #8
+ nop
+ cfldrd mvd5, [ip], #8
+ nop
+ cfldrd mvd6, [ip], #8
+ nop
+ cfldrd mvd7, [ip], #8
+ nop
+ cfldrd mvd8, [ip], #8
+ nop
+ cfldrd mvd9, [ip], #8
+ nop
+ cfldrd mvd10, [ip], #8
+ nop
+ cfldrd mvd11, [ip], #8
+ nop
+ cfldrd mvd12, [ip], #8
+ nop
+ cfldrd mvd13, [ip], #8
+ nop
+ cfldrd mvd14, [ip], #8
+ nop
+ cfldrd mvd15, [ip], #8
+#else
lfmfd f4, 4, [ip] ! /* load the floating point regs */
+#endif
LOADREGS(ia, ip, {v1-v6, sl, fp, sp, pc})
END (__longjmp)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/fenv.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/fenv.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/fenv.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/fenv.h 2009-11-13 00:51:22.000000000 +0100
@@ -20,6 +20,45 @@
# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
#endif
+#if defined(__MAVERICK__)
+
+/* Define bits representing exceptions in the FPU status word. */
+enum
+ {
+ FE_INVALID = 1,
+#define FE_INVALID FE_INVALID
+ FE_OVERFLOW = 4,
+#define FE_OVERFLOW FE_OVERFLOW
+ FE_UNDERFLOW = 8,
+#define FE_UNDERFLOW FE_UNDERFLOW
+ FE_INEXACT = 16,
+#define FE_INEXACT FE_INEXACT
+ };
+
+/* Amount to shift by to convert an exception to a mask bit. */
+#define FE_EXCEPT_SHIFT 5
+
+/* All supported exceptions. */
+#define FE_ALL_EXCEPT \
+ (FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
+
+/* IEEE rounding modes. */
+enum
+ {
+ FE_TONEAREST = 0,
+#define FE_TONEAREST FE_TONEAREST
+ FE_TOWARDZERO = 0x400,
+#define FE_TOWARDZERO FE_TOWARDZERO
+ FE_DOWNWARD = 0x800,
+#define FE_DOWNWARD FE_DOWNWARD
+ FE_UPWARD = 0xc00,
+#define FE_UPWARD FE_UPWARD
+ };
+
+#define FE_ROUND_MASK (FE_UPWARD)
+
+#else /* FPA */
+
/* Define bits representing exceptions in the FPU status word. */
enum
{
@@ -44,6 +83,8 @@
modes exist, but you have to encode them in the actual instruction. */
#define FE_TONEAREST 0
+#endif
+
/* Type representing exception flags. */
typedef unsigned long int fexcept_t;
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/setjmp.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/setjmp.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/setjmp.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/bits/setjmp.h 2009-11-13 00:51:22.000000000 +0100
@@ -28,7 +28,11 @@
#ifndef _ASM
/* Jump buffer contains v1-v6, sl, fp, sp and pc. Other registers are not
saved. */
+#ifdef __MAVERICK__
+typedef int __jmp_buf[34];
+#else
typedef int __jmp_buf[22];
#endif
+#endif
#endif
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/fegetround.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/fegetround.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/fegetround.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/fegetround.c 2009-11-13 00:51:22.000000000 +0100
@@ -18,9 +18,21 @@
02111-1307 USA. */
#include <fenv.h>
+#include <fpu_control.h>
int
fegetround (void)
{
+#if defined(__MAVERICK__)
+
+ unsigned long temp;
+
+ _FPU_GETCW (temp);
+ return temp & FE_ROUND_MASK;
+
+#else /* FPA */
+
return FE_TONEAREST; /* Easy. :-) */
+
+#endif
}
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/fesetround.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/fesetround.c
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/fesetround.c 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/fesetround.c 2009-11-13 00:51:22.000000000 +0100
@@ -18,12 +18,28 @@
02111-1307 USA. */
#include <fenv.h>
+#include <fpu_control.h>
int
fesetround (int round)
{
+#if defined(__MAVERICK__)
+ unsigned long temp;
+
+ if (round & ~FE_ROUND_MASK)
+ return 1;
+
+ _FPU_GETCW (temp);
+ temp = (temp & ~FE_ROUND_MASK) | round;
+ _FPU_SETCW (temp);
+ return 0;
+
+#else /* FPA */
+
/* We only support FE_TONEAREST, so there is no need for any work. */
return (round == FE_TONEAREST)?0:1;
+
+#endif
}
libm_hidden_def (fesetround)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/fpu_control.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/fpu_control.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/fpu_control.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/fpu_control.h 2009-11-13 00:51:22.000000000 +0100
@@ -1,5 +1,6 @@
/* FPU control word definitions. ARM version.
- Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 2000, 2005
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -20,6 +21,79 @@
#ifndef _FPU_CONTROL_H
#define _FPU_CONTROL_H
+#if defined(__MAVERICK__)
+
+/* DSPSC register: (from EP9312 User's Guide)
+ *
+ * bits 31..29 - DAID
+ * bits 28..26 - HVID
+ * bits 25..24 - RSVD
+ * bit 23 - ISAT
+ * bit 22 - UI
+ * bit 21 - INT
+ * bit 20 - AEXC
+ * bits 19..18 - SAT
+ * bits 17..16 - FCC
+ * bit 15 - V
+ * bit 14 - FWDEN
+ * bit 13 - Invalid
+ * bit 12 - Denorm
+ * bits 11..10 - RM
+ * bits 9..5 - IXE, UFE, OFE, RSVD, IOE
+ * bits 4..0 - IX, UF, OF, RSVD, IO
+ */
+
+/* masking of interrupts */
+#define _FPU_MASK_IM (1 << 5) /* invalid operation */
+#define _FPU_MASK_ZM 0 /* divide by zero */
+#define _FPU_MASK_OM (1 << 7) /* overflow */
+#define _FPU_MASK_UM (1 << 8) /* underflow */
+#define _FPU_MASK_PM (1 << 9) /* inexact */
+#define _FPU_MASK_DM 0 /* denormalized operation */
+
+#define _FPU_RESERVED 0xfffff000 /* These bits are reserved. */
+
+#define _FPU_DEFAULT 0x00b00000 /* Default value. */
+#define _FPU_IEEE 0x00b003a0 /* Default + exceptions enabled. */
+
+/* Type of the control word. */
+typedef unsigned int fpu_control_t;
+
+/* Macros for accessing the hardware control word. */
+#define _FPU_GETCW(cw) ({ \
+ register int __t1, __t2; \
+ \
+ __asm__ volatile ( \
+ "cfmvr64l %1, mvdx0\n\t" \
+ "cfmvr64h %2, mvdx0\n\t" \
+ "cfmv32sc mvdx0, dspsc\n\t" \
+ "cfmvr64l %0, mvdx0\n\t" \
+ "cfmv64lr mvdx0, %1\n\t" \
+ "cfmv64hr mvdx0, %2" \
+ : "=r" (cw), "=r" (__t1), "=r" (__t2) \
+ ); \
+})
+
+#define _FPU_SETCW(cw) ({ \
+ register int __t0, __t1, __t2; \
+ \
+ __asm__ volatile ( \
+ "cfmvr64l %1, mvdx0\n\t" \
+ "cfmvr64h %2, mvdx0\n\t" \
+ "cfmv64lr mvdx0, %0\n\t" \
+ "cfmvsc32 dspsc, mvdx0\n\t" \
+ "cfmv64lr mvdx0, %1\n\t" \
+ "cfmv64hr mvdx0, %2" \
+ : "=r" (__t0), "=r" (__t1), "=r" (__t2) \
+ : "0" (cw) \
+ ); \
+})
+
+/* Default control word set at startup. */
+extern fpu_control_t __fpu_control;
+
+#else /* FPA */
+
/* We have a slight terminology confusion here. On the ARM, the register
* we're interested in is actually the FPU status word - the FPU control
* word is something different (which is implementation-defined and only
@@ -99,4 +173,6 @@
/* Default control word set at startup. */
extern fpu_control_t __fpu_control;
+#endif
+
#endif /* _FPU_CONTROL_H */
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/jmpbuf-offsets.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/jmpbuf-offsets.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/jmpbuf-offsets.h 2009-11-13 00:51:22.000000000 +0100
@@ -17,4 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#ifdef __MAVERICK__
+#define __JMP_BUF_SP 32
+#else
#define __JMP_BUF_SP 20
+#endif
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/setjmp.S glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/setjmp.S
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/fpu/setjmp.S 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/fpu/setjmp.S 2009-11-13 00:51:22.000000000 +0100
@@ -24,11 +24,41 @@
ENTRY (__sigsetjmp)
/* Save registers */
+#ifdef __MAVERICK__
+ cfstrd mvd4, [r0], #8
+ nop
+ cfstrd mvd5, [r0], #8
+ nop
+ cfstrd mvd6, [r0], #8
+ nop
+ cfstrd mvd7, [r0], #8
+ nop
+ cfstrd mvd8, [r0], #8
+ nop
+ cfstrd mvd9, [r0], #8
+ nop
+ cfstrd mvd10, [r0], #8
+ nop
+ cfstrd mvd11, [r0], #8
+ nop
+ cfstrd mvd12, [r0], #8
+ nop
+ cfstrd mvd13, [r0], #8
+ nop
+ cfstrd mvd14, [r0], #8
+ nop
+ cfstrd mvd15, [r0], #8
+#else
sfmea f4, 4, [r0]!
+#endif
stmia r0, {v1-v6, sl, fp, sp, lr}
/* Restore pointer to jmp_buf */
+#ifdef __MAVERICK__
+ sub r0, r0, #96
+#else
sub r0, r0, #48
+#endif
/* Make a tail call to __sigjmp_save; it takes the same args. */
B PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/gccframe.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/gccframe.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/gccframe.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/gccframe.h 2009-11-13 00:51:22.000000000 +0100
@@ -17,6 +17,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#ifdef __MAVERICK__
+#define FIRST_PSEUDO_REGISTER 43
+#else
#define FIRST_PSEUDO_REGISTER 27
+#endif
#include <sysdeps/generic/gccframe.h>
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/gmp-mparam.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/gmp-mparam.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/arm/gmp-mparam.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/arm/gmp-mparam.h 2009-11-13 00:51:22.000000000 +0100
@@ -29,7 +29,7 @@
#if defined(__ARMEB__)
# define IEEE_DOUBLE_MIXED_ENDIAN 0
# define IEEE_DOUBLE_BIG_ENDIAN 1
-#elif defined(__VFP_FP__)
+#elif defined(__VFP_FP__) || defined(__MAVERICK__)
# define IEEE_DOUBLE_MIXED_ENDIAN 0
# define IEEE_DOUBLE_BIG_ENDIAN 0
#else
diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/bits/endian.h glibc-2.10.1/ports/sysdeps/arm/bits/endian.h
diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/__longjmp.S glibc-2.10.1/ports/sysdeps/arm/fpu/__longjmp.S
diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/bits/fenv.h glibc-2.10.1/ports/sysdeps/arm/fpu/bits/fenv.h
diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/bits/setjmp.h glibc-2.10.1/ports/sysdeps/arm/fpu/bits/setjmp.h
diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/fegetround.c glibc-2.10.1/ports/sysdeps/arm/fpu/fegetround.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/fesetround.c glibc-2.10.1/ports/sysdeps/arm/fpu/fesetround.c
diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/fpu_control.h glibc-2.10.1/ports/sysdeps/arm/fpu/fpu_control.h
diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/jmpbuf-offsets.h glibc-2.10.1/ports/sysdeps/arm/fpu/jmpbuf-offsets.h
diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/fpu/setjmp.S glibc-2.10.1/ports/sysdeps/arm/fpu/setjmp.S
diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/gccframe.h glibc-2.10.1/ports/sysdeps/arm/gccframe.h
diff -durN glibc-2.10.1.orig/ports/sysdeps/arm/gmp-mparam.h glibc-2.10.1/ports/sysdeps/arm/gmp-mparam.h

View File

@ -0,0 +1,23 @@
fix build error on arm like on hppa:
arm-unknown-linux-gnu-gcc ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -fno-strict-aliasing -g -pipe -Wstrict-prototypes -fPIC -I../include -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl -I/var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl -I../ports/sysdeps/arm/elf -I../ports/sysdeps/unix/sysv/linux/arm/nptl -I../ports/sysdeps/unix/sysv/linux/arm -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../ports/sysdeps/unix/sysv/linux -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../ports/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../ports/sysdeps/unix/arm -I../nptl/sysdeps/unix -I../ports/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../ports/sysdeps/arm/fpu -I../ports/sysdeps/arm/nptl -I../ports/sysdeps/arm -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl -I../ports -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include -isystem /usr/lib/gcc/arm-unknown-linux-gnu/4.3.2/include-fixed -isystem /usr/arm-unknown-linux-gnu/usr/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DPIC -DSHARED -o /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -MD -MP -MF /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os.dt -MT /var/tmp/portage/cross-arm-unknown-linux-gnu/glibc-2.8_p20080602/work/build-default-arm-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os -DNOT_IN_libc=1 -DIS_IN_rtld=1
In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21:
../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private':
../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: warning: implicit declaration of function 'THREAD_GETMEM'
../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'THREAD_SELF' undeclared (first use in this function)
../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: (Each undeclared identifier is reported only once
../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: for each function it appears in.)
../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:31: error: 'header' undeclared (first use in this function)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h 2009-11-13 00:51:23.000000000 +0100
@@ -25,6 +25,7 @@
#include <atomic.h>
#include <sysdep.h>
#include <kernel-features.h>
+#include <tls.h> /* Need THREAD_*, and header.*. */
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h glibc-2.10.1/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h

View File

@ -0,0 +1,13 @@
diff -durN glibc-2.10.1.orig/sysdeps/sh/sh4/fpu/fpu_control.h glibc-2.10.1/sysdeps/sh/sh4/fpu/fpu_control.h
--- glibc-2.10.1.orig/sysdeps/sh/sh4/fpu/fpu_control.h 2001-07-06 06:56:04.000000000 +0200
+++ glibc-2.10.1/sysdeps/sh/sh4/fpu/fpu_control.h 2009-11-13 00:51:26.000000000 +0100
@@ -45,6 +45,7 @@
#define _FPU_GETCW(cw) __asm__ ("sts fpscr,%0" : "=r" (cw))
#if defined __GNUC__
+extern void __set_fpscr(unsigned long);
#define _FPU_SETCW(cw) __set_fpscr ((cw))
#else
#define _FPU_SETCW(cw) __asm__ ("lds %0,fpscr" : : "r" (cw))

View File

@ -0,0 +1,94 @@
we kind of screwed ourselves into a corner by having the clock symbols
exported only with the glibc-2.0 version ... this patch fixes the
export so all new binaries built against librt will use the correct
glibc-2.2 symbol version
one day, we'll just drop this on the floor (maybe after 2006.1)
diff -durN glibc-2.10.1.orig/Versions.def glibc-2.10.1/Versions.def
--- glibc-2.10.1.orig/Versions.def 2008-12-03 05:19:06.000000000 +0100
+++ glibc-2.10.1/Versions.def 2009-11-13 00:51:27.000000000 +0100
@@ -98,6 +98,7 @@
GLIBC_PRIVATE
}
librt {
+ GLIBC_2.0
GLIBC_2.1
GLIBC_2.2
GLIBC_2.3
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/mips/Versions glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/mips/Versions
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/mips/Versions 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/unix/sysv/linux/mips/Versions 2009-11-13 00:51:27.000000000 +0100
@@ -35,3 +35,9 @@
_test_and_set;
}
}
+librt {
+ GLIBC_2.0 {
+ # c*
+ clock_gettime; clock_settime;
+ }
+}
diff -durN glibc-2.10.1.orig/ports/sysdeps/unix/sysv/linux/mips/Versions glibc-2.10.1/ports/sysdeps/unix/sysv/linux/mips/Versions
diff -durN glibc-2.10.1.orig/sysdeps/unix/clock_gettime.c glibc-2.10.1/sysdeps/unix/clock_gettime.c
--- glibc-2.10.1.orig/sysdeps/unix/clock_gettime.c 2007-07-28 22:36:04.000000000 +0200
+++ glibc-2.10.1/sysdeps/unix/clock_gettime.c 2009-11-13 00:51:27.000000000 +0100
@@ -23,6 +23,7 @@
#include <sys/time.h>
#include <libc-internal.h>
#include <ldsodefs.h>
+#include <shlib-compat.h>
#if HP_TIMING_AVAIL
@@ -90,7 +91,7 @@
/* Get current value of CLOCK and store it in TP. */
int
-clock_gettime (clockid_t clock_id, struct timespec *tp)
+__clock_gettime (clockid_t clock_id, struct timespec *tp)
{
int retval = -1;
@@ -133,4 +134,10 @@
return retval;
}
-librt_hidden_def (clock_gettime)
+versioned_symbol (librt, __clock_gettime, clock_gettime, GLIBC_2_2);
+librt_hidden_ver (__clock_gettime, clock_gettime)
+
+#if defined __mips__ && defined SHARED
+strong_alias (__clock_gettime, __mips_clock_gettime)
+compat_symbol (librt, __mips_clock_gettime, clock_gettime, GLIBC_2_0);
+#endif
diff -durN glibc-2.10.1.orig/sysdeps/unix/clock_settime.c glibc-2.10.1/sysdeps/unix/clock_settime.c
--- glibc-2.10.1.orig/sysdeps/unix/clock_settime.c 2007-08-14 05:19:33.000000000 +0200
+++ glibc-2.10.1/sysdeps/unix/clock_settime.c 2009-11-13 00:51:27.000000000 +0100
@@ -21,6 +21,7 @@
#include <sys/time.h>
#include <libc-internal.h>
#include <ldsodefs.h>
+#include <shlib-compat.h>
#if HP_TIMING_AVAIL && !defined HANDLED_CPUTIME
@@ -73,7 +74,7 @@
/* Set CLOCK to value TP. */
int
-clock_settime (clockid_t clock_id, const struct timespec *tp)
+__clock_settime (clockid_t clock_id, const struct timespec *tp)
{
int retval;
@@ -125,3 +126,9 @@
return retval;
}
+versioned_symbol (librt, __clock_settime, clock_settime, GLIBC_2_2);
+
+#if defined __mips__ && defined SHARED
+strong_alias (__clock_settime, __mips_clock_settime)
+compat_symbol (librt, __mips_clock_settime, clock_settime, GLIBC_2_0);
+#endif

View File

@ -0,0 +1,15 @@
http://sourceware.org/ml/libc-alpha/2002-10/msg00392.html
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/mips/fpu_control.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/mips/fpu_control.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/mips/fpu_control.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/mips/fpu_control.h 2009-11-13 00:51:31.000000000 +0100
@@ -86,7 +86,7 @@
#define _FPU_RC_UP 0x2
#define _FPU_RC_DOWN 0x3
-#define _FPU_RESERVED 0xfe3c0000 /* Reserved bits in cw */
+#define _FPU_RESERVED 0xfebc0000 /* Reserved bits in cw */
/* The fdlibm code requires strict IEEE double precision arithmetic,
diff -durN glibc-2.10.1.orig/ports/sysdeps/mips/fpu_control.h glibc-2.10.1/ports/sysdeps/mips/fpu_control.h

View File

@ -0,0 +1,67 @@
ripped from Debian
the R10000 needs an LL/SC Workaround. If not applied all R10k before
rev 3.0 misbehave on atomic ops and rev 2.6 and lower (e.g. SGI IP28)
die after very few seconds with a deadlock due to even more erratas.
ports/sysdeps/mips/bits/atomic.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/mips/bits/atomic.h glibc-2.10.1/glibc-ports-2.10.1/sysdeps/mips/bits/atomic.h
--- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/mips/bits/atomic.h 2009-05-16 10:36:20.000000000 +0200
+++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/mips/bits/atomic.h 2009-11-13 00:51:34.000000000 +0100
@@ -74,7 +74,7 @@
"bne %0,%2,2f\n\t" \
"move %1,%3\n\t" \
"sc %1,%4\n\t" \
- "beqz %1,1b\n" \
+ "beqzl %1,1b\n" \
acq "\n\t" \
".set pop\n" \
"2:\n\t" \
@@ -98,7 +98,7 @@
"bne %0,%2,2f\n\t" \
"move %1,%3\n\t" \
"scd %1,%4\n\t" \
- "beqz %1,1b\n" \
+ "beqzl %1,1b\n" \
acq "\n\t" \
".set pop\n" \
"2:\n\t" \
@@ -192,7 +192,7 @@
"ll %0,%3\n\t" \
"move %1,%2\n\t" \
"sc %1,%3\n\t" \
- "beqz %1,1b\n" \
+ "beqzl %1,1b\n" \
acq "\n\t" \
".set pop\n" \
"2:\n\t" \
@@ -216,7 +216,7 @@
"lld %0,%3\n\t" \
"move %1,%2\n\t" \
"scd %1,%3\n\t" \
- "beqz %1,1b\n" \
+ "beqzl %1,1b\n" \
acq "\n\t" \
".set pop\n" \
"2:\n\t" \
@@ -251,7 +251,7 @@
"ll %0,%3\n\t" \
"addu %1,%0,%2\n\t" \
"sc %1,%3\n\t" \
- "beqz %1,1b\n" \
+ "beqzl %1,1b\n" \
acq "\n\t" \
".set pop\n" \
"2:\n\t" \
@@ -275,7 +275,7 @@
"lld %0,%3\n\t" \
"daddu %1,%0,%2\n\t" \
"scd %1,%3\n\t" \
- "beqz %1,1b\n" \
+ "beqzl %1,1b\n" \
acq "\n\t" \
".set pop\n" \
"2:\n\t" \
diff -durN glibc-2.10.1.orig/ports/sysdeps/mips/bits/atomic.h glibc-2.10.1/ports/sysdeps/mips/bits/atomic.h

View File

@ -0,0 +1,24 @@
Hack from Debian to hopefully get sandbox working on mips
<`Kumba> ths: given the SHN_UNDEF thing is a hack, what's the preferred solution?
<ths> For fakeroot the simplest trigger is "fakeroot file /bin/ls".
<ths> `Kumba: I haven't found a better one yet.
<ths> Probably marker symbols around the stub section, and then exclude it from the link map.
<ths> This needs a ld change.
diff -durN glibc-2.10.1.orig/elf/do-lookup.h glibc-2.10.1/elf/do-lookup.h
--- glibc-2.10.1.orig/elf/do-lookup.h 2009-03-30 23:14:32.000000000 +0200
+++ glibc-2.10.1/elf/do-lookup.h 2009-11-13 00:51:36.000000000 +0100
@@ -248,6 +248,12 @@
}
/* FALLTHROUGH */
case STB_GLOBAL:
+#ifdef __mips__
+ /* HACK: MIPS marks its lazy evaluation stubs with SHN_UNDEF
+ symbols, we skip them. */
+ if (sym->st_shndx == SHN_UNDEF)
+ break;
+#endif
/* Global definition. Just what we need. */
result->s = sym;
result->m = (struct link_map *) map;

View File

@ -1,7 +1,7 @@
# #
# Automatically generated make config: don't edit # Automatically generated make config: don't edit
# crosstool-NG version: hg_default@1596_241387704817 # crosstool-NG version: hg_default@1625_41323205e117
# Wed Oct 28 19:22:15 2009 # Fri Nov 13 19:35:22 2009
# #
# #
@ -12,7 +12,7 @@
# crosstool-NG behavior # crosstool-NG behavior
# #
# CT_OBSOLETE is not set # CT_OBSOLETE is not set
# CT_EXPERIMENTAL is not set CT_EXPERIMENTAL=y
# CT_DEBUG_CT is not set # CT_DEBUG_CT is not set
# #
@ -34,6 +34,7 @@ CT_INSTALL_DIR_RO=y
CT_USE_MIRROR=y CT_USE_MIRROR=y
# CT_PREFER_MIRROR is not set # CT_PREFER_MIRROR is not set
CT_MIRROR_BASE_URL="http://ymorin.is-a-geek.org/mirrors/" CT_MIRROR_BASE_URL="http://ymorin.is-a-geek.org/mirrors/"
# CT_MIRROR_LS_R is not set
CT_CONNECT_TIMEOUT=10 CT_CONNECT_TIMEOUT=10
# CT_ONLY_DOWNLOAD is not set # CT_ONLY_DOWNLOAD is not set
@ -86,14 +87,14 @@ CT_LOG_FILE_COMPRESS=y
# #
CT_ARCH="arm" CT_ARCH="arm"
# CT_ARCH_64 is not set # CT_ARCH_64 is not set
# CT_ARCH_SUPPORTS_BOTH_MMU is not set CT_ARCH_SUPPORTS_BOTH_MMU=y
CT_ARCH_SUPPORTS_BOTH_ENDIAN=y CT_ARCH_SUPPORTS_BOTH_ENDIAN=y
CT_ARCH_SUPPORT_ARCH=y CT_ARCH_SUPPORT_ARCH=y
# CT_ARCH_SUPPORT_ABI is not set # CT_ARCH_SUPPORT_ABI is not set
CT_ARCH_SUPPORT_CPU=y CT_ARCH_SUPPORT_CPU=y
CT_ARCH_SUPPORT_TUNE=y CT_ARCH_SUPPORT_TUNE=y
CT_ARCH_SUPPORT_FPU=y CT_ARCH_SUPPORT_FPU=y
# CT_ARCH_DEFAULT_HAS_MMU is not set CT_ARCH_DEFAULT_HAS_MMU=y
# CT_ARCH_DEFAULT_BE is not set # CT_ARCH_DEFAULT_BE is not set
CT_ARCH_DEFAULT_LE=y CT_ARCH_DEFAULT_LE=y
CT_ARCH_ARCH="armv5te" CT_ARCH_ARCH="armv5te"
@ -120,6 +121,10 @@ CT_ARCH_arm=y
# CT_ARCH_sh is not set # CT_ARCH_sh is not set
# CT_ARCH_x86 is not set # CT_ARCH_x86 is not set
# CT_ARCH_x86_64 is not set # CT_ARCH_x86_64 is not set
CT_ARCH_ARM_MODE="arm"
CT_ARCH_ARM_MODE_ARM=y
# CT_ARCH_ARM_MODE_THUMB is not set
# CT_ARCH_ARM_INTERWORKING is not set
CT_ARCH_ARM_EABI=y CT_ARCH_ARM_EABI=y
CT_ARCH_USE_MMU=y CT_ARCH_USE_MMU=y
@ -269,17 +274,23 @@ CT_CC_SUPPORT_OBJCXX=y
CT_CC_LANG_CXX=y CT_CC_LANG_CXX=y
CT_CC_LANG_FORTRAN=y CT_CC_LANG_FORTRAN=y
CT_CC_LANG_JAVA=y CT_CC_LANG_JAVA=y
CT_LIBC="glibc" # CT_CC_LANG_ADA is not set
# CT_CC_LANG_OBJC is not set
# CT_CC_LANG_OBJCXX is not set
CT_CC_LANG_OTHERS=""
# #
# C-library # C-library
# #
CT_LIBC_VERSION="2.9" CT_LIBC="glibc"
CT_LIBC_VERSION="2.10.1"
# CT_LIBC_eglibc is not set # CT_LIBC_eglibc is not set
CT_LIBC_glibc=y CT_LIBC_glibc=y
# CT_LIBC_newlib is not set # CT_LIBC_newlib is not set
# CT_LIBC_none is not set
# CT_LIBC_uClibc is not set # CT_LIBC_uClibc is not set
CT_LIBC_V_2_9=y CT_LIBC_V_2_10_1=y
# CT_LIBC_V_2_9 is not set
# CT_LIBC_V_2_8 is not set # CT_LIBC_V_2_8 is not set
# CT_LIBC_V_2_7 is not set # CT_LIBC_V_2_7 is not set
# CT_LIBC_V_2_6_1 is not set # CT_LIBC_V_2_6_1 is not set
@ -287,10 +298,9 @@ CT_LIBC_V_2_9=y
# CT_LIBC_V_2_5_1 is not set # CT_LIBC_V_2_5_1 is not set
# CT_LIBC_V_2_5 is not set # CT_LIBC_V_2_5 is not set
# CT_LIBC_V_2_3_6 is not set # CT_LIBC_V_2_3_6 is not set
CT_LIBC_GLIBC_2_8_or_later=y # CT_LIBC_GLIBC_2_8_or_later is not set
# CT_LIBC_GLIBC_TARBALL is not set CT_LIBC_GLIBC_TARBALL=y
CT_LIBC_GLIBC_CVS=y # CT_LIBC_GLIBC_CVS is not set
CT_LIBC_GLIBC_CVS_date="2009-03-29"
# #
# glibc/eglibc common options # glibc/eglibc common options
@ -301,29 +311,17 @@ CT_LIBC_GLIBC_EXTRA_CFLAGS=""
CT_LIBC_EXTRA_CC_ARGS="" CT_LIBC_EXTRA_CC_ARGS=""
CT_LIBC_GLIBC_USE_PORTS=y CT_LIBC_GLIBC_USE_PORTS=y
CT_LIBC_ADDONS_LIST="" CT_LIBC_ADDONS_LIST=""
#
# WARNING!!!
#
#
# For glibc >= 2.8, addons are only available via a CVS checkout.
#
#
# Be sure to review the associated options, above.
#
# CT_LIBC_GLIBC_KERNEL_VERSION_NONE is not set # CT_LIBC_GLIBC_KERNEL_VERSION_NONE is not set
CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS=y CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS=y
# CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN is not set # CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN is not set
CT_LIBC_GLIBC_MIN_KERNEL="2.6.31.1" CT_LIBC_GLIBC_MIN_KERNEL="2.6.31.1"
CT_LIBC_SUPPORT_NPTL=y
CT_LIBC_SUPPORT_LINUXTHREADS=y
CT_THREADS="nptl"
# #
# Common C library options # Common C library options
# #
CT_LIBC_SUPPORT_NPTL=y
CT_LIBC_SUPPORT_LINUXTHREADS=y
CT_THREADS="nptl"
CT_THREADS_NPTL=y CT_THREADS_NPTL=y
# CT_THREADS_LINUXTHREADS is not set # CT_THREADS_LINUXTHREADS is not set
# CT_THREADS_NONE is not set # CT_THREADS_NONE is not set
@ -346,6 +344,7 @@ CT_DUMA_VERSION="2_5_15"
CT_DEBUG_gdb=y CT_DEBUG_gdb=y
CT_GDB_CROSS=y CT_GDB_CROSS=y
# CT_GDB_CROSS_STATIC is not set # CT_GDB_CROSS_STATIC is not set
# CT_GDB_CROSS_INSIGHT is not set
CT_GDB_NATIVE=y CT_GDB_NATIVE=y
# CT_GDB_NATIVE_STATIC is not set # CT_GDB_NATIVE_STATIC is not set
CT_GDB_NATIVE_USE_GMP_MPFR=y CT_GDB_NATIVE_USE_GMP_MPFR=y

View File

@ -5,7 +5,12 @@ set -e
myname="$0" myname="$0"
# Parse the tools' paths configuration # Parse the tools' paths configuration
. "paths.mk" # It is expected that this script is only to be run from the
# source directory of crosstool-NG, so it is trivial to find
# paths.mk (we can't use ". paths.mk", as POSIX states that
# $PATH should be searched for, and $PATH most probably doe
# not include "."), hence the "./".
. "./paths.mk"
doHelp() { doHelp() {
cat <<-EOF cat <<-EOF

View File

@ -5,41 +5,56 @@ set -e
myname="$0" myname="$0"
# Parse the tools' paths configuration # Parse the tools' paths configuration
. "paths.mk" # It is expected that this script is only to be run from the
# source directory of crosstool-NG, so it is trivial to find
# paths.mk (we can't use ". paths.mk", as POSIX states that
# $PATH should be searched for, and $PATH most probably doe
# not include "."), hence the "./".
. "./paths.mk"
doUsage() { doUsage() {
cat <<_EOF_ cat <<_EOF_
Usage: ${myname} <dir> <base> <inc> [sed_re] Usage: ${myname} <src_dir> <dst_dir> <base> <inc> [sed_re]
Will renumber all patches found in 'dir', starting at 'base', and with Renumbers all patches found in 'src_dir', starting at 'base', with an
an increment of 'inc'. increment of 'inc', and puts the renumbered patches in 'dst_dir'.
Leading digits are replaced with the new indexes, and a subsequent '_'
is replaced with a '-'.
If 'sed_re' is given, it is interpreted as a valid sed expression, and If 'sed_re' is given, it is interpreted as a valid sed expression, and
it will be applied to the patch name. is be applied to the patch name.
If the environment variable FAKE is set to 'y', then the command will If the environment variable FAKE is set to 'y', then nothing gets done,
only be printed, and not executed (so you can check beforehand). the command to run is only be printed, and not executed (so you can
check beforehand).
'dst_dir' must not yet exist.
Eg.: Eg.:
patch-renumber.sh patches/gcc/4.3.1 100 10 patch-renumber.sh patches/gcc/4.2.3 patches/gcc/4.2.4 100 10
patch-renumber.sh patches/gcc/4.2.4 100 10 's/(all[_-])*(gcc[-_])*//;' patch-renumber.sh /some/dir/my-patches patches/gcc/4.3.1 100 10 's/(all[_-])*(gcc[-_])*//;'
_EOF_ _EOF_
} }
[ $# -lt 3 -o $# -gt 4 ] && { doUsage; exit 1; } [ $# -lt 4 -o $# -gt 5 ] && { doUsage; exit 1; }
[ -d "${1}" ] || { doUsage; exit 1; }
dir="${1}" src="${1}"
cpt="${2}" dst="${2}"
inc="${3}" cpt="${3}"
sed_re="${4}" inc="${4}"
sed_re="${5}"
case "$(LC_ALL=C hg id "${dir}" 2>/dev/null)" in if [ ! -d "${src}" ]; then
"") CMD="";; printf "%s: '%s': not a directory\n" "${myname}" "${src}"
*) CMD="hg";; exit 1
esac fi
if [ -d "${dst}" ]; then
if [ "${FAKE}" = "y" ]; then printf "%s: '%s': directory already exists\n" "${myname}" "${dst}"
CMD="echo ${CMD}" exit 1
fi fi
for p in "${dir}"/*.patch*; do Q=
if [ -n "${FAKE}" ]; then
printf "%s: won't do anything: FAKE='%s'\n" "${myname}" "${FAKE}"
Q="echo"
fi
${Q} mkdir -pv "${dst}"
for p in "${src}/"*.patch*; do
[ -e "${p}" ] || { echo "No such file '${p}'"; exit 1; } [ -e "${p}" ] || { echo "No such file '${p}'"; exit 1; }
newname="$(printf "%03d-%s" \ newname="$(printf "%03d-%s" \
"${cpt}" \ "${cpt}" \
@ -48,6 +63,6 @@ for p in "${dir}"/*.patch*; do
-e "${sed_re}" \ -e "${sed_re}" \
)" \ )" \
)" )"
[ "${p}" = "${dir}/${newname}" ] || ${CMD} mv -v "${p}" "${dir}/${newname}" ${Q} cp -v "${p}" "${dst}/${newname}"
cpt=$((cpt+inc)) cpt=$((cpt+inc))
done done

153
scripts/patch-rework.sh Executable file
View File

@ -0,0 +1,153 @@
#!/bin/sh
# Get our required options
base="$1"
src="$2"
dst="$3"
shift 3
# The remainder is for diff
diff="$@"
# This function checks that the files listed in the file in "$1"
# do exist, at the given depth-stripping level (aka diff -p#)
do_check_files_at_depth() {
local flist="$1"
local depth="$2"
local ok=0 # 0: OK, !0: KO
exec 6<&0
exec 7<"${flist}"
while read -u7 f; do
f="$( echo "${f}" |sed -r -e "s:^([^/]+/){${depth}}::;" )"
[ -f "${f}" ] || ok=1
done
exec 7<&-
exec <&6
return ${ok}
}
mkdir -p "${dst}"
dst="$( cd "${dst}"; pwd )"
# Iterate through patches
for p in "${src}/"*.patch; do
pname="$( basename "${p}" )"
printf "Handling patch '${pname}'...\n"
printf " creating reference..."
cp -a "${base}" "${base}.orig"
printf " done\n"
printf " retrieving patch comment..."
comment="$( awk '
BEGIN { mark=0; }
$0~/^diff --/ { nextfile; }
$1=="---" { mark=1; next; }
$1=="+++" && mark==1 { nextfile; }
{ mark=0; print; }
' "${p}" )"
printf " done\n"
printf " creating patched file list..."
diffstat -f 4 -r 2 -u -p 0 "${p}" \
|head -n -1 \
|awk '{ for(i=NF;i>=NF-5;i--) { $(i) = ""; } print; }' \
|sort \
>"diffstat.orig"
printf " done\n"
pushd "${base}" >/dev/null 2>&1
# Check all files exist, up to depth 3
printf " checking depth:"
for((d=0;d<4;d++)); do
printf " ${d}"
if do_check_files_at_depth "../diffstat.orig" ${d}; then
printf " ok, using depth '${d}'\n"
break
fi
done
if [ ${d} -ge 4 ]; then
printf "\n"
printf " checking depth failed\n"
read -p " --> enter patch depth (or Ctrl-C to abort): " d
fi
# Store the original list of fiels touched by the patch,
# removing the $d leading components
sed -r -e "s:^([^/]+/){${d}}::;" "../diffstat.orig" >"${dst}/${pname}.diffstat.orig"
# Apply the patch proper, and check it applied cleanly.
# We can't check with --dry-run because of patches that
# contain multiple accumulated patches onto a single file.
printf " applying patch..."
if ! patch -g0 -F1 -f -p${d} <"${p}" >"../patch.out" 2>&1; then
printf " ERROR\n"
# Revert the patch
popd >/dev/null 2>&1
printf " restoring '${base}'..."
rm -f "diffstat.tmp"
rm -rf "${base}"
mv "${base}.orig" "${base}"
printf " done\n\n"
printf "There was an error while applying:\n --> ${p} <--\n"
printf "'${base}' was restored to the state it was prior to applying this faulty patch.\n"
printf "Here's the 'patch' command, and its output:\n"
printf " ----8<----\n"
printf " patch -g0 -F1 -f -p${d} <'${p}'\n"
cat "patch.out" |(IFS=$(printf "\n"); while read line; do printf " ${line}\n"; done)
rm -f "patch.out"
printf " ----8<----\n"
exit 1
fi
printf " done\n"
printf " removing '.orig' files..."
find . -type f -name '*.orig' -exec rm -f {} +
printf " done\n"
popd >/dev/null 2>&1
printf " re-diffing the patch..."
printf "%s\n\n" "${comment}" >"${dst}/${pname}"
diff -durN "${base}.orig" "${base}" >>"${dst}/${pname}"
printf " done\n"
if [ -n "${diff}" ]; then
printf " applying diff filter..."
filterdiff -x "${diff}" "${dst}/${pname}" >"tmp-diff"
mv "tmp-diff" "${dst}/${pname}"
printf " done\n"
fi
printf " creating new patched file list..."
diffstat -f 4 -r 2 -u -p 1 "${dst}/${pname}" \
|head -n -1 \
|awk '{ for(i=NF;i>=NF-5;i--) { $(i) = ""; } print; }' \
|sort \
>"${dst}/${pname}.diffstat.new"
printf " done\n"
printf " removing temporary files/dirs..."
rm -f "patch.out"
rm -f "diffstat.tmp"
rm -rf "${base}.orig"
printf " done\n"
done
# Scan all new patches to see if they touch
# more files than the original patches
printf "\nChecking resulting patchset:\n"
for p in "${dst}/"*.patch; do
pname="$( basename "${p}" )"
if ! cmp "${p}.diffstat.orig" "${p}.diffstat.new" >/dev/null; then
printf " --> '${pname}' differ in touched files <--\n"
fi
done
printf " done.\n"