This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PATCH: Add x32 support to <sys/user.h>
On Wed, May 16, 2012 at 2:13 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, May 16, 2012 at 12:47 PM, Roland McGrath <roland@hack.frob.com> wrote:
>>> ? ?struct user_regs_struct* ? u_ar0;
>>> +# ifdef __ILP32__
>>> + ?unsigned int ? ? ? ? ? ? ? ? ? ? ? pad0;
>>> +# endif
>>> ? ?struct user_fpregs_struct* u_fpstate;
>>> - ?unsigned long int ? ? ? ? ?magic;
>>> +# ifdef __ILP32__
>>> + ?unsigned int ? ? ? ? ? ? ? ? ? ? ? pad1;
>>> +# endif
>>> + ?__extension__ unsigned long long int ? ? ? magic;
>>
>> For consistency all fields should have names starting with "u_".
>> But I prefer the union trick over #ifdef'd padding fields.
>
> Like this?
>
Should be this. OK to install?
Thanks.
--
H.J.
---
* sysdeps/unix/sysv/linux/x86_64/sys/user.h (user): Use
anonymous union.
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/user.h
b/sysdeps/unix/sysv/linux/x86_64/sys/user.h
index 46bf6ef..9db2937 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sys/user.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/user.h
@@ -82,14 +82,16 @@ struct user
__extension__ unsigned long long int start_stack;
__extension__ long long int signal;
int reserved;
- struct user_regs_struct* u_ar0;
-# ifdef __ILP32__
- unsigned int pad0;
-# endif
- struct user_fpregs_struct* u_fpstate;
-# ifdef __ILP32__
- unsigned int pad1;
-# endif
+ __extension__ union
+ {
+ struct user_regs_struct* u_ar0;
+ __extension__ unsigned long long int __u_ar0_word;
+ };
+ __extension__ union
+ {
+ struct user_fpregs_struct* u_fpstate;
+ __extension__ unsigned long long int __u_fpstate_word;
+ };
__extension__ unsigned long long int magic;
char u_comm [32];
__extension__ unsigned long long int u_debugreg [8];