1*0cdf705cSLionel Sambuc /* Definitions for ARM running MINIX using the ELF format 2b86af8beSLionel Sambuc Copyright (C) 2001, 2004, 2007 Free Software Foundation, Inc. 3b86af8beSLionel Sambuc Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi. 4*0cdf705cSLionel Sambuc Adapted for MINIX by Lionel Sambuc <lionel@minix3.org> 5b86af8beSLionel Sambuc 6b86af8beSLionel Sambuc This file is part of GCC. 7b86af8beSLionel Sambuc 8b86af8beSLionel Sambuc GCC is free software; you can redistribute it and/or modify it 9b86af8beSLionel Sambuc under the terms of the GNU General Public License as published 10b86af8beSLionel Sambuc by the Free Software Foundation; either version 3, or (at your 11b86af8beSLionel Sambuc option) any later version. 12b86af8beSLionel Sambuc 13b86af8beSLionel Sambuc GCC is distributed in the hope that it will be useful, but WITHOUT 14b86af8beSLionel Sambuc ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15b86af8beSLionel Sambuc or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 16b86af8beSLionel Sambuc License for more details. 17b86af8beSLionel Sambuc 18b86af8beSLionel Sambuc You should have received a copy of the GNU General Public License 19b86af8beSLionel Sambuc along with GCC; see the file COPYING3. If not see 20b86af8beSLionel Sambuc <http://www.gnu.org/licenses/>. */ 21b86af8beSLionel Sambuc 22b86af8beSLionel Sambuc #undef MINIX_TARGET_CPU_CPP_BUILTINS 23b86af8beSLionel Sambuc #define MINIX_TARGET_CPU_CPP_BUILTINS() \ 24b86af8beSLionel Sambuc do \ 25b86af8beSLionel Sambuc { \ 26b86af8beSLionel Sambuc TARGET_BPABI_CPP_BUILTINS(); \ 27b86af8beSLionel Sambuc } \ 28b86af8beSLionel Sambuc while (0) 29b86af8beSLionel Sambuc 30b86af8beSLionel Sambuc /* Define the actual types of some ANSI-mandated types. 31b86af8beSLionel Sambuc Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c, 32b86af8beSLionel Sambuc c-common.c, and config/<arch>/<arch>.h. */ 33b86af8beSLionel Sambuc #undef SIZE_TYPE 34b86af8beSLionel Sambuc #define SIZE_TYPE "unsigned int" 35b86af8beSLionel Sambuc 36b86af8beSLionel Sambuc #undef PTRDIFF_TYPE 37b86af8beSLionel Sambuc #define PTRDIFF_TYPE "int" 38b86af8beSLionel Sambuc 39b86af8beSLionel Sambuc #undef WCHAR_TYPE 40b86af8beSLionel Sambuc #define WCHAR_TYPE "int" 41b86af8beSLionel Sambuc 42*0cdf705cSLionel Sambuc /* VERY BIG NOTE: Change of structure alignment for NetBSD/arm. 43*0cdf705cSLionel Sambuc There are consequences you should be aware of... 44*0cdf705cSLionel Sambuc 45*0cdf705cSLionel Sambuc Normally GCC/arm uses a structure alignment of 32 for compatibility 46*0cdf705cSLionel Sambuc with armcc. This means that structures are padded to a word 47*0cdf705cSLionel Sambuc boundary. However this causes problems with bugged NetBSD kernel 48*0cdf705cSLionel Sambuc code (possibly userland code as well - I have not checked every 49*0cdf705cSLionel Sambuc binary). The nature of this bugged code is to rely on sizeof() 50*0cdf705cSLionel Sambuc returning the correct size of various structures rounded to the 51*0cdf705cSLionel Sambuc nearest byte (SCSI and ether code are two examples, the vm system 52*0cdf705cSLionel Sambuc is another). This code breaks when the structure alignment is 32 53*0cdf705cSLionel Sambuc as sizeof() will report a word=rounded size. By changing the 54*0cdf705cSLionel Sambuc structure alignment to 8. GCC will conform to what is expected by 55*0cdf705cSLionel Sambuc NetBSD. 56*0cdf705cSLionel Sambuc 57*0cdf705cSLionel Sambuc This has several side effects that should be considered. 58*0cdf705cSLionel Sambuc 1. Structures will only be aligned to the size of the largest member. 59*0cdf705cSLionel Sambuc i.e. structures containing only bytes will be byte aligned. 60*0cdf705cSLionel Sambuc structures containing shorts will be half word aligned. 61*0cdf705cSLionel Sambuc structures containing ints will be word aligned. 62*0cdf705cSLionel Sambuc 63*0cdf705cSLionel Sambuc This means structures should be padded to a word boundary if 64*0cdf705cSLionel Sambuc alignment of 32 is required for byte structures etc. 65*0cdf705cSLionel Sambuc 66*0cdf705cSLionel Sambuc 2. A potential performance penalty may exist if strings are no longer 67*0cdf705cSLionel Sambuc word aligned. GCC will not be able to use word load/stores to copy 68*0cdf705cSLionel Sambuc short strings. 69*0cdf705cSLionel Sambuc 70*0cdf705cSLionel Sambuc This modification is not encouraged but with the present state of the 71*0cdf705cSLionel Sambuc NetBSD source tree it is currently the only solution that meets the 72*0cdf705cSLionel Sambuc requirements. */ 73*0cdf705cSLionel Sambuc 74*0cdf705cSLionel Sambuc #undef DEFAULT_STRUCTURE_SIZE_BOUNDARY 75*0cdf705cSLionel Sambuc #define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8 76*0cdf705cSLionel Sambuc 77*0cdf705cSLionel Sambuc /* Fixed-sized enum by default (-fno-short-enums) */ 78*0cdf705cSLionel Sambuc #undef MINIX_CC1_SPEC 79*0cdf705cSLionel Sambuc #define MINIX_CC1_SPEC "%{!fshort-enums:%{!fno-short-enums:-fno-short-enums}} " 80b86af8beSLionel Sambuc 81b86af8beSLionel Sambuc /* Use by default the new abi and calling standard */ 82b86af8beSLionel Sambuc #undef ARM_DEFAULT_ABI 83b86af8beSLionel Sambuc #define ARM_DEFAULT_ABI ARM_ABI_AAPCS 84b86af8beSLionel Sambuc 85*0cdf705cSLionel Sambuc /* LSC: FIXME: When activated, some programs crash on qemu with an illegal 86*0cdf705cSLionel Sambuc * instruction. 87*0cdf705cSLionel Sambuc * The cause is unknown (Missing support on MINIX, missing support 88*0cdf705cSLionel Sambuc * on the emulator, library error...). 89*0cdf705cSLionel Sambuc */ 90*0cdf705cSLionel Sambuc #if 0 91*0cdf705cSLionel Sambuc /* Make sure we use hard-floating point ABI by default */ 92*0cdf705cSLionel Sambuc #undef TARGET_DEFAULT_FLOAT_ABI 93*0cdf705cSLionel Sambuc #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD 94b86af8beSLionel Sambuc #endif 95b86af8beSLionel Sambuc 96*0cdf705cSLionel Sambuc /* Default to full VFP if -mhard-float is specified. */ 97*0cdf705cSLionel Sambuc #undef MINIX_SUBTARGET_ASM_FLOAT_SPEC 98*0cdf705cSLionel Sambuc #define MINIX_SUBTARGET_ASM_FLOAT_SPEC \ 99*0cdf705cSLionel Sambuc "%{mhard-float:{!mfpu=*:-mfpu=vfpv3-d16}} \ 100*0cdf705cSLionel Sambuc %{mfloat-abi=hard:{!mfpu=*:-mfpu=vfpv3-d16}}" 101*0cdf705cSLionel Sambuc 102*0cdf705cSLionel Sambuc #undef MINIX_SUBTARGET_EXTRA_ASM_SPEC 103*0cdf705cSLionel Sambuc #define MINIX_SUBTARGET_EXTRA_ASM_SPEC \ 104*0cdf705cSLionel Sambuc "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" \ 105*0cdf705cSLionel Sambuc TARGET_FIX_V4BX_SPEC \ 106*0cdf705cSLionel Sambuc "%{fpic|fpie:-k} %{fPIC|fPIE:-k}" 107*0cdf705cSLionel Sambuc 108*0cdf705cSLionel Sambuc /* Little endian by default */ 109*0cdf705cSLionel Sambuc #undef TARGET_ENDIAN_DEFAULT 110*0cdf705cSLionel Sambuc #define TARGET_ENDIAN_DEFAULT 0 111*0cdf705cSLionel Sambuc 112b86af8beSLionel Sambuc #undef SUBTARGET_CPU_DEFAULT 113b86af8beSLionel Sambuc #define SUBTARGET_CPU_DEFAULT TARGET_CPU_cortexa8 114b86af8beSLionel Sambuc 115b86af8beSLionel Sambuc #undef TARGET_VERSION 116b86af8beSLionel Sambuc #define TARGET_VERSION fputs (" (MINIX/arm ELF EABI)", stderr); 117