Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/share/mk Add support for generating tramponlines in the modu...
details: https://anonhg.NetBSD.org/src/rev/ba7190feae4a
branches: trunk
changeset: 789122:ba7190feae4a
user: matt <matt%NetBSD.org@localhost>
date: Wed Aug 07 17:36:11 2013 +0000
description:
Add support for generating tramponlines in the module at link time.
This is done using some awk scripts and KMODTRAMPOLINE in <machine/asm.h>
It's not as efficient as having the kloader do it but it is a lot simpler.
diffstat:
share/mk/bsd.kmodule.mk | 39 +++++++++++++++++++++++++++++++++++++--
1 files changed, 37 insertions(+), 2 deletions(-)
diffs (65 lines):
diff -r 47f7c813591b -r ba7190feae4a share/mk/bsd.kmodule.mk
--- a/share/mk/bsd.kmodule.mk Wed Aug 07 17:29:15 2013 +0000
+++ b/share/mk/bsd.kmodule.mk Wed Aug 07 17:36:11 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.kmodule.mk,v 1.38 2013/08/06 06:08:39 skrll Exp $
+# $NetBSD: bsd.kmodule.mk,v 1.39 2013/08/07 17:36:11 matt Exp $
# We are not building this with PIE
MKPIE=no
@@ -27,7 +27,7 @@
# relocations inside the loader and removing this workaround, as the
# resulting code would be much faster.
.if ${MACHINE_CPU} == "arm"
-CFLAGS+= -mlong-calls
+CFLAGS+= -fno-common
.elif ${MACHINE_CPU} == "hppa"
CFLAGS+= -mlong-calls
.elif ${MACHINE_CPU} == "powerpc"
@@ -104,11 +104,46 @@
${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}
${_MKTARGET_LINK}
${CC} ${LDFLAGS} -nostdlib -r -Wl,-T,${KMODSCRIPT},-d \
-o ${.TARGET} ${OBJS}
.endif
+.endif
##### Install rules
.if !target(kmodinstall)
Home |
Main Index |
Thread Index |
Old Index