From schwidefsky@de.ibm.com Mon Jan 5 14:49:00 2009 From: schwidefsky@de.ibm.com (Martin Schwidefsky) Date: Mon, 05 Jan 2009 14:49:00 -0000 Subject: [PATCH] s390: make use of vdso. Message-ID: <1231166959.20209.1.camel@localhost> Greetings, the s390 vdso implementation has been intregrated into the upstream kernel repository with git commit b020632e40c3ed5e8c0c066d022672907e8401cf. This patch uses the vdso to speed up the glibc functions gettimeofday, clock_gettime and clock_getres. I have chosen kernel version 2.6.29 as symbol version as the next kernel release will be the first one with the vdso support. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- 2009-01-05 Martin Schwidefsky * sysdeps/unix/sysv/linux/s390/bits/libc-vdso.h: New file. * sysdeps/unix/sysv/linux/s390/gettimeofday.c: New file. * sysdeps/unix/sysv/linux/s390/init-first.c: New file. * sysdeps/unix/sysv/linux/s390/Makefile (sysdep_routines): Add dl-vdso for elf subdir. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (INLINE_VSYSCALL, INTERNAL_VSYSCALL, INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK, INTERNAL_SYSCALL_NCS, HAVE_CLOCK_GETRES_VSYSCALL and HAVE_CLOCK_GETTIME_VSYSCALL: Define. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/Versions: New file. diff -urpN libc/sysdeps/unix/sysv/linux/s390/bits/libc-vdso.h libc-s390/sysdeps/unix/sysv/linux/s390/bits/libc-vdso.h --- libc/sysdeps/unix/sysv/linux/s390/bits/libc-vdso.h 1970-01-01 01:00:00.000000000 +0100 +++ libc-s390/sysdeps/unix/sysv/linux/s390/bits/libc-vdso.h 2009-01-02 10:50:26.000000000 +0100 @@ -0,0 +1,35 @@ +/* Resolve function pointers to VDSO functions. + Copyright (C) 2008 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 _LIBC_VDSO_H +#define _LIBC_VDSO_H + +#ifdef SHARED + +extern long int (*__vdso_gettimeofday) (struct timeval *, void *) + attribute_hidden; + +extern long int (*__vdso_clock_gettime) (clockid_t, struct timespec *); + +extern long int (*__vdso_clock_getres) (clockid_t, struct timespec *); + +#endif + +#endif /* _LIBC_VDSO_H */ diff -urpN libc/sysdeps/unix/sysv/linux/s390/gettimeofday.c libc-s390/sysdeps/unix/sysv/linux/s390/gettimeofday.c --- libc/sysdeps/unix/sysv/linux/s390/gettimeofday.c 1970-01-01 01:00:00.000000000 +0100 +++ libc-s390/sysdeps/unix/sysv/linux/s390/gettimeofday.c 2009-01-02 10:50:26.000000000 +0100 @@ -0,0 +1,42 @@ +/* Copyright (C) 2008 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 +#include +#include +#include +#include +#include + +#undef __gettimeofday +#include + +/* Get the current time of day and timezone information, + putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled. + Returns 0 on success, -1 on errors. */ + +int +__gettimeofday (tv, tz) + struct timeval *tv; + struct timezone *tz; +{ + return INLINE_VSYSCALL (gettimeofday, 2, CHECK_1 (tv), CHECK_1 (tz)); +} + +INTDEF (__gettimeofday) +weak_alias (__gettimeofday, gettimeofday) diff -urpN libc/sysdeps/unix/sysv/linux/s390/init-first.c libc-s390/sysdeps/unix/sysv/linux/s390/init-first.c --- libc/sysdeps/unix/sysv/linux/s390/init-first.c 1970-01-01 01:00:00.000000000 +0100 +++ libc-s390/sysdeps/unix/sysv/linux/s390/init-first.c 2009-01-02 10:52:22.000000000 +0100 @@ -0,0 +1,50 @@ +/* Copyright (C) 2008 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. */ + +#ifdef SHARED +# include +# undef __gettimeofday +# undef __clock_gettime +# undef __clock_getres +# include + +long int (*__vdso_gettimeofday) (struct timeval *, void *) attribute_hidden; + +long int (*__vdso_clock_gettime) (clockid_t, struct timespec *) + __attribute__ ((nocommon)); +strong_alias (__vdso_clock_gettime, __GI___vdso_clock_gettime attribute_hidden) + +long int (*__vdso_clock_getres) (clockid_t, struct timespec *) + __attribute__ ((nocommon)); +strong_alias (__vdso_clock_getres, __GI___vdso_clock_getres attribute_hidden) + + +static inline void +_libc_vdso_platform_setup (void) +{ + PREPARE_VERSION (linux2629, "LINUX_2.6.29", 123718585); + + __vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2629); + __vdso_clock_gettime = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2629); + __vdso_clock_getres = _dl_vdso_vsym ("__kernel_clock_getres", &linux2629); +} + +# define VDSO_SETUP _libc_vdso_platform_setup +#endif + +#include "../init-first.c" diff -urpN libc/sysdeps/unix/sysv/linux/s390/Makefile libc-s390/sysdeps/unix/sysv/linux/s390/Makefile --- libc/sysdeps/unix/sysv/linux/s390/Makefile 2008-09-30 13:23:20.000000000 +0200 +++ libc-s390/sysdeps/unix/sysv/linux/s390/Makefile 2009-01-02 10:50:26.000000000 +0100 @@ -6,3 +6,7 @@ endif ifeq ($(subdir),stdlib) gen-as-const-headers += ucontext_i.sym endif + +ifeq ($(subdir),elf) +sysdep_routines += dl-vdso +endif diff -urpN libc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h libc-s390/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h --- libc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h 2008-09-30 11:19:54.000000000 +0200 +++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h 2009-01-02 10:50:26.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -26,6 +26,11 @@ #include /* For RTLD_PRIVATE_ERRNO. */ #include +/* Define __set_errno() for INLINE_SYSCALL macro below. */ +#ifndef __ASSEMBLER__ +#include +#endif + /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -276,6 +281,100 @@ #define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) #define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7) +#define CLOBBER_0 , "3", "4", "5" +#define CLOBBER_1 , "3", "4", "5" +#define CLOBBER_2 , "4", "5" +#define CLOBBER_3 , "5" +#define CLOBBER_4 +#define CLOBBER_5 +#define CLOBBER_6 + +/* List of system calls which are supported as vsyscalls. */ +#define HAVE_CLOCK_GETRES_VSYSCALL 1 +#define HAVE_CLOCK_GETTIME_VSYSCALL 1 + +/* This version is for kernels that implement system calls that + behave like function calls as far as register saving. + It falls back to the syscall in the case that the vDSO doesn't + exist or fails for ENOSYS */ +#ifdef SHARED +# define INLINE_VSYSCALL(name, nr, args...) \ + ({ \ + __label__ out; \ + __label__ iserr; \ + long int _ret; \ + \ + if (__vdso_##name != NULL) \ + { \ + _ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, , nr, ##args); \ + if (!INTERNAL_SYSCALL_ERROR_P (_ret, )) \ + goto out; \ + if (INTERNAL_SYSCALL_ERRNO (_ret, ) != ENOSYS) \ + goto iserr; \ + } \ + \ + _ret = INTERNAL_SYSCALL (name, , nr, ##args); \ + if (INTERNAL_SYSCALL_ERROR_P (_ret, )) \ + { \ + iserr: \ + __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \ + _ret = -1L; \ + } \ + out: \ + (int) _ret; \ + }) +#else +# define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) +#endif + +#ifdef SHARED +# define INTERNAL_VSYSCALL(name, err, nr, args...) \ + ({ \ + __label__ out; \ + long int _ret; \ + \ + if (__vdso_##name != NULL) \ + { \ + _ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \ + if (!INTERNAL_SYSCALL_ERROR_P (_ret, err) \ + || INTERNAL_SYSCALL_ERRNO (_ret, err) != ENOSYS) \ + goto out; \ + } \ + _ret = INTERNAL_SYSCALL (name, err, nr, ##args); \ + out: \ + _ret; \ + }) +#else +# define INTERNAL_VSYSCALL(name, err, nr, args...) \ + INTERNAL_SYSCALL (name, err, nr, ##args) +#endif + +/* This version is for internal uses when there is no desire + to set errno */ +#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \ + ({ \ + long int _ret = ENOSYS; \ + \ + if (__vdso_##name != NULL) \ + _ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \ + else \ + err = 1 << 28; \ + _ret; \ + }) + +#define INTERNAL_VSYSCALL_NCS(fn, err, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register long _ret asm("2"); \ + asm volatile ( \ + "lr 11,14\n\t" \ + "basr 14,%1\n\t" \ + "lr 14,11\n\t" \ + : "=d" (_ret) \ + : "d" (fn) ASMFMT_##nr \ + : "cc", "memory", "0", "1", "11" CLOBBER_##nr); \ + _ret; }) /* Pointer mangling support. */ #if defined NOT_IN_libc && defined IS_IN_rtld diff -urpN libc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h --- libc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h 2008-09-30 11:19:54.000000000 +0200 +++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h 2009-01-02 10:50:26.000000000 +0100 @@ -1,5 +1,5 @@ /* Assembler macros for 64 bit S/390. - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -27,6 +27,11 @@ #include /* For RTLD_PRIVATE_ERRNO. */ #include +/* Define __set_errno() for INLINE_SYSCALL macro below. */ +#ifndef __ASSEMBLER__ +#include +#endif + /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -278,6 +283,101 @@ #define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) #define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7) +#define CLOBBER_0 , "3", "4", "5" +#define CLOBBER_1 , "3", "4", "5" +#define CLOBBER_2 , "4", "5" +#define CLOBBER_3 , "5" +#define CLOBBER_4 +#define CLOBBER_5 +#define CLOBBER_6 + +/* List of system calls which are supported as vsyscalls. */ +#define HAVE_CLOCK_GETRES_VSYSCALL 1 +#define HAVE_CLOCK_GETTIME_VSYSCALL 1 + +/* This version is for kernels that implement system calls that + behave like function calls as far as register saving. + It falls back to the syscall in the case that the vDSO doesn't + exist or fails for ENOSYS */ +#ifdef SHARED +# define INLINE_VSYSCALL(name, nr, args...) \ + ({ \ + __label__ out; \ + __label__ iserr; \ + long int _ret; \ + \ + if (__vdso_##name != NULL) \ + { \ + _ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, , nr, ##args); \ + if (!INTERNAL_SYSCALL_ERROR_P (_ret, )) \ + goto out; \ + if (INTERNAL_SYSCALL_ERRNO (_ret, ) != ENOSYS) \ + goto iserr; \ + } \ + \ + _ret = INTERNAL_SYSCALL (name, , nr, ##args); \ + if (INTERNAL_SYSCALL_ERROR_P (_ret, )) \ + { \ + iserr: \ + __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \ + _ret = -1L; \ + } \ + out: \ + (int) _ret; \ + }) +#else +# define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) +#endif + +#ifdef SHARED +# define INTERNAL_VSYSCALL(name, err, nr, args...) \ + ({ \ + __label__ out; \ + long int _ret; \ + \ + if (__vdso_##name != NULL) \ + { \ + _ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \ + if (!INTERNAL_SYSCALL_ERROR_P (_ret, err) \ + || INTERNAL_SYSCALL_ERRNO (_ret, err) != ENOSYS) \ + goto out; \ + } \ + _ret = INTERNAL_SYSCALL (name, err, nr, ##args); \ + out: \ + _ret; \ + }) +#else +# define INTERNAL_VSYSCALL(name, err, nr, args...) \ + INTERNAL_SYSCALL (name, err, nr, ##args) +#endif + +/* This version is for internal uses when there is no desire + to set errno */ +#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \ + ({ \ + long int _ret = ENOSYS; \ + \ + if (__vdso_##name != NULL) \ + _ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \ + else \ + err = 1 << 28; \ + _ret; \ + }) + +#define INTERNAL_VSYSCALL_NCS(fn, err, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register long _ret asm("2"); \ + asm volatile ( \ + "lgr 11,14\n\t" \ + "basr 14,%1\n\t" \ + "lgr 14,11\n\t" \ + : "=d" (_ret) \ + : "a" (fn) ASMFMT_##nr \ + : "cc", "memory", "0", "1", "11" CLOBBER_##nr); \ + _ret; }) + /* Pointer mangling support. */ #if defined NOT_IN_libc && defined IS_IN_rtld /* We cannot use the thread descriptor because in ld.so we use setjmp diff -urpN libc/sysdeps/unix/sysv/linux/s390/Versions libc-s390/sysdeps/unix/sysv/linux/s390/Versions --- libc/sysdeps/unix/sysv/linux/s390/Versions 1970-01-01 01:00:00.000000000 +0100 +++ libc-s390/sysdeps/unix/sysv/linux/s390/Versions 2009-01-02 10:50:26.000000000 +0100 @@ -0,0 +1,6 @@ +libc { + GLIBC_PRIVATE { + __vdso_clock_gettime; + __vdso_clock_getres; + } +} From drepper@redhat.com Thu Jan 8 00:42:00 2009 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 08 Jan 2009 00:42:00 -0000 Subject: [PATCH] s390: make use of vdso. In-Reply-To: <1231166959.20209.1.camel@localhost> References: <1231166959.20209.1.camel@localhost> Message-ID: <496548B4.7090801@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Applied. - -- ??? Ulrich Drepper ??? Red Hat, Inc. ??? 444 Castro St ??? Mountain View, CA ??? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkllSLQACgkQ2ijCOnn/RHTOkwCgjqC0zMYkAnSEct+N8djUR74c fEkAoKZKOfoKZq3Hw3oeUH81azITj18a =lopc -----END PGP SIGNATURE----- From kkojima@rr.iij4u.or.jp Wed Jan 14 03:49:00 2009 From: kkojima@rr.iij4u.or.jp (Kaz Kojima) Date: Wed, 14 Jan 2009 03:49:00 -0000 Subject: [PATCH] SH nptl tidyup Message-ID: <20090114.124816.43311703.kkojima@rr.iij4u.or.jp> Hi, The attached patch is a nptl patch for SH to sync with the recent x86 changes. Regards, kaz -- 2009-01-14 Kaz Kojima * sysdeps/unix/sysv/linux/sh/lowlevellock.S (__lll_timedlock_wait): Use FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME instead of computing relative timeout. * sysdeps/unix/sysv/linux/sh/lowlevellock.h: Define FUTEX_CLOCK_REALTIME and FUTEX_BITSET_MATCH_ANY. diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S 2008-01-23 06:46:43.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S 2009-01-14 10:49:59.000000000 +0900 @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004, 2005, 2007, 2008 +/* Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -36,6 +36,13 @@ mov #(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), tmp; \ extu.b tmp, tmp; \ xor tmp, reg +# define LOAD_FUTEX_WAIT_ABS(reg,tmp,tmp2) \ + mov #(FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG), tmp; \ + extu.b tmp, tmp; \ + mov #(FUTEX_CLOCK_REALTIME >> 8), tmp2; \ + swap.b tmp2, tmp2; \ + or tmp2, tmp; \ + xor tmp, reg # define LOAD_FUTEX_WAKE(reg,tmp,tmp2) \ mov #(FUTEX_WAKE | FUTEX_PRIVATE_FLAG), tmp; \ extu.b tmp, tmp; \ @@ -96,6 +103,22 @@ and tmp2, reg ; \ mov #FUTEX_WAIT, tmp ; \ or tmp, reg +# define LOAD_FUTEX_WAIT_ABS(reg,tmp,tmp2) \ + stc gbr, tmp ; \ + mov.w 99f, tmp2 ; \ + add tmp2, tmp ; \ + mov.l @tmp, tmp2 ; \ + bra 98f ; \ + mov #FUTEX_PRIVATE_FLAG, tmp ; \ +99: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE ; \ +98: extu.b tmp, tmp ; \ + xor tmp, reg ; \ + and tmp2, reg ; \ + mov #FUTEX_WAIT_BITSET, tmp ; \ + mov #(FUTEX_CLOCK_REALTIME >> 8), tmp2; \ + swap.b tmp2, tmp2; \ + or tmp2, tmp; \ + or tmp, reg # endif # define LOAD_FUTEX_WAKE(reg,tmp,tmp2) \ stc gbr, tmp ; \ @@ -193,12 +216,85 @@ __lll_lock_wait: cfi_endproc .size __lll_lock_wait,.-__lll_lock_wait + /* r5 (r8): futex + r7 (r11): flags + r6 (r9): timeout + r4 (r10): futex value + */ .globl __lll_timedlock_wait .type __lll_timedlock_wait,@function .hidden __lll_timedlock_wait .align 5 cfi_startproc __lll_timedlock_wait: + mov.l r12, @-r15 + cfi_adjust_cfa_offset(4) + cfi_rel_offset (r12, 0) + +# ifndef __ASSUME_FUTEX_CLOCK_REALTIME + mov.l .Lhave, r1 +# ifdef PIC + mova .Lgot, r0 + mov.l .Lgot, r12 + add r0, r12 + add r12, r1 +# endif + mov.l @r1, r0 + tst r0, r0 + bt .Lreltmo +# endif + + mov r4, r2 + mov r5, r4 + mov r7, r5 + mov r6, r7 + LOAD_FUTEX_WAIT_ABS (r5, r0, r1) + + mov #2, r6 + cmp/eq r6, r2 + bf/s 2f + mov r2, r6 + +1: + mov #2, r6 + mov #-1, r1 + mov #SYS_futex, r3 + extu.b r3, r3 + trapa #0x16 + SYSCALL_INST_PAD + mov r0, r6 + +2: + XCHG (r2, @r4, r3) /* NB: lock is implied */ + + tst r3, r3 + bt/s 3f + mov r6, r0 + + cmp/eq #-ETIMEDOUT, r0 + bt 4f + cmp/eq #-EINVAL, r0 + bf 1b +4: + neg r0, r3 +3: + mov r3, r0 + rts + mov.l @r15+, r12 + + .align 2 +# ifdef PIC +.Lgot: + .long _GLOBAL_OFFSET_TABLE_ +.Lhave: + .long __have_futex_clock_realtime@GOTOFF +# else +.Lhave: + .long __have_futex_clock_realtime +# endif + +# ifndef __ASSUME_FUTEX_CLOCK_REALTIME +.Lreltmo: /* Check for a valid timeout value. */ mov.l @(4,r6), r1 mov.l .L1g, r0 @@ -290,12 +386,15 @@ __lll_timedlock_wait: mov.l @r15+, r8 mov.l @r15+, r9 mov.l @r15+, r10 + mov.l @r15+, r11 rts - mov.l @r15+, r11 + mov.l @r15+, r12 3: + mov.l @r15+, r12 rts mov #EINVAL, r0 +# endif cfi_endproc .L1k: diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h 2008-12-06 07:14:23.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h 2009-01-13 22:37:01.000000000 +0900 @@ -1,4 +1,5 @@ -/* Copyright (C) 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2003, 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 @@ -37,6 +38,9 @@ #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 #define FUTEX_OP_CLEAR_WAKE_IF_GT_ONE ((4 << 24) | 1) From kkojima@rr.iij4u.or.jp Wed Jan 14 03:50:00 2009 From: kkojima@rr.iij4u.or.jp (Kaz Kojima) Date: Wed, 14 Jan 2009 03:50:00 -0000 Subject: [PATCH] SH: Fixup clobber list of syscall Message-ID: <20090114.124900.206586899.kkojima@rr.iij4u.or.jp> Recently SH kernel folks changes the syscall interface so to clobber the T register. Here is a follow up patch for this change. Regards, kaz -- 2009-01-14 Kaz Kojima * sysdeps/unix/sysv/linux/sh/sysdep.h (INTERNAL_SYSCALL): Add "t" to clobber list. (INTERNAL_SYSCALL_NCS): Likewise. --- ORIG/libc/sysdeps/unix/sysv/linux/sh/sysdep.h 2006-01-21 07:09:52.000000000 +0900 +++ LOCAL/libc/sysdeps/unix/sysv/linux/sh/sysdep.h 2009-01-14 10:56:43.000000000 +0900 @@ -1,5 +1,5 @@ /* Copyright (C) 1992,1993,1995,1996,1997,1998,1999,2000,2002,2003,2004, - 2005,2006 Free Software Foundation, Inc. + 2005,2006,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, , August 1995. Changed by Kaz Kojima, . @@ -339,7 +339,7 @@ asm volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \ : "=z" (resultvar) \ : "r" (r3) ASMFMT_##nr \ - : "memory"); \ + : "memory", "t"); \ \ (int) resultvar; }) @@ -353,7 +353,7 @@ asm volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \ : "=z" (resultvar) \ : "r" (r3) ASMFMT_##nr \ - : "memory"); \ + : "memory", "t"); \ \ (int) resultvar; }) From schwab@suse.de Thu Jan 22 00:01:00 2009 From: schwab@suse.de (Andreas Schwab) Date: Thu, 22 Jan 2009 00:01:00 -0000 Subject: Fix version map sorting Message-ID: The math/Versions file has an inline comment which is mishandled by the version map scripts: exp2; exp2f; # exp2l; -- bug omitted this until GLIBC_2.4 (below) Such inline comments are not stripped, and the dot in it becomes significant when sorting the temporary versions file. On targets where GLIBC_2.2 is the earliest version for libm this causes the file to be out of order: this line is sorted as if belonging to GLIBC_2.2.4. Fixed by putting the comment on a line by itself. Andreas. 2009-01-22 Andreas Schwab * math/Versions: Avoid inline comment. --- math/Versions 29 M??r 2005 11:41:38 +0200 1.9 +++ math/Versions 22 Jan 2009 00:42:47 +0100 @@ -94,7 +94,8 @@ libm { } GLIBC_2.1 { # mathematical functions - exp2; exp2f; # exp2l; -- bug omitted this until GLIBC_2.4 (below) + exp2; exp2f; + # exp2l; -- bug omitted this until GLIBC_2.4 (below) exp10; exp10f; exp10l; fdim; fdimf; fdiml; fma; fmaf; fmal; -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra??e 5, 90409 N??rnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From roland@redhat.com Thu Jan 22 02:52:00 2009 From: roland@redhat.com (Roland McGrath) Date: Thu, 22 Jan 2009 02:52:00 -0000 Subject: Fix version map sorting In-Reply-To: Andreas Schwab's message of Thursday, 22 January 2009 01:00:43 +0100 References: Message-ID: <20090122025201.6FC88FC3C7@magilla.sf.frob.com> Does this instead work for you? Thanks, Roland 2009-01-21 Roland McGrath * Makeconfig (%.v.i): Strip trailing # comments, not only whole-line comments. Index: Makeconfig =================================================================== RCS file: /cvs/glibc/libc/Makeconfig,v retrieving revision 1.327 diff -u -r1.327 Makeconfig --- Makeconfig 18 Aug 2008 09:42:17 -0000 1.327 +++ Makeconfig 22 Jan 2009 02:51:25 -0000 @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2003,2004,2005,2006,2007,2008 +# Copyright (C) 1991-2003,2004,2005,2006,2007,2008,2009 # Free Software Foundation, Inc. # This file is part of the GNU C Library. @@ -794,7 +794,8 @@ # listing both its input files, and any header files that it may reference # (but no commands). %.v.i: $(common-objpfx)config.h - sed '/^[ ]*#/d;s/^[ ]*%/#/' $(filter-out FORCE %.h,$^) \ + sed 's/#.*$$//;s//^[ ]*$$/d;s/^[ ]*%/#/' \ + $(filter-out FORCE %.h,$^) \ | $(CC) -E -undef $(CPPFLAGS) -x assembler-with-cpp - \ > $@T mv -f $@T $@ From schwab@suse.de Thu Jan 22 09:47:00 2009 From: schwab@suse.de (Andreas Schwab) Date: Thu, 22 Jan 2009 09:47:00 -0000 Subject: Fix version map sorting In-Reply-To: <20090122025201.6FC88FC3C7@magilla.sf.frob.com> (Roland McGrath's message of "Wed, 21 Jan 2009 18:52:01 -0800 (PST)") References: <20090122025201.6FC88FC3C7@magilla.sf.frob.com> Message-ID: Roland McGrath writes: > @@ -794,7 +794,8 @@ > # listing both its input files, and any header files that it may reference > # (but no commands). > %.v.i: $(common-objpfx)config.h > - sed '/^[ ]*#/d;s/^[ ]*%/#/' $(filter-out FORCE %.h,$^) \ > + sed 's/#.*$$//;s//^[ ]*$$/d;s/^[ ]*%/#/' \ + sed 's/#.*$$//;/^[ ]*$$/d;s/^[ ]*%/#/' \ Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra??e 5, 90409 N??rnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From roland@redhat.com Thu Jan 22 09:49:00 2009 From: roland@redhat.com (Roland McGrath) Date: Thu, 22 Jan 2009 09:49:00 -0000 Subject: Fix version map sorting In-Reply-To: Andreas Schwab's message of Thursday, 22 January 2009 10:47:33 +0100 References: <20090122025201.6FC88FC3C7@magilla.sf.frob.com> Message-ID: <20090122094940.02F6CFC3E2@magilla.sf.frob.com> > > + sed 's/#.*$$//;s//^[ ]*$$/d;s/^[ ]*%/#/' \ > + sed 's/#.*$$//;/^[ ]*$$/d;s/^[ ]*%/#/' \ Oops, thanks. Do you mean that with that it does work fine without your other patch? Thanks, Roland From schwab@suse.de Thu Jan 22 10:28:00 2009 From: schwab@suse.de (Andreas Schwab) Date: Thu, 22 Jan 2009 10:28:00 -0000 Subject: Fix version map sorting In-Reply-To: <20090122094940.02F6CFC3E2@magilla.sf.frob.com> (Roland McGrath's message of "Thu, 22 Jan 2009 01:49:39 -0800 (PST)") References: <20090122025201.6FC88FC3C7@magilla.sf.frob.com> <20090122094940.02F6CFC3E2@magilla.sf.frob.com> Message-ID: Roland McGrath writes: >> > + sed 's/#.*$$//;s//^[ ]*$$/d;s/^[ ]*%/#/' \ >> + sed 's/#.*$$//;/^[ ]*$$/d;s/^[ ]*%/#/' \ > > Oops, thanks. Do you mean that with that it does work fine without your > other patch? Yes. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra??e 5, 90409 N??rnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From schwab@suse.de Thu Jan 22 13:01:00 2009 From: schwab@suse.de (Andreas Schwab) Date: Thu, 22 Jan 2009 13:01:00 -0000 Subject: Fix version map sorting In-Reply-To: (Andreas Schwab's message of "Thu, 22 Jan 2009 11:28:10 +0100") References: <20090122025201.6FC88FC3C7@magilla.sf.frob.com> <20090122094940.02F6CFC3E2@magilla.sf.frob.com> Message-ID: Andreas Schwab writes: > Roland McGrath writes: > >>> > + sed 's/#.*$$//;s//^[ ]*$$/d;s/^[ ]*%/#/' \ >>> + sed 's/#.*$$//;/^[ ]*$$/d;s/^[ ]*%/#/' \ >> >> Oops, thanks. Do you mean that with that it does work fine without your >> other patch? > > Yes. But not the change you just committed. Andreas. 2009-01-22 Andreas Schwab * Makeconfig (%.v.i): Fix typo. Index: Makeconfig =================================================================== RCS file: /cvs/glibc/libc/Makeconfig,v retrieving revision 1.328 diff -u -a -p -u -p -a -r1.328 Makeconfig --- Makeconfig 22 Jan 2009 11:25:16 -0000 1.328 +++ Makeconfig 22 Jan 2009 13:00:11 -0000 @@ -794,7 +794,7 @@ ifeq (yes, $(build-shared)) # listing both its input files, and any header files that it may reference # (but no commands). %.v.i: $(common-objpfx)config.h - sed 's/#.*$$//;//^[ ]*$$/d;s/^[ ]*%/#/' \ + sed 's/#.*$$//;/^[ ]*$$/d;s/^[ ]*%/#/' \ $(filter-out FORCE %.h,$^) \ | $(CC) -E -undef $(CPPFLAGS) -x assembler-with-cpp - \ > $@T -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra??e 5, 90409 N??rnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From roland@redhat.com Thu Jan 22 20:38:00 2009 From: roland@redhat.com (Roland McGrath) Date: Thu, 22 Jan 2009 20:38:00 -0000 Subject: Fix version map sorting In-Reply-To: Andreas Schwab's message of Thursday, 22 January 2009 14:01:45 +0100 References: <20090122025201.6FC88FC3C7@magilla.sf.frob.com> <20090122094940.02F6CFC3E2@magilla.sf.frob.com> Message-ID: <20090122203842.D990BFC3C5@magilla.sf.frob.com> > But not the change you just committed. :-) One day I'll learn how to do this stuff. From drepper@redhat.com Wed Jan 28 16:10:00 2009 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 28 Jan 2009 16:10:00 -0000 Subject: [PATCH] SH nptl tidyup In-Reply-To: <20090114.124816.43311703.kkojima@rr.iij4u.or.jp> References: <20090114.124816.43311703.kkojima@rr.iij4u.or.jp> Message-ID: <49808381.1060704@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Applied. - -- ??? Ulrich Drepper ??? Red Hat, Inc. ??? 444 Castro St ??? Mountain View, CA ??? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkmAg4EACgkQ2ijCOnn/RHQM9gCgi56SImiA/5AIxrXuR1Bdntql TnUAnio2/4DnG+/XpGRI5Fx2ubXGOgrO =OnJp -----END PGP SIGNATURE----- From drepper@redhat.com Wed Jan 28 16:11:00 2009 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 28 Jan 2009 16:11:00 -0000 Subject: [PATCH] SH: Fixup clobber list of syscall In-Reply-To: <20090114.124900.206586899.kkojima@rr.iij4u.or.jp> References: <20090114.124900.206586899.kkojima@rr.iij4u.or.jp> Message-ID: <498083C1.5050605@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Applied. - -- ??? Ulrich Drepper ??? Red Hat, Inc. ??? 444 Castro St ??? Mountain View, CA ??? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkmAg8EACgkQ2ijCOnn/RHQXCACgvwXgiNEdBiaBzaoX8cqhsFWq wesAn1icRAXsRJ5vetC6mZdjDakDh5t0 =ypgt -----END PGP SIGNATURE----- From jakub@redhat.com Fri Jan 30 16:13:00 2009 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 30 Jan 2009 16:13:00 -0000 Subject: [PATCH] Fixes for C++ strchr etc. overloads Message-ID: <20090130161620.GA16681@sunsite.ms.mff.cuni.cz> Hi! This patch fixes two problems with the patch from yesterday. 1) #include #include no longer compiles in C++, the same overloads for index/rindex need to be present in both. 2) When the functions are extern "C++", they are no longer considered builtins, so little help (inline wrappers) is needed to tell G++ that they can be optimized if possible. Tested with the testcases posted to gcc-patches today. 2009-01-30 Jakub Jelinek * string/string.h (memchr, strchr, strrchr, strpbrk, strstr, index, rindex): For C++ add inlines so that they can be recognized as builtins. * string/strings.h: Define correct C++ prototypes for gcc 4.4. --- libc/string/string.h.jj 2009-01-30 13:26:22.000000000 +0100 +++ libc/string/string.h 2009-01-30 14:21:47.000000000 +0100 @@ -69,10 +69,27 @@ extern int memcmp (__const void *__s1, _ /* Search N bytes of S for C. */ #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO -extern "C++" void *memchr (void *__s, int __c, size_t __n) +extern "C++" +{ +extern void *memchr (void *__s, int __c, size_t __n) __THROW __asm ("memchr") __attribute_pure__ __nonnull ((1)); -extern "C++" __const void *memchr (__const void *__s, int __c, size_t __n) +extern __const void *memchr (__const void *__s, int __c, size_t __n) __THROW __asm ("memchr") __attribute_pure__ __nonnull ((1)); + +# ifdef __OPTIMIZE__ +__extern_always_inline void * +memchr (void *__s, int __c, size_t __n) __THROW +{ + return __builtin_memchr (__s, __c, __n); +} + +__extern_always_inline __const void * +memchr (__const void *__s, int __c, size_t __n) __THROW +{ + return __builtin_memchr (__s, __c, __n); +} +# endif +} #else extern void *memchr (__const void *__s, int __c, size_t __n) __THROW __attribute_pure__ __nonnull ((1)); @@ -191,20 +208,54 @@ extern char *strndup (__const char *__st __BEGIN_NAMESPACE_STD /* Find the first occurrence of C in S. */ #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO -extern "C++" char *strchr (char *__s, int __c) +extern "C++" +{ +extern char *strchr (char *__s, int __c) __THROW __asm ("strchr") __attribute_pure__ __nonnull ((1)); -extern "C++" __const char *strchr (__const char *__s, int __c) +extern __const char *strchr (__const char *__s, int __c) __THROW __asm ("strchr") __attribute_pure__ __nonnull ((1)); + +# ifdef __OPTIMIZE__ +__extern_always_inline char * +strchr (char *__s, int __c) __THROW +{ + return __builtin_strchr (__s, __c); +} + +__extern_always_inline __const char * +strchr (__const char *__s, int __c) __THROW +{ + return __builtin_strchr (__s, __c); +} +# endif +} #else extern char *strchr (__const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); #endif /* Find the last occurrence of C in S. */ #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO -extern "C++" char *strrchr (char *__s, int __c) +extern "C++" +{ +extern char *strrchr (char *__s, int __c) __THROW __asm ("strrchr") __attribute_pure__ __nonnull ((1)); -extern "C++" __const char *strrchr (__const char *__s, int __c) +extern __const char *strrchr (__const char *__s, int __c) __THROW __asm ("strrchr") __attribute_pure__ __nonnull ((1)); + +# ifdef __OPTIMIZE__ +__extern_always_inline char * +strrchr (char *__s, int __c) __THROW +{ + return __builtin_strrchr (__s, __c); +} + +__extern_always_inline __const char * +strrchr (__const char *__s, int __c) __THROW +{ + return __builtin_strrchr (__s, __c); +} +# endif +} #else extern char *strrchr (__const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); @@ -236,21 +287,55 @@ extern size_t strspn (__const char *__s, __THROW __attribute_pure__ __nonnull ((1, 2)); /* Find the first occurrence in S of any character in ACCEPT. */ #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO -extern "C++" char *strpbrk (char *__s, __const char *__accept) +extern "C++" +{ +extern char *strpbrk (char *__s, __const char *__accept) __THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2)); -extern "C++" __const char *strpbrk (__const char *__s, __const char *__accept) +extern __const char *strpbrk (__const char *__s, __const char *__accept) __THROW __asm ("strpbrk") __attribute_pure__ __nonnull ((1, 2)); + +# ifdef __OPTIMIZE__ +__extern_always_inline char * +strpbrk (char *__s, __const char *__accept) __THROW +{ + return __builtin_strpbrk (__s, __accept); +} + +__extern_always_inline __const char * +strpbrk (__const char *__s, __const char *__accept) __THROW +{ + return __builtin_strpbrk (__s, __accept); +} +# endif +} #else extern char *strpbrk (__const char *__s, __const char *__accept) __THROW __attribute_pure__ __nonnull ((1, 2)); #endif /* Find the first occurrence of NEEDLE in HAYSTACK. */ #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO -extern "C++" char *strstr (char *__haystack, __const char *__needle) +extern "C++" +{ +extern char *strstr (char *__haystack, __const char *__needle) __THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2)); -extern "C++" __const char *strstr (__const char *__haystack, - __const char *__needle) +extern __const char *strstr (__const char *__haystack, + __const char *__needle) __THROW __asm ("strstr") __attribute_pure__ __nonnull ((1, 2)); + +# ifdef __OPTIMIZE__ +__extern_always_inline char * +strstr (char *__haystack, __const char *__needle) __THROW +{ + return __builtin_strstr (__haystack, __needle); +} + +__extern_always_inline __const char * +strstr (__const char *__haystack, __const char *__needle) __THROW +{ + return __builtin_strstr (__haystack, __needle); +} +# endif +} #else extern char *strstr (__const char *__haystack, __const char *__needle) __THROW __attribute_pure__ __nonnull ((1, 2)); @@ -377,10 +462,27 @@ extern int bcmp (__const void *__s1, __c /* Find the first occurrence of C in S (same as strchr). */ # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO -extern "C++" char *index (char *__s, int __c) +extern "C++" +{ +extern char *index (char *__s, int __c) __THROW __asm ("index") __attribute_pure__ __nonnull ((1)); -extern "C++" __const char *index (__const char *__s, int __c) +extern __const char *index (__const char *__s, int __c) __THROW __asm ("index") __attribute_pure__ __nonnull ((1)); + +# if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRINGS_H_PROTO +__extern_always_inline char * +index (char *__s, int __c) __THROW +{ + return __builtin_index (__s, __c); +} + +__extern_always_inline __const char * +index (__const char *__s, int __c) __THROW +{ + return __builtin_index (__s, __c); +} +# endif +} # else extern char *index (__const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); @@ -388,10 +490,27 @@ extern char *index (__const char *__s, i /* Find the last occurrence of C in S (same as strrchr). */ # ifdef __CORRECT_ISO_CPP_STRING_H_PROTO -extern "C++" char *rindex (char *__s, int __c) +extern "C++" +{ +extern char *rindex (char *__s, int __c) __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1)); -extern "C++" __const char *rindex (__const char *__s, int __c) +extern __const char *rindex (__const char *__s, int __c) __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1)); + +# if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRINGS_H_PROTO +__extern_always_inline char * +rindex (char *__s, int __c) __THROW +{ + return __builtin_rindex (__s, __c); +} + +__extern_always_inline __const char * +rindex (__const char *__s, int __c) __THROW +{ + return __builtin_rindex (__s, __c); +} +#endif +} # else extern char *rindex (__const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); --- libc/string/strings.h.jj 2001-07-06 06:55:41.000000000 +0200 +++ libc/string/strings.h 2009-01-30 14:22:40.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,96,97,99,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,96,97,99,2000,2001,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 @@ -28,6 +28,11 @@ # define __need_size_t # include +/* Tell the caller that we provide correct C++ prototypes. */ +# if defined __cplusplus && __GNUC_PREREQ (4, 4) +# define __CORRECT_ISO_CPP_STRINGS_H_PROTO +# endif + __BEGIN_DECLS /* Compare N bytes of S1 and S2 (same as memcmp). */ @@ -45,10 +50,60 @@ extern void bzero (void *__s, size_t __n extern int ffs (int __i) __THROW __attribute__ ((const)); /* Find the first occurrence of C in S (same as strchr). */ -extern char *index (__const char *__s, int __c) __THROW __attribute_pure__; +# ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO +extern "C++" +{ +extern char *index (char *__s, int __c) + __THROW __asm ("index") __attribute_pure__ __nonnull ((1)); +extern __const char *index (__const char *__s, int __c) + __THROW __asm ("index") __attribute_pure__ __nonnull ((1)); + +# if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRING_H_PROTO +__extern_always_inline char * +index (char *__s, int __c) __THROW +{ + return __builtin_index (__s, __c); +} + +__extern_always_inline __const char * +index (__const char *__s, int __c) __THROW +{ + return __builtin_index (__s, __c); +} +# endif +} +# else +extern char *index (__const char *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)); +# endif /* Find the last occurrence of C in S (same as strrchr). */ -extern char *rindex (__const char *__s, int __c) __THROW __attribute_pure__; +# ifdef __CORRECT_ISO_CPP_STRINGS_H_PROTO +extern "C++" +{ +extern char *rindex (char *__s, int __c) + __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1)); +extern __const char *rindex (__const char *__s, int __c) + __THROW __asm ("rindex") __attribute_pure__ __nonnull ((1)); + +# if defined __OPTIMIZE__ && !defined __CORRECT_ISO_CPP_STRING_H_PROTO +__extern_always_inline char * +rindex (char *__s, int __c) __THROW +{ + return __builtin_rindex (__s, __c); +} + +__extern_always_inline __const char * +rindex (__const char *__s, int __c) __THROW +{ + return __builtin_rindex (__s, __c); +} +#endif +} +# else +extern char *rindex (__const char *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)); +# endif /* Compare S1 and S2, ignoring case. */ extern int strcasecmp (__const char *__s1, __const char *__s2) Jakub From aj@suse.de Fri Jan 30 20:02:00 2009 From: aj@suse.de (Andreas Jaeger) Date: Fri, 30 Jan 2009 20:02:00 -0000 Subject: Define SHM_EXEC Message-ID: <87ljss4l5p.fsf@suse.de> SHM_EXEC is defined in but missing in glibc's headers. ok to commit? Andreas 2009-01-30 Andreas Jaeger * sysdeps/unix/sysv/linux/bits/shm.h (SHM_EXEC): Define. * sysdeps/unix/sysv/linux/ia64/bits/shm.h (SHM_EXEC): Define. * sysdeps/unix/sysv/linux/powerpc/bits/shm.h (SHM_EXEC): Define. * sysdeps/unix/sysv/linux/s390/bits/shm.h (SHM_EXEC): Define. * sysdeps/unix/sysv/linux/sh/bits/shm.h (SHM_EXEC): Define. * sysdeps/unix/sysv/linux/sparc/bits/shm.h (SHM_EXEC): Define. * sysdeps/unix/sysv/linux/x86_64/bits/shm.h (SHM_EXEC): Define. ============================================================ Index: ./sysdeps/unix/sysv/linux/ia64/bits/shm.h --- ./sysdeps/unix/sysv/linux/ia64/bits/shm.h 16 Jan 2008 23:49:27 -0000 1.7 +++ ./sysdeps/unix/sysv/linux/ia64/bits/shm.h 30 Jan 2009 20:02:22 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002, 2005, 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 @@ -30,6 +30,7 @@ #define SHM_RDONLY 010000 /* attach read-only else read-write */ #define SHM_RND 020000 /* round attach address to SHMLBA */ #define SHM_REMAP 040000 /* take-over region on attach */ +#define SHM_EXEC 0100000 /* execution access */ /* Commands for `shmctl'. */ #define SHM_LOCK 11 /* lock segment (root only) */ ============================================================ Index: ./sysdeps/unix/sysv/linux/powerpc/bits/shm.h --- ./sysdeps/unix/sysv/linux/powerpc/bits/shm.h 16 Jan 2008 23:49:27 -0000 1.8 +++ ./sysdeps/unix/sysv/linux/powerpc/bits/shm.h 30 Jan 2009 20:02:22 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004 +/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -28,9 +28,10 @@ #define SHM_W 0200 /* or S_IWUGO from */ /* Flags for `shmat'. */ -#define SHM_RDONLY 010000 /* attach read-only else read-write */ -#define SHM_RND 020000 /* round attach address to SHMLBA */ -#define SHM_REMAP 040000 /* take-over region on attach */ +#define SHM_RDONLY 010000 /* attach read-only else read-write */ +#define SHM_RND 020000 /* round attach address to SHMLBA */ +#define SHM_REMAP 040000 /* take-over region on attach */ +#define SHM_EXEC 0100000 /* execution access */ /* Commands for `shmctl'. */ #define SHM_LOCK 11 /* lock segment (root only) */ ============================================================ Index: ./sysdeps/unix/sysv/linux/s390/bits/shm.h --- ./sysdeps/unix/sysv/linux/s390/bits/shm.h 16 Jan 2008 23:49:27 -0000 1.6 +++ ./sysdeps/unix/sysv/linux/s390/bits/shm.h 30 Jan 2009 20:02:22 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2002, 2004, 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 @@ -31,6 +31,7 @@ #define SHM_RDONLY 010000 /* attach read-only else read-write */ #define SHM_RND 020000 /* round attach address to SHMLBA */ #define SHM_REMAP 040000 /* take-over region on attach */ +#define SHM_EXEC 0100000 /* execution access */ /* Commands for `shmctl'. */ #define SHM_LOCK 11 /* lock segment (root only) */ ============================================================ Index: ./sysdeps/unix/sysv/linux/sh/bits/shm.h --- ./sysdeps/unix/sysv/linux/sh/bits/shm.h 16 Jan 2008 23:49:28 -0000 1.2 +++ ./sysdeps/unix/sysv/linux/sh/bits/shm.h 30 Jan 2009 20:02:22 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1996,1997,2000,2002,2004,2006 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1997,2000,2002,2004,2006,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 @@ -30,6 +30,7 @@ #define SHM_RDONLY 010000 /* attach read-only else read-write */ #define SHM_RND 020000 /* round attach address to SHMLBA */ #define SHM_REMAP 040000 /* take-over region on attach */ +#define SHM_EXEC 0100000 /* execution access */ /* Commands for `shmctl'. */ #define SHM_LOCK 11 /* lock segment (root only) */ ============================================================ Index: ./sysdeps/unix/sysv/linux/sparc/bits/shm.h --- ./sysdeps/unix/sysv/linux/sparc/bits/shm.h 16 Jan 2008 23:49:28 -0000 1.9 +++ ./sysdeps/unix/sysv/linux/sparc/bits/shm.h 30 Jan 2009 20:02:22 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004 +/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -32,6 +32,7 @@ #define SHM_RDONLY 010000 /* attach read-only else read-write */ #define SHM_RND 020000 /* round attach address to SHMLBA */ #define SHM_REMAP 040000 /* take-over region on attach */ +#define SHM_EXEC 0100000 /* execution access */ /* Commands for `shmctl'. */ #define SHM_LOCK 11 /* lock segment (root only) */ ============================================================ Index: ./sysdeps/unix/sysv/linux/x86_64/bits/shm.h --- ./sysdeps/unix/sysv/linux/x86_64/bits/shm.h 16 Jan 2008 23:49:28 -0000 1.6 +++ ./sysdeps/unix/sysv/linux/x86_64/bits/shm.h 30 Jan 2009 20:02:22 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004 +/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -31,6 +31,7 @@ #define SHM_RDONLY 010000 /* attach read-only else read-write */ #define SHM_RND 020000 /* round attach address to SHMLBA */ #define SHM_REMAP 040000 /* take-over region on attach */ +#define SHM_EXEC 0100000 /* execution access */ /* Commands for `shmctl'. */ #define SHM_LOCK 11 /* lock segment (root only) */ ============================================================ Index: ./sysdeps/unix/sysv/linux/bits/shm.h --- ./sysdeps/unix/sysv/linux/bits/shm.h 16 Jan 2008 23:49:27 -0000 1.15 +++ ./sysdeps/unix/sysv/linux/bits/shm.h 30 Jan 2009 20:02:22 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1996,1997,2000,2002,2004 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1997,2000,2002,2004,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 @@ -30,6 +30,7 @@ #define SHM_RDONLY 010000 /* attach read-only else read-write */ #define SHM_RND 020000 /* round attach address to SHMLBA */ #define SHM_REMAP 040000 /* take-over region on attach */ +#define SHM_EXEC 0100000 /* execution access */ /* Commands for `shmctl'. */ #define SHM_LOCK 11 /* lock segment (root only) */ -- Andreas Jaeger, Director Platform / openSUSE, aj@suse.de SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N?rnberg) Maxfeldstr. 5, 90409 N?rnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 From drepper@redhat.com Fri Jan 30 20:18:00 2009 From: drepper@redhat.com (Ulrich Drepper) Date: Fri, 30 Jan 2009 20:18:00 -0000 Subject: Define SHM_EXEC In-Reply-To: <87ljss4l5p.fsf@suse.de> References: <87ljss4l5p.fsf@suse.de> Message-ID: <49836063.2030109@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Andreas Jaeger wrote: > ok to commit? Yes. - -- ??? Ulrich Drepper ??? Red Hat, Inc. ??? 444 Castro St ??? Mountain View, CA ??? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkmDYGMACgkQ2ijCOnn/RHR6/ACgtwY/nrXNZDjw756LTpRvwtd8 xywAnihEymTi0gpAsEPXHs+6GspHpGNK =t0V3 -----END PGP SIGNATURE-----