[HURD, PATCH] Fix stack switching at initialization time

Ludovic Courtès ludo@gnu.org
Fri Jul 22 17:15:00 GMT 2011


Hello,

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.

Thanks,
Ludo’.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Hurd-Fix-stack-switching-at-initialization-time-when.patch
Type: text/x-patch
Size: 1675 bytes
Desc: the patch
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20110722/f5345ad7/attachment.bin>


More information about the Libc-alpha mailing list