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 Thu, Mar 22, 2012 at 9:58 AM, Roland McGrath <roland@hack.frob.com> wrote:
> I think the bit using the union warrants a comment explaining why it's there.
>
>> ? ? ? * sysdeps/x86_64/dl-tlsdesc.h (tlsdesc): Use anonymouse union
>
> typo: s/anonymouse/anonymous/
>
>> + ? ? ?ptrdiff_t (*entry)(struct tlsdesc *on_rax);
>
> Missing space before paren.
>
> With those nits fixed, I'm happy with the change.
> But I'd be happier yet if other people gave opinions
> about the union trick vs explicit #ifdef's padding fields.
>
>
Here is an updated patch. Does anyone have any preference of
anonymous union vs. explicit #ifdef's padding fields? My opinion
is we can go anonymous union for now. We can always change
it to explicit #ifdef's padding fields if it is a real issue. Any comments?
Thanks.
--
H.J.
2012-03-22 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/x86_64/dl-tlsdesc.h (tlsdesc): Use anonymous 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..f5635f7 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