blob: d35be92f8c4af199946cedef419a686061c16dc6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
# $NetBSD: Makefile.aarch64,v 1.23 2021/05/27 06:19:38 ryo Exp $
# Makefile for NetBSD
#
# This makefile is constructed from a machine description:
# config machineid
# Most changes should be made in the machine description
# /sys/arch/<arch>/conf/``machineid''
# after which you should do
# config machineid
# Machine generic makefile changes should be made in
# /sys/arch/arm/conf/Makefile.arm
# after which config should be rerun for all machines of that type.
#
# To specify debugging, add the config line: makeoptions DEBUG="-g"
# A better way is to specify -g only for a few files.
#
# makeoptions DEBUGLIST="uvm* trap if_*"
USETOOLS?= no
NEED_OWN_INSTALL_TARGET?=no
.include <bsd.own.mk>
##
## (1) port identification
##
THISARM= $S/arch/${MACHINE}
ARM= $S/arch/aarch64
GENASSYM_CONF= ${ARM}/aarch64/genassym.cf
.-include "$S/arch/${MACHINE}/conf/Makefile.${MACHINE}.inc"
##
## (2) compile settings
##
# CPPFLAGS set by platform-specific Makefile fragment.
CFLAGS+= -march=armv8-a+nofp+nosimd
#CFLAGS+= -fomit-frame-pointer
CFLAGS+= -fno-omit-frame-pointer
CFLAGS+= -mno-omit-leaf-frame-pointer
#CFLAGS+= -mno-unaligned-access
.if defined(PROF) && ${HAVE_GCC:U0} > 0
# For accurate profiling, it is better to suppress the tail call.
CFLAGS+= -fno-optimize-sibling-calls
.endif
.if ${ARMV83_PAC:U0} > 0 && ${ARMV85_BTI:U0} > 0
CFLAGS+= -mbranch-protection=pac-ret+bti
.else
.if ${ARMV83_PAC:U0} > 0
CFLAGS+= -mbranch-protection=pac-ret
.endif
.if ${ARMV85_BTI:U0} > 0
CFLAGS+= -mbranch-protection=bti
.endif
.endif
.if ${KASAN:U0} > 0 && ${HAVE_GCC:U0} > 0
KASANFLAGS= -fsanitize=kernel-address \
--param asan-globals=1 --param asan-stack=1 \
--param asan-instrument-allocas=1 \
-fsanitize-address-use-after-scope \
-fasan-shadow-offset=0xDFFF600000000000
.for f in subr_asan.c
KASANFLAGS.${f}= # empty
.endfor
CFLAGS+= ${KASANFLAGS.${.IMPSRC:T}:U${KASANFLAGS}}
.endif
##
## (3) libkern and compat
##
OPT_MODULAR= %MODULAR%
##
## (4) local objects, compile rules, and dependencies
##
MD_OBJS+= ${SYSTEM_FIRST_OBJ} locore.o
MD_CFILES+=
MD_SFILES+= ${SYSTEM_FIRST_SFILE} ${ARM}/aarch64/locore.S
.if defined(SYSTEM_FIRST_OBJ)
${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h
${NORMAL_S}
.endif
locore.o: ${ARM}/aarch64/locore.S assym.h
${NORMAL_S}
##
## (5) link settings
##
KERNLDSCRIPT?= ${ARM}/conf/kern.ldscript
LOADADDRESS?= 0xffffc00000000000
LINKFLAGS_NORMAL= -X
# Strip AArch64 mapping symbols from the kernel image, as they interfere
# with ddb. Do it differently if 'makeoptions DEBUG="-g"' was specified.
.if !defined(DEBUG) || empty(DEBUG:M-g*)
SYSTEM_LD_TAIL?= ${OBJCOPY} -w --strip-symbol='[$$][dx]' \
--strip-symbol='[$$][dx]\.*' $@ ;\
${SIZE} $@; chmod 755 $@
.else
STRIPFLAGS=-g --strip-symbol='$$x' --strip-symbol='$$d'
.endif
##
## (6) port specific target dependencies
##
# depend on DIAGNOSTIC etc.
cpuswitch.o fault.o machdep.o: Makefile
# various assembly files that depend on assym.h
atomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h
exception.o sigcode.o: assym.h
spl.o vectors.o: assym.h
##
## (7) misc settings
##
# define .MAIN _before_ the make() check, so that implicit target
# would be defined
.MAIN: all
.if !make(obj) && !make(clean) && !make(cleandir)
.BEGIN::
-@rm -f arm && \
ln -s $S/arch/arm/include arm
.endif
##
## (8) config(8) generated machinery
##
%INCLUDES
%OBJS
%CFILES
%SFILES
%LOAD
%RULES
##
## (9) after the config file is inserted
##
##
## (10) port independent kernel machinery
##
.include "$S/conf/Makefile.kern.inc"
##
## (11) Appending make options.
##
%MAKEOPTIONSAPPEND
|