1 /* Definitions of target machine for GNU compiler, NetBSD/arm ELF version.
2 Copyright (C) 2002-2015 Free Software Foundation, Inc.
3 Contributed by Wasabi Systems, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published
9 by the Free Software Foundation; either version 3, or (at your
10 option) any later version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
26 /* Run-time Target Specification. */
28 /* arm.h defaults to ARM6 CPU. */
30 /* This defaults us to little-endian. */
31 #ifndef TARGET_ENDIAN_DEFAULT
32 #define TARGET_ENDIAN_DEFAULT 0
35 #undef MULTILIB_DEFAULTS
37 /* Default it to use ATPCS with soft-VFP. */
39 #define TARGET_DEFAULT \
41 | TARGET_ENDIAN_DEFAULT)
43 #undef ARM_DEFAULT_ABI
44 #define ARM_DEFAULT_ABI ARM_ABI_ATPCS
46 #define TARGET_OS_CPP_BUILTINS() \
49 NETBSD_OS_CPP_BUILTINS_ELF(); \
53 #undef SUBTARGET_CPP_SPEC
54 #define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
56 #undef SUBTARGET_EXTRA_ASM_SPEC
57 #define SUBTARGET_EXTRA_ASM_SPEC \
58 "-matpcs %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
60 /* Default to full VFP if -mfloat-abi=hard is specified. */
61 #undef SUBTARGET_ASM_FLOAT_SPEC
62 #define SUBTARGET_ASM_FLOAT_SPEC \
63 "%{mfloat-abi=hard:{!mfpu=*:-mfpu=vfp}}"
65 #undef SUBTARGET_EXTRA_SPECS
66 #define SUBTARGET_EXTRA_SPECS \
67 { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \
68 { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
69 { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
70 { "netbsd_entry_point", NETBSD_ENTRY_POINT },
72 #define NETBSD_ENTRY_POINT "__start"
76 "-X %{mbig-endian:-EB} %{mlittle-endian:-EL} \
79 /* Make GCC agree with <machine/ansi.h>. */
82 #define SIZE_TYPE "long unsigned int"
85 #define PTRDIFF_TYPE "long int"
87 /* We don't have any limit on the length as out debugger is GDB. */
88 #undef DBX_CONTIN_LENGTH
90 /* NetBSD does its profiling differently to the Acorn compiler. We
91 don't need a word following the mcount call; and to skip it
92 requires either an assembly stub or use of fomit-frame-pointer when
93 compiling the profiling functions. Since we break Acorn CC
94 compatibility below a little more won't hurt. */
96 #undef ARM_FUNCTION_PROFILER
97 #define ARM_FUNCTION_PROFILER(STREAM,LABELNO) \
99 asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n"); \
100 asm_fprintf (STREAM, "\tbl\t__mcount%s\n", \
101 (TARGET_ARM && NEED_PLT_RELOC) \
105 /* VERY BIG NOTE: Change of structure alignment for NetBSD/arm.
106 There are consequences you should be aware of...
108 Normally GCC/arm uses a structure alignment of 32 for compatibility
109 with armcc. This means that structures are padded to a word
110 boundary. However this causes problems with bugged NetBSD kernel
111 code (possibly userland code as well - I have not checked every
112 binary). The nature of this bugged code is to rely on sizeof()
113 returning the correct size of various structures rounded to the
114 nearest byte (SCSI and ether code are two examples, the vm system
115 is another). This code breaks when the structure alignment is 32
116 as sizeof() will report a word=rounded size. By changing the
117 structure alignment to 8. GCC will conform to what is expected by
120 This has several side effects that should be considered.
121 1. Structures will only be aligned to the size of the largest member.
122 i.e. structures containing only bytes will be byte aligned.
123 structures containing shorts will be half word aligned.
124 structures containing ints will be word aligned.
126 This means structures should be padded to a word boundary if
127 alignment of 32 is required for byte structures etc.
129 2. A potential performance penalty may exist if strings are no longer
130 word aligned. GCC will not be able to use word load/stores to copy
133 This modification is not encouraged but with the present state of the
134 NetBSD source tree it is currently the only solution that meets the
137 #undef DEFAULT_STRUCTURE_SIZE_BOUNDARY
138 #define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8
140 /* Clear the instruction cache from `BEG' to `END'. This makes a
141 call to the ARM_SYNC_ICACHE architecture specific syscall. */
142 #define CLEAR_INSN_CACHE(BEG, END) \
145 extern int sysarch(int number, void *args); \
151 s.addr = (unsigned int)(BEG); \
152 s.len = (END) - (BEG); \
153 (void) sysarch (0, &s); \
157 #undef FPUTYPE_DEFAULT
158 #define FPUTYPE_DEFAULT "vfp"