https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102772
--- Comment #25 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Ah, sorry, my fault apparently. pushl %ebx movl %gs:0, %ebx addl $s@ntpoff, %ebx popl %ebx ret of course doesn't make sense, because when it is a function, it should return the value in %eax, while the above computes something into %ebx and overwrites it and then just returns an uninitialized reg. So we need: pushl %ebx movl %gs:0, %ebx addl $s@ntpoff, %ebx movl %ebx, %eax popl %ebx ret