public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Using the kernel thread pointer on aarch64 (tpidr_el1)
@ 2023-02-13  2:03 Zach 1
  2023-02-13 12:42 ` Kyrylo Tkachov
  0 siblings, 1 reply; 3+ messages in thread
From: Zach 1 @ 2023-02-13  2:03 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]

Hi,

On AArch64, GCC seems to use tpidr_el0 (user-mode accessible) to access the
thread pointer for loading thread-local variables by default. I can't find
any option to change this to tpidr_el1 (or tpidr_el2/tpidr_el3). This is
necessary for using thread-local variables in kernel code. Clang has the
`-mtp` option for AArch64 (
https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mtp)
that controls this, but it seems GCC does not? Does any such option exist,
and if not is there any chance to add support for it? Thanks for any help.

Zach

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

* RE: Using the kernel thread pointer on aarch64 (tpidr_el1)
  2023-02-13  2:03 Using the kernel thread pointer on aarch64 (tpidr_el1) Zach 1
@ 2023-02-13 12:42 ` Kyrylo Tkachov
  2023-02-13 19:59   ` Zach 1
  0 siblings, 1 reply; 3+ messages in thread
From: Kyrylo Tkachov @ 2023-02-13 12:42 UTC (permalink / raw)
  To: Zach 1, gcc-help

Hello,

> -----Original Message-----
> From: Gcc-help <gcc-help-bounces+kyrylo.tkachov=arm.com@gcc.gnu.org>
> On Behalf Of Zach 1 via Gcc-help
> Sent: Monday, February 13, 2023 2:04 AM
> To: gcc-help@gcc.gnu.org
> Subject: Using the kernel thread pointer on aarch64 (tpidr_el1)
> 
> Hi,
> 
> On AArch64, GCC seems to use tpidr_el0 (user-mode accessible) to access
> the
> thread pointer for loading thread-local variables by default. I can't find
> any option to change this to tpidr_el1 (or tpidr_el2/tpidr_el3). This is
> necessary for using thread-local variables in kernel code. Clang has the
> `-mtp` option for AArch64 (
> https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-
> clang-mtp)
> that controls this, but it seems GCC does not? Does any such option exist,
> and if not is there any chance to add support for it? Thanks for any help.

Looks like this exists for AArch32 (the arm port of GCC):
https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html

AArch64 doesn't support but I suppose it wouldn't be hard to add given arm supports it and clang as well.
Could you file a bug report in Bugzilla to keep track of the request please?

Thanks,
Kyrill

> 
> Zach

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

* Re: Using the kernel thread pointer on aarch64 (tpidr_el1)
  2023-02-13 12:42 ` Kyrylo Tkachov
@ 2023-02-13 19:59   ` Zach 1
  0 siblings, 0 replies; 3+ messages in thread
From: Zach 1 @ 2023-02-13 19:59 UTC (permalink / raw)
  To: Kyrylo Tkachov; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1437 bytes --]

Thanks, I have filed a Bugzilla report here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108779.

On Mon, Feb 13, 2023 at 4:43 AM Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>
wrote:

> Hello,
>
> > -----Original Message-----
> > From: Gcc-help <gcc-help-bounces+kyrylo.tkachov=arm.com@gcc.gnu.org>
> > On Behalf Of Zach 1 via Gcc-help
> > Sent: Monday, February 13, 2023 2:04 AM
> > To: gcc-help@gcc.gnu.org
> > Subject: Using the kernel thread pointer on aarch64 (tpidr_el1)
> >
> > Hi,
> >
> > On AArch64, GCC seems to use tpidr_el0 (user-mode accessible) to access
> > the
> > thread pointer for loading thread-local variables by default. I can't
> find
> > any option to change this to tpidr_el1 (or tpidr_el2/tpidr_el3). This is
> > necessary for using thread-local variables in kernel code. Clang has the
> > `-mtp` option for AArch64 (
> > https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-
> > clang-mtp)
> > that controls this, but it seems GCC does not? Does any such option
> exist,
> > and if not is there any chance to add support for it? Thanks for any
> help.
>
> Looks like this exists for AArch32 (the arm port of GCC):
> https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
>
> AArch64 doesn't support but I suppose it wouldn't be hard to add given arm
> supports it and clang as well.
> Could you file a bug report in Bugzilla to keep track of the request
> please?
>
> Thanks,
> Kyrill
>
> >
> > Zach
>

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

end of thread, other threads:[~2023-02-13 19:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-13  2:03 Using the kernel thread pointer on aarch64 (tpidr_el1) Zach 1
2023-02-13 12:42 ` Kyrylo Tkachov
2023-02-13 19:59   ` Zach 1

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).