[HURD, PATCH] Fix stack switching at initialization time

Thomas Schwinge thomas@schwinge.name
Fri Jul 22 17:18:00 GMT 2011


Hi!

On Fri, 22 Jul 2011 15:48:29 +0200, ludo@gnu.org wrote:
> The attached patch fixes stack switching in init-first.c when cthreads
> are used (this is for code compiled with a cross-GCC 4.5.1 for
> i586-pc-gnu; Debian GNU/Hurd uses an older GCC and is not affected.)
> 
> With this compiler, ‘data[-1]’ does not point to the return address.
> Thus, ‘switch_stacks’ would never be called, which breaks TLS.
> 
> It seems to me that using ‘data[-1]’ here was fragile in the presence of
> nested functions, inlining, and tail-call optimizations.

If for sure is ugly enough...  :-)

This patch is to be put on top of our TopGit t/init-first.c branch, I
guess, which itself is not yet in the sourceware repository, I think?


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20110722/f2a3dc57/attachment.sig>


More information about the Libc-alpha mailing list