1 /* Definitions of target machine for GNU compiler, 2 for PowerPC NetBSD systems. 3 Copyright 2002, 2003, 2007, 2008 Free Software Foundation, Inc. 4 Contributed by Wasabi Systems, Inc. 5 6 This file is part of GCC. 7 8 GCC is free software; you can redistribute it and/or modify it 9 under the terms of the GNU General Public License as published 10 by the Free Software Foundation; either version 3, or (at your 11 option) any later version. 12 13 GCC is distributed in the hope that it will be useful, but WITHOUT 14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 16 License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with GCC; see the file COPYING3. If not see 20 <http://www.gnu.org/licenses/>. */ 21 22 /* This defines which switch letters take arguments. On NetBSD, most 23 of the normal cases (defined by gcc.c) apply, and we also have -h* 24 and -z* options (for the linker) (coming from SVR4). 25 Copied from ../netbsd-elf.h and re{undef,defined} here to 26 override the powerpc sysv4.h definition. 27 netbsd-elf.h defines the default list + 'h' + 'z' + 'R'. 28 rs6000/sysv4.h defines the default list + 'G'. */ 29 30 #undef SWITCH_TAKES_ARG 31 #define SWITCH_TAKES_ARG(CHAR) \ 32 (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ 33 || (CHAR) == 'h' \ 34 || (CHAR) == 'z' \ 35 || (CHAR) == 'R' \ 36 || (CHAR) == 'G') 37 38 #undef TARGET_OS_CPP_BUILTINS /* FIXME: sysv4.h should not define this! */ 39 #define TARGET_OS_CPP_BUILTINS() \ 40 do \ 41 { \ 42 NETBSD_OS_CPP_BUILTINS_ELF(); \ 43 builtin_define ("__powerpc__"); \ 44 builtin_assert ("cpu=powerpc"); \ 45 builtin_assert ("machine=powerpc"); \ 46 if (TARGET_SECURE_PLT) \ 47 builtin_define ("_SECURE_PLT"); \ 48 if (TARGET_SOFT_FLOAT) \ 49 builtin_define ("_SOFT_FLOAT"); \ 50 } \ 51 while (0) 52 53 /* Override the default from rs6000.h to avoid conflicts with macros 54 defined in NetBSD header files. */ 55 56 #undef RS6000_CPU_CPP_ENDIAN_BUILTINS 57 #define RS6000_CPU_CPP_ENDIAN_BUILTINS() \ 58 do \ 59 { \ 60 if (BYTES_BIG_ENDIAN) \ 61 { \ 62 builtin_define ("__BIG_ENDIAN__"); \ 63 builtin_assert ("machine=bigendian"); \ 64 } \ 65 else \ 66 { \ 67 builtin_define ("__LITTLE_ENDIAN__"); \ 68 builtin_assert ("machine=littleendian"); \ 69 } \ 70 } \ 71 while (0) 72 73 /* Make GCC agree with <machine/ansi.h>. */ 74 75 #undef SIZE_TYPE 76 #define SIZE_TYPE "unsigned int" 77 78 #undef PTRDIFF_TYPE 79 #define PTRDIFF_TYPE "int" 80 81 /* Redefine some types that where redefined by rs6000 include files. */ 82 83 #undef WCHAR_TYPE 84 #define WCHAR_TYPE "int" 85 86 #undef WCHAR_TYPE_SIZE 87 #define WCHAR_TYPE_SIZE 32 88 89 #undef WINT_TYPE 90 #define WINT_TYPE "int" 91 92 /* Undo the spec mess from sysv4.h, and just define the specs 93 the way NetBSD systems actually expect. */ 94 95 #undef CPP_SPEC 96 #define CPP_SPEC NETBSD_CPP_SPEC 97 98 #undef LINK_SPEC 99 #define LINK_SPEC \ 100 "%{!msdata=none:%{G*}} %{msdata=none:-G0} \ 101 %(netbsd_link_spec)" 102 103 #define NETBSD_ENTRY_POINT "_start" 104 105 #undef STARTFILE_SPEC 106 #define STARTFILE_SPEC NETBSD_STARTFILE_SPEC 107 108 #undef ENDFILE_SPEC 109 #define ENDFILE_SPEC "%(netbsd_endfile_spec)" 110 111 #undef LIB_SPEC 112 #define LIB_SPEC NETBSD_LIB_SPEC 113 114 #undef SUBTARGET_EXTRA_SPECS 115 #define SUBTARGET_EXTRA_SPECS \ 116 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \ 117 { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \ 118 { "netbsd_entry_point", NETBSD_ENTRY_POINT }, \ 119 { "netbsd_endfile_spec", NETBSD_ENDFILE_SPEC }, 120 121 /* 122 * Add NetBSD specific defaults: -mpowerpc -mnew_mnemonics -mstrict-align 123 */ 124 #undef TARGET_DEFAULT 125 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_STRICT_ALIGN) 126 127 /* 128 * We know we have the right binutils for this (we shouldn't need to do this 129 * but until the cross build does the right thing...) 130 */ 131 #undef TARGET_SECURE_PLT 132 #define TARGET_SECURE_PLT secure_plt 133 #undef HAVE_AS_TLS 134 #define HAVE_AS_TLS 1 135 136 /* Attempt to enable execute permissions on the stack. */ 137 #define TRANSFER_FROM_TRAMPOLINE NETBSD_ENABLE_EXECUTE_STACK 138 #ifdef L_trampoline 139 #undef TRAMPOLINE_SIZE 140 #define TRAMPOLINE_SIZE 48 141 #endif 142 143 /* Make sure _enable_execute_stack() isn't the empty function in libgcc2.c. 144 It gets defined in _trampoline.o via NETBSD_ENABLE_EXECUTE_STACK. */ 145 #undef ENABLE_EXECUTE_STACK 146 #define ENABLE_EXECUTE_STACK 147 148 /* Override STACK_BOUNDARY to use Altivec compliant one. */ 149 #undef STACK_BOUNDARY 150 #define STACK_BOUNDARY 128 151 152 #undef TARGET_VERSION 153 #define TARGET_VERSION fprintf (stderr, " (NetBSD/powerpc ELF)"); 154