public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* __thread_pointer on powerpc
@ 2021-12-15  2:16 Mathieu Desnoyers
  2021-12-15  9:01 ` Florian Weimer
  0 siblings, 1 reply; 2+ messages in thread
From: Mathieu Desnoyers @ 2021-12-15  2:16 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha

Hi Florian,

In the recent patchset introducing rseq support in glibc, __thread_pointer
is wired up for powerpc.

Based on my interpretation of

https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gcc/Local-Register-Variables.html

it appears that using "register void *__result asm ("r2")" is not sufficient
to guarantee that the compiler will indeed use this register. It's documented
as being just a hint that the compiler is free to optimize away.

I suspect we may want to add something like:

asm ("" : "=r" (__result));

just after the variable definition, to force the compiler to use this variable
as output to an inline asm.

Thoughts ?

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: __thread_pointer on powerpc
  2021-12-15  2:16 __thread_pointer on powerpc Mathieu Desnoyers
@ 2021-12-15  9:01 ` Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2021-12-15  9:01 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: libc-alpha

* Mathieu Desnoyers:

> Hi Florian,
>
> In the recent patchset introducing rseq support in glibc, __thread_pointer
> is wired up for powerpc.
>
> Based on my interpretation of
>
> https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gcc/Local-Register-Variables.html
>
> it appears that using "register void *__result asm ("r2")" is not sufficient
> to guarantee that the compiler will indeed use this register. It's documented
> as being just a hint that the compiler is free to optimize away.
>
> I suspect we may want to add something like:
>
> asm ("" : "=r" (__result));
>
> just after the variable definition, to force the compiler to use this variable
> as output to an inline asm.

Good point.  I think we should use a global register variable instead.
I will try to fix this.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-15  9:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-15  2:16 __thread_pointer on powerpc Mathieu Desnoyers
2021-12-15  9:01 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).