https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125436

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Kevin Puetz from comment #7)
> Created attachment 64543 [details]
> g++ -g -shared -fPIC -O0 foo.cpp -o libfoo.so (reproduces with gcc 16.1.0)
> 
> The same one works if you just force it to use si instead of di. So I can
> either randomly fiddle with making ms_foo complicated enough that ends up
> being the register allocation (like it was in my original code, but that
> involved wine and lots of cruft you don't really want), or could just
> brute-force it by changing line foo.cpp:20 to use
> https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html. I hope
> that's OK.
> 
> I.e. change line 20 of foo.cpp from
> -int ret -1;
> +register int ret asm("si") = -1;
> 

I don't think that hard register in asm is preserved across function calls.
TLS symbol reference may be a function call.

Reply via email to