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