[PATCH] [BZ #19679] [x86_64] Set DL_RUNIME_UNALIGNED_VEC_SIZE to 8

Markus Trippelsdorf markus@trippelsdorf.de
Sat Feb 20 09:16:00 GMT 2016


On 2016.02.20 at 09:38 +0100, Florian Weimer wrote:
> On 02/20/2016 12:49 AM, H.J. Lu wrote:
> > +#ifndef DL_RUNTIME_UNALIGNED_VEC_SIZE
> > +/* The maximum size in bytes of unaligned vector load and store in the
> > +   dynamic linker.  Since SSE optimized memory/string functions with
> > +   aligned SSE register load and store are used in the dynamic linker,
> > +   we must set this to 8 so that _dl_runtime_resolve_sse will align the
> > +   stack before calling _dl_fixup.  */
> > +# define DL_RUNTIME_UNALIGNED_VEC_SIZE 8
> 
> The comment doesn't really explain the situation.  If all programs
> actually fallowed the psABI, we wouldn't need this.
> 
> I think it's easier at this point to change the psABI to say that
> __tls_getaddr can be called with an 8-byte-aligned stack.

I think this would be an overreaction. 

It is actually quite hard to hit the issue in practice. You would have
to build glibc with gcc-6 and -O3, to get the SSE instructions that
require proper alignment in the dynamic linker.
And then you have to use it with an old and buggy libstc++ from
gcc-4.9.3.

One could argue that it isn't really the job of the dynamic linker to
fix unaligned stacks.

-- 
Markus



More information about the Libc-alpha mailing list