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/pointer created. glibc-2.16-ports-merge-775-g8cb8e0f


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/pointer has been created
        at  8cb8e0fc0e45df79c7d3eb776f7e15d2ab287e3b (commit)

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

commit 8cb8e0fc0e45df79c7d3eb776f7e15d2ab287e3b
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Nov 26 16:26:10 2012 -0800

    Include <libc-internal.h>

diff --git a/ChangeLog.hjl b/ChangeLog.hjl
index d3e9873..df2f2bb 100644
--- a/ChangeLog.hjl
+++ b/ChangeLog.hjl
@@ -6,7 +6,7 @@
 	(__integer_if_pointer_type_sub): Likewise.
 	(__integer_if_pointer_type): Likewise.
 	(cast_to_integer): Likewise.
-	* sysdeps/x86_64/bits/atomic.h
+	* sysdeps/x86_64/bits/atomic.h: Include <libc-internal.h>.
 	(__arch_c_compare_and_exchange_val_64_acq): Use cast_to_integer
 	before casting to atomic64_t.
 	(atomic_exchange_acq): Likewise.
@@ -21,8 +21,9 @@ nptl/
 
 	* unwind.c (__pthread_unwind): Pass address of unwind_cleanup
 	to THREAD_SETMEM.
-	* sysdeps/i386/tls.h (THREAD_SETMEM): Use cast_to_integer before
-	casting to uint64_t.
+	* sysdeps/i386/tls.h: Include <libc-internal.h>.
+	(THREAD_SETMEM): Use cast_to_integer before casting to uint64_t.
 	(THREAD_SETMEM_NC): Likewise.
-	* sysdeps/x86_64/tls.h (THREAD_SETMEM): Likewise.
+	* sysdeps/x86_64/tls.h: Include <libc-internal.h>.
+	(THREAD_SETMEM): Use cast_to_integer before casting to uint64_t.
 	(THREAD_SETMEM_NC): Likewise.
diff --git a/nptl/sysdeps/i386/tls.h b/nptl/sysdeps/i386/tls.h
index 96a2708..90c7a53 100644
--- a/nptl/sysdeps/i386/tls.h
+++ b/nptl/sysdeps/i386/tls.h
@@ -26,6 +26,7 @@
 # include <stdint.h>
 # include <stdlib.h>
 # include <sysdep.h>
+# include <libc-internal.h>
 # include <kernel-features.h>
 
 
diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
index ee0b6c0..f3b7649 100644
--- a/nptl/sysdeps/x86_64/tls.h
+++ b/nptl/sysdeps/x86_64/tls.h
@@ -26,6 +26,7 @@
 # include <stdint.h>
 # include <stdlib.h>
 # include <sysdep.h>
+# include <libc-internal.h>
 # include <kernel-features.h>
 
 /* Replacement type for __m128 since this file is included by ld.so,
diff --git a/sysdeps/x86_64/bits/atomic.h b/sysdeps/x86_64/bits/atomic.h
index 81456ed..552581c 100644
--- a/sysdeps/x86_64/bits/atomic.h
+++ b/sysdeps/x86_64/bits/atomic.h
@@ -18,6 +18,7 @@
 
 #include <stdint.h>
 #include <tls.h>	/* For tcbhead_t.  */
+#include <libc-internal.h>
 
 
 typedef int8_t atomic8_t;

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

commit 17fb8e4022fc6792fa44a8bb3d10cf49cceba112
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Nov 26 16:18:21 2012 -0800

    Cast to intptr_t first when casting pointer to int64

diff --git a/ChangeLog.hjl b/ChangeLog.hjl
new file mode 100644
index 0000000..d3e9873
--- /dev/null
+++ b/ChangeLog.hjl
@@ -0,0 +1,28 @@
+2012-11-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf/dl-load.c (_dl_map_object_from_fd): Cast to uintptr_t
+	before casting to void *.
+	* include/libc-internal.h (__pointer_type): New macro.
+	(__integer_if_pointer_type_sub): Likewise.
+	(__integer_if_pointer_type): Likewise.
+	(cast_to_integer): Likewise.
+	* sysdeps/x86_64/bits/atomic.h
+	(__arch_c_compare_and_exchange_val_64_acq): Use cast_to_integer
+	before casting to atomic64_t.
+	(atomic_exchange_acq): Likewise.
+	(__arch_exchange_and_add_body): Likewise.
+	(__arch_add_body): Likewise.
+	(atomic_add_negative): Likewise.
+	(atomic_add_zero): Likewise.
+
+nptl/
+
+2012-11-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* unwind.c (__pthread_unwind): Pass address of unwind_cleanup
+	to THREAD_SETMEM.
+	* sysdeps/i386/tls.h (THREAD_SETMEM): Use cast_to_integer before
+	casting to uint64_t.
+	(THREAD_SETMEM_NC): Likewise.
+	* sysdeps/x86_64/tls.h (THREAD_SETMEM): Likewise.
+	(THREAD_SETMEM_NC): Likewise.
diff --git a/elf/dl-load.c b/elf/dl-load.c
index a695556..70fe78f 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1351,7 +1351,8 @@ cannot allocate TLS data structures for initial thread");
 	    && ((size_t) (c->mapend - c->mapstart + c->mapoff)
 		>= header->e_phoff + header->e_phnum * sizeof (ElfW(Phdr))))
 	  /* Found the program header in this segment.  */
-	  l->l_phdr = (void *) (c->mapstart + header->e_phoff - c->mapoff);
+	  l->l_phdr = (void *) (uintptr_t) (c->mapstart + header->e_phoff
+					    - c->mapoff);
 
 	if (c->allocend > c->dataend)
 	  {
diff --git a/include/libc-internal.h b/include/libc-internal.h
index e5fd533..dfa8060 100644
--- a/include/libc-internal.h
+++ b/include/libc-internal.h
@@ -34,4 +34,20 @@ extern void __libc_thread_freeres (void);
 /* Define and initialize `__progname' et. al.  */
 extern void __init_misc (int, char **, char **);
 
+/* 1 if 'type' is a pointer type, 0 otherwise.  */
+# define __pointer_type(type) (__builtin_classify_type ((type) 0) == 5)
+
+/* __intptr_t if P is true, or T if P is false.  */ 
+# define __integer_if_pointer_type_sub(T, P) \
+  __typeof__ (*(0 ? (__typeof__ (0 ? (T *) 0 : (void *) (P))) 0 \
+		  : (__typeof__ (0 ? (__intptr_t *) 0 : (void *) (!(P)))) 0))
+
+/* __intptr_t if EXPR has a pointer type, or the type of EXPR otherwise.  */
+# define __integer_if_pointer_type(expr) \
+  __integer_if_pointer_type_sub(__typeof__ ((__typeof__ (expr)) 0), \
+				__pointer_type (__typeof__ (expr)))
+
+/* Cast an integer or a pointer VAL to integer with proper type.  */
+# define cast_to_integer(val) ((__integer_if_pointer_type (val)) (val))
+
 #endif /* _LIBC_INTERNAL  */
diff --git a/nptl/sysdeps/i386/tls.h b/nptl/sysdeps/i386/tls.h
index eb1ca31..96a2708 100644
--- a/nptl/sysdeps/i386/tls.h
+++ b/nptl/sysdeps/i386/tls.h
@@ -343,7 +343,7 @@ union user_desc_init
 									      \
 	 asm volatile ("movl %%eax,%%gs:%P1\n\t"			      \
 		       "movl %%edx,%%gs:%P2" :				      \
-		       : "A" ((uint64_t) (value)),			      \
+		       : "A" ((uint64_t) cast_to_integer (value)),	      \
 			 "i" (offsetof (struct pthread, member)),	      \
 			 "i" (offsetof (struct pthread, member) + 4));	      \
        }})
@@ -370,7 +370,7 @@ union user_desc_init
 									      \
 	 asm volatile ("movl %%eax,%%gs:%P1(,%2,8)\n\t"			      \
 		       "movl %%edx,%%gs:4+%P1(,%2,8)" :			      \
-		       : "A" ((uint64_t) (value)),			      \
+		       : "A" ((uint64_t) cast_to_integer (value)),	      \
 			 "i" (offsetof (struct pthread, member)),	      \
 			 "r" (idx));					      \
        }})
diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
index bc60a51..ee0b6c0 100644
--- a/nptl/sysdeps/x86_64/tls.h
+++ b/nptl/sysdeps/x86_64/tls.h
@@ -263,7 +263,7 @@ typedef struct
 	   abort ();							      \
 									      \
 	 asm volatile ("movq %q0,%%fs:%P1" :				      \
-		       : IMM_MODE ((uint64_t) (value)),			      \
+		       : IMM_MODE ((uint64_t) cast_to_integer (value)),	      \
 			 "i" (offsetof (struct pthread, member)));	      \
        }})
 
@@ -288,7 +288,7 @@ typedef struct
 	   abort ();							      \
 									      \
 	 asm volatile ("movq %q0,%%fs:%P1(,%q2,8)" :			      \
-		       : IMM_MODE ((uint64_t) (value)),			      \
+		       : IMM_MODE ((uint64_t) cast_to_integer (value)),	      \
 			 "i" (offsetof (struct pthread, member[0])),	      \
 			 "r" (idx));					      \
        }})
diff --git a/nptl/unwind.c b/nptl/unwind.c
index 7ccb213..aedd037 100644
--- a/nptl/unwind.c
+++ b/nptl/unwind.c
@@ -124,7 +124,7 @@ __pthread_unwind (__pthread_unwind_buf_t *buf)
   /* This is not a catchable exception, so don't provide any details about
      the exception type.  We do need to initialize the field though.  */
   THREAD_SETMEM (self, exc.exception_class, 0);
-  THREAD_SETMEM (self, exc.exception_cleanup, unwind_cleanup);
+  THREAD_SETMEM (self, exc.exception_cleanup, &unwind_cleanup);
 
   _Unwind_ForcedUnwind (&self->exc, unwind_stop, ibuf);
 #else
diff --git a/sysdeps/x86_64/bits/atomic.h b/sysdeps/x86_64/bits/atomic.h
index 100943f..81456ed 100644
--- a/sysdeps/x86_64/bits/atomic.h
+++ b/sysdeps/x86_64/bits/atomic.h
@@ -101,8 +101,9 @@ typedef uintmax_t uatomic_max_t;
 		       "lock\n"						      \
 		       "0:\tcmpxchgq %q2, %1"				      \
 		       : "=a" (ret), "=m" (*mem)			      \
-		       : "q" ((atomic64_t) (newval)), "m" (*mem),	      \
-			 "0" ((atomic64_t) (oldval)),		      \
+		       : "q" ((atomic64_t) cast_to_integer (newval)),	      \
+			 "m" (*mem),					      \
+			 "0" ((atomic64_t) cast_to_integer (oldval)),	      \
 			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
      ret; })
 
@@ -125,7 +126,8 @@ typedef uintmax_t uatomic_max_t;
      else								      \
        __asm __volatile ("xchgq %q0, %1"				      \
 			 : "=r" (result), "=m" (*mem)			      \
-			 : "0" ((atomic64_t) (newvalue)), "m" (*mem));	      \
+			 : "0" ((atomic64_t) cast_to_integer (newvalue)),     \
+			   "m" (*mem));					      \
      result; })
 
 
@@ -149,7 +151,8 @@ typedef uintmax_t uatomic_max_t;
      else								      \
        __asm __volatile (lock "xaddq %q0, %1"				      \
 			 : "=r" (result), "=m" (*mem)			      \
-			 : "0" ((atomic64_t) (value)), "m" (*mem),	      \
+			 : "0" ((atomic64_t) cast_to_integer (value)),	      \
+			   "m" (*mem),					      \
 			   "i" (offsetof (tcbhead_t, multiple_threads)));     \
      result; })
 
@@ -187,7 +190,8 @@ typedef uintmax_t uatomic_max_t;
     else								      \
       __asm __volatile (lock "addq %q1, %0"				      \
 			: "=m" (*mem)					      \
-			: "ir" ((atomic64_t) (value)), "m" (*mem),	      \
+			: "ir" ((atomic64_t) cast_to_integer (value)),	      \
+			  "m" (*mem),					      \
 			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
   } while (0)
 
@@ -218,7 +222,8 @@ typedef uintmax_t uatomic_max_t;
      else								      \
        __asm __volatile (LOCK_PREFIX "addq %q2, %0; sets %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
-			 : "ir" ((atomic64_t) (value)), "m" (*mem));	      \
+			 : "ir" ((atomic64_t) cast_to_integer (value)),	      \
+			   "m" (*mem));					      \
      __result; })
 
 
@@ -239,7 +244,8 @@ typedef uintmax_t uatomic_max_t;
      else								      \
        __asm __volatile (LOCK_PREFIX "addq %q2, %0; setz %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
-			 : "ir" ((atomic64_t) (value)), "m" (*mem));	      \
+			 : "ir" ((atomic64_t) cast_to_integer (value)),	      \
+			   "m" (*mem));					      \
      __result; })
 
 

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


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]