| 1 |
709 |
jeremybenn |
/* Definitions of target machine for GNU compiler, NetBSD/arm ELF version.
|
| 2 |
|
|
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2009, 2011
|
| 3 |
|
|
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 |
|
|
/* Run-time Target Specification. */
|
| 23 |
|
|
|
| 24 |
|
|
/* arm.h defaults to ARM6 CPU. */
|
| 25 |
|
|
|
| 26 |
|
|
/* This defaults us to little-endian. */
|
| 27 |
|
|
#ifndef TARGET_ENDIAN_DEFAULT
|
| 28 |
|
|
#define TARGET_ENDIAN_DEFAULT 0
|
| 29 |
|
|
#endif
|
| 30 |
|
|
|
| 31 |
|
|
#undef MULTILIB_DEFAULTS
|
| 32 |
|
|
|
| 33 |
|
|
/* Default it to use ATPCS with soft-VFP. */
|
| 34 |
|
|
#undef TARGET_DEFAULT
|
| 35 |
|
|
#define TARGET_DEFAULT \
|
| 36 |
|
|
(MASK_APCS_FRAME \
|
| 37 |
|
|
| TARGET_ENDIAN_DEFAULT)
|
| 38 |
|
|
|
| 39 |
|
|
#undef ARM_DEFAULT_ABI
|
| 40 |
|
|
#define ARM_DEFAULT_ABI ARM_ABI_ATPCS
|
| 41 |
|
|
|
| 42 |
|
|
#define TARGET_OS_CPP_BUILTINS() \
|
| 43 |
|
|
do \
|
| 44 |
|
|
{ \
|
| 45 |
|
|
NETBSD_OS_CPP_BUILTINS_ELF(); \
|
| 46 |
|
|
} \
|
| 47 |
|
|
while (0)
|
| 48 |
|
|
|
| 49 |
|
|
#undef SUBTARGET_CPP_SPEC
|
| 50 |
|
|
#define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
|
| 51 |
|
|
|
| 52 |
|
|
#undef SUBTARGET_EXTRA_ASM_SPEC
|
| 53 |
|
|
#define SUBTARGET_EXTRA_ASM_SPEC \
|
| 54 |
|
|
"-matpcs %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
|
| 55 |
|
|
|
| 56 |
|
|
/* Default to full VFP if -mfloat-abi=hard is specified. */
|
| 57 |
|
|
#undef SUBTARGET_ASM_FLOAT_SPEC
|
| 58 |
|
|
#define SUBTARGET_ASM_FLOAT_SPEC \
|
| 59 |
|
|
"%{mfloat-abi=hard:{!mfpu=*:-mfpu=vfp}}"
|
| 60 |
|
|
|
| 61 |
|
|
#undef SUBTARGET_EXTRA_SPECS
|
| 62 |
|
|
#define SUBTARGET_EXTRA_SPECS \
|
| 63 |
|
|
{ "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \
|
| 64 |
|
|
{ "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
|
| 65 |
|
|
{ "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
|
| 66 |
|
|
{ "netbsd_entry_point", NETBSD_ENTRY_POINT },
|
| 67 |
|
|
|
| 68 |
|
|
#define NETBSD_ENTRY_POINT "__start"
|
| 69 |
|
|
|
| 70 |
|
|
#undef LINK_SPEC
|
| 71 |
|
|
#define LINK_SPEC \
|
| 72 |
|
|
"-X %{mbig-endian:-EB} %{mlittle-endian:-EL} \
|
| 73 |
|
|
%(netbsd_link_spec)"
|
| 74 |
|
|
|
| 75 |
|
|
/* Make GCC agree with <machine/ansi.h>. */
|
| 76 |
|
|
|
| 77 |
|
|
#undef SIZE_TYPE
|
| 78 |
|
|
#define SIZE_TYPE "long unsigned int"
|
| 79 |
|
|
|
| 80 |
|
|
#undef PTRDIFF_TYPE
|
| 81 |
|
|
#define PTRDIFF_TYPE "long int"
|
| 82 |
|
|
|
| 83 |
|
|
/* We don't have any limit on the length as out debugger is GDB. */
|
| 84 |
|
|
#undef DBX_CONTIN_LENGTH
|
| 85 |
|
|
|
| 86 |
|
|
/* NetBSD does its profiling differently to the Acorn compiler. We
|
| 87 |
|
|
don't need a word following the mcount call; and to skip it
|
| 88 |
|
|
requires either an assembly stub or use of fomit-frame-pointer when
|
| 89 |
|
|
compiling the profiling functions. Since we break Acorn CC
|
| 90 |
|
|
compatibility below a little more won't hurt. */
|
| 91 |
|
|
|
| 92 |
|
|
#undef ARM_FUNCTION_PROFILER
|
| 93 |
|
|
#define ARM_FUNCTION_PROFILER(STREAM,LABELNO) \
|
| 94 |
|
|
{ \
|
| 95 |
|
|
asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n"); \
|
| 96 |
|
|
asm_fprintf (STREAM, "\tbl\t__mcount%s\n", \
|
| 97 |
|
|
(TARGET_ARM && NEED_PLT_RELOC) \
|
| 98 |
|
|
? "(PLT)" : ""); \
|
| 99 |
|
|
}
|
| 100 |
|
|
|
| 101 |
|
|
/* VERY BIG NOTE: Change of structure alignment for NetBSD/arm.
|
| 102 |
|
|
There are consequences you should be aware of...
|
| 103 |
|
|
|
| 104 |
|
|
Normally GCC/arm uses a structure alignment of 32 for compatibility
|
| 105 |
|
|
with armcc. This means that structures are padded to a word
|
| 106 |
|
|
boundary. However this causes problems with bugged NetBSD kernel
|
| 107 |
|
|
code (possibly userland code as well - I have not checked every
|
| 108 |
|
|
binary). The nature of this bugged code is to rely on sizeof()
|
| 109 |
|
|
returning the correct size of various structures rounded to the
|
| 110 |
|
|
nearest byte (SCSI and ether code are two examples, the vm system
|
| 111 |
|
|
is another). This code breaks when the structure alignment is 32
|
| 112 |
|
|
as sizeof() will report a word=rounded size. By changing the
|
| 113 |
|
|
structure alignment to 8. GCC will conform to what is expected by
|
| 114 |
|
|
NetBSD.
|
| 115 |
|
|
|
| 116 |
|
|
This has several side effects that should be considered.
|
| 117 |
|
|
1. Structures will only be aligned to the size of the largest member.
|
| 118 |
|
|
i.e. structures containing only bytes will be byte aligned.
|
| 119 |
|
|
structures containing shorts will be half word aligned.
|
| 120 |
|
|
structures containing ints will be word aligned.
|
| 121 |
|
|
|
| 122 |
|
|
This means structures should be padded to a word boundary if
|
| 123 |
|
|
alignment of 32 is required for byte structures etc.
|
| 124 |
|
|
|
| 125 |
|
|
2. A potential performance penalty may exist if strings are no longer
|
| 126 |
|
|
word aligned. GCC will not be able to use word load/stores to copy
|
| 127 |
|
|
short strings.
|
| 128 |
|
|
|
| 129 |
|
|
This modification is not encouraged but with the present state of the
|
| 130 |
|
|
NetBSD source tree it is currently the only solution that meets the
|
| 131 |
|
|
requirements. */
|
| 132 |
|
|
|
| 133 |
|
|
#undef DEFAULT_STRUCTURE_SIZE_BOUNDARY
|
| 134 |
|
|
#define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8
|
| 135 |
|
|
|
| 136 |
|
|
/* Clear the instruction cache from `BEG' to `END'. This makes a
|
| 137 |
|
|
call to the ARM_SYNC_ICACHE architecture specific syscall. */
|
| 138 |
|
|
#define CLEAR_INSN_CACHE(BEG, END) \
|
| 139 |
|
|
do \
|
| 140 |
|
|
{ \
|
| 141 |
|
|
extern int sysarch(int number, void *args); \
|
| 142 |
|
|
struct \
|
| 143 |
|
|
{ \
|
| 144 |
|
|
unsigned int addr; \
|
| 145 |
|
|
int len; \
|
| 146 |
|
|
} s; \
|
| 147 |
|
|
s.addr = (unsigned int)(BEG); \
|
| 148 |
|
|
s.len = (END) - (BEG); \
|
| 149 |
|
|
(void) sysarch (0, &s); \
|
| 150 |
|
|
} \
|
| 151 |
|
|
while (0)
|
| 152 |
|
|
|
| 153 |
|
|
#undef FPUTYPE_DEFAULT
|
| 154 |
|
|
#define FPUTYPE_DEFAULT "vfp"
|
| 155 |
|
|
|