Subject: Re: Do LKMs work *at*all* on powerpc platforms?
To: Greg Kritsch <greg@evertz.com>
From: gabriel rosenkoetter <gr@eclipsed.net>
List: port-macppc
Date: 08/02/2000 19:34:26
On Wed, Aug 02, 2000 at 05:02:10PM -0400, Greg Kritsch wrote:
> Fine, make me actually look up what I did... It's covered in the GCC manual,
> or at least it is in the EGCS-2.95.2 version thereof.

Hrm. I can't find any mention of 'longcall' or '__attribute__' in
either gcc(1) or the info (gack) document. Maybe I'm confused, though.

> #define LONGCALL __attribute__ ((longcall))
> 
> void flash_ident_acc(void) LONGCALL;

Cool, thanks.

> The __attribute__ (()) is GNU's syntax for such implementation specific
> attributes, longcall is the attribute in question.  Notice also that the
> attribute has to come after the prototype args, not before it.  I don't know
> if it's valid to prepend an extern or not, I seem to remember it being
> rather fussy syntactically.

Doesn't seem to mind externs (they're not on memcpy or printf, but are
on the lkm functions).

> The linker won't get confused because you aren't creating a second object,
> you're just saying, in this source file, when you generate code to _call_
> this function, do it with the full 32 bit range because the target is (may
> be) further away than a relative branch allows.

Makes sense, and gets a lot closer.

In the end, however, it's not possible to just do this in my own
source and have a working LKM on powerpc, because...

achemar:misc/module# make load                                              [4]
modload -o miscmod -emiscmod combined.o
combined.o: In function `miscmod_handle':
combined.o(.text+0x114): relocation truncated to fit: R_PPC_REL24 memcpy
combined.o(.text+0x140): relocation truncated to fit: R_PPC_REL24 memcpy
combined.o(.text+0x1f8): relocation truncated to fit: R_PPC_REL24 memcpy
modload: can't link `combined.o' creating `miscmod' bound to 0xe921b000
*** Error code 1

Stop.

miscmod_handle isn't a function that exists in the example
misc module, it's part of the LKM functionality. I *think* it's a
symbol read out of the kernel, but I haven't even thought about it
hard.

Buggered again.

I need to get some actual work done, so I'm going to give in and do it
the old-fashioned way (hack, rebuild kernel, reboot, panic, boot
alternate kernel, repeat). Since I wanted to be starting an LKM Monday
and I'm now starting a kernel hack, I'm just a touch behind. When I
scramble back up even with the world, I'll take more of a whirl at
kludging together a working LKM. By then, there'll probably have been
a bit more discussion of it on the list.

       ~ g r @ eclipsed.net