NetBSD/sys/rump/Makefile.rump

261 lines
8.0 KiB
Makefile
Raw Normal View History

# $NetBSD: Makefile.rump,v 1.127 2020/03/09 14:45:41 kamil Exp $
#
2014-04-15 17:41:46 +04:00
.if !defined(_RUMP_MK)
_RUMP_MK= #defined
WARNS?= 3 # XXX: src/sys won't compile with -Wsign-compare yet
NOLINT= # kernel code
.include <bsd.own.mk>
# Use NetBSD kernel ABI by default on x86 archs. Performance-related
# compile-time options may override this at a later date.
.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64")
_RUMP_NATIVEABI= yes
.else
_RUMP_NATIVEABI= no
CPPFLAGS:= -I${RUMPTOP}/include ${CPPFLAGS}
CPPFLAGS+= -D_RUMPKERNEL -I${RUMPTOP}/librump/rumpkern
.endif
# We are compiling the kernel code with no-delete-null-pointer-checks,
# and compiling without it, causes issues at least on sh3 by adding
# aborts after kern_assert on NULL pointer checks.
CFLAGS+= ${${ACTIVE_CC} == "gcc":? -fno-delete-null-pointer-checks :}
# Define baseline cpu for mips ports, required for
# rumpcomp_sync_icache() hypercall.
.if !empty(MACHINE_ARCH:Mmips*)
.if !empty(MACHINE_ARCH:Mmips64*)
CPPFLAGS+= -DMIPS64=1
.else
CPPFLAGS+= -DMIPS1=1
.endif
.endif
# which NetBSD compat to build
RUMP_NBCOMPAT?=default
.if ${RUMP_NBCOMPAT} == "all" || ${RUMP_NBCOMPAT} == "default"
implement 32-bit compat support for raidframe. convert several raidframe ioctls to be bitsize idempotent so that they work the same in 32 and 64 bit worlds, allowing netbsd32 to configure and query raid properly. remove useless 'row' in a few places. add COMPAT_80 and put the old ioctls there. raidframeio.h: RAIDFRAME_TEST_ACC - remove, unused RAIDFRAME_GET_COMPONENT_LABEL - convert to label not pointer to label RAIDFRAME_CHECK_RECON_STATUS_EXT RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT RAIDFRAME_CHECK_COPYBACK_STATUS_EXT - convert to progress info not pointer to info RAIDFRAME_GET_INFO - version entirely. raidframevar.h: - rf_recon_req{} has row, flags and raidPtr removed (they're not a useful part of this interface.) - RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed. - RF_RaidDisk_s{} is re-ordered slightly to fix alignment padding - the actual data was already OK. - InstallSpareTable() loses row argument rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32. rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK, RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT, RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT, RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO. move several of the per-ioctl code blocks into separate functions. add rf_recon_req_internal{} to replace old usage of global rf_recon_req{} that had unused void * in the structure, ruining it's 32/64 bit ABI. add missing case for RAIDFRAME_GET_INFO50. adjust raid tests to use the new .conf format, and add a case to test the old method as well. raidctl: deal with lack of 'row' members in a couple of places. fail request no longer takes row. handle "START array" sections with just "numCol numSpare", ie no "numRow" specified. for now, generate old-style configuration but update raidctl.8 to specify the new style (keeping reference to the old style.) note that: RF_ComponentLabel_s::{row,num_rows} and RF_SingleComponent_s::row are obsolete but not removed yet.
2018-01-18 03:32:48 +03:00
RUMP_NBCOMPAT= 50 60 70 80
.endif
.if ${RUMP_NBCOMPAT} == "none"
RUMP_NBCOMPAT=
.endif
RUMP_NBCOMPAT:= ${RUMP_NBCOMPAT:S/,/ /g}
CPPFLAGS+= ${RUMP_NBCOMPAT:C/[1-9]0/-DCOMPAT_&/g}
CPPFLAGS+= -nostdinc
CFLAGS+= -ffreestanding -fno-strict-aliasing
CWARNFLAGS+= -Wno-format-zero-length -Wno-pointer-sign
CPPFLAGS+= -imacros ${RUMPTOP}/include/opt/opt_rumpkernel.h
2015-08-24 12:45:44 +03:00
.ifdef BUILDRUMP_IMACROS
CPPFLAGS+= -imacros ${BUILDRUMP_IMACROS}
.endif
2008-12-17 02:17:17 +03:00
CPPFLAGS+= -I${.CURDIR} -I.
CPPFLAGS+= -I${RUMPTOP}/../../common/include
CPPFLAGS+= -I${RUMPTOP}/include
CPPFLAGS+= -I${RUMPTOP}/include/opt
SHLIB_MAJOR?= 0
SHLIB_MINOR?= 0
.ifdef NEED_ISYSTEM
CPPFLAGS+= -isystem ${RUMPTOP}/../arch
CPPFLAGS+= -isystem ${RUMPTOP}/..
.else
CPPFLAGS+= -I${RUMPTOP}/../arch
CPPFLAGS+= -I${RUMPTOP}/..
.endif
RUMP_LDSCRIPT?= GNU
.if ${RUMP_LDSCRIPT} != "no"
2013-03-15 16:15:52 +04:00
# my ld or yours?
.if ${RUMP_LDSCRIPT} == "sun"
2013-03-15 16:15:52 +04:00
LDFLAGS+= -Wl,-M ${RUMPTOP}/ldscript_sun.rump
SRCS+= linksyms_sun.c
2013-03-15 16:42:18 +04:00
.PATH: ${RUMPTOP}
.elif ${RUMP_LDSCRIPT} == "GNU"
LDFLAGS+= -Wl,-T,${RUMPTOP}/ldscript.rump
.elif ${RUMP_LDSCRIPT} == "ctor"
CPPFLAGS+= -DRUMP_USE_CTOR
.else
.error Unknown ldscript ${RUMP_LDSCRIPT}
.endif
.endif
.if defined(RUMP_CURLWP)
.if ${RUMP_CURLWP} == "hypercall"
CPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP_HYPERCALL
.elif ${RUMP_CURLWP} == "__thread"
CPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP___THREAD
.elif ${RUMP_CURLWP} == "register"
CPPFLAGS+= -DRUMP_CURLWP=RUMP_CURLWP_REGISTER
.else
.error Unsupported curlwp scheme: ${RUMP_CURLWP}
.endif
.endif
RUMP_DIAGNOSTIC?=yes
.if ${RUMP_DIAGNOSTIC} == "yes"
CPPFLAGS+= -DDIAGNOSTIC
.endif
.ifdef RUMP_DEBUG
CPPFLAGS+= -DDEBUG
.endif
.ifdef RUMP_LOCKDEBUG
CPPFLAGS+= -DLOCKDEBUG
.endif
2013-12-09 21:57:11 +04:00
RUMP_KTRACE?=yes
.if ${RUMP_KTRACE} == "yes"
CPPFLAGS+= -DKTRACE
.endif
# kernel libs should not get linked against libc
# XXX: actually, we would like to enable this but cannot, since it
# also leaves out libgcc, it causes problems on some platforms.
# revisit some day.
#LDFLAGS+= -nodefaultlibs
# make sure __NetBSD__ gets defined (for builds on non-NetBSD)
# also, give those builds a way to undef the local compiler's macros
CPPFLAGS+= ${RUMPKERN_UNDEF}
RUMPKERNEL= This is NetBSD and I am the rump. Good evening.
# workaround: evbppc is not a well-defined arch
.if (${MACHINE} == "evbppc")
CPPFLAGS+= -DPPC_OEA
.endif
# If any of these files change, we need a full rebuild
DPSRCS+= ${RUMPTOP}/Makefile.rump
#
# Support for component-specific hypercalls
#
# no easy way to get WARNS out of bsd.sys.mk
RUMPCOMP_USER_WARNFLAGS= -Wall -Wextra -Wno-unused-parameter
RUMPCOMP_USER_WARNFLAGS+= -Wstrict-prototypes -Wmissing-prototypes
2013-03-17 01:38:21 +04:00
.ifdef RUMPCOMP_USER_SRCS && !defined(RUMPKERN_ONLY)
2013-03-17 01:38:21 +04:00
.if empty(DESTDIR)
DESTDIR=/
.endif
BUILDRUMP_CPPFLAGS ?= -isysroot ${DESTDIR}
RUMPCOMP_USER_WERROR = ${${_NOWERROR} == "no" :?-Werror:}
.for rcusrc in ${RUMPCOMP_USER_SRCS:R}
${rcusrc}.d: ${rcusrc}.c
${_MKTARGET_CREATE}
2017-10-08 21:46:10 +03:00
${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} ${CPUFLAGS} ${REPROFLAGS} ${BUILDRUMP_CPPFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${.ALLSRC:O:u:M*${rcusrc}.c}
${rcusrc}.o: ${rcusrc}.c
${_MKTARGET_COMPILE}
2017-10-08 21:46:10 +03:00
${CC} -o ${.TARGET} ${DBG} ${CWARNFLAGS} ${CPUFLAGS} ${REPROFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c}
${rcusrc}.pico: ${rcusrc}.c
${_MKTARGET_COMPILE}
2017-10-08 21:46:10 +03:00
${CC} -o ${.TARGET} -fPIC -DPIC ${DBG} ${CWARNFLAGS} ${CPUFLAGS} ${REPROFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c}
${rcusrc}.po: ${rcusrc}.c
${_MKTARGET_COMPILE}
2017-10-08 21:46:10 +03:00
${CC} -o ${.TARGET} ${PROFFLAGS} -pg ${DBG} ${CWARNFLAGS} ${CPUFLAGS} ${REPROFLAGS} ${RUMPCOMP_USER_WERROR} ${RUMPCOMP_USER_WARNFLAGS} ${BUILDRUMP_CPPFLAGS} ${BUILDRUMP_CFLAGS} ${RUMPCOMP_USER_CPPFLAGS} ${RUMPCOMP_USER_CFLAGS} -c ${.ALLSRC:O:u:M*${rcusrc}.c}
RUMPOBJ_NORENAME+=${rcusrc}.o ${rcusrc}.pico ${rcusrc}.po
SRCS+=${rcusrc}.c
.endfor
.endif
#
# Rename library symbols before use. If a symbol does not already belong
# to a rump namespace ("rump" or "RUMP"), prefix it with "rumpns". This
# avoids accidentally linking any kernel symbol against host platform
# libraries. The only non-renamed symbols are linkset delimiters and
# the GOT, which are more a property of the compiler than the kernel.
#
# Some toolchains generate unresolved symbols which are supposed to be
# satisfied by the toolchain itself when the program is linked.
# Unfortunately, we do not know which of the symbols are generated by
# the toolchain. Worse, they vary from platform to platform and
# toolchain to toolchain. The good news, however, is that this will
# be detected by a compile-time failure, so we can fairly easily manage
# a quirktable here.
#
# We also allow calling ourselves externally with e.g.:
# make -f /sys/rump/Makefile.rump RUMP_SYMREN=ffs.kobj
#
.if ${MACHINE_CPU} == "mips"
_SYMQUIRK='|_gp_disp'
.elif ${MACHINE_CPU} == "hppa"
_SYMQUIRK='|\$$\$$'
.elif ${MACHINE_ARCH} == "powerpc64"
_SYMQUIRK="|PF_funcs"
.endif
#
# Prefix quirks. At least one toolchain generates global
# symbols with prefixes which really need to remain as prefixes
# (i.e. the '.' on the front of some ppc64 globals). The
# way to know if you have the problem is if you get later
# complaints about symbols like 'rumpns_XrumpBLAH' or 'XrumpBLAH';
# the 'X' part was added by the toolchain and will need to
# be mentioned here.
#
.if ${MACHINE_ARCH} == "powerpc64"
_PQ="\.?"
.else
_PQ=
.endif
rump_symren: __archivebuild
.if !defined(RUMP_SYMREN)
@echo "Must supply RUMP_SYMREN for target rump_symren"
@false
.endif
# if we are called from lib build (RUMP_SYMREN is not specified),
# build the arrrrchive. otherwise just rename symbols.
__archivebuild: .USE
.if defined(RUMP_SYMREN) && defined(RUMPTOP)
@echo "ERROR: RUMP_SYMREN can only be used standalone"
@false
.endif
.if defined(RUMP_SYMREN)
${_MKMSG} " symbol rename " ${RUMP_SYMREN}
.else
${_MKTARGET_BUILD}
rm -f ${.TARGET}
.endif
for renameobj in ${RUMP_SYMREN:U${.ALLSRC:C/(${RUMPOBJ_NORENAME:ts|})//g}}; do \
${NM} -go $${renameobj} | ${TOOL_AWK} ' \
$$NF!~/^'${_PQ}'(rump|RUMP|__|_GLOBAL_OFFSET_TABLE|\.TOC\.'${_SYMQUIRK}'${RUMP_SYM_NORENAME:D|${RUMP_SYM_NORENAME}})/ \
{s=$$NF;sub(/^'${_PQ}'/, "&rumpns_", s); print $$NF, s}'\
| sort | uniq > renametab.$${renameobj}; \
${OBJCOPY} --preserve-dates --redefine-syms \
renametab.$${renameobj} $${renameobj}; \
rm -f renametab.$${renameobj}; \
done
.if !defined(RUMP_SYMREN)
${AR} ${_ARFL} ${.TARGET} \
`NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
.endif
COMMENT?= (no description)
2015-11-15 16:50:10 +03:00
rumpdescribe: .PHONY
@printf '%-24s %s\n' '${LIB}' '${COMMENT}'
_BSD_IOCONF_MK_USER_=1
.include <bsd.ioconf.mk>
.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE_CPU}/include/Makefile.inc"
.-include "${NETBSDSRCDIR}/sys/arch/${MACHINE}/include/Makefile.inc"
2014-04-15 17:41:46 +04:00
.endif # _RUMP_MK