No need for thread pointer in bare metal toolchain. Use TP register normally.
gcc/ 2016-09-29 Claudiu Zissulescu <claz...@synopsys.com> * config/arc/elf.h (ARGET_ARC_TP_REGNO_DEFAULT): Define. * config/arc/linux.h (ARGET_ARC_TP_REGNO_DEFAULT): Likewise. * config/arc/arc.opt (mtp-regno): Use ARGET_ARC_TP_REGNO_DEFAULT. --- gcc/config/arc/arc.opt | 2 +- gcc/config/arc/elf.h | 5 +++++ gcc/config/arc/linux.h | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/config/arc/arc.opt b/gcc/config/arc/arc.opt index 17af736..6060ded 100644 --- a/gcc/config/arc/arc.opt +++ b/gcc/config/arc/arc.opt @@ -469,7 +469,7 @@ EnumValue Enum(arc_fpu) String(fpud_all) Value(FPU_FPUD_ALL) mtp-regno= -Target RejectNegative Joined UInteger Var(arc_tp_regno) Init(25) +Target RejectNegative Joined UInteger Var(arc_tp_regno) Init(TARGET_ARC_TP_REGNO_DEFAULT) Specify thread pointer register number. mtp-regno=none diff --git a/gcc/config/arc/elf.h b/gcc/config/arc/elf.h index d2106c5..a6d6c05 100644 --- a/gcc/config/arc/elf.h +++ b/gcc/config/arc/elf.h @@ -53,3 +53,8 @@ along with GCC; see the file COPYING3. If not see # define MULTILIB_DEFAULTS { "mcpu=" ARC_MULTILIB_CPU_DEFAULT } # endif #endif + +/* Bare-metal toolchains are not having a thread pointer register + set. */ +#undef TARGET_ARC_TP_REGNO_DEFAULT +#define TARGET_ARC_TP_REGNO_DEFAULT -1 diff --git a/gcc/config/arc/linux.h b/gcc/config/arc/linux.h index 10c291c..1d10357 100644 --- a/gcc/config/arc/linux.h +++ b/gcc/config/arc/linux.h @@ -74,3 +74,7 @@ along with GCC; see the file COPYING3. If not see /* We do not have any MULTILIB_OPTIONS specified, so there are no MULTILIB_DEFAULTS. */ #undef MULTILIB_DEFAULTS + +/* Linux toolchains are using r25 as TLS register. */ +#undef TARGET_ARC_TP_REGNO_DEFAULT +#define TARGET_ARC_TP_REGNO_DEFAULT 25 -- 1.9.1