Subject: RE: Do LKMs work *at*all* on powerpc platforms?
To: Bill Studenmund <wrstuden@zembu.com>
From: Todd Vierling <tv@wasabisystems.com>
List: port-macppc
Date: 08/07/2000 22:40:35
On Mon, 7 Aug 2000, Bill Studenmund wrote:

: > : > > I think adding something like -mlong-call and __attribute__ ((short-call))
: > : > > would be the most efficient thing. :-)
: 
: Oops! This option would ONLY be for the LKM's, not the kernel compile. :-)

However, does this mean that there's a `different' calling convention for
the kernel vs. LKMs?  i.e. stack has `more' on it with one method than the
other, you can't just rts from long-call code into shortcall.  An example of
`incompatible' calling conventions is the m68020 CALLM/RTM vs. the usual
[JB]SR/RTS.

If the calling methods aren't directly compatible, the kernel shouldn't be
littered with attributes on functions, even in the LKM itself.  One link
unit should use one calling convention specified on only the command line,
wherever possible.  This probably means extra overhead inside the
LKM-compiled code, but `you get what you pay for' wrt LKMs.

One other option is to use PIC.  Position-independent code directs jumps and
references through the PLT and GOT, which could(?) be a lower overhead than
-mlong-call--this would need to be tested.  PIC code can link against a
static binary such as `netbsd' fine; the PLT and GOT are filled at link time
with absolute addresses in that case.

: Also, could we teach all other ports about it, -mlong-call (and to ignore
: it), or make some sort of include file magic happen?

That's probably not the best idea; you're probably better off adding it to
<bsd.kmod.mk>, which is used by LKMs to build.  Additional CFLAGS can easily
be added there.

-- 
-- Todd Vierling <tv@wasabisystems.com>  *  http://www.wasabisystems.com/
-- Speed, stability, security, and support.  Wasabi NetBSD:  Run with it.