version 1.33, 2011/09/11 18:38:03 |
version 1.33.2.3, 2014/05/22 11:37:53 |
Line 18 CPPFLAGS+= -isystem ${S}/../common/inclu |
|
Line 18 CPPFLAGS+= -isystem ${S}/../common/inclu |
|
CPPFLAGS+= -D_KERNEL -D_LKM -D_MODULE -DSYSCTL_INCLUDE_DESCR |
CPPFLAGS+= -D_KERNEL -D_LKM -D_MODULE -DSYSCTL_INCLUDE_DESCR |
|
|
# XXX until the kernel is fixed again... |
# XXX until the kernel is fixed again... |
.if defined(HAVE_GCC) || defined(HAVE_PCC) |
|
CFLAGS+= -fno-strict-aliasing -Wno-pointer-sign |
CFLAGS+= -fno-strict-aliasing -Wno-pointer-sign |
.endif |
|
|
|
# XXX This is a workaround for platforms that have relative relocations |
# XXX This is a workaround for platforms that have relative relocations |
# that, when relocated by the module loader, result in addresses that |
# that, when relocated by the module loader, result in addresses that |
Line 29 CFLAGS+= -fno-strict-aliasing -Wno-point |
|
Line 27 CFLAGS+= -fno-strict-aliasing -Wno-point |
|
# relocations inside the loader and removing this workaround, as the |
# relocations inside the loader and removing this workaround, as the |
# resulting code would be much faster. |
# resulting code would be much faster. |
.if ${MACHINE_CPU} == "arm" |
.if ${MACHINE_CPU} == "arm" |
|
CFLAGS+= -fno-common -fno-unwind-tables |
|
.elif ${MACHINE_CPU} == "hppa" |
CFLAGS+= -mlong-calls |
CFLAGS+= -mlong-calls |
.elif ${MACHINE_CPU} == "powerpc" |
.elif ${MACHINE_CPU} == "powerpc" |
CFLAGS+= -mlongcall |
CFLAGS+= -mlongcall |
Line 36 CFLAGS+= -mlongcall |
|
Line 36 CFLAGS+= -mlongcall |
|
CFLAGS+= -fno-pic |
CFLAGS+= -fno-pic |
.endif |
.endif |
|
|
|
.if ${MACHINE_CPU} == "sparc64" |
|
# force same memory model as rest of the kernel |
|
CFLAGS+= ${${ACTIVE_CC} == "gcc":? -mcmodel=medlow :} |
|
CFLAGS+= ${${ACTIVE_CC} == "clang":? -mcmodel=small :} |
|
.endif |
|
|
# evbppc needs some special help |
# evbppc needs some special help |
.if ${MACHINE} == "evbppc" |
.if ${MACHINE} == "evbppc" |
|
|
Line 69 KMODSCRIPT= $S/../sys/modules/xldscripts |
|
Line 75 KMODSCRIPT= $S/../sys/modules/xldscripts |
|
KMODSCRIPT= ${DESTDIR}/usr/libdata/ldscripts/kmodule |
KMODSCRIPT= ${DESTDIR}/usr/libdata/ldscripts/kmodule |
.endif |
.endif |
|
|
OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g} |
|
PROG?= ${KMOD}.kmod |
PROG?= ${KMOD}.kmod |
|
|
##### Build rules |
##### Build rules |
realall: ${PROG} |
realall: ${PROG} |
|
|
|
.if (defined(USE_COMBINE) && ${USE_COMBINE} != "no" && !commands(${_P}) \ |
|
&& !defined(NOCOMBINE.${_P}) && !defined(NOCOMBINE)) |
|
.for f in ${SRCS:N*.h:N*.sh:N*.fth:C/\.[yl]$/.c/g} |
|
.if (${CPPFLAGS.$f:D1} == "1" || ${CPUFLAGS.$f:D2} == "2" \ |
|
|| ${COPTS.$f:D3} == "3" || ${OBJCOPTS.$f:D4} == "4" \ |
|
|| ${CXXFLAGS.$f:D5} == "5") \ |
|
|| ("${f:M*.[cyl]}" == "" || commands(${f:R:S/$/.o/})) |
|
XOBJS+= ${f:R:S/$/.o/} |
|
.else |
|
XSRCS+= ${f} |
|
NODPSRCS+= ${f} |
|
.endif |
|
.endfor |
|
|
|
.if !empty(XOBJS) |
|
${XOBJS}: ${DPSRCS} |
|
.endif |
|
|
|
${PROG}: ${XOBJS} ${XSRCS} ${DPSRCS} ${DPADD} |
|
${_MKTARGET_LINK} |
|
${CC} ${LDFLAGS} -nostdlib -MD -combine -r -Wl,-T,${KMODSCRIPT},-d \ |
|
-o ${.TARGET} ${CFLAGS} ${CPPFLAGS} ${XOBJS} \ |
|
${XSRCS:@.SRC.@${.ALLSRC:M*.c:M*${.SRC.}}@:O:u} && \ |
|
echo '.-include "${KMOD}.d"' > .depend |
|
|
|
.else |
|
OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g} |
|
|
${OBJS} ${LOBJS}: ${DPSRCS} |
${OBJS} ${LOBJS}: ${DPSRCS} |
|
|
|
.if ${MACHINE_CPU} == "arm" |
|
# The solution to limited branch space involves generating trampolines for |
|
# those relocations while creating the module, as the resulting code will |
|
# be much faster and simplifies the loader. |
|
ARCHDIR= $S/modules/arch/${MACHINE_CPU} |
|
ASM_H= $S/arch/${MACHINE_CPU}/include/asm.h |
|
CLEANFILES+= tmp.o tmp.S ${KMOD}_tmp.o ${KMOD}_tramp.o ${KMOD}_tramp.S |
|
${KMOD}_tmp.o: ${OBJS} ${DPADD} |
|
${_MKTARGET_LINK} |
|
${LD} -r -o tmp.o ${OBJS} |
|
${LD} -r \ |
|
`${OBJDUMP} --syms --reloc tmp.o | \ |
|
${TOOL_AWK} -f ${ARCHDIR}/kmodwrap.awk` \ |
|
-o ${.TARGET} tmp.o |
|
|
|
${KMOD}_tramp.S: ${KMOD}_tmp.o ${ARCHDIR}/kmodtramp.awk ${ASM_H} |
|
${_MKTARGET_CREATE} |
|
${OBJDUMP} --syms --reloc ${KMOD}_tmp.o | \ |
|
${TOOL_AWK} -f ${ARCHDIR}/kmodtramp.awk \ |
|
> tmp.S && \ |
|
mv tmp.S ${.TARGET} |
|
|
|
${PROG}: ${KMOD}_tmp.o ${KMOD}_tramp.o |
|
${_MKTARGET_LINK} |
|
.if exists(${ARCHDIR}/kmodhide.awk) |
|
${LD} -r -o tmp.o ${KMOD}_tmp.o ${KMOD}_tramp.o |
|
${OBJCOPY} \ |
|
`${NM} tmp.o | ${TOOL_AWK} -f ${ARCHDIR}/kmodhide.awk` \ |
|
tmp.o ${.TARGET} && \ |
|
rm tmp.o |
|
.else |
|
${LD} -r -o ${.TARGET} ${KMOD}_tmp.o ${KMOD}_tramp.o |
|
.endif |
|
.else |
${PROG}: ${OBJS} ${DPADD} |
${PROG}: ${OBJS} ${DPADD} |
${_MKTARGET_LINK} |
${_MKTARGET_LINK} |
${CC} ${LDFLAGS} -nostdlib -r -Wl,-T,${KMODSCRIPT},-d \ |
${CC} ${LDFLAGS} -nostdlib -r -Wl,-T,${KMODSCRIPT},-d \ |
-o ${.TARGET} ${OBJS} |
-o ${.TARGET} ${OBJS} |
|
.endif |
|
.endif |
|
|
##### Install rules |
##### Install rules |
.if !target(kmodinstall) |
.if !target(kmodinstall) |
.if !defined(KMODULEDIR) |
.if !defined(KMODULEDIR) |
_OSRELEASE!= ${HOST_SH} $S/conf/osrelease.sh |
_OSRELEASE!= ${HOST_SH} $S/conf/osrelease.sh -k |
# Ensure these are recorded properly in METALOG on unprived installes: |
# Ensure these are recorded properly in METALOG on unprived installes: |
KMODULEARCHDIR?= ${MACHINE} |
KMODULEARCHDIR?= ${MACHINE} |
_INST_DIRS= ${DESTDIR}/stand/${KMODULEARCHDIR} |
_INST_DIRS= ${DESTDIR}/stand/${KMODULEARCHDIR} |