This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PATCH: Add x32 support to sysdeps/x86_64/dl-tlsdesc.h
On Wed, Mar 21, 2012 at 2:58 PM, Roland McGrath <roland@hack.frob.com> wrote:
>> ? ?ptrdiff_t (*entry)(struct tlsdesc *on_rax);
>> +#ifndef __LP64__
>> + ?int pad1;
>> +#endif
>> ? ?void *arg;
>> +#ifndef __LP64__
>> + ?int pad2;
>> +#endif
>
> I wonder if it might not be cleaner to use:
>
> ? ?union
> ? ?{
> ? ? ?ptrdiff_t (*entry) (struct tlsdesc *on_rax);
> ? ? ?uint64_t entry_slot;
> ? ?};
> ? ?union
> ? ?{
> ? ? ?void *arg;
> ? ? ?uint64_t arg_slot;
> ? ?};
>
This works. Here is the updated patch. Tested on
Linux/x86-64 and Linux/x32. OK to install?
Thanks.
--
H.J.
2012-03-22 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/x86_64/dl-tlsdesc.h (tlsdesc): Use anonymouse union
to pad to uint64_t for each field.
(dl_tls_index): Replace unsigned long with uint64_t.
diff --git a/sysdeps/x86_64/dl-tlsdesc.h b/sysdeps/x86_64/dl-tlsdesc.h
index 82a0109..7a5059b 100644
--- a/sysdeps/x86_64/dl-tlsdesc.h
+++ b/sysdeps/x86_64/dl-tlsdesc.h
@@ -29,14 +29,22 @@
/* Type used to represent a TLS descriptor in the GOT. */
struct tlsdesc
{
- ptrdiff_t (*entry)(struct tlsdesc *on_rax);
- void *arg;
+ union
+ {
+ ptrdiff_t (*entry)(struct tlsdesc *on_rax);
+ uint64_t entry_slot;
+ };
+ union
+ {
+ void *arg;
+ uint64_t arg_slot;
+ };
};
typedef struct dl_tls_index
{
- unsigned long int ti_module;
- unsigned long int ti_offset;
+ uint64_t ti_module;
+ uint64_t ti_offset;
} tls_index;
/* Type used as the argument in a TLS descriptor for a symbol that