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