1/* Definitions of target machine for GNU compiler. Vxworks PowerPC version. 2 Copyright (C) 1996-2020 Free Software Foundation, Inc. 3 Contributed by CodeSourcery, LLC. 4 5This file is part of GCC. 6 7GCC is free software; you can redistribute it and/or modify it under 8the terms of the GNU General Public License as published by the Free 9Software Foundation; either version 3, or (at your option) any later 10version. 11 12GCC is distributed in the hope that it will be useful, but WITHOUT ANY 13WARRANTY; without even the implied warranty of MERCHANTABILITY or 14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15for more details. 16 17You should have received a copy of the GNU General Public License 18along with GCC; see the file COPYING3. If not see 19<http://www.gnu.org/licenses/>. */ 20 21/* Note to future editors: VxWorks is mostly an EABI target. We do 22 not use rs6000/eabi.h because we would have to override most of 23 it anyway. However, if you change that file, consider making 24 analogous changes here too. */ 25 26/* CPP predefined macros. */ 27 28#undef TARGET_OS_CPP_BUILTINS 29#define TARGET_OS_CPP_BUILTINS() \ 30 do \ 31 { \ 32 builtin_define ("__ppc"); \ 33 builtin_define ("__PPC__"); \ 34 builtin_define ("__EABI__"); \ 35 builtin_define ("__ELF__"); \ 36 if (!TARGET_SOFT_FLOAT) \ 37 builtin_define ("__hardfp"); \ 38 \ 39 /* C89 namespace violation! */ \ 40 builtin_define ("CPU_FAMILY=PPC"); \ 41 \ 42 VXWORKS_OS_CPP_BUILTINS (); \ 43 } \ 44 while (0) 45 46/* vx6 library path. */ 47#if !TARGET_VXWORKS7 48#undef STARTFILE_PREFIX_SPEC 49#define STARTFILE_PREFIX_SPEC \ 50 "%{mrtp:%{!shared:%:getenv(WIND_BASE /target/lib/usr/lib/ppc/PPC32/common)}}" 51#endif 52 53/* Only big endian PPC is supported by VxWorks. */ 54#undef BYTES_BIG_ENDIAN 55#define BYTES_BIG_ENDIAN 1 56#undef WORDS_BIG_ENDIAN 57#define WORDS_BIG_ENDIAN 1 58 59/* We have to kill off the entire specs set created by rs6000/sysv4.h 60 and substitute our own set. The top level vxworks.h has done some 61 of this for us. */ 62 63#undef SUBTARGET_EXTRA_SPECS 64#undef CPP_SPEC 65#undef CC1_SPEC 66#undef ASM_SPEC 67 68#define SUBTARGET_EXTRA_SPECS /* none needed */ 69 70/* FIXME: The only reason we allow no -mcpu switch at all is because 71 config-ml.in insists on a "." multilib. */ 72#define CPP_SPEC \ 73"%{!DCPU=*: \ 74 %{mcpu=403 : -DCPU=PPC403 ; \ 75 mcpu=405 : -DCPU=PPC405 ; \ 76 mcpu=440 : -DCPU=PPC440 ; \ 77 mcpu=464 : -DCPU=PPC464 ; \ 78 mcpu=476 : -DCPU=PPC476 ; \ 79 mcpu=603 : -DCPU=PPC603 ; \ 80 mcpu=604 : -DCPU=PPC604 ; \ 81 mcpu=860 : -DCPU=PPC860 ; \ 82 mcpu=8540: -DCPU=PPC85XX ; \ 83 mcpu=8548: -DCPU=PPC85XX ; \ 84 : -DCPU=PPC604 }}" \ 85VXWORKS_ADDITIONAL_CPP_SPEC 86 87#define CC1_SPEC \ 88"%{G*} %{mno-sdata:-msdata=none} %{msdata:-msdata=default} \ 89 %{mlittle|mlittle-endian:-mstrict-align}" 90 91#define ASM_SPEC \ 92"%(asm_cpu) \ 93 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \ 94 %{mrelocatable} %{mrelocatable-lib} %{" FPIC_SPEC ":-K PIC} -mbig" 95 96#undef LIB_SPEC 97#define LIB_SPEC VXWORKS_LIB_SPEC 98 99/* For RTPs, leverage linker relaxation. This helps programs referring 100 to, typically, kernel services too far away for short calls. This is more 101 precise than -mlongcall and can be overriden with -Wl,--no-relax. */ 102#define VXWORKS_RELAX_LINK_SPEC "%{mrtp:--relax}" 103 104#undef LINK_SPEC 105#define LINK_SPEC VXWORKS_LINK_SPEC " " VXWORKS_RELAX_LINK_SPEC 106 107#undef STARTFILE_SPEC 108#define STARTFILE_SPEC VXWORKS_STARTFILE_SPEC 109#undef ENDFILE_SPEC 110#define ENDFILE_SPEC VXWORKS_ENDFILE_SPEC 111 112/* There is no default multilib. */ 113#undef MULTILIB_DEFAULTS 114 115#undef TARGET_DEFAULT 116#define TARGET_DEFAULT (MASK_EABI | MASK_STRICT_ALIGN) 117 118#undef PROCESSOR_DEFAULT 119#define PROCESSOR_DEFAULT PROCESSOR_PPC604 120 121/* Nor sdata, for kernel mode. We use this in 122 SUBSUBTARGET_INITIALIZE_OPTIONS, after rs6000_rtp has been initialized. */ 123#undef SDATA_DEFAULT_SIZE 124#define SDATA_DEFAULT_SIZE (TARGET_VXWORKS_RTP ? 8 : 0) 125 126/* Enforce 16-byte alignment for the stack pointer, to permit general 127 compliance with e.g. Altivec instructions requirements. Make sure 128 this isn't overruled by the EABI constraints. */ 129 130#undef STACK_BOUNDARY 131#define STACK_BOUNDARY (16*BITS_PER_UNIT) 132 133#undef PREFERRED_STACK_BOUNDARY 134#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY 135 136#undef ABI_STACK_BOUNDARY 137 138#undef RS6000_STARTING_FRAME_OFFSET 139#define RS6000_STARTING_FRAME_OFFSET \ 140 (cfun->calls_alloca \ 141 ? RS6000_ALIGN (crtl->outgoing_args_size + RS6000_SAVE_AREA, 16) \ 142 : (RS6000_ALIGN (crtl->outgoing_args_size, 16) + RS6000_SAVE_AREA)) 143 144#undef STACK_DYNAMIC_OFFSET 145#define STACK_DYNAMIC_OFFSET(FUNDECL) \ 146 RS6000_ALIGN (crtl->outgoing_args_size.to_constant () \ 147 + STACK_POINTER_OFFSET, 16) 148 149#undef SUBSUBTARGET_OVERRIDE_OPTIONS 150#define SUBSUBTARGET_OVERRIDE_OPTIONS \ 151 do { \ 152 if (!global_options_set.x_g_switch_value) \ 153 g_switch_value = SDATA_DEFAULT_SIZE; \ 154 VXWORKS_OVERRIDE_OPTIONS; \ 155 } while (0) 156 157/* No _mcount profiling on VxWorks. */ 158#undef FUNCTION_PROFILER 159#define FUNCTION_PROFILER(FILE,LABELNO) VXWORKS_FUNCTION_PROFILER(FILE,LABELNO) 160 161/* Define this to be nonzero if static stack checking is supported. */ 162#define STACK_CHECK_STATIC_BUILTIN 1 163 164/* This platform supports the probing method of stack checking (RTP mode). 165 8K is reserved in the stack to propagate exceptions in case of overflow. */ 166#define STACK_CHECK_PROTECT 8192 167