1117395Skan/* Definitions of target machine for GNU compiler, NetBSD/arm ELF version. 2169689Skan Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 3117395Skan Contributed by Wasabi Systems, Inc. 4117395Skan 5132718Skan This file is part of GCC. 6117395Skan 7132718Skan GCC is free software; you can redistribute it and/or modify it 8132718Skan under the terms of the GNU General Public License as published 9132718Skan by the Free Software Foundation; either version 2, or (at your 10132718Skan option) any later version. 11117395Skan 12132718Skan GCC is distributed in the hope that it will be useful, but WITHOUT 13132718Skan ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14132718Skan or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 15132718Skan License for more details. 16117395Skan 17132718Skan You should have received a copy of the GNU General Public License 18132718Skan along with GCC; see the file COPYING. If not, write to 19169689Skan the Free Software Foundation, 51 Franklin Street, Fifth Floor, 20169689Skan Boston, MA 02110-1301, USA. */ 21117395Skan 22117395Skan/* Run-time Target Specification. */ 23117395Skan#undef TARGET_VERSION 24117395Skan#define TARGET_VERSION fputs (" (NetBSD/arm ELF)", stderr); 25117395Skan 26117395Skan/* arm.h defaults to ARM6 CPU. */ 27117395Skan 28117395Skan/* This defaults us to little-endian. */ 29117395Skan#ifndef TARGET_ENDIAN_DEFAULT 30117395Skan#define TARGET_ENDIAN_DEFAULT 0 31117395Skan#endif 32117395Skan 33117395Skan#undef MULTILIB_DEFAULTS 34117395Skan 35117395Skan/* Default it to use ATPCS with soft-VFP. */ 36117395Skan#undef TARGET_DEFAULT 37117395Skan#define TARGET_DEFAULT \ 38169689Skan (MASK_APCS_FRAME \ 39117395Skan | TARGET_ENDIAN_DEFAULT) 40117395Skan 41169689Skan#undef ARM_DEFAULT_ABI 42169689Skan#define ARM_DEFAULT_ABI ARM_ABI_ATPCS 43169689Skan 44117395Skan#define TARGET_OS_CPP_BUILTINS() \ 45117395Skan do \ 46117395Skan { \ 47117395Skan NETBSD_OS_CPP_BUILTINS_ELF(); \ 48117395Skan } \ 49117395Skan while (0) 50117395Skan 51117395Skan#undef SUBTARGET_CPP_SPEC 52117395Skan#define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC 53117395Skan 54117395Skan#undef SUBTARGET_EXTRA_ASM_SPEC 55117395Skan#define SUBTARGET_EXTRA_ASM_SPEC \ 56132718Skan "-matpcs %{fpic|fpie:-k} %{fPIC|fPIE:-k}" 57117395Skan 58169689Skan/* Default to full VFP if -mhard-float is specified. */ 59117395Skan#undef SUBTARGET_ASM_FLOAT_SPEC 60117395Skan#define SUBTARGET_ASM_FLOAT_SPEC \ 61169689Skan "%{mhard-float:{!mfpu=*:-mfpu=vfp}} \ 62169689Skan %{mfloat-abi=hard:{!mfpu=*:-mfpu=vfp}}" 63117395Skan 64117395Skan#undef SUBTARGET_EXTRA_SPECS 65117395Skan#define SUBTARGET_EXTRA_SPECS \ 66117395Skan { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \ 67117395Skan { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \ 68117395Skan { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \ 69117395Skan { "netbsd_entry_point", NETBSD_ENTRY_POINT }, 70117395Skan 71117395Skan#define NETBSD_ENTRY_POINT "__start" 72117395Skan 73117395Skan#undef LINK_SPEC 74117395Skan#define LINK_SPEC \ 75117395Skan "-X %{mbig-endian:-EB} %{mlittle-endian:-EL} \ 76117395Skan %(netbsd_link_spec)" 77117395Skan 78117395Skan/* Make GCC agree with <machine/ansi.h>. */ 79117395Skan 80117395Skan#undef SIZE_TYPE 81117395Skan#define SIZE_TYPE "long unsigned int" 82117395Skan 83117395Skan#undef PTRDIFF_TYPE 84117395Skan#define PTRDIFF_TYPE "long int" 85117395Skan 86117395Skan/* We don't have any limit on the length as out debugger is GDB. */ 87117395Skan#undef DBX_CONTIN_LENGTH 88117395Skan 89117395Skan/* NetBSD does its profiling differently to the Acorn compiler. We 90117395Skan don't need a word following the mcount call; and to skip it 91117395Skan requires either an assembly stub or use of fomit-frame-pointer when 92117395Skan compiling the profiling functions. Since we break Acorn CC 93117395Skan compatibility below a little more won't hurt. */ 94117395Skan 95117395Skan#undef ARM_FUNCTION_PROFILER 96117395Skan#define ARM_FUNCTION_PROFILER(STREAM,LABELNO) \ 97117395Skan{ \ 98117395Skan asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n"); \ 99117395Skan asm_fprintf (STREAM, "\tbl\t__mcount%s\n", \ 100169689Skan (TARGET_ARM && NEED_PLT_RELOC) \ 101169689Skan ? "(PLT)" : ""); \ 102117395Skan} 103117395Skan 104117395Skan/* VERY BIG NOTE: Change of structure alignment for NetBSD/arm. 105117395Skan There are consequences you should be aware of... 106117395Skan 107117395Skan Normally GCC/arm uses a structure alignment of 32 for compatibility 108117395Skan with armcc. This means that structures are padded to a word 109117395Skan boundary. However this causes problems with bugged NetBSD kernel 110117395Skan code (possibly userland code as well - I have not checked every 111117395Skan binary). The nature of this bugged code is to rely on sizeof() 112117395Skan returning the correct size of various structures rounded to the 113117395Skan nearest byte (SCSI and ether code are two examples, the vm system 114117395Skan is another). This code breaks when the structure alignment is 32 115117395Skan as sizeof() will report a word=rounded size. By changing the 116117395Skan structure alignment to 8. GCC will conform to what is expected by 117117395Skan NetBSD. 118117395Skan 119117395Skan This has several side effects that should be considered. 120117395Skan 1. Structures will only be aligned to the size of the largest member. 121117395Skan i.e. structures containing only bytes will be byte aligned. 122132718Skan structures containing shorts will be half word aligned. 123117395Skan structures containing ints will be word aligned. 124117395Skan 125117395Skan This means structures should be padded to a word boundary if 126117395Skan alignment of 32 is required for byte structures etc. 127117395Skan 128117395Skan 2. A potential performance penalty may exist if strings are no longer 129117395Skan word aligned. GCC will not be able to use word load/stores to copy 130117395Skan short strings. 131117395Skan 132117395Skan This modification is not encouraged but with the present state of the 133117395Skan NetBSD source tree it is currently the only solution that meets the 134117395Skan requirements. */ 135117395Skan 136117395Skan#undef DEFAULT_STRUCTURE_SIZE_BOUNDARY 137117395Skan#define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8 138117395Skan 139117395Skan/* Clear the instruction cache from `BEG' to `END'. This makes a 140117395Skan call to the ARM_SYNC_ICACHE architecture specific syscall. */ 141117395Skan#define CLEAR_INSN_CACHE(BEG, END) \ 142117395Skando \ 143117395Skan { \ 144117395Skan extern int sysarch(int number, void *args); \ 145117395Skan struct \ 146117395Skan { \ 147117395Skan unsigned int addr; \ 148117395Skan int len; \ 149117395Skan } s; \ 150117395Skan s.addr = (unsigned int)(BEG); \ 151117395Skan s.len = (END) - (BEG); \ 152117395Skan (void) sysarch (0, &s); \ 153117395Skan } \ 154117395Skanwhile (0) 155169689Skan 156169689Skan#undef FPUTYPE_DEFAULT 157169689Skan#define FPUTYPE_DEFAULT FPUTYPE_VFP 158169689Skan 159