This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, hjl/x32/release/2.15, created. glibc-2.15-126-g5ab87b4


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/x32/release/2.15 has been created
        at  5ab87b4b920c425940a505acb3856838449bdf7f (commit)

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5ab87b4b920c425940a505acb3856838449bdf7f

commit 5ab87b4b920c425940a505acb3856838449bdf7f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 26 12:02:42 2012 -0700

    Use R*_LP on SP, PC and pointers, not on rbp

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index a667747..acd57c5 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,15 @@
 2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S: Use R*_LP
+	to operate on SP, PC and pointers.  Don't use PTR_DEMANGLE on
+	rbp.
+	* sysdeps/x86_64/__longjmp.S: Don't use PTR_DEMANGLE on rbp.
+	Use R*_LP on SP.
+	* sysdeps/x86_64/setjmp.S: Don't use PTR_MANGLE on rbp. Use
+	R*_LP on SP and PC.
+
+2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/x86_64/64/bits/wordsize.h: Check __ILP32__ instead
 	of __LP64__.
 	* sysdeps/x86_64/x32/bits/wordsize.h: Likewise.
diff --git a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
index fd7e6b7..17d824b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
+++ b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
@@ -32,15 +32,15 @@ longjmp_msg:
 //#define __longjmp ____longjmp_chk
 
 #ifdef PIC
-# define CALL_FAIL	subq	$8, %rsp;				      \
+# define CALL_FAIL	sub	$8, %RSP_LP;				      \
 			cfi_remember_state;				      \
 			cfi_def_cfa_offset(16);				      \
-			leaq	longjmp_msg(%rip), %rdi;		      \
+			lea	longjmp_msg(%rip), %RDI_LP;		      \
 			call	HIDDEN_JUMPTARGET(__fortify_fail);	      \
 			nop;						      \
 			cfi_restore_state
 #else
-# define CALL_FAIL	subq	$8, %rsp;				      \
+# define CALL_FAIL	sub	$8, %RSP_LP;				      \
 			cfi_remember_state;				      \
 			cfi_def_cfa_offset(16);				      \
 			mov	$longjmp_msg, %RDI_LP;			      \
@@ -55,16 +55,15 @@ longjmp_msg:
 	.text
 ENTRY(____longjmp_chk)
 	/* Restore registers.  */
-	movq	(JB_RSP*8)(%rdi), %r8
+	mov	(JB_RSP*8)(%rdi), %R8_LP
 	movq	(JB_RBP*8)(%rdi), %r9
-	movq	(JB_PC*8)(%rdi), %rdx
+	mov	(JB_PC*8)(%rdi), %RDX_LP
 #ifdef PTR_DEMANGLE
 	PTR_DEMANGLE (%R8_LP)
-	PTR_DEMANGLE (%R9_LP)
 	PTR_DEMANGLE (%RDX_LP)
 #endif
 
-	cmpq	%r8, %rsp
+	cmp	%R8_LP, %RSP_LP
 	jbe	.Lok
 
 	/* Save function parameters.  */
@@ -85,7 +84,7 @@ ENTRY(____longjmp_chk)
 
 	mov	(-sizeSS + oSS_SP)(%rsp), %RAX_LP
 	add	(-sizeSS + oSS_SIZE)(%rsp), %RAX_LP
-	subq	%r8, %rax
+	sub	%R8_LP, %RAX_LP
 	cmp	(-sizeSS + oSS_SIZE)(%rsp), %RAX_LP
 	jae	.Lok2
 
@@ -113,7 +112,7 @@ ENTRY(____longjmp_chk)
 	movq	(JB_R15*8)(%rdi), %r15
 	/* Set return value for setjmp.  */
 	movl	%esi, %eax
-	movq	%r8,%rsp
+	mov	%R8_LP, %RSP_LP
 	movq	%r9,%rbp
 	jmpq	*%rdx
 END (____longjmp_chk)
diff --git a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S
index fa9e96b..a88ff07 100644
--- a/sysdeps/x86_64/__longjmp.S
+++ b/sysdeps/x86_64/__longjmp.S
@@ -31,7 +31,6 @@ ENTRY(__longjmp)
 	movq (JB_PC*8)(%rdi),%rdx
 #ifdef PTR_DEMANGLE
 	PTR_DEMANGLE (%R8_LP)
-	PTR_DEMANGLE (%R9_LP)
 	PTR_DEMANGLE (%RDX_LP)
 #endif
 	/* We add unwind information for the target here.  */
@@ -51,7 +50,7 @@ ENTRY(__longjmp)
 	movq (JB_R15*8)(%rdi),%r15
 	/* Set return value for setjmp.  */
 	mov %esi, %eax
-	movq %r8,%rsp
+	mov %R8_LP,%RSP_LP
 	movq %r9,%rbp
 	jmpq *%rdx
 END (__longjmp)
diff --git a/sysdeps/x86_64/setjmp.S b/sysdeps/x86_64/setjmp.S
index 68340f1..9cab2fa 100644
--- a/sysdeps/x86_64/setjmp.S
+++ b/sysdeps/x86_64/setjmp.S
@@ -26,7 +26,6 @@ ENTRY (__sigsetjmp)
 	movq %rbx, (JB_RBX*8)(%rdi)
 #ifdef PTR_MANGLE
 	movq %rbp, %rax
-	PTR_MANGLE (%RAX_LP)
 	movq %rax, (JB_RBP*8)(%rdi)
 #else
 	movq %rbp, (JB_RBP*8)(%rdi)
@@ -35,12 +34,12 @@ ENTRY (__sigsetjmp)
 	movq %r13, (JB_R13*8)(%rdi)
 	movq %r14, (JB_R14*8)(%rdi)
 	movq %r15, (JB_R15*8)(%rdi)
-	leaq 8(%rsp), %rdx	/* Save SP as it will be after we return.  */
+	lea 8(%rsp), %RDX_LP	/* Save SP as it will be after we return.  */
 #ifdef PTR_MANGLE
 	PTR_MANGLE (%RDX_LP)
 #endif
 	movq %rdx, (JB_RSP*8)(%rdi)
-	movq (%rsp), %rax	/* Save PC we are returning to now.  */
+	mov (%rsp), %RAX_LP	/* Save PC we are returning to now.  */
 #ifdef PTR_MANGLE
 	PTR_MANGLE (%RAX_LP)
 #endif

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d532d4a835b391859fbd58022ffb7b3051bece25

commit d532d4a835b391859fbd58022ffb7b3051bece25
Merge: 5e57f37 60ff996
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 26 11:49:42 2012 -0700

    Merge remote-tracking branch 'origin/release/2.15/master' into hjl/x32/release/2.15


http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5e57f372dc39d2d75dddefeefa3cb57c0c7d4ac9

commit 5e57f372dc39d2d75dddefeefa3cb57c0c7d4ac9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 26 11:37:53 2012 -0700

    Check __ILP32__ instead of __LP64__ for __WORDSIZE

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index ce6fa36..a667747 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,11 @@
 2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/x86_64/64/bits/wordsize.h: Check __ILP32__ instead
+	of __LP64__.
+	* sysdeps/x86_64/x32/bits/wordsize.h: Likewise.
+
+2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/x86_64/dl-machine.h (elf_machine_rela_relative): Handle
 	R_X86_64_RELATIVE64 if RTLD_BOOTSTRAP isn't defined.
 
diff --git a/sysdeps/x86_64/64/bits/wordsize.h b/sysdeps/x86_64/64/bits/wordsize.h
index 3841a2b..9b38756 100644
--- a/sysdeps/x86_64/64/bits/wordsize.h
+++ b/sysdeps/x86_64/64/bits/wordsize.h
@@ -1,9 +1,6 @@
-/* Determine the wordsize from the preprocessor defines.  __LP64__ is
-   defined for 64bit since GCC 3.3.  For GCC older than GCC 4.0, if
-   __x86_64__ is defined, it must be 64bit.  */
+/* Determine the wordsize from the preprocessor defines.  */
 
-#if defined __x86_64__ \
-    && (defined __LP64__ || !defined __GNUC__ || __GNUC__ < 4)
+#if defined __x86_64__ && !defined __ILP32__
 # define __WORDSIZE	64
 # define __WORDSIZE_COMPAT32	1
 #else
diff --git a/sysdeps/x86_64/x32/bits/wordsize.h b/sysdeps/x86_64/x32/bits/wordsize.h
index 3841a2b..9b38756 100644
--- a/sysdeps/x86_64/x32/bits/wordsize.h
+++ b/sysdeps/x86_64/x32/bits/wordsize.h
@@ -1,9 +1,6 @@
-/* Determine the wordsize from the preprocessor defines.  __LP64__ is
-   defined for 64bit since GCC 3.3.  For GCC older than GCC 4.0, if
-   __x86_64__ is defined, it must be 64bit.  */
+/* Determine the wordsize from the preprocessor defines.  */
 
-#if defined __x86_64__ \
-    && (defined __LP64__ || !defined __GNUC__ || __GNUC__ < 4)
+#if defined __x86_64__ && !defined __ILP32__
 # define __WORDSIZE	64
 # define __WORDSIZE_COMPAT32	1
 #else

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b0ff2b2be85883517cc58436b8ab63910b2b9199

commit b0ff2b2be85883517cc58436b8ab63910b2b9199
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 26 11:26:24 2012 -0700

    Handle R_X86_64_RELATIVE64 in elf_machine_rela_relative

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 7676097..ce6fa36 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,10 @@
 2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/x86_64/dl-machine.h (elf_machine_rela_relative): Handle
+	R_X86_64_RELATIVE64 if RTLD_BOOTSTRAP isn't defined.
+
+2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/unix/sysv/linux/x86_64/x32/llseek.S: Renamed to ...
 	* sysdeps/unix/sysv/linux/x86_64/x32/lseek.S: This.
 	* sysdeps/unix/sysv/linux/x86_64/x32/llseek.S: New dummy file.
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 5539ce3..99e8900 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -482,8 +482,15 @@ elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
 			   void *const reloc_addr_arg)
 {
   ElfW(Addr) *const reloc_addr = reloc_addr_arg;
-  assert (ELF32_R_TYPE (reloc->r_info) == R_X86_64_RELATIVE);
-  *reloc_addr = l_addr + reloc->r_addend;
+#if !defined RTLD_BOOTSTRAP
+  if (__builtin_expect (ELF32_R_TYPE (reloc->r_info) == R_X86_64_RELATIVE64, 0))
+    *(Elf64_Addr *) reloc_addr = (Elf64_Addr) l_addr + reloc->r_addend;
+  else
+#endif
+    {
+      assert (ELF32_R_TYPE (reloc->r_info) == R_X86_64_RELATIVE);
+      *reloc_addr = l_addr + reloc->r_addend;
+    }
 }
 
 auto inline void

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=caec587c62423a60ca084c41e04ea49062074000

commit caec587c62423a60ca084c41e04ea49062074000
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 26 11:24:03 2012 -0700

    Rename llseek.S to lseek.S and add dummy llseek.S

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 86e78ca..7676097 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,11 @@
 2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/unix/sysv/linux/x86_64/x32/llseek.S: Renamed to ...
+	* sysdeps/unix/sysv/linux/x86_64/x32/lseek.S: This.
+	* sysdeps/unix/sysv/linux/x86_64/x32/llseek.S: New dummy file.
+
+2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/unix/sysv/linux/x86_64/x32/fallocate.c: Removed.
 	* sysdeps/unix/sysv/linux/x86_64/x32/posix_fadvise.c: Likewise.
 	* sysdeps/unix/sysv/linux/x86_64/x32/preadv.c: Likewise.
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/llseek.S b/sysdeps/unix/sysv/linux/x86_64/x32/llseek.S
index ca33fd1..5084d0e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/llseek.S
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/llseek.S
@@ -1,33 +1 @@
-/* Copyright (C) 2011 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define SYSCALL_RETURN_INT64
-#include <sysdep.h>
-
-#define SYSCALL_NAME lseek
-#define SYSCALL_NARGS 3
-#define SYSCALL_SYMBOL __libc_lseek64
-#define SYSCALL_CANCELLABLE 1
-#include <syscall-template.S>
-weak_alias (__libc_lseek64, __lseek64)
-libc_hidden_weak (__lseek64)
-weak_alias (__libc_lseek64, lseek64)
-libc_hidden_weak (lseek64)
-weak_alias (__libc_lseek64, __lseek)
-libc_hidden_weak (__lseek)
-weak_alias (__libc_lseek64, lseek)
+/* No llseek for x32.  */
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/llseek.S b/sysdeps/unix/sysv/linux/x86_64/x32/lseek.S
similarity index 100%
copy from sysdeps/unix/sysv/linux/x86_64/x32/llseek.S
copy to sysdeps/unix/sysv/linux/x86_64/x32/lseek.S

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1d83e6dbc9d6ad29d1aafe1229594cccbe4722e0

commit 1d83e6dbc9d6ad29d1aafe1229594cccbe4722e0
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 19 08:53:04 2012 -0700

    Move fallocate/posix_fadvise/preadv/pwritev to syscalls.list
    
    Conflicts:
    
    	ChangeLog.x32
    	sysdeps/unix/sysv/linux/x86_64/x32/fallocate.c
    	sysdeps/unix/sysv/linux/x86_64/x32/posix_fadvise.c
    	sysdeps/unix/sysv/linux/x86_64/x32/preadv.c
    	sysdeps/unix/sysv/linux/x86_64/x32/pwritev.c
    	sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 0655735..86e78ca 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,14 @@
 2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/unix/sysv/linux/x86_64/x32/fallocate.c: Removed.
+	* sysdeps/unix/sysv/linux/x86_64/x32/posix_fadvise.c: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/x32/preadv.c: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/x32/pwritev.c: Likewise.
+
+	* sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list: New file.
+
+2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/x86_64/x32/shlib-versions: Replace GLIBC_2.11 with
 	GLIBC_2.16.
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
index a5d4007..7edb6fd 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
@@ -1,23 +1,6 @@
-# Copied from 64bit syscalls.list without llseek, which is implemented in
-# llseek.S to properly handle 64bit parameter and return value.
-
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-lseek		llseek	-
-pread		-	pread		Ci:ibni	__libc_pread	__libc_pread64 __pread pread __pread64 pread64
-pwrite		-	pwrite		Ci:ibni	__libc_pwrite	__libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
-fstatfs		-	fstatfs		i:ip	__fstatfs	fstatfs fstatfs64 __fstatfs64
-statfs		-	statfs		i:sp	__statfs	statfs statfs64
-mmap		-	mmap		b:aniiii __mmap		mmap __mmap64 mmap64
-ftruncate	-	ftruncate	i:ii	__ftruncate	ftruncate ftruncate64 __ftruncate64
-truncate	-	truncate	i:si	truncate	truncate64
-getrlimit	-	getrlimit	i:ip	__getrlimit	getrlimit getrlimit64
-setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit setrlimit64
-readahead	-	readahead	i:iii	__readahead	readahead
-sendfile	-	sendfile	i:iipi	sendfile	sendfile64
-sync_file_range	-	sync_file_range	Ci:iiii	sync_file_range
-creat		-	creat		Ci:si	__libc_creat	creat creat64
-open		-	open		Ci:siv	__libc_open	__open open __open64 open64
-prlimit		EXTRA	prlimit64	i:iipp	prlimit		prlimit64
-
-fanotify_mark	EXTRA	fanotify_mark	i:iiiis	fanotify_mark
+fallocate	-	fallocate	Ci:iiii	fallocate	fallocate64
+posix_fadvise	-	fadvise64	Vi:iiii	posix_fadvise	posix_fadvise64
+preadv		-	preadv		Ci:ipii	preadv		preadv64
+pwritev		-	pwritev		Ci:ipii	pwritev		pwritev64

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ba605a551bc0ef572ef26dd1dc4f83b4e96fea0d

commit ba605a551bc0ef572ef26dd1dc4f83b4e96fea0d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 26 11:12:58 2012 -0700

    Change x32 ABI from GLIBC_2.11 to GLIBC_2.16

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 8037a43..0655735 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,10 @@
 2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/x86_64/x32/shlib-versions: Replace GLIBC_2.11 with
+	GLIBC_2.16.
+
+2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/unix/sysv/linux/x86_64/bits/ipctypes.h: Don't
 	include <bits/types.h>.
 	(__ipc_pid_t): Properly define.
diff --git a/nptl/ChangeLog.x32 b/nptl/ChangeLog.x32
index 1264bfb..38bd076 100644
--- a/nptl/ChangeLog.x32
+++ b/nptl/ChangeLog.x32
@@ -1,3 +1,8 @@
+2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/x86_64/x32/shlib-versions: Replace GLIBC_2.11 with
+	GLIBC_2.16.
+
 2012-03-17  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/unix/sysv/linux/x86_64/cancellation.S: Replace ADD_LP,
diff --git a/nptl/sysdeps/x86_64/x32/shlib-versions b/nptl/sysdeps/x86_64/x32/shlib-versions
new file mode 100644
index 0000000..80ff581
--- /dev/null
+++ b/nptl/sysdeps/x86_64/x32/shlib-versions
@@ -0,0 +1 @@
+x86_64-.*-linux.*	libpthread=0		GLIBC_2.16
diff --git a/sysdeps/x86_64/x32/shlib-versions b/sysdeps/x86_64/x32/shlib-versions
index a0d353d..c30aeef 100644
--- a/sysdeps/x86_64/x32/shlib-versions
+++ b/sysdeps/x86_64/x32/shlib-versions
@@ -1,2 +1,3 @@
-x86_64-.*-linux.*       DEFAULT			GLIBC_2.11
-x86_64-.*-linux.*	ld=ld-linux-x32.so.2	GLIBC_2.11
+x86_64-.*-linux.*       DEFAULT			GLIBC_2.16
+x86_64-.*-linux.*	ld=ld-linux-x32.so.2	GLIBC_2.16
+x86_64-.*-.*		ABI			x32-@OS@

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c207569c056755e4f00e9111c48e91d3debde65f

commit c207569c056755e4f00e9111c48e91d3debde65f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 26 11:10:43 2012 -0700

    Properly define __ipc_pid_t

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 5378b56..8037a43 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,11 @@
 2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/unix/sysv/linux/x86_64/bits/ipctypes.h: Don't
+	include <bits/types.h>.
+	(__ipc_pid_t): Properly define.
+
+2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/unix/sysv/linux/x86_64/x32/Makefile (sysdep_routines):
 	Add arch_prctl.
 	* sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c: New file.
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/ipctypes.h b/sysdeps/unix/sysv/linux/x86_64/bits/ipctypes.h
index f8101b1..025bab5 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/ipctypes.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/ipctypes.h
@@ -24,9 +24,11 @@
 #ifndef _BITS_IPCTYPES_H
 #define _BITS_IPCTYPES_H	1
 
-#include <bits/types.h>
-
 /* Used in `struct shmid_ds'.  */
-typedef __pid_t __ipc_pid_t;
+# ifdef __x86_64__
+typedef int __ipc_pid_t;
+# else
+typedef unsigned short int __ipc_pid_t;
+# endif
 
 #endif /* bits/ipctypes.h */

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=06a248367e66125fbcaf2c49498e0e98938b5f62

commit 06a248367e66125fbcaf2c49498e0e98938b5f62
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 26 11:07:54 2012 -0700

    Add x32 arch_prctl.c

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 58f2da0..5378b56 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,3 +1,9 @@
+2012-05-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/x32/Makefile (sysdep_routines):
+	Add arch_prctl.
+	* sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c: New file.
+
 2012-03-20  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/x86_64/bits/setjmp.h: Include <bits/wordsize.h>.
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/Makefile b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
index 5f77df7..aa78238 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
@@ -1,3 +1,7 @@
+ifeq ($(subdir),misc)
+sysdep_routines += arch_prctl
+endif
+
 ifeq ($(subdir),posix)
 sysdep_routines += getcpu sched_getcpu-static
 endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c b/sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c
new file mode 100644
index 0000000..a4079af
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch_prctl.c
@@ -0,0 +1,64 @@
+/* arch_prctl call for Linux/x32.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <sys/prctl.h>
+#include <sys/syscall.h>
+#include <sysdep.h>
+
+/* Since x32 arch_prctl stores 32bit base address of segment register %fs
+   and %gs as unsigned 64bit value via ARCH_GET_FS and ARCH_GET_GS, we
+   use a local unsigned 64bit variable to hold the base address and copy
+   it to ADDR after arch_prctl return.  */
+
+int
+__arch_prctl (int code, unsigned long *addr)
+{
+  int res;
+  unsigned long long base_addr;
+  unsigned long *addr_saved;
+
+  switch (code)
+    {
+    case ARCH_GET_FS:
+    case ARCH_GET_GS:
+      addr_saved = addr;
+      addr = &base_addr;
+      break;
+
+    default:
+      break;
+    }
+
+  res = INLINE_SYSCALL (arch_prctl, 2, code, addr);
+  if (res == 0)
+    switch (code)
+      {
+      case ARCH_GET_FS:
+      case ARCH_GET_GS:
+	*addr_saved = (unsigned long) base_addr;
+	break;
+
+      default:
+	break;
+      }
+
+  return res;
+}
+
+weak_alias (__arch_prctl, arch_prctl);

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5e033eaa978eee2cde1539a20ee0f39ecd1aa1cd

commit 5e033eaa978eee2cde1539a20ee0f39ecd1aa1cd
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Mar 19 17:29:26 2012 -0700

    Use atomic64_t with 64bit atomic macros
    
    Conflicts:
    
    	ChangeLog
    	sysdeps/x86_64/bits/atomic.h

diff --git a/sysdeps/x86_64/bits/atomic.h b/sysdeps/x86_64/bits/atomic.h
index 2ded147..e5cd5c1 100644
--- a/sysdeps/x86_64/bits/atomic.h
+++ b/sysdeps/x86_64/bits/atomic.h
@@ -133,8 +133,8 @@ typedef uintmax_t uatomic_max_t;
 		       "lock\n"						      \
 		       "0:\tcmpxchgq %q2, %1"				      \
 		       : "=a" (ret), "=m" (*mem)			      \
-		       : "q" ((long long int) (newval)), "m" (*mem),	      \
-			 "0" ((long long int) (oldval)),		      \
+		       : "q" ((atomic64_t) (newval)), "m" (*mem),	      \
+			 "0" ((atomic64_t) (oldval)),		      \
 			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
      ret; })
 
@@ -157,7 +157,7 @@ typedef uintmax_t uatomic_max_t;
      else								      \
        __asm __volatile ("xchgq %q0, %1"				      \
 			 : "=r" (result), "=m" (*mem)			      \
-			 : "0" ((long long) (newvalue)), "m" (*mem));	      \
+			 : "0" ((atomic64_t) (newvalue)), "m" (*mem));	      \
      result; })
 
 
@@ -181,7 +181,7 @@ typedef uintmax_t uatomic_max_t;
      else								      \
        __asm __volatile (lock "xaddq %q0, %1"				      \
 			 : "=r" (result), "=m" (*mem)			      \
-			 : "0" ((long long) (value)), "m" (*mem),	      \
+			 : "0" ((atomic64_t) (value)), "m" (*mem),	      \
 			   "i" (offsetof (tcbhead_t, multiple_threads)));     \
      result; })
 
@@ -224,7 +224,7 @@ typedef uintmax_t uatomic_max_t;
     else								      \
       __asm __volatile (lock "addq %q1, %0"				      \
 			: "=m" (*mem)					      \
-			: "ir" ((long long) (value)), "m" (*mem),	      \
+			: "ir" ((atomic64_t) (value)), "m" (*mem),	      \
 			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
   } while (0)
 
@@ -255,7 +255,7 @@ typedef uintmax_t uatomic_max_t;
      else								      \
        __asm __volatile (LOCK_PREFIX "addq %q2, %0; sets %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
-			 : "ir" ((long long) (value)), "m" (*mem));	      \
+			 : "ir" ((atomic64_t) (value)), "m" (*mem));	      \
      __result; })
 
 
@@ -276,7 +276,7 @@ typedef uintmax_t uatomic_max_t;
      else								      \
        __asm __volatile (LOCK_PREFIX "addq %q2, %0; setz %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
-			 : "ir" ((long long) (value)), "m" (*mem));	      \
+			 : "ir" ((atomic64_t) (value)), "m" (*mem));	      \
      __result; })
 
 

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=56bd4dc2f42afcd005a38dd70b5aa7f629677fa9

commit 56bd4dc2f42afcd005a38dd70b5aa7f629677fa9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Mar 19 16:21:21 2012 -0700

    Use __asm__("rsp") to get CURRENT_STACK_FRAME
    
    Conflicts:
    
    	nptl/ChangeLog
    	nptl/sysdeps/x86_64/pthreaddef.h

diff --git a/nptl/sysdeps/x86_64/pthreaddef.h b/nptl/sysdeps/x86_64/pthreaddef.h
index ea5de38..23da637 100644
--- a/nptl/sysdeps/x86_64/pthreaddef.h
+++ b/nptl/sysdeps/x86_64/pthreaddef.h
@@ -42,7 +42,7 @@
 
 /* Location of current stack frame.  The frame pointer is not usable.  */
 #define CURRENT_STACK_FRAME \
-  ({ char *frame; asm ("mov %%" RSP_LP ", %0" : "=r" (frame)); frame; })
+  ({ register char *frame __asm__("rsp"); frame; })
 
 
 /* XXX Until we have a better place keep the definitions here.  */

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d56e4649d9b11490265f3aa3112252c923bbf93b

commit d56e4649d9b11490265f3aa3112252c923bbf93b
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Mar 19 16:10:51 2012 -0700

    Check __x86_64__ instead of __WORDSIZE for fenv_t
    
    Conflicts:
    
    	ChangeLog
    	sysdeps/x86_64/fpu/bits/fenv.h

diff --git a/sysdeps/x86_64/fpu/bits/fenv.h b/sysdeps/x86_64/fpu/bits/fenv.h
index de47cac..75884dc 100644
--- a/sysdeps/x86_64/fpu/bits/fenv.h
+++ b/sysdeps/x86_64/fpu/bits/fenv.h
@@ -79,7 +79,7 @@ typedef struct
     unsigned int __data_offset;
     unsigned short int __data_selector;
     unsigned short int __unused5;
-#if __x86_64__
+#ifdef __x86_64__
     unsigned int __mxcsr;
 #endif
   }

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=45430d807c7a9fa992f77c3957ab3cbd2bab429d

commit 45430d807c7a9fa992f77c3957ab3cbd2bab429d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Mar 20 08:57:27 2012 -0700

    Use long long int on __jmp_buf only for x32
    
    2012-03-20  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/x86_64/bits/setjmp.h: Include <bits/wordsize.h>.
    	(__jmp_buf): Use long long int for x32.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 3cfb7e4..58f2da0 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,3 +1,8 @@
+2012-03-20  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/x86_64/bits/setjmp.h: Include <bits/wordsize.h>.
+	(__jmp_buf): Use long long int for x32.
+
 2012-03-19  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/i386/bits/byteswap.h: Include <features.h>.
diff --git a/sysdeps/x86_64/bits/setjmp.h b/sysdeps/x86_64/bits/setjmp.h
index 72cfd65..3f6f2fe 100644
--- a/sysdeps/x86_64/bits/setjmp.h
+++ b/sysdeps/x86_64/bits/setjmp.h
@@ -24,9 +24,13 @@
 # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
 #endif
 
+#include <bits/wordsize.h>
+
 #ifndef _ASM
 
-# if __x86_64__
+# if __WORDSIZE == 64
+typedef long int __jmp_buf[8];
+# elif defined  __x86_64__
 typedef long long int __jmp_buf[8];
 # else
 typedef int __jmp_buf[6];

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=fbdf90f159244fb7fae1d1253d89a43d2cb0250e

commit fbdf90f159244fb7fae1d1253d89a43d2cb0250e
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Mar 19 17:51:53 2012 -0700

    Use __builtin_bswap[32|64] if GCC >= 4.2
    
    2012-03-19  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/i386/bits/byteswap.h: Include <features.h>.
    	(__bswap_32): Use __builtin_bswap32 if GCC >= 4.2.
    	(__bswap_64): Use __builtin_bswap64 if GCC >= 4.2.
    
    	* sysdeps/x86_64/bits/byteswap.h: Include <features.h>.
    	(__bswap_32): Use __builtin_bswap32 if GCC >= 4.2.
    	(__bswap_64): Use __builtin_bswap64 if GCC >= 4.2.
    
    Conflicts:
    
    	sysdeps/x86_64/bits/byteswap.h

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 9015d36..3cfb7e4 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,3 +1,13 @@
+2012-03-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/i386/bits/byteswap.h: Include <features.h>.
+	(__bswap_32): Use __builtin_bswap32 if GCC >= 4.2.
+	(__bswap_64): Use __builtin_bswap64 if GCC >= 4.2.
+
+	* sysdeps/x86_64/bits/byteswap.h: Include <features.h>.
+	(__bswap_32): Use __builtin_bswap32 if GCC >= 4.2.
+	(__bswap_64): Use __builtin_bswap64 if GCC >= 4.2.
+
 2012-03-17  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/x86_64/64/bits/wordsize.h (__GNUC_PREREQ): Removed.
diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h
index ddfb785..d4fb6bd 100644
--- a/sysdeps/i386/bits/byteswap.h
+++ b/sysdeps/i386/bits/byteswap.h
@@ -25,6 +25,8 @@
 #ifndef _BITS_BYTESWAP_H
 #define _BITS_BYTESWAP_H 1
 
+#include <features.h>
+
 /* Swap bytes in 16 bit value.  */
 #define __bswap_constant_16(x) \
      ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
@@ -62,42 +64,8 @@ __bswap_16 (unsigned short int __bsx)
      ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) |		      \
       (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
 
-#ifdef __GNUC__
-# if __GNUC__ >= 2
-/* To swap the bytes in a word the i486 processors and up provide the
-   `bswap' opcode.  On i386 we have to use three instructions.  */
-#  if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__ \
-      && !defined __pentium4__ && !defined __k8__ && !defined __athlon__ \
-      && !defined __k6__ && !defined __nocona__ && !defined __core2__ \
-      && !defined __geode__ && !defined __amdfam10__
-#   define __bswap_32(x)						      \
-     (__extension__							      \
-      ({ register unsigned int __v, __x = (x);				      \
-	 if (__builtin_constant_p (__x))				      \
-	   __v = __bswap_constant_32 (__x);				      \
-	 else								      \
-	   __asm__ ("rorw $8, %w0;"					      \
-		    "rorl $16, %0;"					      \
-		    "rorw $8, %w0"					      \
-		    : "=r" (__v)					      \
-		    : "0" (__x)						      \
-		    : "cc");						      \
-	 __v; }))
-#  else
-#   define __bswap_32(x) \
-     (__extension__							      \
-      ({ register unsigned int __v, __x = (x);				      \
-	 if (__builtin_constant_p (__x))				      \
-	   __v = __bswap_constant_32 (__x);				      \
-	 else								      \
-	   __asm__ ("bswap %0" : "=r" (__v) : "0" (__x));		      \
-	 __v; }))
-#  endif
-# else
-#  define __bswap_32(x) \
-     (__extension__							      \
-      ({ register unsigned int __x = (x); __bswap_constant_32 (__x); }))
-# endif
+#if __GNUC_PREREQ (4,2)
+# define __bswap_32(x)  __builtin_bswap32 (x)
 #else
 static __inline unsigned int
 __bswap_32 (unsigned int __bsx)
@@ -109,7 +77,10 @@ __bswap_32 (unsigned int __bsx)
 
 #if defined __GNUC__ && __GNUC__ >= 2
 /* Swap bytes in 64 bit value.  */
-# define __bswap_constant_64(x) \
+# if __GNUC_PREREQ (4,2)
+#  define __bswap_64(x)  __builtin_bswap64 (x)
+# else
+#  define __bswap_constant_64(x) \
      (__extension__ ((((x) & 0xff00000000000000ull) >> 56)		      \
 		     | (((x) & 0x00ff000000000000ull) >> 40)		      \
 		     | (((x) & 0x0000ff0000000000ull) >> 24)		      \
@@ -119,7 +90,7 @@ __bswap_32 (unsigned int __bsx)
 		     | (((x) & 0x000000000000ff00ull) << 40)		      \
 		     | (((x) & 0x00000000000000ffull) << 56)))
 
-# define __bswap_64(x) \
+#  define __bswap_64(x) \
      (__extension__							      \
       ({ union { __extension__ unsigned long long int __ll;		      \
 		 unsigned long int __l[2]; } __w, __r;			      \
@@ -132,6 +103,7 @@ __bswap_32 (unsigned int __bsx)
 	     __r.__l[1] = __bswap_32 (__w.__l[0]);			      \
 	   }								      \
 	 __r.__ll; }))
+# endif
 #endif
 
 #endif /* _BITS_BYTESWAP_H */
diff --git a/sysdeps/x86_64/bits/byteswap.h b/sysdeps/x86_64/bits/byteswap.h
index 4015f9c..98767e4 100644
--- a/sysdeps/x86_64/bits/byteswap.h
+++ b/sysdeps/x86_64/bits/byteswap.h
@@ -25,6 +25,9 @@
 #ifndef _BITS_BYTESWAP_H
 #define _BITS_BYTESWAP_H 1
 
+#include <features.h>
+#include <bits/wordsize.h>
+
 /* Swap bytes in 16 bit value.  */
 #define __bswap_constant_16(x) \
      ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
@@ -55,37 +58,8 @@
      ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) |		      \
       (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
 
-#if defined __GNUC__ && __GNUC__ >= 2
-# if defined __x86_64__ || defined __i486__ || defined __pentium__	      \
-     || defined __pentiumpro__ || defined __pentium4__  || defined __k8__     \
-     || defined __athlon__ || defined __k6__ || defined __nocona__	      \
-     || defined __core2__ || defined __corei7__ || defined __geode__ 	      \
-     || defined __amdfam10__
-/* To swap the bytes in a word the i486 processors and up provide the
-   `bswap' opcode.  On i386 we have to use three instructions.  */
-#  define __bswap_32(x) \
-     (__extension__							      \
-      ({ register unsigned int __v, __x = (x);				      \
-	 if (__builtin_constant_p (__x))				      \
-	   __v = __bswap_constant_32 (__x);				      \
-	 else								      \
-	   __asm__ ("bswap %0" : "=r" (__v) : "0" (__x));		      \
-	 __v; }))
-# else
-#  define __bswap_32(x)							      \
-     (__extension__							      \
-      ({ register unsigned int __v, __x = (x);				      \
-	 if (__builtin_constant_p (__x))				      \
-	   __v = __bswap_constant_32 (__x);				      \
-	 else								      \
-	   __asm__ ("rorw $8, %w0;"					      \
-		    "rorl $16, %0;"					      \
-		    "rorw $8, %w0"					      \
-		    : "=r" (__v)					      \
-		    : "0" (__x)						      \
-		    : "cc");						      \
-	 __v; }))
-# endif
+#if __GNUC_PREREQ (4,2)
+# define __bswap_32(x)  __builtin_bswap32 (x)
 #else
 # define __bswap_32(x) \
      (__extension__							      \
@@ -95,7 +69,10 @@
 
 #if defined __GNUC__ && __GNUC__ >= 2
 /* Swap bytes in 64 bit value.  */
-# define __bswap_constant_64(x) \
+# if __GNUC_PREREQ (4,2)
+#  define __bswap_64(x)  __builtin_bswap64 (x)
+# else
+#  define __bswap_constant_64(x) \
      (__extension__ ((((x) & 0xff00000000000000ull) >> 56)		      \
 		     | (((x) & 0x00ff000000000000ull) >> 40)		      \
 		     | (((x) & 0x0000ff0000000000ull) >> 24)		      \
@@ -105,17 +82,17 @@
 		     | (((x) & 0x000000000000ff00ull) << 40)		      \
 		     | (((x) & 0x00000000000000ffull) << 56)))
 
-# ifdef __x86_64__ 
-#  define __bswap_64(x) \
+#  if __WORDSIZE == 64
+#   define __bswap_64(x) \
      (__extension__							      \
-      ({ register unsigned long long int __v, __x = (x);		      \
+      ({ register unsigned long __v, __x = (x);				      \
 	 if (__builtin_constant_p (__x))				      \
 	   __v = __bswap_constant_64 (__x);				      \
 	 else								      \
 	   __asm__ ("bswap %q0" : "=r" (__v) : "0" (__x));		      \
 	 __v; }))
-# else
-#  define __bswap_64(x) \
+#  else
+#   define __bswap_64(x) \
      (__extension__                                                           \
       ({ union { __extension__ unsigned long long int __ll;                   \
 		 unsigned int __l[2]; } __w, __r;                             \
@@ -128,6 +105,7 @@
 	     __r.__l[1] = __bswap_32 (__w.__l[0]);                            \
 	   }                                                                  \
 	 __r.__ll; }))
+#  endif
 # endif
 #endif
 

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c66e8d8d8dd593b6c631e9771c895edbdf680495

commit c66e8d8d8dd593b6c631e9771c895edbdf680495
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat Mar 17 09:25:28 2012 -0700

    Check __GNUC__ directly for __WORDSIZE
    
    2012-03-17  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/x86_64/64/bits/wordsize.h (__GNUC_PREREQ): Removed.
    	(__WORDSIZE): Check __GNUC__ directly.
    	* sysdeps/x86_64/x32/bits/wordsize.h: Likewise.
    
    Conflicts:
    
    	sysdeps/x86_64/64/bits/wordsize.h
    	sysdeps/x86_64/x32/bits/wordsize.h

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index da2b2a5..9015d36 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,11 @@
 2012-03-17  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/x86_64/64/bits/wordsize.h (__GNUC_PREREQ): Removed.
+	(__WORDSIZE): Check __GNUC__ directly.
+	* sysdeps/x86_64/x32/bits/wordsize.h: Likewise.
+
+2012-03-17  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/x86_64/sysdep.h (MOVE_LP): Removed.
 	(ADD_LP): Likewise.
 	(SUB_LP): Likewise.
diff --git a/sysdeps/x86_64/64/bits/wordsize.h b/sysdeps/x86_64/64/bits/wordsize.h
index cb59cd2..3841a2b 100644
--- a/sysdeps/x86_64/64/bits/wordsize.h
+++ b/sysdeps/x86_64/64/bits/wordsize.h
@@ -1,7 +1,11 @@
-/* Determine the wordsize from the preprocessor defines.  */
+/* Determine the wordsize from the preprocessor defines.  __LP64__ is
+   defined for 64bit since GCC 3.3.  For GCC older than GCC 4.0, if
+   __x86_64__ is defined, it must be 64bit.  */
 
-#if defined __LP64__
+#if defined __x86_64__ \
+    && (defined __LP64__ || !defined __GNUC__ || __GNUC__ < 4)
 # define __WORDSIZE	64
+# define __WORDSIZE_COMPAT32	1
 #else
 # define __WORDSIZE	32
 #endif
diff --git a/sysdeps/x86_64/x32/bits/wordsize.h b/sysdeps/x86_64/x32/bits/wordsize.h
index cb59cd2..3841a2b 100644
--- a/sysdeps/x86_64/x32/bits/wordsize.h
+++ b/sysdeps/x86_64/x32/bits/wordsize.h
@@ -1,7 +1,11 @@
-/* Determine the wordsize from the preprocessor defines.  */
+/* Determine the wordsize from the preprocessor defines.  __LP64__ is
+   defined for 64bit since GCC 3.3.  For GCC older than GCC 4.0, if
+   __x86_64__ is defined, it must be 64bit.  */
 
-#if defined __LP64__
+#if defined __x86_64__ \
+    && (defined __LP64__ || !defined __GNUC__ || __GNUC__ < 4)
 # define __WORDSIZE	64
+# define __WORDSIZE_COMPAT32	1
 #else
 # define __WORDSIZE	32
 #endif

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=302a1e0ffd9c5e6f4902366332bdd207659b025c

commit 302a1e0ffd9c5e6f4902366332bdd207659b025c
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat Mar 17 09:22:29 2012 -0700

    Replace MOVE_LP/ADD_LP/SUB_LP/CMP_LP with LP_OP
    
    2012-03-17  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/x86_64/sysdep.h (MOVE_LP): Removed.
    	(ADD_LP): Likewise.
    	(SUB_LP): Likewise.
    	(CMP_LP): Likewise.
    	(LP_OP): New.
    
    	* sysdeps/x86_64/x32/sysdep.h (MOVE_LP): Removed.
    	(ADD_LP): Likewise.
    	(SUB_LP): Likewise.
    	(CMP_LP): Likewise.
    	(LP_OP): New.
    
    nptl/
    
    2012-03-17  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/unix/sysv/linux/x86_64/cancellation.S: Replace ADD_LP,
    	CMP_LP, MOVE_LP, SUB_LP with LP_OP(add), LP_OP(cmp), LP_OP(mov),
    	LP_OP(sub).
    	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/sem_post.S: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Likewise.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 2976894..da2b2a5 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,3 +1,17 @@
+2012-03-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/x86_64/sysdep.h (MOVE_LP): Removed.
+	(ADD_LP): Likewise.
+	(SUB_LP): Likewise.
+	(CMP_LP): Likewise.
+	(LP_OP): New.
+
+	* sysdeps/x86_64/x32/sysdep.h (MOVE_LP): Removed.
+	(ADD_LP): Likewise.
+	(SUB_LP): Likewise.
+	(CMP_LP): Likewise.
+	(LP_OP): New.
+
 2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (PTR_MANGLE): Use
diff --git a/nptl/ChangeLog.x32 b/nptl/ChangeLog.x32
index 5f69fa8..1264bfb 100644
--- a/nptl/ChangeLog.x32
+++ b/nptl/ChangeLog.x32
@@ -1,3 +1,16 @@
+2012-03-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/cancellation.S: Replace ADD_LP,
+	CMP_LP, MOVE_LP, SUB_LP with LP_OP(add), LP_OP(cmp), LP_OP(mov),
+	LP_OP(sub).
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sem_post.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Likewise.
+
 2012-03-14  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Use CMP_LP
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S b/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
index fe33f69..a0dce33 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
@@ -73,7 +73,7 @@ ENTRY(__pthread_enable_asynccancel)
 
 3:	subq	$8, %rsp
 	cfi_adjust_cfa_offset(8)
-	MOVE_LP	$TCB_PTHREAD_CANCELED, %fs:RESULT
+	LP_OP(mov) $TCB_PTHREAD_CANCELED, %fs:RESULT
 	lock
 	orl	$TCB_EXITING_BITMASK, %fs:CANCELHANDLING
 	mov	%fs:CLEANUP_JMP_BUF, %RDI_LP
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
index 5c89c04..61d450f 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
@@ -67,7 +67,7 @@ __pthread_cond_broadcast:
 	decl	cond_lock-cond_futex(%rdi)
 	jne	7f
 
-8:	CMP_LP	$-1, %R8_LP
+8:	cmp	$-1, %R8_LP
 	je	9f
 
 	/* Do not use requeue for pshared condvars.  */
@@ -129,7 +129,7 @@ __pthread_cond_broadcast:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -141,7 +141,7 @@ __pthread_cond_broadcast:
 
 	/* Unlock in loop requires wakeup.  */
 5:	addq	$cond_lock-cond_futex, %rdi
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -150,7 +150,7 @@ __pthread_cond_broadcast:
 
 	/* Unlock in loop requires wakeup.  */
 7:	addq	$cond_lock-cond_futex, %rdi
-	CMP_LP	$-1, %R8_LP
+	cmp	$-1, %R8_LP
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -159,7 +159,7 @@ __pthread_cond_broadcast:
 	jmp	8b
 
 9:	/* The futex requeue functionality is not available.  */
-	CMP_LP	$-1, %R8_LP
+	cmp	$-1, %R8_LP
 	movl	$0x7fffffff, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
 	movl	$FUTEX_WAKE, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
index 9f05d28..c750115 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
@@ -56,7 +56,7 @@ __pthread_cond_signal:
 	addl	$1, (%rdi)
 
 	/* Wake up one thread.  */
-	CMP_LP	$-1, dep_mutex(%r8)
+	LP_OP(cmp) $-1, dep_mutex(%r8)
 	movl	$FUTEX_WAKE_OP, %esi
 	movl	$1, %edx
 	movl	$SYS_futex, %eax
@@ -135,7 +135,7 @@ __pthread_cond_signal:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -151,7 +151,7 @@ __pthread_cond_signal:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
index 048d0ce..b50576b 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
@@ -90,7 +90,7 @@ __pthread_cond_timedwait:
 		    +--------------------------+
 	*/
 
-	CMP_LP	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 
 	/* Prepare structure passed to cancellation handler.  */
 	movq	%rdi, 8(%rsp)
@@ -164,7 +164,7 @@ __pthread_cond_timedwait:
 
 	movq	%r13, %r10
 	movl	$FUTEX_WAIT_BITSET, %esi
-	CMP_LP	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 	je	60f
 
 	mov	dep_mutex(%rdi), %R8_LP
@@ -269,7 +269,7 @@ __pthread_cond_timedwait:
 	jne	55f
 
 	addq	$cond_nwaiters, %rdi
-	CMP_LP	$-1, dep_mutex-cond_nwaiters(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_nwaiters(%rdi)
 	movl	$1, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
 	movl	$FUTEX_WAKE, %eax
@@ -332,7 +332,7 @@ __pthread_cond_timedwait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -344,7 +344,7 @@ __pthread_cond_timedwait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -356,7 +356,7 @@ __pthread_cond_timedwait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -371,7 +371,7 @@ __pthread_cond_timedwait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -392,7 +392,7 @@ __pthread_cond_timedwait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -509,7 +509,7 @@ __pthread_cond_timedwait:
 	movl	%eax, (%rsp)
 
 	leaq	32(%rsp), %r10
-	CMP_LP	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 	movq	%r12, %rdx
 # ifdef __ASSUME_PRIVATE_FUTEX
 	movl	$FUTEX_WAIT, %eax
@@ -569,7 +569,7 @@ __pthread_cond_timedwait:
 # if cond_lock != 0
 	addq	$cond_lock, %rdi
 # endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -581,7 +581,7 @@ __pthread_cond_timedwait:
 # if cond_lock != 0
 	addq	$cond_lock, %rdi
 # endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -593,7 +593,7 @@ __pthread_cond_timedwait:
 # if cond_lock != 0
 	addq	$cond_lock, %rdi
 # endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -676,7 +676,7 @@ __condvar_cleanup2:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -709,7 +709,7 @@ __condvar_cleanup2:
 	andl	$~((1 << nwaiters_shift) - 1), %eax
 	jne	4f
 
-	CMP_LP	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 	leaq	cond_nwaiters(%rdi), %rdi
 	movl	$1, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
@@ -737,7 +737,7 @@ __condvar_cleanup2:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -747,7 +747,7 @@ __condvar_cleanup2:
 2:	testq	%r12, %r12
 	jnz	5f
 	addq	$cond_futex, %rdi
-	CMP_LP	$-1, dep_mutex-cond_futex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_futex(%rdi)
 	movl	$0x7fffffff, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
 	movl	$FUTEX_WAKE, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
index 9fb8cf1..e28a0a7 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
@@ -66,7 +66,7 @@ __pthread_cond_wait:
 	            +--------------------------+
 	*/
 
-	CMP_LP	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 
 		/* Prepare structure passed to cancellation handler.  */
 	movq	%rdi, 8(%rsp)
@@ -121,7 +121,7 @@ __pthread_cond_wait:
 	movl	%eax, (%rsp)
 
 	xorq	%r10, %r10
-	CMP_LP	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 	leaq	cond_futex(%rdi), %rdi
 	movl	$FUTEX_WAIT, %esi
 	je	60f
@@ -207,7 +207,7 @@ __pthread_cond_wait:
 	jne	17f
 
 	addq	$cond_nwaiters, %rdi
-	CMP_LP	$-1, dep_mutex-cond_nwaiters(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_nwaiters(%rdi)
 	movl	$1, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
 	movl	$FUTEX_WAKE, %eax
@@ -256,7 +256,7 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -268,7 +268,7 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -284,7 +284,7 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -299,7 +299,7 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -320,7 +320,7 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -349,7 +349,7 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -375,7 +375,7 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -435,7 +435,7 @@ __condvar_cleanup1:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -468,7 +468,7 @@ __condvar_cleanup1:
 	andl	$~((1 << nwaiters_shift) - 1), %eax
 	jne	4f
 
-	CMP_LP	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 	leaq	cond_nwaiters(%rdi), %rdi
 	movl	$1, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
@@ -496,7 +496,7 @@ __condvar_cleanup1:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -507,7 +507,7 @@ __condvar_cleanup1:
 2:	testl	%ecx, %ecx
 	jnz	5f
 	addq	$cond_futex, %rdi
-	CMP_LP	$-1, dep_mutex-cond_futex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_futex(%rdi)
 	movl	$0x7fffffff, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
 	movl	$FUTEX_WAKE, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
index 99f4ec0..df68319 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
@@ -46,7 +46,7 @@ sem_post:
 #endif
 	jnz	0b
 
-	CMP_LP	$0, NWAITERS(%rdi)
+	LP_OP(cmp) $0, NWAITERS(%rdi)
 	je	2f
 
 	movl	$SYS_futex, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
index 78c7c0c..80d44c3 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
@@ -84,7 +84,7 @@ sem_timedwait:
 	movq	%rsi, %r10
 
 	LOCK
-	ADD_LP	$1, NWAITERS(%rdi)
+	LP_OP(add) $1, NWAITERS(%rdi)
 
 .LcleanupSTART:
 13:	call	__pthread_enable_asynccancel
@@ -135,7 +135,7 @@ sem_timedwait:
 	xorl	%eax, %eax
 
 15:	LOCK
-	SUB_LP	$1, NWAITERS(%rdi)
+	LP_OP(sub) $1, NWAITERS(%rdi)
 
 	leaq	8(%rsp), %rsp
 	cfi_adjust_cfa_offset(-8)
@@ -190,7 +190,7 @@ sem_timedwait:
 	movq	%rsi, %r13
 
 	LOCK
-	ADD_LP	$1, NWAITERS(%r12)
+	LP_OP(add) $1, NWAITERS(%r12)
 
 7:	xorl	%esi, %esi
 	movq	%rsp,%rdi
@@ -267,7 +267,7 @@ sem_timedwait:
 	xorl	%eax, %eax
 
 45:	LOCK
-	SUB_LP	$1, NWAITERS(%r12)
+	LP_OP(sub) $1, NWAITERS(%r12)
 
 	addq	$STACKFRAME, %rsp
 	cfi_adjust_cfa_offset(-STACKFRAME)
@@ -305,7 +305,7 @@ sem_timedwait_cleanup:
 
 	movq	(%rsp), %rdi
 	LOCK
-	SUB_LP	$1, NWAITERS(%rdi)
+	LP_OP(sub) $1, NWAITERS(%rdi)
 	movq	%rax, %rdi
 .LcallUR:
 	call	_Unwind_Resume@PLT
@@ -325,7 +325,7 @@ sem_timedwait_cleanup2:
 	cfi_rel_offset(%r14, STACKFRAME)
 
 	LOCK
-	SUB_LP	$1, NWAITERS(%r12)
+	LP_OP(sub) $1, NWAITERS(%r12)
 	movq	%rax, %rdi
 	movq	STACKFRAME(%rsp), %r14
 	movq	STACKFRAME+8(%rsp), %r13
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
index a13fffd..9d12b42 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
@@ -67,7 +67,7 @@ sem_wait:
 	cfi_adjust_cfa_offset(8)
 
 	LOCK
-	ADD_LP	$1, NWAITERS(%rdi)
+	LP_OP(add) $1, NWAITERS(%rdi)
 
 .LcleanupSTART:
 6:	call	__pthread_enable_asynccancel
@@ -116,7 +116,7 @@ sem_wait:
 	xorl	%eax, %eax
 
 9:	LOCK
-	SUB_LP	$1, NWAITERS(%rdi)
+	LP_OP(sub) $1, NWAITERS(%rdi)
 
 	leaq	8(%rsp), %rsp
 	cfi_adjust_cfa_offset(-8)
@@ -137,7 +137,7 @@ sem_wait:
 sem_wait_cleanup:
 	movq	(%rsp), %rdi
 	LOCK
-	SUB_LP	$1, NWAITERS(%rdi)
+	LP_OP(sub) $1, NWAITERS(%rdi)
 	movq	%rax, %rdi
 .LcallUR:
 	call	_Unwind_Resume@PLT
diff --git a/sysdeps/x86_64/sysdep.h b/sysdeps/x86_64/sysdep.h
index b9da915..c0116da 100644
--- a/sysdeps/x86_64/sysdep.h
+++ b/sysdeps/x86_64/sysdep.h
@@ -119,17 +119,8 @@ lose:									      \
 /* Long and pointer size in bytes.  */
 #define LP_SIZE	8
 
-/* Instruction to move long and pointer.  */
-#define MOVE_LP movq
-
-/* Instruction to add long and pointer.  */
-#define ADD_LP addq
-
-/* Instruction to substract long and pointer.  */
-#define SUB_LP subq
-
-/* Instruction to compare against long and pointer.  */
-#define CMP_LP cmpq
+/* Instruction to operate on long and pointer.  */
+#define LP_OP(insn) insn##q
 
 /* Assembler address directive. */
 #define ASM_ADDR .quad
@@ -160,6 +151,9 @@ lose:									      \
 /* Assembler address directive. */
 #define ASM_ADDR ".quad"
 
+/* Instruction to operate on long and pointer.  */
+#define LP_OP(insn) #insn "q"
+
 /* Registers to hold long and pointer.  */
 #define RAX_LP	"rax"
 #define RBP_LP	"rbp"
diff --git a/sysdeps/x86_64/x32/sysdep.h b/sysdeps/x86_64/x32/sysdep.h
index 0bb21f8..d8c87d9 100644
--- a/sysdeps/x86_64/x32/sysdep.h
+++ b/sysdeps/x86_64/x32/sysdep.h
@@ -17,8 +17,9 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#undef ASM_ADDR
 #undef LP_SIZE
+#undef LP_OP
+#undef ASM_ADDR
 
 #undef RAX_LP
 #undef RBP_LP
@@ -41,17 +42,7 @@
 
 # define LP_SIZE 4
 
-# undef MOVE_LP
-# define MOVE_LP movl
-
-# undef ADD_LP
-# define ADD_LP addl
-
-# undef SUB_LP
-# define SUB_LP subl
-
-# undef CMP_LP
-# define CMP_LP cmpl
+# define LP_OP(insn) insn##l
 
 # define ASM_ADDR .long
 
@@ -76,6 +67,8 @@
 
 # define LP_SIZE "4"
 
+# define LP_OP(insn) #insn "l"
+
 # define ASM_ADDR ".long"
 
 # define RAX_LP	"eax"

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7d0a6919547c49a8f5e3e92832808a4802b956c8

commit 7d0a6919547c49a8f5e3e92832808a4802b956c8
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Mar 16 16:19:54 2012 -0700

    Replace $17 with $2*LP_SIZE+1
    
    2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (PTR_MANGLE): Use
    	$2*LP_SIZE+1 instead of $17.
    	(PTR_DEMANGLE): Likewise.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index d332547..2976894 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,11 @@
 2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (PTR_MANGLE): Use
+	$2*LP_SIZE+1 instead of $17.
+	(PTR_DEMANGLE): Likewise.
+
+2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* bits/types.h (__syscall_slong_t): New type.
 	(__syscall_ulong_t): Likewise.
 	* sysdeps/unix/sysv/linux/x86_64/bits/ipc.h: Replace
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 34e0464..9f4105d 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -344,32 +344,32 @@
    earlier than the descriptor is initialized.  */
 # ifdef __ASSEMBLER__
 #  define PTR_MANGLE(reg)	xor __pointer_chk_guard_local(%rip), reg;    \
-				rol $17, reg
-#  define PTR_DEMANGLE(reg)	ror $17, reg;				      \
+				rol $2*LP_SIZE+1, reg
+#  define PTR_DEMANGLE(reg)	ror $2*LP_SIZE+1, reg;			     \
 				xor __pointer_chk_guard_local(%rip), reg
 # else
 #  define PTR_MANGLE(reg)	asm ("xor __pointer_chk_guard_local(%%rip), %0\n" \
-				     "rol $17, %0"			      \
+				     "rol $2*" LP_SIZE "+1, %0"			  \
 				     : "=r" (reg) : "0" (reg))
-#  define PTR_DEMANGLE(reg)	asm ("ror $17, %0\n"			      \
-				     "xor __pointer_chk_guard_local(%%rip), %0" \
+#  define PTR_DEMANGLE(reg)	asm ("ror $2*" LP_SIZE "+1, %0\n"		  \
+				     "xor __pointer_chk_guard_local(%%rip), %0"   \
 				     : "=r" (reg) : "0" (reg))
 # endif
 #else
 # ifdef __ASSEMBLER__
 #  define PTR_MANGLE(reg)	xor %fs:POINTER_GUARD, reg;		      \
-				rol $17, reg
-#  define PTR_DEMANGLE(reg)	ror $17, reg;				      \
+				rol $2*LP_SIZE+1, reg
+#  define PTR_DEMANGLE(reg)	ror $2*LP_SIZE+1, reg;			      \
 				xor %fs:POINTER_GUARD, reg
 # else
 #  define PTR_MANGLE(var)	asm ("xor %%fs:%c2, %0\n"		      \
-				     "rol $17, %0"			      \
+				     "rol $2*" LP_SIZE "+1, %0"		      \
 				     : "=r" (var)			      \
 				     : "0" (var),			      \
 				       "i" (offsetof (tcbhead_t,	      \
 						      pointer_guard)))
-#  define PTR_DEMANGLE(var)	asm ("ror $17, %0\n"			      \
-				     "xor %%fs:%c2, %0"		      \
+#  define PTR_DEMANGLE(var)	asm ("ror $2*" LP_SIZE "+1, %0\n"	      \
+				     "xor %%fs:%c2, %0"			      \
 				     : "=r" (var)			      \
 				     : "0" (var),			      \
 				       "i" (offsetof (tcbhead_t,	      \

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=21c5210c901e85914095ec19b666480c45d69b06

commit 21c5210c901e85914095ec19b666480c45d69b06
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Mar 16 16:04:20 2012 -0700

    Replace __[SU]SYSCALL_LONG_TYPE with __syscall_[su]long_t
    
    2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* bits/types.h (__syscall_slong_t): New type.
    	(__syscall_ulong_t): Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/ipc.h: Replace
    	__USYSCALL_LONG_TYPE/__USYSCALL_LONG_TYPE with
    	__syscall_slong_t/__syscall_ulong_t.
    	* sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/msq.: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/sem.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/shm.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/stat.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/statfs.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/timex.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/sys/msg.h: Likewise.
    
    	* bits/typesizes.h (__SYSCALL_SLONG_TYPE): New macro.
    	(__SYSCALL_ULONG_TYPE): Likewise.
    	* sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h
    	(__SYSCALL_SLONG_TYPE): Likewise.
    	(__SYSCALL_ULONG_TYPE): Likewise.
    	* sysdeps/unix/sysv/linux/s390/bits/typesizes.h
    	(__SYSCALL_SLONG_TYPE): Likewise.
    	(__SYSCALL_ULONG_TYPE): Likewise.
    	* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
    	(__SYSCALL_SLONG_TYPE): Likewise.
    	(__SYSCALL_ULONG_TYPE): Likewise.
    
    	* sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h
    	(__SSYSCALL_LONG_TYPE): Renamed to ...
    	(__SYSCALL_SLONG_TYPE): This.
    	(__SSYSCALL_LONG_TYPE): Renamed to ...
    	(__SYSCALL_ULONG_TYPE): This.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index c111b36..d332547 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,40 @@
 2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* bits/types.h (__syscall_slong_t): New type.
+	(__syscall_ulong_t): Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/ipc.h: Replace
+	__USYSCALL_LONG_TYPE/__USYSCALL_LONG_TYPE with
+	__syscall_slong_t/__syscall_ulong_t.
+	* sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/msq.: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/sem.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/shm.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/stat.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/statfs.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/timex.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sys/msg.h: Likewise.
+
+	* bits/typesizes.h (__SYSCALL_SLONG_TYPE): New macro.
+	(__SYSCALL_ULONG_TYPE): Likewise.
+	* sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h
+	(__SYSCALL_SLONG_TYPE): Likewise.
+	(__SYSCALL_ULONG_TYPE): Likewise.
+	* sysdeps/unix/sysv/linux/s390/bits/typesizes.h
+	(__SYSCALL_SLONG_TYPE): Likewise.
+	(__SYSCALL_ULONG_TYPE): Likewise.
+	* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
+	(__SYSCALL_SLONG_TYPE): Likewise.
+	(__SYSCALL_ULONG_TYPE): Likewise.
+
+	* sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h
+	(__SSYSCALL_LONG_TYPE): Renamed to ...
+	(__SYSCALL_SLONG_TYPE): This.
+	(__SSYSCALL_LONG_TYPE): Renamed to ...
+	(__SYSCALL_ULONG_TYPE): This.
+
+2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/unix/sysv/linux/i386/readelflib.c (process_elf_file):
 	Move e_machine check before EI_CLASS check.  Check EM_IA_64 only
 	if SKIP_EM_IA_64 isn't defined.
diff --git a/bits/types.h b/bits/types.h
index d6915d7..542a61e 100644
--- a/bits/types.h
+++ b/bits/types.h
@@ -180,6 +180,11 @@ __STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t;
 
 __STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error.  */
 
+/* Signed long type used in system calls.  */
+__STD_TYPE __SYSCALL_SLONG_TYPE __syscall_slong_t;
+/* Unsigned long type used in system calls.  */
+__STD_TYPE __SYSCALL_ULONG_TYPE __syscall_ulong_t;
+
 /* These few don't really vary by system, they always correspond
    to one of the other defined types.  */
 typedef __off64_t __loff_t;	/* Type of file sizes and offsets (LFS).  */
diff --git a/bits/typesizes.h b/bits/typesizes.h
index 63ef936..17ff797 100644
--- a/bits/typesizes.h
+++ b/bits/typesizes.h
@@ -60,6 +60,8 @@
 #define __FSID_T_TYPE		struct { int __val[2]; }
 #define __SSIZE_T_TYPE		__SWORD_TYPE
 #define __SNSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 
 /* Number of descriptors that can fit in an `fd_set'.  */
 #define	__FD_SETSIZE		1024
diff --git a/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h b/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h
index 26ea5a6..430ca75 100644
--- a/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h
+++ b/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h
@@ -59,6 +59,8 @@
 #define __FSID_T_TYPE		struct { int __val[2]; }
 #define __SSIZE_T_TYPE		__SWORD_TYPE
 #define __SNSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 
 /* Number of descriptors that can fit in an `fd_set'.  */
 #define	__FD_SETSIZE		1024
diff --git a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
index b97f42a..c016b7d 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
@@ -65,6 +65,8 @@
 #define __SSIZE_T_TYPE		__SLONGWORD_TYPE
 #endif
 #define __SNSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 
 /* Number of descriptors that can fit in an `fd_set'.  */
 #define	__FD_SETSIZE		1024
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
index 3f062c0..50f4a8b 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
@@ -59,6 +59,8 @@
 #define __FSID_T_TYPE		struct { int __val[2]; }
 #define __SSIZE_T_TYPE		__SWORD_TYPE
 #define __SNSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 
 /* Number of descriptors that can fit in an `fd_set'.  */
 #define	__FD_SETSIZE		1024
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/ipc.h b/sysdeps/unix/sysv/linux/x86_64/bits/ipc.h
index de6aec1..0736d43 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/ipc.h
@@ -52,6 +52,6 @@ struct ipc_perm
     unsigned short int __pad1;
     unsigned short int __seq;		/* Sequence number.  */
     unsigned short int __pad2;
-    __USYSCALL_LONG_TYPE __unused1;
-    __USYSCALL_LONG_TYPE __unused2;
+    __syscall_ulong_t __unused1;
+    __syscall_ulong_t __unused2;
   };
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h b/sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h
index 096c8df..1448a7a 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h
@@ -27,9 +27,9 @@ typedef int mqd_t;
 
 struct mq_attr
 {
-  __SSYSCALL_LONG_TYPE mq_flags;		/* Message queue flags.  */
-  __SSYSCALL_LONG_TYPE mq_maxmsg;	/* Maximum number of messages.  */
-  __SSYSCALL_LONG_TYPE mq_msgsize;	/* Maximum message size.  */
-  __SSYSCALL_LONG_TYPE mq_curmsgs;	/* Number of messages currently queued.  */
-  __SSYSCALL_LONG_TYPE __pad[4];
+  __syscall_slong_t mq_flags;	/* Message queue flags.  */
+  __syscall_slong_t mq_maxmsg;	/* Maximum number of messages.  */
+  __syscall_slong_t mq_msgsize;	/* Maximum message size.  */
+  __syscall_slong_t mq_curmsgs;	/* Number of messages currently queued.  */
+  __syscall_slong_t __pad[4];
 };
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/msq.h b/sysdeps/unix/sysv/linux/x86_64/bits/msq.h
index 6007e74..f6a99e5 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/msq.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/msq.h
@@ -30,8 +30,8 @@
 #endif
 
 /* Types used in the structure definition.  */
-typedef __USYSCALL_LONG_TYPE msgqnum_t;
-typedef __USYSCALL_LONG_TYPE msglen_t;
+typedef __syscall_ulong_t msgqnum_t;
+typedef __syscall_ulong_t msglen_t;
 
 /* Structure of record for one message inside the kernel.
    The type `struct msg' is opaque.  */
@@ -50,13 +50,13 @@ struct msqid_ds
 #ifndef __x86_64__
   unsigned long int __unused3;
 #endif
-  __USYSCALL_LONG_TYPE __msg_cbytes; /* current number of bytes on queue */
+  __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */
   msgqnum_t msg_qnum;		/* number of messages currently on queue */
   msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
   __pid_t msg_lspid;		/* pid of last msgsnd() */
   __pid_t msg_lrpid;		/* pid of last msgrcv() */
-  __USYSCALL_LONG_TYPE __unused4;
-  __USYSCALL_LONG_TYPE __unused5;
+  __syscall_ulong_t __unused4;
+  __syscall_ulong_t __unused5;
 };
 
 #ifdef __USE_MISC
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/sem.h b/sysdeps/unix/sysv/linux/x86_64/bits/sem.h
index e1d0827..4169641 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/sem.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/sem.h
@@ -40,12 +40,12 @@ struct semid_ds
 {
   struct ipc_perm sem_perm;		/* operation permission struct */
   __time_t sem_otime;			/* last semop() time */
-  __USYSCALL_LONG_TYPE __unused1;
+  __syscall_ulong_t __unused1;
   __time_t sem_ctime;			/* last time changed by semctl() */
-  __USYSCALL_LONG_TYPE __unused2;
-  __USYSCALL_LONG_TYPE sem_nsems;	/* number of semaphores in set */
-  __USYSCALL_LONG_TYPE __unused3;
-  __USYSCALL_LONG_TYPE __unused4;
+  __syscall_ulong_t __unused2;
+  __syscall_ulong_t sem_nsems;		/* number of semaphores in set */
+  __syscall_ulong_t __unused3;
+  __syscall_ulong_t __unused4;
 };
 
 /* The user should define a union like the following to use it for arguments
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/shm.h b/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
index 1184caa..ee51deb 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
@@ -45,7 +45,7 @@ extern int __getpagesize (void) __THROW __attribute__ ((__const__));
 
 
 /* Type to count number of attaches.  */
-typedef __USYSCALL_LONG_TYPE shmatt_t;
+typedef __syscall_ulong_t shmatt_t;
 
 /* Data structure describing a shared memory segment.  */
 struct shmid_ds
@@ -67,8 +67,8 @@ struct shmid_ds
     __pid_t shm_cpid;			/* pid of creator */
     __pid_t shm_lpid;			/* pid of last shmop */
     shmatt_t shm_nattch;		/* number of current attaches */
-    __USYSCALL_LONG_TYPE __unused4;
-    __USYSCALL_LONG_TYPE __unused5;
+    __syscall_ulong_t __unused4;
+    __syscall_ulong_t __unused5;
   };
 
 #ifdef __USE_MISC
@@ -85,25 +85,25 @@ struct shmid_ds
 
 struct	shminfo
   {
-    __USYSCALL_LONG_TYPE shmmax;
-    __USYSCALL_LONG_TYPE shmmin;
-    __USYSCALL_LONG_TYPE shmmni;
-    __USYSCALL_LONG_TYPE shmseg;
-    __USYSCALL_LONG_TYPE shmall;
-    __USYSCALL_LONG_TYPE __unused1;
-    __USYSCALL_LONG_TYPE __unused2;
-    __USYSCALL_LONG_TYPE __unused3;
-    __USYSCALL_LONG_TYPE __unused4;
+    __syscall_ulong_t shmmax;
+    __syscall_ulong_t shmmin;
+    __syscall_ulong_t shmmni;
+    __syscall_ulong_t shmseg;
+    __syscall_ulong_t shmall;
+    __syscall_ulong_t __unused1;
+    __syscall_ulong_t __unused2;
+    __syscall_ulong_t __unused3;
+    __syscall_ulong_t __unused4;
   };
 
 struct shm_info
   {
     int used_ids;
-    __USYSCALL_LONG_TYPE shm_tot;	/* total allocated shm */
-    __USYSCALL_LONG_TYPE shm_rss;	/* total resident shm */
-    __USYSCALL_LONG_TYPE shm_swp;	/* total swapped shm */
-    __USYSCALL_LONG_TYPE swap_attempts;
-    __USYSCALL_LONG_TYPE swap_successes;
+    __syscall_ulong_t shm_tot;	/* total allocated shm */
+    __syscall_ulong_t shm_rss;	/* total resident shm */
+    __syscall_ulong_t shm_swp;	/* total swapped shm */
+    __syscall_ulong_t swap_attempts;
+    __syscall_ulong_t swap_successes;
   };
 
 #endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/stat.h b/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
index a9bac0b..7a56c75 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
@@ -96,11 +96,11 @@ struct stat
 # define st_ctime st_ctim.tv_sec
 #else
     __time_t st_atime;			/* Time of last access.  */
-    __USYSCALL_LONG_TYPE st_atimensec;	/* Nscecs of last access.  */
+    __syscall_ulong_t st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
-    __USYSCALL_LONG_TYPE st_mtimensec;	/* Nsecs of last modification.  */
+    __syscall_ulong_t st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
-    __USYSCALL_LONG_TYPE st_ctimensec;	/* Nsecs of last status change.  */
+    __syscall_ulong_t st_ctimensec;	/* Nsecs of last status change.  */
 #endif
 #ifdef __x86_64__ 
     long long int __unused[3];
@@ -157,11 +157,11 @@ struct stat64
 #  define st_ctime st_ctim.tv_sec
 # else
     __time_t st_atime;			/* Time of last access.  */
-    __USYSCALL_LONG_TYPE st_atimensec;	/* Nscecs of last access.  */
+    __syscall_ulong_t st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
-    __USYSCALL_LONG_TYPE st_mtimensec;	/* Nsecs of last modification.  */
+    __syscall_ulong_t st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
-    __USYSCALL_LONG_TYPE st_ctimensec;	/* Nsecs of last status change.  */
+    __syscall_ulong_t st_ctimensec;	/* Nsecs of last status change.  */
 # endif
 # ifdef __x86_64__ 
     long long int __unused[3];
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h b/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h
index 96977e1..d96337e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h
@@ -25,8 +25,8 @@
 
 struct statfs
   {
-    __SSYSCALL_LONG_TYPE f_type;
-    __SSYSCALL_LONG_TYPE f_bsize;
+    __syscall_slong_t f_type;
+    __syscall_slong_t f_bsize;
 #ifndef __USE_FILE_OFFSET64
     __fsblkcnt_t f_blocks;
     __fsblkcnt_t f_bfree;
@@ -41,27 +41,27 @@ struct statfs
     __fsfilcnt64_t f_ffree;
 #endif
     __fsid_t f_fsid;
-    __SSYSCALL_LONG_TYPE f_namelen;
-    __SSYSCALL_LONG_TYPE f_frsize;
-    __SSYSCALL_LONG_TYPE f_flags;
-    __SSYSCALL_LONG_TYPE f_spare[4];
+    __syscall_slong_t f_namelen;
+    __syscall_slong_t f_frsize;
+    __syscall_slong_t f_flags;
+    __syscall_slong_t f_spare[4];
   };
 
 #ifdef __USE_LARGEFILE64
 struct statfs64
   {
-    __SSYSCALL_LONG_TYPE f_type;
-    __SSYSCALL_LONG_TYPE f_bsize;
+    __syscall_slong_t f_type;
+    __syscall_slong_t f_bsize;
     __fsblkcnt64_t f_blocks;
     __fsblkcnt64_t f_bfree;
     __fsblkcnt64_t f_bavail;
     __fsfilcnt64_t f_files;
     __fsfilcnt64_t f_ffree;
     __fsid_t f_fsid;
-    __SSYSCALL_LONG_TYPE f_namelen;
-    __SSYSCALL_LONG_TYPE f_frsize;
-    __SSYSCALL_LONG_TYPE f_flags;
-    __SSYSCALL_LONG_TYPE f_spare[4];
+    __syscall_slong_t f_namelen;
+    __syscall_slong_t f_frsize;
+    __syscall_slong_t f_flags;
+    __syscall_slong_t f_spare[4];
   };
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/timex.h b/sysdeps/unix/sysv/linux/x86_64/bits/timex.h
index 1c7d90d..adf6292 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/timex.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/timex.h
@@ -27,41 +27,41 @@ struct timex
   /* mode selector */
   unsigned int modes;
   /* time offset (usec) */
-  __SSYSCALL_LONG_TYPE offset;
+  __syscall_slong_t offset;
   /* frequency offset (scaled ppm) */
-  __SSYSCALL_LONG_TYPE freq;
+  __syscall_slong_t freq;
   /* maximum error (usec) */
-  __SSYSCALL_LONG_TYPE maxerror;
+  __syscall_slong_t maxerror;
   /* estimated error (usec) */
-  __SSYSCALL_LONG_TYPE esterror;
+  __syscall_slong_t esterror;
   /* clock command/status */
   int status;
   /* pll time constant */
-  __SSYSCALL_LONG_TYPE constant;
+  __syscall_slong_t constant;
   /* clock precision (usec) (read only) */
-  __SSYSCALL_LONG_TYPE precision;
+  __syscall_slong_t precision;
   /* clock frequency tolerance (ppm) (read only) */
-  __SSYSCALL_LONG_TYPE tolerance;
+  __syscall_slong_t tolerance;
   /* (read only) */
   struct timeval time;
   /* (modified) usecs between clock ticks */
-  __SSYSCALL_LONG_TYPE tick;
+  __syscall_slong_t tick;
   /* pps frequency (scaled ppm) (ro) */
-  __SSYSCALL_LONG_TYPE ppsfreq;
+  __syscall_slong_t ppsfreq;
   /* pps jitter (us) (ro) */
-  __SSYSCALL_LONG_TYPE jitter;
+  __syscall_slong_t jitter;
   /* interval duration (s) (shift) (ro) */
   int shift;
   /* pps stability (scaled ppm) (ro) */
-  __SSYSCALL_LONG_TYPE stabil;
+  __syscall_slong_t stabil;
   /* jitter limit exceeded (ro) */
-  __SSYSCALL_LONG_TYPE jitcnt;
+  __syscall_slong_t jitcnt;
   /* calibration intervals (ro) */
-  __SSYSCALL_LONG_TYPE calcnt;
+  __syscall_slong_t calcnt;
   /* calibration errors (ro) */
-  __SSYSCALL_LONG_TYPE errcnt;
+  __syscall_slong_t errcnt;
   /* stability limit exceeded (ro) */
-  __SSYSCALL_LONG_TYPE stbcnt;
+  __syscall_slong_t stbcnt;
 
   /* TAI offset (ro) */
   int tai;
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h b/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h
index 2f41667..d6d4b92 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h
@@ -41,8 +41,8 @@
 #define __SUSECONDS_T_TYPE	__SQUAD_TYPE
 #define __SNSECONDS_T_TYPE	__SQUAD_TYPE
 #define __BLKSIZE_T_TYPE	__SQUAD_TYPE
-#define __SSYSCALL_LONG_TYPE	__SQUAD_TYPE
-#define __USYSCALL_LONG_TYPE	__UQUAD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SQUAD_TYPE
+#define __SYSCALL_ULONG_TYPE	__UQUAD_TYPE
 #else
 #define __INO_T_TYPE		__ULONGWORD_TYPE
 #define __NLINK_T_TYPE		__UWORD_TYPE
@@ -56,8 +56,8 @@
 #define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
 #define __SNSECONDS_T_TYPE	__SLONGWORD_TYPE
 #define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
-#define __SSYSCALL_LONG_TYPE	__SLONGWORD_TYPE
-#define __USYSCALL_LONG_TYPE	__ULONGWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 #endif
 
 #define __DEV_T_TYPE		__UQUAD_TYPE
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/msg.h b/sysdeps/unix/sysv/linux/x86_64/sys/msg.h
index 4a6271d..35aa171 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sys/msg.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/msg.h
@@ -52,7 +52,7 @@ typedef __ssize_t ssize_t;
 /* Template for struct to be used as argument for `msgsnd' and `msgrcv'.  */
 struct msgbuf
   {
-    __SSYSCALL_LONG_TYPE mtype;	/* type of received/sent message */
+    __syscall_slong_t mtype;	/* type of received/sent message */
     char mtext[1];		/* text of the message */
   };
 #endif

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=64874de8abfccc47631202a64b91e0ec3f3d53c2

commit 64874de8abfccc47631202a64b91e0ec3f3d53c2
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Mar 16 15:01:30 2012 -0700

    Use i386/readelflib.c in x86_64/readelflib.c
    
    2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/unix/sysv/linux/i386/readelflib.c (process_elf_file):
    	Move e_machine check before EI_CLASS check.  Check EM_IA_64 only
    	if SKIP_EM_IA_64 isn't defined.
    	* sysdeps/unix/sysv/linux/x86_64/readelflib.c: Just define
    	SKIP_EM_IA_64 and include <sysdeps/unix/sysv/linux/i386/readelflib.c>.
    
    Conflicts:
    
    	sysdeps/unix/sysv/linux/x86_64/readelflib.c

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 2d6b37a..c111b36 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,13 @@
 2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/unix/sysv/linux/i386/readelflib.c (process_elf_file):
+	Move e_machine check before EI_CLASS check.  Check EM_IA_64 only
+	if SKIP_EM_IA_64 isn't defined.
+	* sysdeps/unix/sysv/linux/x86_64/readelflib.c: Just define
+	SKIP_EM_IA_64 and include <sysdeps/unix/sysv/linux/i386/readelflib.c>.
+
+2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/unix/sysv/linux/x86_64/makecontext.c (__makecontext):
 	Use greg_t instead of unsigned long long int and long long int.
 
diff --git a/sysdeps/unix/sysv/linux/i386/readelflib.c b/sysdeps/unix/sysv/linux/i386/readelflib.c
index 6e39b3d..bac83bb 100644
--- a/sysdeps/unix/sysv/linux/i386/readelflib.c
+++ b/sysdeps/unix/sysv/linux/i386/readelflib.c
@@ -33,50 +33,52 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 		  size_t file_length)
 {
   ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
-  int ret;
+  int ret, file_flag = 0;
 
-  if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
+  switch (elf_header->e_machine)
     {
-      ret = process_elf32_file (file_name, lib, flag, osversion, soname,
-				file_contents, file_length);
-      /* X32 libraries are always libc.so.6+.  */
-      if (!ret)
-	switch (elf_header->e_machine)
-	  {
-	  case EM_X86_64:
-	    *flag = FLAG_X8664_LIBX32|FLAG_ELF_LIBC6;
-	    break;
-	  }
-    }
-  else
-    {
-      switch (elf_header->e_machine)
+    case EM_X86_64:
+      if (elf_header->e_ident[EI_CLASS] == ELFCLASS64)
+	/* X86-64 64bit libraries are always libc.so.6+.  */
+	file_flag = FLAG_X8664_LIB64|FLAG_ELF_LIBC6;
+      else
+	/* X32 libraries are always libc.so.6+.  */
+	file_flag = FLAG_X8664_LIBX32|FLAG_ELF_LIBC6;
+      break;
+#ifndef SKIP_EM_IA_64
+    case EM_IA_64:
+      if (elf_header->e_ident[EI_CLASS] == ELFCLASS64)
 	{
-	case EM_IA_64:
-	case EM_X86_64:
+	  /* IA64 64bit libraries are always libc.so.6+.  */
+	  file_flag = FLAG_IA64_LIB64|FLAG_ELF_LIBC6;
 	  break;
-	default:
-	  error (0, 0, _("%s is for unknown machine %d.\n"),
-		 file_name, elf_header->e_machine);
-	  return 1;
 	}
+      goto failed;
+#endif
+    case EM_386:
+      if (elf_header->e_ident[EI_CLASS] == ELFCLASS32)
+	break;
+      /* Fall through.  */
+    default:
+#ifndef SKIP_EM_IA_64
+failed:
+#endif
+      error (0, 0, _("%s is for unknown machine %d.\n"),
+	     file_name, elf_header->e_machine);
+      return 1;
+    }
 
-      ret = process_elf64_file (file_name, lib, flag, osversion, soname,
-				file_contents, file_length);
-      /* IA64/X86-64 64bit libraries are always libc.so.6+.  */
-      if (!ret)
-	switch (elf_header->e_machine)
-	  {
-	  case EM_IA_64:
-	    *flag = FLAG_IA64_LIB64|FLAG_ELF_LIBC6;
-	    break;
-	  case EM_X86_64:
-	    *flag = FLAG_X8664_LIB64|FLAG_ELF_LIBC6;
-	    break;
-	  }
+  if (elf_header->e_ident[EI_CLASS] == ELFCLASS32)
+    ret = process_elf32_file (file_name, lib, flag, osversion, soname,
+			      file_contents, file_length);
+  else
+    ret = process_elf64_file (file_name, lib, flag, osversion, soname,
+			      file_contents, file_length);
 
-      return ret;
-    }
+  if (!ret && file_flag)
+    *flag = file_flag;
+
+  return ret;
 }
 
 #undef __ELF_NATIVE_CLASS
diff --git a/sysdeps/unix/sysv/linux/x86_64/readelflib.c b/sysdeps/unix/sysv/linux/x86_64/readelflib.c
index 65d3ed7..4c4e5f9 100644
--- a/sysdeps/unix/sysv/linux/x86_64/readelflib.c
+++ b/sysdeps/unix/sysv/linux/x86_64/readelflib.c
@@ -1,72 +1,2 @@
-/* Copyright (C) 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
-		  Jakub Jelinek <jakub@redhat.com>, 1999.
-
-   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.  */
-
-
-int process_elf32_file (const char *file_name, const char *lib, int *flag,
-			unsigned int *osversion, char **soname,
-			void *file_contents, size_t file_length);
-int process_elf64_file (const char *file_name, const char *lib, int *flag,
-			unsigned int *osversion, char **soname,
-			void *file_contents, size_t file_length);
-
-/* Returns 0 if everything is ok, != 0 in case of error.  */
-int
-process_elf_file (const char *file_name, const char *lib, int *flag,
-		  unsigned int *osversion, char **soname, void *file_contents,
-		  size_t file_length)
-{
-  ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
-  int ret;
-
-  if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
-    {
-      ret = process_elf32_file (file_name, lib, flag, osversion, soname,
-				file_contents, file_length);
-      /* X32 libraries are always libc.so.6+.  */
-      if (!ret)
-	switch (elf_header->e_machine)
-	  {
-	  case EM_X86_64:
-	    *flag = FLAG_X8664_LIBX32|FLAG_ELF_LIBC6;
-	    break;
-	  }
-    }
-  else
-    {
-      ret = process_elf64_file (file_name, lib, flag, osversion, soname,
-				file_contents, file_length);
-      /* x86-64 64bit libraries are always libc.so.6+.  */
-      if (!ret)
-	*flag = FLAG_X8664_LIB64|FLAG_ELF_LIBC6;
-      return ret;
-    }
-}
-
-#undef __ELF_NATIVE_CLASS
-#undef process_elf_file
-#define process_elf_file process_elf32_file
-#define __ELF_NATIVE_CLASS 32
-#include "elf/readelflib.c"
-
-#undef __ELF_NATIVE_CLASS
-#undef process_elf_file
-#define process_elf_file process_elf64_file
-#define __ELF_NATIVE_CLASS 64
-#include "elf/readelflib.c"
+#define SKIP_EM_IA_64
+#include <sysdeps/unix/sysv/linux/i386/readelflib.c>

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1ed0a851631da1da272cc97eeff701da32d73cc9

commit 1ed0a851631da1da272cc97eeff701da32d73cc9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Mar 16 14:59:49 2012 -0700

    Use greg_t instead of long long int in __makecontext
    
    2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/unix/sysv/linux/x86_64/makecontext.c (__makecontext):
    	Use greg_t instead of unsigned long long int and long long int.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 64e8e4c..2d6b37a 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,10 @@
 2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/unix/sysv/linux/x86_64/makecontext.c (__makecontext):
+	Use greg_t instead of unsigned long long int and long long int.
+
+2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/unix/sysv/linux/x86_64/sysdep.h
 	(VSYSCALL_ADDR_vgettimeofday): Removed.
 	(VSYSCALL_ADDR_vtime): Likewise.
diff --git a/sysdeps/unix/sysv/linux/x86_64/makecontext.c b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
index 477d22e..9ae9528 100644
--- a/sysdeps/unix/sysv/linux/x86_64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
@@ -53,30 +53,30 @@ void
 __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 {
   extern void __start_context (void);
-  unsigned long long int *sp;
+  greg_t *sp;
   unsigned int idx_uc_link;
   va_list ap;
   int i;
 
   /* Generate room on stack for parameter if needed and uc_link.  */
-  sp = (unsigned long long int *) ((uintptr_t) ucp->uc_stack.ss_sp
-				   + ucp->uc_stack.ss_size);
+  sp = (greg_t *) ((uintptr_t) ucp->uc_stack.ss_sp
+		   + ucp->uc_stack.ss_size);
   sp -= (argc > 6 ? argc - 6 : 0) + 1;
   /* Align stack and make space for trampoline address.  */
-  sp = (unsigned long long int *) ((((uintptr_t) sp) & -16L) - 8);
+  sp = (greg_t *) ((((uintptr_t) sp) & -16L) - 8);
 
   idx_uc_link = (argc > 6 ? argc - 6 : 0) + 1;
 
   /* Setup context ucp.  */
   /* Address to jump to.  */
-  ucp->uc_mcontext.gregs[REG_RIP] = (unsigned long int) func;
+  ucp->uc_mcontext.gregs[REG_RIP] = (uintptr_t) func;
   /* Setup rbx.*/
-  ucp->uc_mcontext.gregs[REG_RBX] = (unsigned long int) &sp[idx_uc_link];
-  ucp->uc_mcontext.gregs[REG_RSP] = (unsigned long int) sp;
+  ucp->uc_mcontext.gregs[REG_RBX] = (uintptr_t) &sp[idx_uc_link];
+  ucp->uc_mcontext.gregs[REG_RSP] = (uintptr_t) sp;
 
   /* Setup stack.  */
-  sp[0] = (unsigned long int) &__start_context;
-  sp[idx_uc_link] = (unsigned long int) ucp->uc_link;
+  sp[0] = (uintptr_t) &__start_context;
+  sp[idx_uc_link] = (uintptr_t) ucp->uc_link;
 
   va_start (ap, argc);
   /* Handle arguments.
@@ -92,26 +92,26 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
     switch (i)
       {
       case 0:
-	ucp->uc_mcontext.gregs[REG_RDI] = va_arg (ap, long long int);
+	ucp->uc_mcontext.gregs[REG_RDI] = va_arg (ap, greg_t);
 	break;
       case 1:
-	ucp->uc_mcontext.gregs[REG_RSI] = va_arg (ap, long long int);
+	ucp->uc_mcontext.gregs[REG_RSI] = va_arg (ap, greg_t);
 	break;
       case 2:
-	ucp->uc_mcontext.gregs[REG_RDX] = va_arg (ap, long long int);
+	ucp->uc_mcontext.gregs[REG_RDX] = va_arg (ap, greg_t);
 	break;
       case 3:
-	ucp->uc_mcontext.gregs[REG_RCX] = va_arg (ap, long long int);
+	ucp->uc_mcontext.gregs[REG_RCX] = va_arg (ap, greg_t);
 	break;
       case 4:
-	ucp->uc_mcontext.gregs[REG_R8] = va_arg (ap, long long int);
+	ucp->uc_mcontext.gregs[REG_R8] = va_arg (ap, greg_t);
 	break;
       case 5:
-	ucp->uc_mcontext.gregs[REG_R9] = va_arg (ap, long long int);
+	ucp->uc_mcontext.gregs[REG_R9] = va_arg (ap, greg_t);
 	break;
       default:
 	/* Put value on stack.  */
-	sp[i - 5] = va_arg (ap, unsigned long long int);
+	sp[i - 5] = va_arg (ap, greg_t);
 	break;
       }
   va_end (ap);

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=df16dc2916cc4699412999b4e8cff7a41f5fec38

commit df16dc2916cc4699412999b4e8cff7a41f5fec38
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Mar 16 14:25:30 2012 -0700

    Restore VSYSCALL_ADDR_xxx
    
    2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/unix/sysv/linux/x86_64/sysdep.h
    	(VSYSCALL_ADDR_vgettimeofday): Removed.
    	(VSYSCALL_ADDR_vtime): Likewise.
    	(VSYSCALL_ADDR_vgetcpu): Likewise.
    
    	* sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
    	(VSYSCALL_ADDR_vgettimeofday): Restored.
    	* sysdeps/unix/sysv/linux/x86_64/init-first.c
    	(VSYSCALL_ADDR_vgetcpu): Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
    	(VSYSCALL_ADDR_vgetcpu): Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/time.c (VSYSCALL_ADDR_vtime):
    	Likewise.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index ca6db3e..64e8e4c 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,21 @@
 2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h
+	(VSYSCALL_ADDR_vgettimeofday): Removed.
+	(VSYSCALL_ADDR_vtime): Likewise.
+	(VSYSCALL_ADDR_vgetcpu): Likewise.
+
+	* sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
+	(VSYSCALL_ADDR_vgettimeofday): Restored.
+	* sysdeps/unix/sysv/linux/x86_64/init-first.c
+	(VSYSCALL_ADDR_vgetcpu): Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
+	(VSYSCALL_ADDR_vgetcpu): Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/time.c (VSYSCALL_ADDR_vtime):
+	Likewise.
+
+2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h: Include
 	<bits/wordsize.h>.
 	(sigcontext): Check __WORDSIZE instead of __LP64__.
diff --git a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
index 0b06133..3aba81c 100644
--- a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
@@ -18,6 +18,10 @@
 
 #include <dl-vdso.h>
 
+
+#define VSYSCALL_ADDR_vgettimeofday	0xffffffffff600000ul
+
+
 #ifdef SHARED
 void *gettimeofday_ifunc (void) __asm__ ("__gettimeofday");
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
index c331e12..cb39aca 100644
--- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
+++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
@@ -45,6 +45,7 @@ _libc_vdso_platform_setup (void)
 
   p = _dl_vdso_vsym ("getcpu", &linux26);
   /* If the vDSO is not available we fall back on the old vsyscall.  */
+#define VSYSCALL_ADDR_vgetcpu	0xffffffffff600800
   if (p == NULL)
     p = (void *) VSYSCALL_ADDR_vgetcpu;
   PTR_MANGLE (p);
diff --git a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
index 2053bfd..246c955 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
+++ b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
@@ -22,6 +22,10 @@
 #include <bits/errno.h>
 #include <kernel-features.h>
 
+/* For the calculation see asm/vsyscall.h.  */
+#define VSYSCALL_ADDR_vgetcpu	0xffffffffff600800
+
+
 ENTRY (sched_getcpu)
 	/* Align stack and create local variable for result.  */
 	sub	$0x8, %rsp
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 48c74a1..34e0464 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -190,11 +190,6 @@
 # define DOARGS_5 DOARGS_4
 # define DOARGS_6 DOARGS_5
 
-/* For the calculation see asm/vsyscall.h.  */
-# define VSYSCALL_ADDR_vgettimeofday	0xffffffffff600000
-# define VSYSCALL_ADDR_vtime		0xffffffffff600400
-# define VSYSCALL_ADDR_vgetcpu		0xffffffffff600800
-
 #else	/* !__ASSEMBLER__ */
 /* Define a macro which expands inline into the wrapper code for a system
    call.  */
@@ -340,11 +335,6 @@
   LOAD_REGS_5
 # define ASM_ARGS_6	ASM_ARGS_5, "r" (_a6)
 
-/* For the calculation see asm/vsyscall.h.  */
-# define VSYSCALL_ADDR_vgettimeofday	0xffffffffff600000ul
-# define VSYSCALL_ADDR_vgetcpu		0xffffffffff600800ul
-# define VSYSCALL_ADDR_vtime		0xffffffffff600400ul
-
 #endif	/* __ASSEMBLER__ */
 
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/time.c b/sysdeps/unix/sysv/linux/x86_64/time.c
index 7b4a0c8..a613eb0 100644
--- a/sysdeps/unix/sysv/linux/x86_64/time.c
+++ b/sysdeps/unix/sysv/linux/x86_64/time.c
@@ -19,6 +19,8 @@
 #ifdef SHARED
 #include <dl-vdso.h>
 
+#define VSYSCALL_ADDR_vtime	0xffffffffff600400
+
 void *time_ifunc (void) __asm__ ("time");
 
 void *

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2693f350c2d99fd2da00e71df997bd98e63973bd

commit 2693f350c2d99fd2da00e71df997bd98e63973bd
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Mar 16 14:09:51 2012 -0700

    Check __WORDSIZE instead of __LP64__
    
    2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h: Include
    	<bits/wordsize.h>.
    	(sigcontext): Check __WORDSIZE instead of __LP64__.
    
    	* sysdeps/unix/sysv/linux/x86_64/sys/user.h: Include
    	<bits/wordsize.h>.
    	(user): Check __WORDSIZE instead of __LP64__.
    
    Conflicts:
    
    	ChangeLog.x32

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 111b490..ca6db3e 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,3 +1,13 @@
+2012-03-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h: Include
+	<bits/wordsize.h>.
+	(sigcontext): Check __WORDSIZE instead of __LP64__.
+
+	* sysdeps/unix/sysv/linux/x86_64/sys/user.h: Include
+	<bits/wordsize.h>.
+	(user): Check __WORDSIZE instead of __LP64__.
+
 2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* time/offtime.c (__offtime): Use time_t on days, rem, y and yg.
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h b/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
index f470b22..152a546 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
@@ -23,6 +23,8 @@
 # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
 #endif
 
+#include <bits/wordsize.h>
+
 struct _fpreg
 {
   unsigned short significand[4];
@@ -149,9 +151,9 @@ struct sigcontext
   unsigned long long oldmask;
   unsigned long long cr2;
   struct _fpstate * fpstate;
-#ifndef __LP64__
+# if __WORDSIZE == 32
   unsigned int pad0;
-#endif
+# endif
   unsigned long long __reserved1 [8];
 };
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/user.h b/sysdeps/unix/sysv/linux/x86_64/sys/user.h
index d09a420..35bfa8b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sys/user.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/user.h
@@ -23,6 +23,8 @@
    too much into it.  Don't use it for anything other than GDB unless
    you know what you are doing.  */
 
+#include <bits/wordsize.h>
+
 #ifdef __x86_64__
 
 struct user_fpregs_struct
@@ -84,13 +86,13 @@ struct user
   long long int			signal;
   int				reserved;
   struct user_regs_struct*	u_ar0;
-#ifndef __LP64__
+# if __WORDSIZE == 32
   unsigned int			pad0;
-#endif
+# endif
   struct user_fpregs_struct*	u_fpstate;
-#ifndef __LP64__
+# if __WORDSIZE == 32
   unsigned int			pad1;
-#endif
+# endif
   unsigned long long int	magic;
   char				u_comm [32];
   unsigned long long int	u_debugreg [8];

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5a22f575dc0b564bd38637bc400d98743b38d4cc

commit 5a22f575dc0b564bd38637bc400d98743b38d4cc
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Mar 15 16:58:12 2012 -0700

    Use time_t on days, rem, y and yg in __offtime
    
    2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* time/offtime.c (__offtime): Use time_t on days, rem, y and yg.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 7606c55..111b490 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,9 @@
 2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* time/offtime.c (__offtime): Use time_t on days, rem, y and yg.
+
+2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* time/mktime.c: Sync with gnulib mktime.c at commit
 	a7967a2cf0998b6c157c7cf8e1d8d9d11dab30b0.
 
diff --git a/time/offtime.c b/time/offtime.c
index 312ad42..703ae9e 100644
--- a/time/offtime.c
+++ b/time/offtime.c
@@ -32,12 +32,10 @@ __offtime (t, offset, tp)
      long int offset;
      struct tm *tp;
 {
-  long int days, rem, y;
+  time_t days, rem, y;
   const unsigned short int *ip;
 
   days = *t / SECS_PER_DAY;
-  if (days != *t / SECS_PER_DAY)
-    goto overflow;
   rem = *t % SECS_PER_DAY;
   rem += offset;
   while (rem < 0)
@@ -66,10 +64,7 @@ __offtime (t, offset, tp)
   while (days < 0 || days >= (__isleap (y) ? 366 : 365))
     {
       /* Guess a corrected year, assuming 365 days per year.  */
-      long int yg = y + days / 365 - (days % 365 < 0);
-
-      if (yg < 0)
-	goto overflow;
+      time_t yg = y + days / 365 - (days % 365 < 0);
 
       /* Adjust DAYS and Y to match the guessed year.  */
       days -= ((yg - y) * 365
@@ -80,7 +75,6 @@ __offtime (t, offset, tp)
   tp->tm_year = y - 1900;
   if (tp->tm_year != y - 1900)
     {
-overflow:
       /* The year cannot be represented due to overflow.  */
       __set_errno (EOVERFLOW);
       return 0;

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=741ed72fff7bea4e353e693b08580355683302c5

commit 741ed72fff7bea4e353e693b08580355683302c5
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Mar 20 09:42:37 2012 -0700

    Sync time/mktime.c with gnulib
    
    2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* time/mktime.c: Sync with gnulib mktime.c at commit
    	a7967a2cf0998b6c157c7cf8e1d8d9d11dab30b0.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 0058808..7606c55 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,10 @@
 2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* time/mktime.c: Sync with gnulib mktime.c at commit
+	a7967a2cf0998b6c157c7cf8e1d8d9d11dab30b0.
+
+2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c (getcpu_ifunc):
 	Replace getcpu with __vdso_getcpu.
 
diff --git a/time/mktime.c b/time/mktime.c
index af0457f..da0a15a 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -22,31 +22,62 @@
    mktime.  */
 /* #define DEBUG 1 */
 
-#ifdef HAVE_CONFIG_H
+#ifndef _LIBC
 # include <config.h>
 #endif
 
 /* Assume that leap seconds are possible, unless told otherwise.
-   If the host has a `zic' command with a `-L leapsecondfilename' option,
+   If the host has a 'zic' command with a '-L leapsecondfilename' option,
    then it supports leap seconds; otherwise it probably doesn't.  */
 #ifndef LEAP_SECONDS_POSSIBLE
 # define LEAP_SECONDS_POSSIBLE 1
 #endif
 
-#include <sys/types.h>		/* Some systems define `time_t' here.  */
 #include <time.h>
 
 #include <limits.h>
 
-#include <string.h>		/* For the real memcpy prototype.  */
+#include <string.h>             /* For the real memcpy prototype.  */
 
 #if DEBUG
 # include <stdio.h>
 # include <stdlib.h>
 /* Make it work even if the system's libc has its own mktime routine.  */
+# undef mktime
 # define mktime my_mktime
 #endif /* DEBUG */
 
+/* Some of the code in this file assumes that signed integer overflow
+   silently wraps around.  This assumption can't easily be programmed
+   around, nor can it be checked for portably at compile-time or
+   easily eliminated at run-time.
+
+   Define WRAPV to 1 if the assumption is valid and if
+     #pragma GCC optimize ("wrapv")
+   does not trigger GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51793>.
+   Otherwise, define it to 0; this forces the use of slower code that,
+   while not guaranteed by the C Standard, works on all production
+   platforms that we know about.  */
+#ifndef WRAPV
+# if ((__GNUC__ == 4 && 4 <= __GNUC_MINOR__) || 4 < __GNUC__) && defined __GLIBC__
+#  pragma GCC optimize ("wrapv")
+#  define WRAPV 1
+# else
+#  define WRAPV 0
+# endif
+#endif
+
+/* Verify a requirement at compile-time (unlike assert, which is runtime).  */
+#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
+
+/* A signed type that is at least one bit wider than int.  */
+#if INT_MAX <= LONG_MAX / 2
+typedef long int long_int;
+#else
+typedef long long int long_int;
+#endif
+verify (long_int_is_wide_enough, INT_MAX == INT_MAX * (long_int) 2 / 2);
+
 /* Shift A right by B bits portably, by dividing A by 2**B and
    truncating towards minus infinity.  A and B should be free of side
    effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
@@ -57,9 +88,11 @@
    implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
    right in the usual way when A < 0, so SHR falls back on division if
    ordinary A >> B doesn't seem to be the usual signed shift.  */
-#define SHR(a, b)	\
-  (-1 >> 1 == -1	\
-   ? (a) >> (b)		\
+#define SHR(a, b)                                               \
+  ((-1 >> 1 == -1                                               \
+    && (long_int) -1 >> 1 == -1                                 \
+    && ((time_t) -1 >> 1 == -1 || ! TYPE_SIGNED (time_t)))      \
+   ? (a) >> (b)                                                 \
    : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
 
 /* The extra casts in the following macros work around compiler bugs,
@@ -70,12 +103,8 @@
 #define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
 
 /* True if negative values of the signed integer type T use two's
-   complement, ones' complement, or signed magnitude representation,
-   respectively.  Much GNU code assumes two's complement, but some
-   people like to be portable to all possible C hosts.  */
+   complement, or if T is an unsigned integer type.  */
 #define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
-#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
-#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
 
 /* True if the arithmetic type T is signed.  */
 #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
@@ -86,14 +115,12 @@
    your host.  */
 #define TYPE_MINIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-	? (t) 0 \
-	: TYPE_SIGNED_MAGNITUDE (t) \
-	? ~ (t) 0 \
-	: ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
+        ? (t) 0 \
+        : ~ TYPE_MAXIMUM (t)))
 #define TYPE_MAXIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-	? (t) -1 \
-	: ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
+        ? (t) -1 \
+        : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
 
 #ifndef TIME_T_MIN
 # define TIME_T_MIN TYPE_MINIMUM (time_t)
@@ -103,14 +130,11 @@
 #endif
 #define TIME_T_MIDPOINT (SHR (TIME_T_MIN + TIME_T_MAX, 1) + 1)
 
-/* Verify a requirement at compile-time (unlike assert, which is runtime).  */
-#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
-
 verify (time_t_is_integer, TYPE_IS_INTEGER (time_t));
-verify (twos_complement_arithmetic, TYPE_TWOS_COMPLEMENT (int));
-/* The code also assumes that signed integer overflow silently wraps
-   around, but this assumption can't be stated without causing a
-   diagnostic on some hosts.  */
+verify (twos_complement_arithmetic,
+        (TYPE_TWOS_COMPLEMENT (int)
+         && TYPE_TWOS_COMPLEMENT (long_int)
+         && TYPE_TWOS_COMPLEMENT (time_t)));
 
 #define EPOCH_YEAR 1970
 #define TM_YEAR_BASE 1900
@@ -118,14 +142,14 @@ verify (base_year_is_a_multiple_of_100, TM_YEAR_BASE % 100 == 0);
 
 /* Return 1 if YEAR + TM_YEAR_BASE is a leap year.  */
 static inline int
-leapyear (long int year)
+leapyear (long_int year)
 {
   /* Don't add YEAR to TM_YEAR_BASE, as that might overflow.
      Also, work even if YEAR is negative.  */
   return
     ((year & 3) == 0
      && (year % 100 != 0
-	 || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3)));
+         || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3)));
 }
 
 /* How many days come before each month (0-12).  */
@@ -142,16 +166,24 @@ const unsigned short int __mon_yday[2][13] =
 
 
 #ifndef _LIBC
-/* Portable standalone applications should supply a "time_r.h" that
+/* Portable standalone applications should supply a <time.h> that
    declares a POSIX-compliant localtime_r, for the benefit of older
    implementations that lack localtime_r or have a nonstandard one.
    See the gnulib time_r module for one way to implement this.  */
-# include "time_r.h"
 # undef __localtime_r
 # define __localtime_r localtime_r
 # define __mktime_internal mktime_internal
+# include "mktime-internal.h"
 #endif
 
+/* Return 1 if the values A and B differ according to the rules for
+   tm_isdst: A and B differ if one is zero and the other positive.  */
+static int
+isdst_differ (int a, int b)
+{
+  return (!a != !b) & (0 <= a) & (0 <= b);
+}
+
 /* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) -
    (YEAR0-YDAY0 HOUR0:MIN0:SEC0) in seconds, assuming that the clocks
    were not adjusted between the time stamps.
@@ -164,12 +196,10 @@ const unsigned short int __mon_yday[2][13] =
    detect overflow.  */
 
 static inline time_t
-ydhms_diff (long int year1, long int yday1, int hour1, int min1, int sec1,
-	    int year0, int yday0, int hour0, int min0, int sec0)
+ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1,
+            int year0, int yday0, int hour0, int min0, int sec0)
 {
   verify (C99_integer_division, -1 / 2 == 0);
-  verify (long_int_year_and_yday_are_wide_enough,
-	  INT_MAX <= TIME_T_MAX / 2 || TIME_T_MAX <= UINT_MAX);
 
   /* Compute intervening leap days correctly even if year is negative.
      Take care to avoid integer overflow here.  */
@@ -192,6 +222,53 @@ ydhms_diff (long int year1, long int yday1, int hour1, int min1, int sec1,
   return seconds;
 }
 
+/* Return the average of A and B, even if A + B would overflow.  */
+static time_t
+time_t_avg (time_t a, time_t b)
+{
+  return SHR (a, 1) + SHR (b, 1) + (a & b & 1);
+}
+
+/* Return 1 if A + B does not overflow.  If time_t is unsigned and if
+   B's top bit is set, assume that the sum represents A - -B, and
+   return 1 if the subtraction does not wrap around.  */
+static int
+time_t_add_ok (time_t a, time_t b)
+{
+  if (! TYPE_SIGNED (time_t))
+    {
+      time_t sum = a + b;
+      return (sum < a) == (TIME_T_MIDPOINT <= b);
+    }
+  else if (WRAPV)
+    {
+      time_t sum = a + b;
+      return (sum < a) == (b < 0);
+    }
+  else
+    {
+      time_t avg = time_t_avg (a, b);
+      return TIME_T_MIN / 2 <= avg && avg <= TIME_T_MAX / 2;
+    }
+}
+
+/* Return 1 if A + B does not overflow.  */
+static int
+time_t_int_add_ok (time_t a, int b)
+{
+  verify (int_no_wider_than_time_t, INT_MAX <= TIME_T_MAX);
+  if (WRAPV)
+    {
+      time_t sum = a + b;
+      return (sum < a) == (b < 0);
+    }
+  else
+    {
+      int a_odd = a & 1;
+      time_t avg = SHR (a, 1) + (SHR (b, 1) + (a_odd & b));
+      return TIME_T_MIN / 2 <= avg && avg <= TIME_T_MAX / 2;
+    }
+}
 
 /* Return a time_t value corresponding to (YEAR-YDAY HOUR:MIN:SEC),
    assuming that *T corresponds to *TP and that no clock adjustments
@@ -200,17 +277,16 @@ ydhms_diff (long int year1, long int yday1, int hour1, int min1, int sec1,
    If overflow occurs, yield the minimal or maximal value, except do not
    yield a value equal to *T.  */
 static time_t
-guess_time_tm (long int year, long int yday, int hour, int min, int sec,
-	       const time_t *t, const struct tm *tp)
+guess_time_tm (long_int year, long_int yday, int hour, int min, int sec,
+               const time_t *t, const struct tm *tp)
 {
   if (tp)
     {
       time_t d = ydhms_diff (year, yday, hour, min, sec,
-			     tp->tm_year, tp->tm_yday,
-			     tp->tm_hour, tp->tm_min, tp->tm_sec);
-      time_t t1 = *t + d;
-      if ((t1 < *t) == (TYPE_SIGNED (time_t) ? d < 0 : TIME_T_MAX / 2 < d))
-	return t1;
+                             tp->tm_year, tp->tm_yday,
+                             tp->tm_hour, tp->tm_min, tp->tm_sec);
+      if (time_t_add_ok (*t, d))
+        return *t + d;
     }
 
   /* Overflow occurred one way or another.  Return the nearest result
@@ -219,8 +295,8 @@ guess_time_tm (long int year, long int yday, int hour, int min, int sec,
      match; and don't oscillate between two values, as that would
      confuse the spring-forward gap detector.  */
   return (*t < TIME_T_MIDPOINT
-	  ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN)
-	  : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX));
+          ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN)
+          : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX));
 }
 
 /* Use CONVERT to convert *T to a broken down time in *TP.
@@ -228,7 +304,7 @@ guess_time_tm (long int year, long int yday, int hour, int min, int sec,
    it is the nearest in-range value and then convert that.  */
 static struct tm *
 ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
-		time_t *t, struct tm *tp)
+                time_t *t, struct tm *tp)
 {
   struct tm *r = convert (t, tp);
 
@@ -238,27 +314,25 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
       time_t ok = 0;
 
       /* BAD is a known unconvertible time_t, and OK is a known good one.
-	 Use binary search to narrow the range between BAD and OK until
-	 they differ by 1.  */
+         Use binary search to narrow the range between BAD and OK until
+         they differ by 1.  */
       while (bad != ok + (bad < 0 ? -1 : 1))
-	{
-	  time_t mid = *t = (bad < 0
-			     ? bad + ((ok - bad) >> 1)
-			     : ok + ((bad - ok) >> 1));
-	  r = convert (t, tp);
-	  if (r)
-	    ok = mid;
-	  else
-	    bad = mid;
-	}
+        {
+          time_t mid = *t = time_t_avg (ok, bad);
+          r = convert (t, tp);
+          if (r)
+            ok = mid;
+          else
+            bad = mid;
+        }
 
       if (!r && ok)
-	{
-	  /* The last conversion attempt failed;
-	     revert to the most recent successful attempt.  */
-	  *t = ok;
-	  r = convert (t, tp);
-	}
+        {
+          /* The last conversion attempt failed;
+             revert to the most recent successful attempt.  */
+          *t = ok;
+          r = convert (t, tp);
+        }
     }
 
   return r;
@@ -273,8 +347,8 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
    This function is external because it is used also by timegm.c.  */
 time_t
 __mktime_internal (struct tm *tp,
-		   struct tm *(*convert) (const time_t *, struct tm *),
-		   time_t *offset)
+                   struct tm *(*convert) (const time_t *, struct tm *),
+                   time_t *offset)
 {
   time_t t, gt, t0, t1, t2;
   struct tm tm;
@@ -293,9 +367,7 @@ __mktime_internal (struct tm *tp,
   int mday = tp->tm_mday;
   int mon = tp->tm_mon;
   int year_requested = tp->tm_year;
-  /* Normalize the value.  */
-  int isdst = ((tp->tm_isdst >> (8 * sizeof (tp->tm_isdst) - 1))
-	       | (tp->tm_isdst != 0));
+  int isdst = tp->tm_isdst;
 
   /* 1 if the previous probe was DST.  */
   int dst2;
@@ -304,8 +376,8 @@ __mktime_internal (struct tm *tp,
   int mon_remainder = mon % 12;
   int negative_mon_remainder = mon_remainder < 0;
   int mon_years = mon / 12 - negative_mon_remainder;
-  long int lyear_requested = year_requested;
-  long int year = lyear_requested + mon_years;
+  long_int lyear_requested = year_requested;
+  long_int year = lyear_requested + mon_years;
 
   /* The other values need not be in range:
      the remaining code handles minor overflows correctly,
@@ -315,10 +387,10 @@ __mktime_internal (struct tm *tp,
   /* Calculate day of year from year, month, and day of month.
      The result need not be in range.  */
   int mon_yday = ((__mon_yday[leapyear (year)]
-		   [mon_remainder + 12 * negative_mon_remainder])
-		  - 1);
-  long int lmday = mday;
-  long int yday = mon_yday + lmday;
+                   [mon_remainder + 12 * negative_mon_remainder])
+                  - 1);
+  long_int lmday = mday;
+  long_int yday = mon_yday + lmday;
 
   time_t guessed_offset = *offset;
 
@@ -327,33 +399,33 @@ __mktime_internal (struct tm *tp,
   if (LEAP_SECONDS_POSSIBLE)
     {
       /* Handle out-of-range seconds specially,
-	 since ydhms_tm_diff assumes every minute has 60 seconds.  */
+         since ydhms_tm_diff assumes every minute has 60 seconds.  */
       if (sec < 0)
-	sec = 0;
+        sec = 0;
       if (59 < sec)
-	sec = 59;
+        sec = 59;
     }
 
   /* Invert CONVERT by probing.  First assume the same offset as last
      time.  */
 
   t0 = ydhms_diff (year, yday, hour, min, sec,
-		   EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, - guessed_offset);
+                   EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, - guessed_offset);
 
   if (TIME_T_MAX / INT_MAX / 366 / 24 / 60 / 60 < 3)
     {
       /* time_t isn't large enough to rule out overflows, so check
-	 for major overflows.  A gross check suffices, since if t0
-	 has overflowed, it is off by a multiple of TIME_T_MAX -
-	 TIME_T_MIN + 1.  So ignore any component of the difference
-	 that is bounded by a small value.  */
+         for major overflows.  A gross check suffices, since if t0
+         has overflowed, it is off by a multiple of TIME_T_MAX -
+         TIME_T_MIN + 1.  So ignore any component of the difference
+         that is bounded by a small value.  */
 
       /* Approximate log base 2 of the number of time units per
-	 biennium.  A biennium is 2 years; use this unit instead of
-	 years to avoid integer overflow.  For example, 2 average
-	 Gregorian years are 2 * 365.2425 * 24 * 60 * 60 seconds,
-	 which is 63113904 seconds, and rint (log2 (63113904)) is
-	 26.  */
+         biennium.  A biennium is 2 years; use this unit instead of
+         years to avoid integer overflow.  For example, 2 average
+         Gregorian years are 2 * 365.2425 * 24 * 60 * 60 seconds,
+         which is 63113904 seconds, and rint (log2 (63113904)) is
+         26.  */
       int ALOG2_SECONDS_PER_BIENNIUM = 26;
       int ALOG2_MINUTES_PER_BIENNIUM = 20;
       int ALOG2_HOURS_PER_BIENNIUM = 14;
@@ -361,119 +433,117 @@ __mktime_internal (struct tm *tp,
       int LOG2_YEARS_PER_BIENNIUM = 1;
 
       int approx_requested_biennia =
-	(SHR (year_requested, LOG2_YEARS_PER_BIENNIUM)
-	 - SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM)
-	 + SHR (mday, ALOG2_DAYS_PER_BIENNIUM)
-	 + SHR (hour, ALOG2_HOURS_PER_BIENNIUM)
-	 + SHR (min, ALOG2_MINUTES_PER_BIENNIUM)
-	 + (LEAP_SECONDS_POSSIBLE
-	    ? 0
-	    : SHR (sec, ALOG2_SECONDS_PER_BIENNIUM)));
+        (SHR (year_requested, LOG2_YEARS_PER_BIENNIUM)
+         - SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM)
+         + SHR (mday, ALOG2_DAYS_PER_BIENNIUM)
+         + SHR (hour, ALOG2_HOURS_PER_BIENNIUM)
+         + SHR (min, ALOG2_MINUTES_PER_BIENNIUM)
+         + (LEAP_SECONDS_POSSIBLE
+            ? 0
+            : SHR (sec, ALOG2_SECONDS_PER_BIENNIUM)));
 
       int approx_biennia = SHR (t0, ALOG2_SECONDS_PER_BIENNIUM);
       int diff = approx_biennia - approx_requested_biennia;
-      int abs_diff = diff < 0 ? - diff : diff;
+      int abs_diff = diff < 0 ? -1 - diff : diff;
 
       /* IRIX 4.0.5 cc miscalculates TIME_T_MIN / 3: it erroneously
-	 gives a positive value of 715827882.  Setting a variable
-	 first then doing math on it seems to work.
-	 (ghazi@caip.rutgers.edu) */
+         gives a positive value of 715827882.  Setting a variable
+         first then doing math on it seems to work.
+         (ghazi@caip.rutgers.edu) */
       time_t time_t_max = TIME_T_MAX;
       time_t time_t_min = TIME_T_MIN;
       time_t overflow_threshold =
-	(time_t_max / 3 - time_t_min / 3) >> ALOG2_SECONDS_PER_BIENNIUM;
+        (time_t_max / 3 - time_t_min / 3) >> ALOG2_SECONDS_PER_BIENNIUM;
 
       if (overflow_threshold < abs_diff)
-	{
-	  /* Overflow occurred.  Try repairing it; this might work if
-	     the time zone offset is enough to undo the overflow.  */
-	  time_t repaired_t0 = -1 - t0;
-	  approx_biennia = SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM);
-	  diff = approx_biennia - approx_requested_biennia;
-	  abs_diff = diff < 0 ? - diff : diff;
-	  if (overflow_threshold < abs_diff)
-	    return -1;
-	  guessed_offset += repaired_t0 - t0;
-	  t0 = repaired_t0;
-	}
+        {
+          /* Overflow occurred.  Try repairing it; this might work if
+             the time zone offset is enough to undo the overflow.  */
+          time_t repaired_t0 = -1 - t0;
+          approx_biennia = SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM);
+          diff = approx_biennia - approx_requested_biennia;
+          abs_diff = diff < 0 ? -1 - diff : diff;
+          if (overflow_threshold < abs_diff)
+            return -1;
+          guessed_offset += repaired_t0 - t0;
+          t0 = repaired_t0;
+        }
     }
 
   /* Repeatedly use the error to improve the guess.  */
 
   for (t = t1 = t2 = t0, dst2 = 0;
        (gt = guess_time_tm (year, yday, hour, min, sec, &t,
-			    ranged_convert (convert, &t, &tm)),
-	t != gt);
+                            ranged_convert (convert, &t, &tm)),
+        t != gt);
        t1 = t2, t2 = t, t = gt, dst2 = tm.tm_isdst != 0)
     if (t == t1 && t != t2
-	&& (tm.tm_isdst < 0
-	    || (isdst < 0
-		? dst2 <= (tm.tm_isdst != 0)
-		: (isdst != 0) != (tm.tm_isdst != 0))))
+        && (tm.tm_isdst < 0
+            || (isdst < 0
+                ? dst2 <= (tm.tm_isdst != 0)
+                : (isdst != 0) != (tm.tm_isdst != 0))))
       /* We can't possibly find a match, as we are oscillating
-	 between two values.  The requested time probably falls
-	 within a spring-forward gap of size GT - T.  Follow the common
-	 practice in this case, which is to return a time that is GT - T
-	 away from the requested time, preferring a time whose
-	 tm_isdst differs from the requested value.  (If no tm_isdst
-	 was requested and only one of the two values has a nonzero
-	 tm_isdst, prefer that value.)  In practice, this is more
-	 useful than returning -1.  */
+         between two values.  The requested time probably falls
+         within a spring-forward gap of size GT - T.  Follow the common
+         practice in this case, which is to return a time that is GT - T
+         away from the requested time, preferring a time whose
+         tm_isdst differs from the requested value.  (If no tm_isdst
+         was requested and only one of the two values has a nonzero
+         tm_isdst, prefer that value.)  In practice, this is more
+         useful than returning -1.  */
       goto offset_found;
     else if (--remaining_probes == 0)
       return -1;
 
   /* We have a match.  Check whether tm.tm_isdst has the requested
      value, if any.  */
-  if (isdst != tm.tm_isdst && 0 <= isdst && 0 <= tm.tm_isdst)
+  if (isdst_differ (isdst, tm.tm_isdst))
     {
       /* tm.tm_isdst has the wrong value.  Look for a neighboring
-	 time with the right value, and use its UTC offset.
+         time with the right value, and use its UTC offset.
 
-	 Heuristic: probe the adjacent timestamps in both directions,
-	 looking for the desired isdst.  This should work for all real
-	 time zone histories in the tz database.  */
+         Heuristic: probe the adjacent timestamps in both directions,
+         looking for the desired isdst.  This should work for all real
+         time zone histories in the tz database.  */
 
       /* Distance between probes when looking for a DST boundary.  In
-	 tzdata2003a, the shortest period of DST is 601200 seconds
-	 (e.g., America/Recife starting 2000-10-08 01:00), and the
-	 shortest period of non-DST surrounded by DST is 694800
-	 seconds (Africa/Tunis starting 1943-04-17 01:00).  Use the
-	 minimum of these two values, so we don't miss these short
-	 periods when probing.  */
+         tzdata2003a, the shortest period of DST is 601200 seconds
+         (e.g., America/Recife starting 2000-10-08 01:00), and the
+         shortest period of non-DST surrounded by DST is 694800
+         seconds (Africa/Tunis starting 1943-04-17 01:00).  Use the
+         minimum of these two values, so we don't miss these short
+         periods when probing.  */
       int stride = 601200;
 
       /* The longest period of DST in tzdata2003a is 536454000 seconds
-	 (e.g., America/Jujuy starting 1946-10-01 01:00).  The longest
-	 period of non-DST is much longer, but it makes no real sense
-	 to search for more than a year of non-DST, so use the DST
-	 max.  */
+         (e.g., America/Jujuy starting 1946-10-01 01:00).  The longest
+         period of non-DST is much longer, but it makes no real sense
+         to search for more than a year of non-DST, so use the DST
+         max.  */
       int duration_max = 536454000;
 
       /* Search in both directions, so the maximum distance is half
-	 the duration; add the stride to avoid off-by-1 problems.  */
+         the duration; add the stride to avoid off-by-1 problems.  */
       int delta_bound = duration_max / 2 + stride;
 
       int delta, direction;
 
       for (delta = stride; delta < delta_bound; delta += stride)
-	for (direction = -1; direction <= 1; direction += 2)
-	  {
-	    time_t ot = t + delta * direction;
-	    if ((ot < t) == (direction < 0))
-	      {
-		struct tm otm;
-		ranged_convert (convert, &ot, &otm);
-		if (otm.tm_isdst == isdst)
-		  {
-		    /* We found the desired tm_isdst.
-		       Extrapolate back to the desired time.  */
-		    t = guess_time_tm (year, yday, hour, min, sec, &ot, &otm);
-		    ranged_convert (convert, &t, &tm);
-		    goto offset_found;
-		  }
-	      }
-	  }
+        for (direction = -1; direction <= 1; direction += 2)
+          if (time_t_int_add_ok (t, delta * direction))
+            {
+              time_t ot = t + delta * direction;
+              struct tm otm;
+              ranged_convert (convert, &ot, &otm);
+              if (! isdst_differ (isdst, otm.tm_isdst))
+                {
+                  /* We found the desired tm_isdst.
+                     Extrapolate back to the desired time.  */
+                  t = guess_time_tm (year, yday, hour, min, sec, &ot, &otm);
+                  ranged_convert (convert, &t, &tm);
+                  goto offset_found;
+                }
+            }
     }
 
  offset_found:
@@ -482,14 +552,16 @@ __mktime_internal (struct tm *tp,
   if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec)
     {
       /* Adjust time to reflect the tm_sec requested, not the normalized value.
-	 Also, repair any damage from a false match due to a leap second.  */
+         Also, repair any damage from a false match due to a leap second.  */
       int sec_adjustment = (sec == 0 && tm.tm_sec == 60) - sec;
+      if (! time_t_int_add_ok (t, sec_requested))
+        return -1;
       t1 = t + sec_requested;
+      if (! time_t_int_add_ok (t1, sec_adjustment))
+        return -1;
       t2 = t1 + sec_adjustment;
-      if (((t1 < t) != (sec_requested < 0))
-	  | ((t2 < t1) != (sec_adjustment < 0))
-	  | ! convert (&t2, &tm))
-	return -1;
+      if (! convert (&t2, &tm))
+        return -1;
       t = t2;
     }
 
@@ -510,7 +582,7 @@ mktime (struct tm *tp)
 {
 #ifdef _LIBC
   /* POSIX.1 8.1.1 requires that whenever mktime() is called, the
-     time zone names contained in the external variable `tzname' shall
+     time zone names contained in the external variable 'tzname' shall
      be set as if the tzset() function had been called.  */
   __tzset ();
 #endif
@@ -533,13 +605,13 @@ static int
 not_equal_tm (const struct tm *a, const struct tm *b)
 {
   return ((a->tm_sec ^ b->tm_sec)
-	  | (a->tm_min ^ b->tm_min)
-	  | (a->tm_hour ^ b->tm_hour)
-	  | (a->tm_mday ^ b->tm_mday)
-	  | (a->tm_mon ^ b->tm_mon)
-	  | (a->tm_year ^ b->tm_year)
-	  | (a->tm_yday ^ b->tm_yday)
-	  | (a->tm_isdst ^ b->tm_isdst));
+          | (a->tm_min ^ b->tm_min)
+          | (a->tm_hour ^ b->tm_hour)
+          | (a->tm_mday ^ b->tm_mday)
+          | (a->tm_mon ^ b->tm_mon)
+          | (a->tm_year ^ b->tm_year)
+          | (a->tm_yday ^ b->tm_yday)
+          | isdst_differ (a->tm_isdst, b->tm_isdst));
 }
 
 static void
@@ -547,9 +619,9 @@ print_tm (const struct tm *tp)
 {
   if (tp)
     printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
-	    tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
-	    tp->tm_hour, tp->tm_min, tp->tm_sec,
-	    tp->tm_yday, tp->tm_wday, tp->tm_isdst);
+            tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
+            tp->tm_hour, tp->tm_min, tp->tm_sec,
+            tp->tm_yday, tp->tm_wday, tp->tm_isdst);
   else
     printf ("0");
 }
@@ -581,11 +653,11 @@ main (int argc, char **argv)
 
   if ((argc == 3 || argc == 4)
       && (sscanf (argv[1], "%d-%d-%d%c",
-		  &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
-	  == 3)
+                  &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
+          == 3)
       && (sscanf (argv[2], "%d:%d:%d%c",
-		  &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
-	  == 3))
+                  &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
+          == 3))
     {
       tm.tm_year -= TM_YEAR_BASE;
       tm.tm_mon--;
@@ -594,10 +666,10 @@ main (int argc, char **argv)
       tl = mktime (&tmk);
       lt = localtime (&tl);
       if (lt)
-	{
-	  tml = *lt;
-	  lt = &tml;
-	}
+        {
+          tml = *lt;
+          lt = &tml;
+        }
       printf ("mktime returns %ld == ", (long int) tl);
       print_tm (&tmk);
       printf ("\n");
@@ -610,51 +682,51 @@ main (int argc, char **argv)
       time_t to = atol (argv[3]);
 
       if (argc == 4)
-	for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
-	  {
-	    lt = localtime (&tl);
-	    if (lt)
-	      {
-		tmk = tml = *lt;
-		tk = mktime (&tmk);
-		status |= check_result (tk, tmk, tl, &tml);
-	      }
-	    else
-	      {
-		printf ("localtime (%ld) yields 0\n", (long int) tl);
-		status = 1;
-	      }
-	    tl1 = tl + by;
-	    if ((tl1 < tl) != (by < 0))
-	      break;
-	  }
+        for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
+          {
+            lt = localtime (&tl);
+            if (lt)
+              {
+                tmk = tml = *lt;
+                tk = mktime (&tmk);
+                status |= check_result (tk, tmk, tl, &tml);
+              }
+            else
+              {
+                printf ("localtime (%ld) yields 0\n", (long int) tl);
+                status = 1;
+              }
+            tl1 = tl + by;
+            if ((tl1 < tl) != (by < 0))
+              break;
+          }
       else
-	for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
-	  {
-	    /* Null benchmark.  */
-	    lt = localtime (&tl);
-	    if (lt)
-	      {
-		tmk = tml = *lt;
-		tk = tl;
-		status |= check_result (tk, tmk, tl, &tml);
-	      }
-	    else
-	      {
-		printf ("localtime (%ld) yields 0\n", (long int) tl);
-		status = 1;
-	      }
-	    tl1 = tl + by;
-	    if ((tl1 < tl) != (by < 0))
-	      break;
-	  }
+        for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
+          {
+            /* Null benchmark.  */
+            lt = localtime (&tl);
+            if (lt)
+              {
+                tmk = tml = *lt;
+                tk = tl;
+                status |= check_result (tk, tmk, tl, &tml);
+              }
+            else
+              {
+                printf ("localtime (%ld) yields 0\n", (long int) tl);
+                status = 1;
+              }
+            tl1 = tl + by;
+            if ((tl1 < tl) != (by < 0))
+              break;
+          }
     }
   else
     printf ("Usage:\
 \t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\
 \t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\
 \t%s FROM BY TO - # Do not test those values (for benchmark).\n",
-	    argv[0], argv[0], argv[0]);
+            argv[0], argv[0], argv[0]);
 
   return status;
 }
@@ -663,6 +735,6 @@ main (int argc, char **argv)
 
 /*
 Local Variables:
-compile-command: "gcc -DDEBUG -Wall -W -O -g mktime.c -o mktime"
+compile-command: "gcc -DDEBUG -I. -Wall -W -O2 -g mktime.c -o mktime"
 End:
 */

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=874423ec7fdc26ab7a5a4beb608d1e6e9bbc2044

commit 874423ec7fdc26ab7a5a4beb608d1e6e9bbc2044
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Mar 15 08:36:34 2012 -0700

    Pass __vdso_xxx to _dl_vdso_vsym
    
    2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c (getcpu_ifunc):
    	Replace getcpu with __vdso_getcpu.
    
    	* sysdeps/unix/sysv/linux/x86_64/x32/gettimeofday.c
    	(gettimeofday_ifunc): Replace gettimeofday with
    	__vdso_gettimeofday.
    
    	* sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
    	(_libc_vdso_platform_setup): Replace clock_gettime with
    	__vdso_clock_gettime.
    
    	* sysdeps/unix/sysv/linux/x86_64/x32/time.c (time_ifunc): Replace
    	time with __vdso_time.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 93335dd..0058808 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,21 @@
 2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c (getcpu_ifunc):
+	Replace getcpu with __vdso_getcpu.
+
+	* sysdeps/unix/sysv/linux/x86_64/x32/gettimeofday.c
+	(gettimeofday_ifunc): Replace gettimeofday with
+	__vdso_gettimeofday.
+
+	* sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
+	(_libc_vdso_platform_setup): Replace clock_gettime with
+	__vdso_clock_gettime.
+
+	* sysdeps/unix/sysv/linux/x86_64/x32/time.c (time_ifunc): Replace
+	time with __vdso_time.
+
+2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/unix/sysv/linux/x86_64/sys/msg.h (msgbuf): Replace
 	__SNATIVE_LONG_TYPE with __SSYSCALL_LONG_TYPE.
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c b/sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c
index f00cdff..06c2722 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c
@@ -26,7 +26,7 @@ getcpu_ifunc (void)
 {
   PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
 
-  return _dl_vdso_vsym ("getcpu", &linux26);
+  return _dl_vdso_vsym ("__vdso_getcpu", &linux26);
 }
 __asm (".type __getcpu, %gnu_indirect_function");
 #endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/gettimeofday.c b/sysdeps/unix/sysv/linux/x86_64/x32/gettimeofday.c
index 3ff95dc..e998e14 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/gettimeofday.c
@@ -26,7 +26,7 @@ gettimeofday_ifunc (void)
 {
   PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
 
-  return _dl_vdso_vsym ("gettimeofday", &linux26);
+  return _dl_vdso_vsym ("__vdso_gettimeofday", &linux26);
 }
 __asm (".type __gettimeofday, %gnu_indirect_function");
 #else
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c b/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
index 6eae5f4..f0aa8c8 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
@@ -29,7 +29,7 @@ _libc_vdso_platform_setup (void)
 {
   PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
 
-  void *p = _dl_vdso_vsym ("clock_gettime", &linux26);
+  void *p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26);
   PTR_MANGLE (p);
   __GI___vdso_clock_gettime = p;
 }
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/time.c b/sysdeps/unix/sysv/linux/x86_64/x32/time.c
index b7feb93..086cb01 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/time.c
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/time.c
@@ -63,7 +63,7 @@ time_ifunc (void)
 {
   PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
 
-  return _dl_vdso_vsym ("time", &linux26) ?: (void *) time_syscall;
+  return _dl_vdso_vsym ("__vdso_time", &linux26) ?: (void *) time_syscall;
 }
 __asm (".type __GI_time, %gnu_indirect_function");
 #else

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=bd51abf287dc58c8cd3a5f70c4638fa015484b31

commit bd51abf287dc58c8cd3a5f70c4638fa015484b31
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Mar 15 07:52:07 2012 -0700

    Replace __SNATIVE_LONG_TYPE with __SSYSCALL_LONG_TYPE
    
    2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/unix/sysv/linux/x86_64/sys/msg.h (msgbuf): Replace
    	__SNATIVE_LONG_TYPE with __SSYSCALL_LONG_TYPE.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 731f9fe..93335dd 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,3 +1,8 @@
+2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/sys/msg.h (msgbuf): Replace
+	__SNATIVE_LONG_TYPE with __SSYSCALL_LONG_TYPE.
+
 2012-03-14  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/unix/sysv/linux/x86_64/bits/siginfo.h: New.
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/msg.h b/sysdeps/unix/sysv/linux/x86_64/sys/msg.h
index b59b3a0..4a6271d 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sys/msg.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/msg.h
@@ -52,7 +52,7 @@ typedef __ssize_t ssize_t;
 /* Template for struct to be used as argument for `msgsnd' and `msgrcv'.  */
 struct msgbuf
   {
-    __SNATIVE_LONG_TYPE mtype;	/* type of received/sent message */
+    __SSYSCALL_LONG_TYPE mtype;	/* type of received/sent message */
     char mtext[1];		/* text of the message */
   };
 #endif

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=efc3200bb0728b652f0e7c76e07463e94eb71c0a

commit efc3200bb0728b652f0e7c76e07463e94eb71c0a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Mar 14 20:57:57 2012 -0700

    Use CMP_LP and R8_LP on dep_mutex
    
    2012-03-14  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Use CMP_LP
    	and R8_LP on dep_mutex.

diff --git a/nptl/ChangeLog.x32 b/nptl/ChangeLog.x32
index 12cbb53..5f69fa8 100644
--- a/nptl/ChangeLog.x32
+++ b/nptl/ChangeLog.x32
@@ -1,3 +1,8 @@
+2012-03-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Use CMP_LP
+	and R8_LP on dep_mutex.
+
 2011-11-21  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* pthread_create.c (start_thread): Check __PTHREAD_MUTEX_HAVE_PREV
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
index 33b7e3a..9fb8cf1 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
@@ -349,7 +349,7 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -375,7 +375,7 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	CMP_LP	$-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -387,7 +387,7 @@ __pthread_cond_wait:
 93:
 	/* Set the rest of SYS_futex args for FUTEX_WAIT_REQUEUE_PI. */
 	xorq	%r10, %r10
-	movq	dep_mutex(%rdi), %r8
+	mov	dep_mutex(%rdi), %R8_LP
 	leaq	cond_futex(%rdi), %rdi
 	jmp	90b
 .LcleanupEND2:

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7ae78ba3e054b7d41c98f358bed40a967e36747d

commit 7ae78ba3e054b7d41c98f358bed40a967e36747d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Mar 14 17:50:47 2012 -0700

    Align siginfo_t to 8 bytes for x32
    
    We align siginfo_t to 8 bytes so that si_utime and si_stime are actually
    aligned to 8 bytes since their offsets are multiple of 8 bytes.

diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/siginfo.h b/sysdeps/unix/sysv/linux/x86_64/bits/siginfo.h
index 4178872..5db7139 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/siginfo.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/siginfo.h
@@ -48,13 +48,17 @@ typedef union sigval
 #  define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 3)
 # endif
 
-#if defined __x86_64__ && __WORDSIZE == 32
+# if defined __x86_64__ && __WORDSIZE == 32
 /* si_utime and si_stime must be 4 byte aligned for x32 to match the
-   kernel.  */
+   kernel.  We align siginfo_t to 8 bytes so that si_utime and si_stime
+   are actually aligned to 8 bytes since their offsets are multiple of
+   8 bytes.  */
 typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t;
-#else
+#  define __SI_ALIGNMENT __attribute__ ((__aligned__ (8)))
+# else
 typedef __clock_t __sigchld_clock_t;
-#endif
+#  define __SI_ALIGNMENT
+# endif
 
 typedef struct siginfo
   {
@@ -113,7 +117,7 @@ typedef struct siginfo
 	    int si_fd;
 	  } _sigpoll;
       } _sifields;
-  } siginfo_t;
+  } siginfo_t __SI_ALIGNMENT;
 
 
 /* X/Open requires some more fields with fixed names.  */

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=255b2f01e690422cb83f2a6c274651a7432557e1

commit 255b2f01e690422cb83f2a6c274651a7432557e1
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Mar 14 12:36:35 2012 -0700

    Add x86-64 <bits/siginfo.h>
    
    Must align si_utime and si_stime fields in _sigchld to 4 bytes for
    x32 to match the kernel.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 51fbd8b..731f9fe 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,5 +1,9 @@
 2012-03-14  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* sysdeps/unix/sysv/linux/x86_64/bits/siginfo.h: New.
+
+2012-03-14  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h: Replace
 	__SNATIVE_LONG_TYPE and __UNATIVE_LONG_TYPE with
 	__SSYSCALL_LONG_TYPE and __USYSCALL_LONG_TYPE.
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/siginfo.h b/sysdeps/unix/sysv/linux/x86_64/bits/siginfo.h
new file mode 100644
index 0000000..4178872
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/siginfo.h
@@ -0,0 +1,321 @@
+/* siginfo_t, sigevent and constants.  Linux x86-64 version.
+   Copyright (C) 1997-2002, 2003, 2011, 2012
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#if !defined _SIGNAL_H && !defined __need_siginfo_t \
+    && !defined __need_sigevent_t
+# error "Never include this file directly.  Use <signal.h> instead"
+#endif
+
+#include <bits/wordsize.h>
+
+#if (!defined __have_sigval_t \
+     && (defined _SIGNAL_H || defined __need_siginfo_t \
+	 || defined __need_sigevent_t))
+# define __have_sigval_t	1
+
+/* Type for data associated with a signal.  */
+typedef union sigval
+  {
+    int sival_int;
+    void *sival_ptr;
+  } sigval_t;
+#endif
+
+#if (!defined __have_siginfo_t \
+     && (defined _SIGNAL_H || defined __need_siginfo_t))
+# define __have_siginfo_t	1
+
+# define __SI_MAX_SIZE     128
+# if __WORDSIZE == 64
+#  define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 4)
+# else
+#  define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 3)
+# endif
+
+#if defined __x86_64__ && __WORDSIZE == 32
+/* si_utime and si_stime must be 4 byte aligned for x32 to match the
+   kernel.  */
+typedef __clock_t __attribute__ ((__aligned__ (4))) __sigchld_clock_t;
+#else
+typedef __clock_t __sigchld_clock_t;
+#endif
+
+typedef struct siginfo
+  {
+    int si_signo;		/* Signal number.  */
+    int si_errno;		/* If non-zero, an errno value associated with
+				   this signal, as defined in <errno.h>.  */
+    int si_code;		/* Signal code.  */
+
+    union
+      {
+	int _pad[__SI_PAD_SIZE];
+
+	 /* kill().  */
+	struct
+	  {
+	    __pid_t si_pid;	/* Sending process ID.  */
+	    __uid_t si_uid;	/* Real user ID of sending process.  */
+	  } _kill;
+
+	/* POSIX.1b timers.  */
+	struct
+	  {
+	    int si_tid;		/* Timer ID.  */
+	    int si_overrun;	/* Overrun count.  */
+	    sigval_t si_sigval;	/* Signal value.  */
+	  } _timer;
+
+	/* POSIX.1b signals.  */
+	struct
+	  {
+	    __pid_t si_pid;	/* Sending process ID.  */
+	    __uid_t si_uid;	/* Real user ID of sending process.  */
+	    sigval_t si_sigval;	/* Signal value.  */
+	  } _rt;
+
+	/* SIGCHLD.  */
+	struct
+	  {
+	    __pid_t si_pid;	/* Which child.  */
+	    __uid_t si_uid;	/* Real user ID of sending process.  */
+	    int si_status;	/* Exit value or signal.  */
+	    __sigchld_clock_t si_utime;
+	    __sigchld_clock_t si_stime;
+	  } _sigchld;
+
+	/* SIGILL, SIGFPE, SIGSEGV, SIGBUS.  */
+	struct
+	  {
+	    void *si_addr;	/* Faulting insn/memory ref.  */
+	  } _sigfault;
+
+	/* SIGPOLL.  */
+	struct
+	  {
+	    long int si_band;	/* Band event for SIGPOLL.  */
+	    int si_fd;
+	  } _sigpoll;
+      } _sifields;
+  } siginfo_t;
+
+
+/* X/Open requires some more fields with fixed names.  */
+# define si_pid		_sifields._kill.si_pid
+# define si_uid		_sifields._kill.si_uid
+# define si_timerid	_sifields._timer.si_tid
+# define si_overrun	_sifields._timer.si_overrun
+# define si_status	_sifields._sigchld.si_status
+# define si_utime	_sifields._sigchld.si_utime
+# define si_stime	_sifields._sigchld.si_stime
+# define si_value	_sifields._rt.si_sigval
+# define si_int		_sifields._rt.si_sigval.sival_int
+# define si_ptr		_sifields._rt.si_sigval.sival_ptr
+# define si_addr	_sifields._sigfault.si_addr
+# define si_band	_sifields._sigpoll.si_band
+# define si_fd		_sifields._sigpoll.si_fd
+
+
+/* Values for `si_code'.  Positive values are reserved for kernel-generated
+   signals.  */
+enum
+{
+  SI_ASYNCNL = -60,		/* Sent by asynch name lookup completion.  */
+# define SI_ASYNCNL	SI_ASYNCNL
+  SI_TKILL = -6,		/* Sent by tkill.  */
+# define SI_TKILL	SI_TKILL
+  SI_SIGIO,			/* Sent by queued SIGIO. */
+# define SI_SIGIO	SI_SIGIO
+  SI_ASYNCIO,			/* Sent by AIO completion.  */
+# define SI_ASYNCIO	SI_ASYNCIO
+  SI_MESGQ,			/* Sent by real time mesq state change.  */
+# define SI_MESGQ	SI_MESGQ
+  SI_TIMER,			/* Sent by timer expiration.  */
+# define SI_TIMER	SI_TIMER
+  SI_QUEUE,			/* Sent by sigqueue.  */
+# define SI_QUEUE	SI_QUEUE
+  SI_USER,			/* Sent by kill, sigsend.  */
+# define SI_USER	SI_USER
+  SI_KERNEL = 0x80		/* Send by kernel.  */
+#define SI_KERNEL	SI_KERNEL
+};
+
+
+/* `si_code' values for SIGILL signal.  */
+enum
+{
+  ILL_ILLOPC = 1,		/* Illegal opcode.  */
+# define ILL_ILLOPC	ILL_ILLOPC
+  ILL_ILLOPN,			/* Illegal operand.  */
+# define ILL_ILLOPN	ILL_ILLOPN
+  ILL_ILLADR,			/* Illegal addressing mode.  */
+# define ILL_ILLADR	ILL_ILLADR
+  ILL_ILLTRP,			/* Illegal trap. */
+# define ILL_ILLTRP	ILL_ILLTRP
+  ILL_PRVOPC,			/* Privileged opcode.  */
+# define ILL_PRVOPC	ILL_PRVOPC
+  ILL_PRVREG,			/* Privileged register.  */
+# define ILL_PRVREG	ILL_PRVREG
+  ILL_COPROC,			/* Coprocessor error.  */
+# define ILL_COPROC	ILL_COPROC
+  ILL_BADSTK			/* Internal stack error.  */
+# define ILL_BADSTK	ILL_BADSTK
+};
+
+/* `si_code' values for SIGFPE signal.  */
+enum
+{
+  FPE_INTDIV = 1,		/* Integer divide by zero.  */
+# define FPE_INTDIV	FPE_INTDIV
+  FPE_INTOVF,			/* Integer overflow.  */
+# define FPE_INTOVF	FPE_INTOVF
+  FPE_FLTDIV,			/* Floating point divide by zero.  */
+# define FPE_FLTDIV	FPE_FLTDIV
+  FPE_FLTOVF,			/* Floating point overflow.  */
+# define FPE_FLTOVF	FPE_FLTOVF
+  FPE_FLTUND,			/* Floating point underflow.  */
+# define FPE_FLTUND	FPE_FLTUND
+  FPE_FLTRES,			/* Floating point inexact result.  */
+# define FPE_FLTRES	FPE_FLTRES
+  FPE_FLTINV,			/* Floating point invalid operation.  */
+# define FPE_FLTINV	FPE_FLTINV
+  FPE_FLTSUB			/* Subscript out of range.  */
+# define FPE_FLTSUB	FPE_FLTSUB
+};
+
+/* `si_code' values for SIGSEGV signal.  */
+enum
+{
+  SEGV_MAPERR = 1,		/* Address not mapped to object.  */
+# define SEGV_MAPERR	SEGV_MAPERR
+  SEGV_ACCERR			/* Invalid permissions for mapped object.  */
+# define SEGV_ACCERR	SEGV_ACCERR
+};
+
+/* `si_code' values for SIGBUS signal.  */
+enum
+{
+  BUS_ADRALN = 1,		/* Invalid address alignment.  */
+# define BUS_ADRALN	BUS_ADRALN
+  BUS_ADRERR,			/* Non-existant physical address.  */
+# define BUS_ADRERR	BUS_ADRERR
+  BUS_OBJERR			/* Object specific hardware error.  */
+# define BUS_OBJERR	BUS_OBJERR
+};
+
+/* `si_code' values for SIGTRAP signal.  */
+enum
+{
+  TRAP_BRKPT = 1,		/* Process breakpoint.  */
+# define TRAP_BRKPT	TRAP_BRKPT
+  TRAP_TRACE			/* Process trace trap.  */
+# define TRAP_TRACE	TRAP_TRACE
+};
+
+/* `si_code' values for SIGCHLD signal.  */
+enum
+{
+  CLD_EXITED = 1,		/* Child has exited.  */
+# define CLD_EXITED	CLD_EXITED
+  CLD_KILLED,			/* Child was killed.  */
+# define CLD_KILLED	CLD_KILLED
+  CLD_DUMPED,			/* Child terminated abnormally.  */
+# define CLD_DUMPED	CLD_DUMPED
+  CLD_TRAPPED,			/* Traced child has trapped.  */
+# define CLD_TRAPPED	CLD_TRAPPED
+  CLD_STOPPED,			/* Child has stopped.  */
+# define CLD_STOPPED	CLD_STOPPED
+  CLD_CONTINUED			/* Stopped child has continued.  */
+# define CLD_CONTINUED	CLD_CONTINUED
+};
+
+/* `si_code' values for SIGPOLL signal.  */
+enum
+{
+  POLL_IN = 1,			/* Data input available.  */
+# define POLL_IN	POLL_IN
+  POLL_OUT,			/* Output buffers available.  */
+# define POLL_OUT	POLL_OUT
+  POLL_MSG,			/* Input message available.   */
+# define POLL_MSG	POLL_MSG
+  POLL_ERR,			/* I/O error.  */
+# define POLL_ERR	POLL_ERR
+  POLL_PRI,			/* High priority input available.  */
+# define POLL_PRI	POLL_PRI
+  POLL_HUP			/* Device disconnected.  */
+# define POLL_HUP	POLL_HUP
+};
+
+# undef __need_siginfo_t
+#endif	/* !have siginfo_t && (have _SIGNAL_H || need siginfo_t).  */
+
+
+#if (defined _SIGNAL_H || defined __need_sigevent_t) \
+    && !defined __have_sigevent_t
+# define __have_sigevent_t	1
+
+/* Structure to transport application-defined values with signals.  */
+# define __SIGEV_MAX_SIZE	64
+# if __WORDSIZE == 64
+#  define __SIGEV_PAD_SIZE	((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
+# else
+#  define __SIGEV_PAD_SIZE	((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
+# endif
+
+typedef struct sigevent
+  {
+    sigval_t sigev_value;
+    int sigev_signo;
+    int sigev_notify;
+
+    union
+      {
+	int _pad[__SIGEV_PAD_SIZE];
+
+	/* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the
+	   thread to receive the signal.  */
+	__pid_t _tid;
+
+	struct
+	  {
+	    void (*_function) (sigval_t);	/* Function to start.  */
+	    void *_attribute;			/* Really pthread_attr_t.  */
+	  } _sigev_thread;
+      } _sigev_un;
+  } sigevent_t;
+
+/* POSIX names to access some of the members.  */
+# define sigev_notify_function   _sigev_un._sigev_thread._function
+# define sigev_notify_attributes _sigev_un._sigev_thread._attribute
+
+/* `sigev_notify' values.  */
+enum
+{
+  SIGEV_SIGNAL = 0,		/* Notify via signal.  */
+# define SIGEV_SIGNAL	SIGEV_SIGNAL
+  SIGEV_NONE,			/* Other notification: meaningless.  */
+# define SIGEV_NONE	SIGEV_NONE
+  SIGEV_THREAD,			/* Deliver via thread creation.  */
+# define SIGEV_THREAD	SIGEV_THREAD
+
+  SIGEV_THREAD_ID = 4		/* Send signal to specific thread.  */
+#define SIGEV_THREAD_ID	SIGEV_THREAD_ID
+};
+
+#endif	/* have _SIGNAL_H.  */

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4fe9191ab3f5def1437e84dec039da747ceef62a

commit 4fe9191ab3f5def1437e84dec039da747ceef62a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Mar 14 12:16:26 2012 -0700

    Use __SSYSCALL_LONG_TYPE and __USYSCALL_LONG_TYPE
    
    2012-03-14  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h: Replace
    	__SNATIVE_LONG_TYPE and __UNATIVE_LONG_TYPE with
    	__SSYSCALL_LONG_TYPE and __USYSCALL_LONG_TYPE.
    
    	* sysdeps/unix/sysv/linux/x86_64/bits/ipc.h: Updated.
    	* sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/msq.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/sem.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/shm.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/stat.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/statfs.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/timex.h: Likewise.
    	* sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h: Likewise.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 745b8f7..51fbd8b 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,3 +1,19 @@
+2012-03-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h: Replace
+	__SNATIVE_LONG_TYPE and __UNATIVE_LONG_TYPE with
+	__SSYSCALL_LONG_TYPE and __USYSCALL_LONG_TYPE.
+
+	* sysdeps/unix/sysv/linux/x86_64/bits/ipc.h: Updated.
+	* sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/msq.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/sem.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/shm.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/stat.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/statfs.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/timex.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h: Likewise.
+
 2012-03-13  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* scripts/data/c++-types-x32-linux-gnu.data: Update clock_t.
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/ipc.h b/sysdeps/unix/sysv/linux/x86_64/bits/ipc.h
index 27758ce..de6aec1 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/ipc.h
@@ -52,6 +52,6 @@ struct ipc_perm
     unsigned short int __pad1;
     unsigned short int __seq;		/* Sequence number.  */
     unsigned short int __pad2;
-    __UNATIVE_LONG_TYPE __unused1;
-    __UNATIVE_LONG_TYPE __unused2;
+    __USYSCALL_LONG_TYPE __unused1;
+    __USYSCALL_LONG_TYPE __unused2;
   };
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h b/sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h
index 3c2c006..096c8df 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/mqueue.h
@@ -27,9 +27,9 @@ typedef int mqd_t;
 
 struct mq_attr
 {
-  __SNATIVE_LONG_TYPE mq_flags;		/* Message queue flags.  */
-  __SNATIVE_LONG_TYPE mq_maxmsg;	/* Maximum number of messages.  */
-  __SNATIVE_LONG_TYPE mq_msgsize;	/* Maximum message size.  */
-  __SNATIVE_LONG_TYPE mq_curmsgs;	/* Number of messages currently queued.  */
-  __SNATIVE_LONG_TYPE __pad[4];
+  __SSYSCALL_LONG_TYPE mq_flags;		/* Message queue flags.  */
+  __SSYSCALL_LONG_TYPE mq_maxmsg;	/* Maximum number of messages.  */
+  __SSYSCALL_LONG_TYPE mq_msgsize;	/* Maximum message size.  */
+  __SSYSCALL_LONG_TYPE mq_curmsgs;	/* Number of messages currently queued.  */
+  __SSYSCALL_LONG_TYPE __pad[4];
 };
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/msq.h b/sysdeps/unix/sysv/linux/x86_64/bits/msq.h
index 376e16f..6007e74 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/msq.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/msq.h
@@ -30,8 +30,8 @@
 #endif
 
 /* Types used in the structure definition.  */
-typedef __UNATIVE_LONG_TYPE msgqnum_t;
-typedef __UNATIVE_LONG_TYPE msglen_t;
+typedef __USYSCALL_LONG_TYPE msgqnum_t;
+typedef __USYSCALL_LONG_TYPE msglen_t;
 
 /* Structure of record for one message inside the kernel.
    The type `struct msg' is opaque.  */
@@ -50,13 +50,13 @@ struct msqid_ds
 #ifndef __x86_64__
   unsigned long int __unused3;
 #endif
-  __UNATIVE_LONG_TYPE __msg_cbytes; /* current number of bytes on queue */
+  __USYSCALL_LONG_TYPE __msg_cbytes; /* current number of bytes on queue */
   msgqnum_t msg_qnum;		/* number of messages currently on queue */
   msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
   __pid_t msg_lspid;		/* pid of last msgsnd() */
   __pid_t msg_lrpid;		/* pid of last msgrcv() */
-  __UNATIVE_LONG_TYPE __unused4;
-  __UNATIVE_LONG_TYPE __unused5;
+  __USYSCALL_LONG_TYPE __unused4;
+  __USYSCALL_LONG_TYPE __unused5;
 };
 
 #ifdef __USE_MISC
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/sem.h b/sysdeps/unix/sysv/linux/x86_64/bits/sem.h
index b57a156..e1d0827 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/sem.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/sem.h
@@ -40,12 +40,12 @@ struct semid_ds
 {
   struct ipc_perm sem_perm;		/* operation permission struct */
   __time_t sem_otime;			/* last semop() time */
-  __UNATIVE_LONG_TYPE __unused1;
+  __USYSCALL_LONG_TYPE __unused1;
   __time_t sem_ctime;			/* last time changed by semctl() */
-  __UNATIVE_LONG_TYPE __unused2;
-  __UNATIVE_LONG_TYPE sem_nsems;	/* number of semaphores in set */
-  __UNATIVE_LONG_TYPE __unused3;
-  __UNATIVE_LONG_TYPE __unused4;
+  __USYSCALL_LONG_TYPE __unused2;
+  __USYSCALL_LONG_TYPE sem_nsems;	/* number of semaphores in set */
+  __USYSCALL_LONG_TYPE __unused3;
+  __USYSCALL_LONG_TYPE __unused4;
 };
 
 /* The user should define a union like the following to use it for arguments
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/shm.h b/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
index 6d09cdd..1184caa 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
@@ -45,7 +45,7 @@ extern int __getpagesize (void) __THROW __attribute__ ((__const__));
 
 
 /* Type to count number of attaches.  */
-typedef __UNATIVE_LONG_TYPE shmatt_t;
+typedef __USYSCALL_LONG_TYPE shmatt_t;
 
 /* Data structure describing a shared memory segment.  */
 struct shmid_ds
@@ -67,8 +67,8 @@ struct shmid_ds
     __pid_t shm_cpid;			/* pid of creator */
     __pid_t shm_lpid;			/* pid of last shmop */
     shmatt_t shm_nattch;		/* number of current attaches */
-    __UNATIVE_LONG_TYPE __unused4;
-    __UNATIVE_LONG_TYPE __unused5;
+    __USYSCALL_LONG_TYPE __unused4;
+    __USYSCALL_LONG_TYPE __unused5;
   };
 
 #ifdef __USE_MISC
@@ -85,25 +85,25 @@ struct shmid_ds
 
 struct	shminfo
   {
-    __UNATIVE_LONG_TYPE shmmax;
-    __UNATIVE_LONG_TYPE shmmin;
-    __UNATIVE_LONG_TYPE shmmni;
-    __UNATIVE_LONG_TYPE shmseg;
-    __UNATIVE_LONG_TYPE shmall;
-    __UNATIVE_LONG_TYPE __unused1;
-    __UNATIVE_LONG_TYPE __unused2;
-    __UNATIVE_LONG_TYPE __unused3;
-    __UNATIVE_LONG_TYPE __unused4;
+    __USYSCALL_LONG_TYPE shmmax;
+    __USYSCALL_LONG_TYPE shmmin;
+    __USYSCALL_LONG_TYPE shmmni;
+    __USYSCALL_LONG_TYPE shmseg;
+    __USYSCALL_LONG_TYPE shmall;
+    __USYSCALL_LONG_TYPE __unused1;
+    __USYSCALL_LONG_TYPE __unused2;
+    __USYSCALL_LONG_TYPE __unused3;
+    __USYSCALL_LONG_TYPE __unused4;
   };
 
 struct shm_info
   {
     int used_ids;
-    __UNATIVE_LONG_TYPE shm_tot;	/* total allocated shm */
-    __UNATIVE_LONG_TYPE shm_rss;	/* total resident shm */
-    __UNATIVE_LONG_TYPE shm_swp;	/* total swapped shm */
-    __UNATIVE_LONG_TYPE swap_attempts;
-    __UNATIVE_LONG_TYPE swap_successes;
+    __USYSCALL_LONG_TYPE shm_tot;	/* total allocated shm */
+    __USYSCALL_LONG_TYPE shm_rss;	/* total resident shm */
+    __USYSCALL_LONG_TYPE shm_swp;	/* total swapped shm */
+    __USYSCALL_LONG_TYPE swap_attempts;
+    __USYSCALL_LONG_TYPE swap_successes;
   };
 
 #endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/stat.h b/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
index 49dec53..a9bac0b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
@@ -96,11 +96,11 @@ struct stat
 # define st_ctime st_ctim.tv_sec
 #else
     __time_t st_atime;			/* Time of last access.  */
-    __UNATIVE_LONG_TYPE st_atimensec;	/* Nscecs of last access.  */
+    __USYSCALL_LONG_TYPE st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
-    __UNATIVE_LONG_TYPE st_mtimensec;	/* Nsecs of last modification.  */
+    __USYSCALL_LONG_TYPE st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
-    __UNATIVE_LONG_TYPE st_ctimensec;	/* Nsecs of last status change.  */
+    __USYSCALL_LONG_TYPE st_ctimensec;	/* Nsecs of last status change.  */
 #endif
 #ifdef __x86_64__ 
     long long int __unused[3];
@@ -157,11 +157,11 @@ struct stat64
 #  define st_ctime st_ctim.tv_sec
 # else
     __time_t st_atime;			/* Time of last access.  */
-    __UNATIVE_LONG_TYPE st_atimensec;	/* Nscecs of last access.  */
+    __USYSCALL_LONG_TYPE st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
-    __UNATIVE_LONG_TYPE st_mtimensec;	/* Nsecs of last modification.  */
+    __USYSCALL_LONG_TYPE st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
-    __UNATIVE_LONG_TYPE st_ctimensec;	/* Nsecs of last status change.  */
+    __USYSCALL_LONG_TYPE st_ctimensec;	/* Nsecs of last status change.  */
 # endif
 # ifdef __x86_64__ 
     long long int __unused[3];
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h b/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h
index 2829607..96977e1 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h
@@ -25,8 +25,8 @@
 
 struct statfs
   {
-    __SNATIVE_LONG_TYPE f_type;
-    __SNATIVE_LONG_TYPE f_bsize;
+    __SSYSCALL_LONG_TYPE f_type;
+    __SSYSCALL_LONG_TYPE f_bsize;
 #ifndef __USE_FILE_OFFSET64
     __fsblkcnt_t f_blocks;
     __fsblkcnt_t f_bfree;
@@ -41,27 +41,27 @@ struct statfs
     __fsfilcnt64_t f_ffree;
 #endif
     __fsid_t f_fsid;
-    __SNATIVE_LONG_TYPE f_namelen;
-    __SNATIVE_LONG_TYPE f_frsize;
-    __SNATIVE_LONG_TYPE f_flags;
-    __SNATIVE_LONG_TYPE f_spare[4];
+    __SSYSCALL_LONG_TYPE f_namelen;
+    __SSYSCALL_LONG_TYPE f_frsize;
+    __SSYSCALL_LONG_TYPE f_flags;
+    __SSYSCALL_LONG_TYPE f_spare[4];
   };
 
 #ifdef __USE_LARGEFILE64
 struct statfs64
   {
-    __SNATIVE_LONG_TYPE f_type;
-    __SNATIVE_LONG_TYPE f_bsize;
+    __SSYSCALL_LONG_TYPE f_type;
+    __SSYSCALL_LONG_TYPE f_bsize;
     __fsblkcnt64_t f_blocks;
     __fsblkcnt64_t f_bfree;
     __fsblkcnt64_t f_bavail;
     __fsfilcnt64_t f_files;
     __fsfilcnt64_t f_ffree;
     __fsid_t f_fsid;
-    __SNATIVE_LONG_TYPE f_namelen;
-    __SNATIVE_LONG_TYPE f_frsize;
-    __SNATIVE_LONG_TYPE f_flags;
-    __SNATIVE_LONG_TYPE f_spare[4];
+    __SSYSCALL_LONG_TYPE f_namelen;
+    __SSYSCALL_LONG_TYPE f_frsize;
+    __SSYSCALL_LONG_TYPE f_flags;
+    __SSYSCALL_LONG_TYPE f_spare[4];
   };
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/timex.h b/sysdeps/unix/sysv/linux/x86_64/bits/timex.h
index 702a8c4..1c7d90d 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/timex.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/timex.h
@@ -27,41 +27,41 @@ struct timex
   /* mode selector */
   unsigned int modes;
   /* time offset (usec) */
-  __SNATIVE_LONG_TYPE offset;
+  __SSYSCALL_LONG_TYPE offset;
   /* frequency offset (scaled ppm) */
-  __SNATIVE_LONG_TYPE freq;
+  __SSYSCALL_LONG_TYPE freq;
   /* maximum error (usec) */
-  __SNATIVE_LONG_TYPE maxerror;
+  __SSYSCALL_LONG_TYPE maxerror;
   /* estimated error (usec) */
-  __SNATIVE_LONG_TYPE esterror;
+  __SSYSCALL_LONG_TYPE esterror;
   /* clock command/status */
   int status;
   /* pll time constant */
-  __SNATIVE_LONG_TYPE constant;
+  __SSYSCALL_LONG_TYPE constant;
   /* clock precision (usec) (read only) */
-  __SNATIVE_LONG_TYPE precision;
+  __SSYSCALL_LONG_TYPE precision;
   /* clock frequency tolerance (ppm) (read only) */
-  __SNATIVE_LONG_TYPE tolerance;
+  __SSYSCALL_LONG_TYPE tolerance;
   /* (read only) */
   struct timeval time;
   /* (modified) usecs between clock ticks */
-  __SNATIVE_LONG_TYPE tick;
+  __SSYSCALL_LONG_TYPE tick;
   /* pps frequency (scaled ppm) (ro) */
-  __SNATIVE_LONG_TYPE ppsfreq;
+  __SSYSCALL_LONG_TYPE ppsfreq;
   /* pps jitter (us) (ro) */
-  __SNATIVE_LONG_TYPE jitter;
+  __SSYSCALL_LONG_TYPE jitter;
   /* interval duration (s) (shift) (ro) */
   int shift;
   /* pps stability (scaled ppm) (ro) */
-  __SNATIVE_LONG_TYPE stabil;
+  __SSYSCALL_LONG_TYPE stabil;
   /* jitter limit exceeded (ro) */
-  __SNATIVE_LONG_TYPE jitcnt;
+  __SSYSCALL_LONG_TYPE jitcnt;
   /* calibration intervals (ro) */
-  __SNATIVE_LONG_TYPE calcnt;
+  __SSYSCALL_LONG_TYPE calcnt;
   /* calibration errors (ro) */
-  __SNATIVE_LONG_TYPE errcnt;
+  __SSYSCALL_LONG_TYPE errcnt;
   /* stability limit exceeded (ro) */
-  __SNATIVE_LONG_TYPE stbcnt;
+  __SSYSCALL_LONG_TYPE stbcnt;
 
   /* TAI offset (ro) */
   int tai;
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h b/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h
index 32dddfd..2f41667 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h
@@ -41,8 +41,8 @@
 #define __SUSECONDS_T_TYPE	__SQUAD_TYPE
 #define __SNSECONDS_T_TYPE	__SQUAD_TYPE
 #define __BLKSIZE_T_TYPE	__SQUAD_TYPE
-#define __SNATIVE_LONG_TYPE	__SQUAD_TYPE
-#define __UNATIVE_LONG_TYPE	__UQUAD_TYPE
+#define __SSYSCALL_LONG_TYPE	__SQUAD_TYPE
+#define __USYSCALL_LONG_TYPE	__UQUAD_TYPE
 #else
 #define __INO_T_TYPE		__ULONGWORD_TYPE
 #define __NLINK_T_TYPE		__UWORD_TYPE
@@ -56,8 +56,8 @@
 #define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
 #define __SNSECONDS_T_TYPE	__SLONGWORD_TYPE
 #define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
-#define __SNATIVE_LONG_TYPE	__SLONGWORD_TYPE
-#define __UNATIVE_LONG_TYPE	__ULONGWORD_TYPE
+#define __SSYSCALL_LONG_TYPE	__SLONGWORD_TYPE
+#define __USYSCALL_LONG_TYPE	__ULONGWORD_TYPE
 #endif
 
 #define __DEV_T_TYPE		__UQUAD_TYPE

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a44a0db6e3f98ff8e1c2222efe41897f630d88c1

commit a44a0db6e3f98ff8e1c2222efe41897f630d88c1
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Mar 13 16:27:30 2012 -0700

    Set clock_t to __SQUAD_TYPE for x32
    
    2012-03-13  H.J. Lu  <hongjiu.lu@intel.com>
    
    	* scripts/data/c++-types-x32-linux-gnu.data: Update clock_t.
    
    	* sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h (__CLOCK_T_TYPE):
    	Set to __SQUAD_TYPE for x32.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 5beb778..745b8f7 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,3 +1,10 @@
+2012-03-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* scripts/data/c++-types-x32-linux-gnu.data: Update clock_t.
+
+	* sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h (__CLOCK_T_TYPE):
+	Set to __SQUAD_TYPE for x32.
+
 2012-03-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h (ucontext): Restore
diff --git a/scripts/data/c++-types-x32-linux-gnu.data b/scripts/data/c++-types-x32-linux-gnu.data
index 0a89e27..348bf52 100644
--- a/scripts/data/c++-types-x32-linux-gnu.data
+++ b/scripts/data/c++-types-x32-linux-gnu.data
@@ -3,7 +3,7 @@ blkcnt_t:x
 blksize_t:x
 caddr_t:Pc
 clockid_t:i
-clock_t:l
+clock_t:x
 daddr_t:i
 dev_t:y
 fd_mask:l
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h b/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h
index fa2be06..32dddfd 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/typesizes.h
@@ -36,10 +36,11 @@
 #define	__BLKCNT_T_TYPE		__SQUAD_TYPE
 #define	__FSFILCNT_T_TYPE	__UQUAD_TYPE
 #define	__FSBLKCNT_T_TYPE	__UQUAD_TYPE
+#define __CLOCK_T_TYPE		__SQUAD_TYPE
 #define __TIME_T_TYPE		__SQUAD_TYPE
-#define __BLKSIZE_T_TYPE	__SQUAD_TYPE
 #define __SUSECONDS_T_TYPE	__SQUAD_TYPE
 #define __SNSECONDS_T_TYPE	__SQUAD_TYPE
+#define __BLKSIZE_T_TYPE	__SQUAD_TYPE
 #define __SNATIVE_LONG_TYPE	__SQUAD_TYPE
 #define __UNATIVE_LONG_TYPE	__UQUAD_TYPE
 #else
@@ -50,10 +51,11 @@
 #define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
 #define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
 #define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
+#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
 #define __TIME_T_TYPE		__SLONGWORD_TYPE
-#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
 #define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
 #define __SNSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
 #define __SNATIVE_LONG_TYPE	__SLONGWORD_TYPE
 #define __UNATIVE_LONG_TYPE	__ULONGWORD_TYPE
 #endif
@@ -70,7 +72,6 @@
 #define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
 #define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
 #define	__ID_T_TYPE		__U32_TYPE
-#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
 #define __USECONDS_T_TYPE	__U32_TYPE
 #define __DADDR_T_TYPE		__S32_TYPE
 #define __SWBLK_T_TYPE		__SLONGWORD_TYPE

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ce28538400af1f80e63d203bac47a9b80b9fa8ed

commit ce28538400af1f80e63d203bac47a9b80b9fa8ed
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Mar 1 13:42:16 2012 -0800

    Restore uc_flags to unsigned long in ucontext
    
    struct ucontext in <sys/ucontext.h> is used for user-level context
    and is kernel indenpendent. It is separate from struct ucontext
    defined in kernel header files.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index 470c8e7..5beb778 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,3 +1,8 @@
+2012-03-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h (ucontext): Restore
+	unsigned long int on uc_flags.
+
 2012-02-25  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (PTR_MANGLE): Remove
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h b/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
index 5bc8f0e..75e37c4 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
@@ -133,7 +133,7 @@ typedef struct
 /* Userlevel context.  */
 typedef struct ucontext
   {
-    unsigned long long int uc_flags;
+    unsigned long int uc_flags;
     struct ucontext *uc_link;
     stack_t uc_stack;
     mcontext_t uc_mcontext;

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=41849ead7edcefcfbb7a4bd6e062b94e0bdf3685

commit 41849ead7edcefcfbb7a4bd6e062b94e0bdf3685
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jan 25 15:14:00 2012 -0800

    Remove x32 PTR_MANGLE/PTR_DEMANGLE
    
    Remove the `q' suffix from x86-64 xor/rol instructions so that they
    work for both x86-64 and x32.

diff --git a/ChangeLog.x32 b/ChangeLog.x32
index d1f0f92..470c8e7 100644
--- a/ChangeLog.x32
+++ b/ChangeLog.x32
@@ -1,3 +1,11 @@
+2012-02-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (PTR_MANGLE): Remove
+	the `q' suffix from xor/rol instructions.
+	(PTR_DEMANGLE): Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h (PTR_MANGLE): Removed.
+	(PTR_DEMANGLE): Likewise.
+
 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* malloc/malloc.c (sYSMALLOc): Free the old top chunk with a
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 1e68cf1..48c74a1 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -353,33 +353,33 @@
 /* We cannot use the thread descriptor because in ld.so we use setjmp
    earlier than the descriptor is initialized.  */
 # ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)	xorq __pointer_chk_guard_local(%rip), reg;    \
-				rolq $17, reg
-#  define PTR_DEMANGLE(reg)	rorq $17, reg;				      \
-				xorq __pointer_chk_guard_local(%rip), reg
+#  define PTR_MANGLE(reg)	xor __pointer_chk_guard_local(%rip), reg;    \
+				rol $17, reg
+#  define PTR_DEMANGLE(reg)	ror $17, reg;				      \
+				xor __pointer_chk_guard_local(%rip), reg
 # else
-#  define PTR_MANGLE(reg)	asm ("xorq __pointer_chk_guard_local(%%rip), %0\n" \
-				     "rolq $17, %0"			      \
+#  define PTR_MANGLE(reg)	asm ("xor __pointer_chk_guard_local(%%rip), %0\n" \
+				     "rol $17, %0"			      \
 				     : "=r" (reg) : "0" (reg))
-#  define PTR_DEMANGLE(reg)	asm ("rorq $17, %0\n"			      \
-				     "xorq __pointer_chk_guard_local(%%rip), %0" \
+#  define PTR_DEMANGLE(reg)	asm ("ror $17, %0\n"			      \
+				     "xor __pointer_chk_guard_local(%%rip), %0" \
 				     : "=r" (reg) : "0" (reg))
 # endif
 #else
 # ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)	xorq %fs:POINTER_GUARD, reg;		      \
-				rolq $17, reg
-#  define PTR_DEMANGLE(reg)	rorq $17, reg;				      \
-				xorq %fs:POINTER_GUARD, reg
+#  define PTR_MANGLE(reg)	xor %fs:POINTER_GUARD, reg;		      \
+				rol $17, reg
+#  define PTR_DEMANGLE(reg)	ror $17, reg;				      \
+				xor %fs:POINTER_GUARD, reg
 # else
-#  define PTR_MANGLE(var)	asm ("xorq %%fs:%c2, %0\n"		      \
-				     "rolq $17, %0"			      \
+#  define PTR_MANGLE(var)	asm ("xor %%fs:%c2, %0\n"		      \
+				     "rol $17, %0"			      \
 				     : "=r" (var)			      \
 				     : "0" (var),			      \
 				       "i" (offsetof (tcbhead_t,	      \
 						      pointer_guard)))
-#  define PTR_DEMANGLE(var)	asm ("rorq $17, %0\n"			      \
-				     "xorq %%fs:%c2, %0"		      \
+#  define PTR_DEMANGLE(var)	asm ("ror $17, %0\n"			      \
+				     "xor %%fs:%c2, %0"		      \
 				     : "=r" (var)			      \
 				     : "0" (var),			      \
 				       "i" (offsetof (tcbhead_t,	      \
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h
index 81b2dbe..15b67b4 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h
@@ -57,46 +57,4 @@
 
 #endif	/* __ASSEMBLER__ */
 
-/* Pointer mangling support.  */
-#undef PTR_MANGLE
-#undef PTR_DEMANGLE
-
-#if defined NOT_IN_libc && defined IS_IN_rtld
-/* We cannot use the thread descriptor because in ld.so we use setjmp
-   earlier than the descriptor is initialized.  */
-# ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)	xorl __pointer_chk_guard_local(%rip), reg;    \
-				roll $17, reg
-#  define PTR_DEMANGLE(reg)	rorl $17, reg;				      \
-				xorl __pointer_chk_guard_local(%rip), reg
-# else
-#  define PTR_MANGLE(reg)	asm ("xorl __pointer_chk_guard_local(%%rip), %0\n" \
-				     "roll $17, %0"			      \
-				     : "=r" (reg) : "0" (reg))
-#  define PTR_DEMANGLE(reg)	asm ("rorl $17, %0\n"			      \
-				     "xorl __pointer_chk_guard_local(%%rip), %0" \
-				     : "=r" (reg) : "0" (reg))
-# endif
-#else
-# ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)	xorl %fs:POINTER_GUARD, reg;		      \
-				roll $17, reg
-#  define PTR_DEMANGLE(reg)	rorl $17, reg;				      \
-				xorl %fs:POINTER_GUARD, reg
-# else
-#  define PTR_MANGLE(var)	asm ("xorl %%fs:%c2, %0\n"		      \
-				     "roll $17, %0"			      \
-				     : "=r" (var)			      \
-				     : "0" (var),			      \
-				       "i" (offsetof (tcbhead_t,	      \
-						      pointer_guard)))
-#  define PTR_DEMANGLE(var)	asm ("rorl $17, %0\n"			      \
-				     "xorl %%fs:%c2, %0"		      \
-				     : "=r" (var)			      \
-				     : "0" (var),			      \
-				       "i" (offsetof (tcbhead_t,	      \
-						      pointer_guard)))
-# endif
-#endif
-
 #endif /* linux/x86_64/x32/sysdep.h */

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]