Makefile.aarch64 revision 1.22
11.22Sryo# $NetBSD: Makefile.aarch64,v 1.22 2021/02/10 08:25:01 ryo Exp $ 21.1Smatt 31.1Smatt# Makefile for NetBSD 41.1Smatt# 51.1Smatt# This makefile is constructed from a machine description: 61.1Smatt# config machineid 71.1Smatt# Most changes should be made in the machine description 81.1Smatt# /sys/arch/<arch>/conf/``machineid'' 91.1Smatt# after which you should do 101.1Smatt# config machineid 111.1Smatt# Machine generic makefile changes should be made in 121.1Smatt# /sys/arch/arm/conf/Makefile.arm 131.1Smatt# after which config should be rerun for all machines of that type. 141.1Smatt# 151.1Smatt# To specify debugging, add the config line: makeoptions DEBUG="-g" 161.1Smatt# A better way is to specify -g only for a few files. 171.1Smatt# 181.1Smatt# makeoptions DEBUGLIST="uvm* trap if_*" 191.1Smatt 201.1SmattUSETOOLS?= no 211.1SmattNEED_OWN_INSTALL_TARGET?=no 221.1Smatt.include <bsd.own.mk> 231.1Smatt 241.1Smatt## 251.1Smatt## (1) port identification 261.1Smatt## 271.9SryoTHISARM= $S/arch/${MACHINE} 281.11SskrllARM= $S/arch/aarch64 291.11SskrllGENASSYM_CONF= ${ARM}/aarch64/genassym.cf 301.1Smatt.-include "$S/arch/${MACHINE}/conf/Makefile.${MACHINE}.inc" 311.1Smatt 321.1Smatt## 331.1Smatt## (2) compile settings 341.1Smatt## 351.1Smatt# CPPFLAGS set by platform-specific Makefile fragment. 361.9SryoCFLAGS+= -march=armv8-a+nofp+nosimd 371.9Sryo#CFLAGS+= -fomit-frame-pointer 381.9SryoCFLAGS+= -fno-omit-frame-pointer 391.9SryoCFLAGS+= -mno-omit-leaf-frame-pointer 401.9Sryo#CFLAGS+= -mno-unaligned-access 411.9Sryo 421.22Sryo.if defined(PROF) && ${HAVE_GCC:U0} > 0 431.22Sryo# For accurate profiling, it is better to suppress the tail call. 441.22SryoCFLAGS+= -fno-optimize-sibling-calls 451.22Sryo.endif 461.22Sryo 471.19Smaxv.if ${HAVE_LLVM:Uno} == "yes" 481.19Smaxv.if ${ARMV83_PAC:U0} > 0 && ${ARMV85_BTI:U0} > 0 491.19SmaxvCFLAGS+= -mbranch-protection=pac-ret+bti 501.19Smaxv.else 511.19Smaxv.if ${ARMV83_PAC:U0} > 0 521.18SmaxvCFLAGS+= -mbranch-protection=pac-ret 531.18Smaxv.endif 541.19Smaxv.if ${ARMV85_BTI:U0} > 0 551.19SmaxvCFLAGS+= -mbranch-protection=bti 561.19Smaxv.endif 571.19Smaxv.endif 581.19Smaxv.endif 591.18Smaxv 601.21Sryo.if ${HAVE_GCC:U0} > 0 611.21Sryo.if ${ARMV83_PAC:U0} > 0 621.21SryoCFLAGS+= -msign-return-address=all 631.21Sryo.endif 641.21Sryo.if ${ARMV85_BTI:U0} > 0 651.21Sryo# XXX: notyet for gcc 661.21Sryo.endif 671.21Sryo.endif 681.21Sryo 691.13Smaxv.if ${KASAN:U0} > 0 && ${HAVE_GCC:U0} > 0 701.13SmaxvKASANFLAGS= -fsanitize=kernel-address \ 711.14Smaxv --param asan-globals=1 --param asan-stack=1 \ 721.20Smaxv --param asan-instrument-allocas=1 \ 731.15Smaxv -fsanitize-address-use-after-scope \ 741.17Sryo -fasan-shadow-offset=0xDFFF600000000000 751.13Smaxv.for f in subr_asan.c 761.13SmaxvKASANFLAGS.${f}= # empty 771.13Smaxv.endfor 781.13SmaxvCFLAGS+= ${KASANFLAGS.${.IMPSRC:T}:U${KASANFLAGS}} 791.13Smaxv.endif 801.1Smatt 811.1Smatt## 821.1Smatt## (3) libkern and compat 831.1Smatt## 841.12SrinOPT_MODULAR= %MODULAR% 851.1Smatt 861.1Smatt## 871.1Smatt## (4) local objects, compile rules, and dependencies 881.1Smatt## 891.1SmattMD_OBJS+= ${SYSTEM_FIRST_OBJ} locore.o 901.1SmattMD_CFILES+= 911.11SskrllMD_SFILES+= ${SYSTEM_FIRST_SFILE} ${ARM}/aarch64/locore.S 921.1Smatt 931.1Smatt.if defined(SYSTEM_FIRST_OBJ) 941.1Smatt${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h 951.1Smatt ${NORMAL_S} 961.1Smatt.endif 971.1Smatt 981.11Sskrlllocore.o: ${ARM}/aarch64/locore.S assym.h 991.1Smatt ${NORMAL_S} 1001.1Smatt 1011.1Smatt## 1021.1Smatt## (5) link settings 1031.1Smatt## 1041.11SskrllKERNLDSCRIPT?= ${ARM}/conf/kern.ldscript 1051.17SryoLOADADDRESS?= 0xffffc00000000000 1061.1SmattLINKFLAGS_NORMAL= -X 1071.1Smatt 1081.1Smatt# Strip AArch64 mapping symbols from the kernel image, as they interfere 1091.1Smatt# with ddb. Do it differently if 'makeoptions DEBUG="-g"' was specified. 1101.1Smatt.if !defined(DEBUG) || empty(DEBUG:M-g*) 1111.3SjoergSYSTEM_LD_TAIL?= ${OBJCOPY} -w --strip-symbol='[$$][dx]' \ 1121.2Sjoerg --strip-symbol='[$$][dx]\.*' $@ ;\ 1131.1Smatt ${SIZE} $@; chmod 755 $@ 1141.1Smatt.else 1151.1SmattSTRIPFLAGS=-g --strip-symbol='$$x' --strip-symbol='$$d' 1161.1Smatt.endif 1171.1Smatt 1181.1Smatt## 1191.1Smatt## (6) port specific target dependencies 1201.1Smatt## 1211.1Smatt 1221.1Smatt# depend on DIAGNOSTIC etc. 1231.1Smattcpuswitch.o fault.o machdep.o: Makefile 1241.1Smatt 1251.1Smatt# various assembly files that depend on assym.h 1261.1Smattatomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h 1271.1Smattexception.o sigcode.o: assym.h 1281.1Smattspl.o vectors.o: assym.h 1291.1Smatt 1301.1Smatt## 1311.1Smatt## (7) misc settings 1321.1Smatt## 1331.1Smatt 1341.7Srjs# define .MAIN _before_ the make() check, so that implicit target 1351.7Srjs# would be defined 1361.7Srjs.MAIN: all 1371.7Srjs 1381.8Schristos.if !make(obj) && !make(clean) && !make(cleandir) 1391.8Schristos.BEGIN:: 1401.8Schristos -@rm -f arm && \ 1411.7Srjs ln -s $S/arch/arm/include arm 1421.7Srjs.endif 1431.7Srjs 1441.1Smatt## 1451.1Smatt## (8) config(8) generated machinery 1461.1Smatt## 1471.1Smatt%INCLUDES 1481.1Smatt 1491.1Smatt%OBJS 1501.1Smatt 1511.1Smatt%CFILES 1521.1Smatt 1531.1Smatt%SFILES 1541.1Smatt 1551.1Smatt%LOAD 1561.1Smatt 1571.1Smatt%RULES 1581.1Smatt 1591.1Smatt## 1601.1Smatt## (9) after the config file is inserted 1611.1Smatt## 1621.1Smatt 1631.1Smatt## 1641.1Smatt## (10) port independent kernel machinery 1651.1Smatt## 1661.1Smatt 1671.1Smatt.include "$S/conf/Makefile.kern.inc" 1681.1Smatt 1691.1Smatt## 1701.1Smatt## (11) Appending make options. 1711.1Smatt## 1721.1Smatt%MAKEOPTIONSAPPEND 173