Port-powerpc archive

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

LKMs.



One of the problems with some of the PPC ports is due to linker
limitations, you can't do LKMs with doing "hacks" to the kernel.

This has always annoyed me since I felt the problem the problem
was in the toolchain.

Using readelf(1) and ld(1)'s --wrap, I've cobbled a small shell
script which given a LKM file as input will emit a new file
which can be used as LKM.

It works by finding all the unresolved branches and creates
trampolines for them.  Then by using --wrap symbol ld will changes
references to symbol to __wrap_symbol and then any references to
__real_symbol to symbol.  So for each symbol it emits a small
trampoline:

_ENTRY(__wrap_free)
        lis     0,__real_free@h
        ori     0,0,__real_free@l
        mtctr   0
        bctr

It emits a single .S with all the trampolines, assembles it,
and merges it into the LKM object.  Now you have a LKM object
which can be put anywhere.

Now to figure out how to get bsd.kmod.mk to do for PPC automatically.

--
Matt Thomas               Internet:   matt%3am-software.com@localhost
3am Software Foundry      WWW URL:    http://www.3am-software.com/bio/matt/
Cupertino, CA             Disclaimer: I avow all knowledge of this message




Home | Main Index | Thread Index | Old Index