This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] x86-64: Align the stack in __tls_get_addr [BZ #21609]
On Thu, Jul 06, 2017 at 10:15:36PM +0200, Florian Weimer wrote:
> On 07/06/2017 05:32 PM, Alexander Monakov wrote:
> > On Thu, 6 Jul 2017, Alexander Monakov wrote:
> >> There is no need to introduce new symbols nor symbol versions. It's
> >> sufficient to implement amd64 __tls_get_attr in assembly, rename generic
> >> __tls_get_attr, and call the renamed generic implementation from the slow
> >> path after realigning the stack.
> >
> > Actually, looking at elf/dl-tls.c, I see that __tls_get_addr doesn't need
> > aligned stack, and its callees update_get_addr and tls_get_addr_tail are
> > already marked noinline, so isn't it sufficient to additionally mark those
> > with __attribute__((force_align_arg_pointer)) on x86-64?
>
> I'm not sure if GCC will honor force_align_arg_pointer on a static
> function which provably called with a properly aligned stack only. We'd
> need another attribute on __tls_get_addr to tell GCC that it is called
> with a misaligned stack pointer.
If it is not inlined, it will honor the attribute.
But if you want to be double-sure, add used attribute to the function,
that means it may be called in means not known to the compiler.
Jakub