This is the mail archive of the libc-alpha@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]

Re: RFC: Add __pointer_guard_t for pointer_guard


On Thu, May 17, 2012 at 7:42 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, May 17, 2012 at 6:23 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>> On Thursday 17 May 2012 21:15:09 H.J. Lu wrote:
>>> on x32, PTR_DEMANGLE/PTR_MANGLE are used on 64-bit registers, which
>>> requires the pointer_guard field in tcbhead_t to be 64-bit. But
>>> uintptr_t is 32-bit on x32. ?This patch adds __pointer_guard_t for
>>> pointer_guard and reorders tcbhead_t for x32. ?By pure luck, stack_guard
>>> and __private_tm offsets used by GCC stay the same. ?Any comments?
>>
>> it's not possible to fix the asm code to work on 32bit values on x32 systems ?
>> it kind of sucks we have to add a new type which is uintptr_t for most
>> targets.
>> -mike
>
> The pointer_guard field in tcbhead_t must be 64-bit for x32
> even if the pointer size is 32bit. ?Another possibility is to add a
> 4 byte pad after pointer_guard. ?The only drawback is its value
> can't be changed.
>

This also works.

-- 
H.J.
---
diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
index f838916..7f9c9f6 100644
--- a/nptl/sysdeps/x86_64/tls.h
+++ b/nptl/sysdeps/x86_64/tls.h
@@ -52,17 +52,26 @@ typedef struct
   int gscope_flag;
   uintptr_t sysinfo;
   uintptr_t stack_guard;
+# ifdef __ILP32__
+  int rtld_must_xmm_save;
+  uintptr_t pointer_guard;	/* Align offset to 8 bytes.  */
+  int __unused1;		/* Used by 64-bit PTR_MANGLE/PTR_DEMANGLE.  */
+  unsigned long int vgetcpu_cache[2];
+  /* Reservation of some values for the TM ABI.  */
+  void *__private_tm[5];
+# else
   uintptr_t pointer_guard;
   unsigned long int vgetcpu_cache[2];
-# ifndef __ASSUME_PRIVATE_FUTEX
+#  ifndef __ASSUME_PRIVATE_FUTEX
   int private_futex;
-# else
+#  else
   int __unused1;
-# endif
+#  endif
   int rtld_must_xmm_save;
   /* Reservation of some values for the TM ABI.  */
   void *__private_tm[5];
   long int __unused2;
+# endif
   /* Have space for the post-AVX register size.  */
   __m128 rtld_savespace_sse[8][4] __attribute__ ((aligned (32)));


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