Instead of #define TARGET_OS_USES_R18 which is not
handled, pick R9 as an alternate static chain regnum
and document that the port needs to be configured to
issue -ffixed-r18 by default.

r9 is now available after the approval at

  https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558094.html


We have been using this variant with gcc-9 in-house
for a while and I verified that I could get a build
+ reasonable test results with gcc-10.

Olivier

2020-11-04  Olivier Hainque  <hain...@adacore.com>

gcc/
        * config/aarch64-vxworks.h (TARGET_OS_USES_R18): Remove
        definition.
        (STATIC_CHAIN_REGNUM): Redefine to 9.

--- a/gcc/config/aarch64/aarch64-vxworks.h
+++ b/gcc/config/aarch64/aarch64-vxworks.h
@@ -60,12 +60,14 @@ along with GCC; see the file COPYING3.  If not see
 #undef STACK_CHECK_PROTECT
 #define STACK_CHECK_PROTECT 16384
 
-/* The VxWorks environment on aarch64 is llvm-based only, uses R18 as
-   a TCB pointer.  */
-
+/* The VxWorks environment on aarch64 is llvm-based.  */
 #undef VXWORKS_PERSONALITY
 #define VXWORKS_PERSONALITY "llvm"
 
-#undef  TARGET_OS_USES_R18
-#define TARGET_OS_USES_R18 1
+/* VxWorks uses R18 as a TCB pointer.  We must pick something else as
+   the static chain and R18 needs to be claimed "fixed".  Until we
+   arrange to override the common parts of the port family to
+   acknowledge the latter, configure --with-specs="-ffixed-r18".  */
+#undef  STATIC_CHAIN_REGNUM
+#define STATIC_CHAIN_REGNUM 9
 
-- 
2.17.1

Reply via email to