https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108779
Bug ID: 108779 Summary: No option to change thread-pointer location on AArch64 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: zach-gcc at cs dot stanford.edu Target Milestone: --- On AArch64, GCC uses tpidr_el0 (user-mode accessible) to access the thread-pointer for loading thread-local variables by default. There is no option to change this to tpidr_el1 (or tpidr_el2/tpidr_el3), which is necessary for using thread-local variables in kernel code (or any code that runs at a higher privilege level). 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. There is a GCC `-mtp` option for ARM, but not AArch64. See also the original gcc-help message I sent here: https://gcc.gnu.org/pipermail/gcc-help/2023-February/142212.html Thanks!