Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk Generate long calls in modules for arm32 and powerp...



details:   https://anonhg.NetBSD.org/src/rev/6503ad51f8cb
branches:  trunk
changeset: 750926:6503ad51f8cb
user:      jmmv <jmmv%NetBSD.org@localhost>
date:      Mon Jan 18 23:39:07 2010 +0000

description:
Generate long calls in modules for arm32 and powerpc to avoid unsupported
relocations by the module loader in the kernel.  This makes modules work
in, at least, shark and macppc respectively.

This is obviously a workaround that results in slower code, but at least
makes modules work.  I'm adding a comment detailing what the real solution
would be so that the whole thing can be revisited in the future.  (Read:
I don't have time now to dig the details of how to implement trampoline
generation.)

(Based on the old bsd.kmod.mk file, I understand that hppa needs this
workaround too, but I can't check this platform.)

diffstat:

 share/mk/bsd.kmodule.mk |  14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r ab4d2049d2f8 -r 6503ad51f8cb share/mk/bsd.kmodule.mk
--- a/share/mk/bsd.kmodule.mk   Mon Jan 18 23:35:51 2010 +0000
+++ b/share/mk/bsd.kmodule.mk   Mon Jan 18 23:39:07 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.kmodule.mk,v 1.23 2009/12/14 08:51:16 mrg Exp $
+#      $NetBSD: bsd.kmodule.mk,v 1.24 2010/01/18 23:39:07 jmmv Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -23,6 +23,18 @@
 CFLAGS+=       -fno-strict-aliasing -Wno-pointer-sign
 .endif
 
+# XXX This is a workaround for platforms that have relative relocations
+# that, when relocated by the module loader, result in addresses that
+# overflow the size of the relocation (e.g. R_PPC_REL24 in powerpc).
+# The real solution to this involves generating trampolines for those
+# relocations inside the loader and removing this workaround, as the
+# resulting code would be much faster.
+.if ${MACHINE_CPU} == "arm"
+CFLAGS+=       -mlong-calls
+.elif ${MACHINE_CPU} == "powerpc"
+CFLAGS+=       -mlongcall
+.endif
+
 _YKMSRCS=      ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
 DPSRCS+=       ${_YKMSRCS}
 CLEANFILES+=   ${_YKMSRCS}



Home | Main Index | Thread Index | Old Index