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

Re: To make insmod work requires some work

> Date: Fri, 4 May 2001 14:04:12 +0200
> From: Jonas Aaberg <aberg@xxxxxxx.ch>

I'm sorry I haven't looked into your questions and problems.
I've been too busy with shared library stuff to dive into this.

> I've been trying to compile insmod and to make it work.
> Since the elf file format is architechture dependent,

I wouldn't say that ELF in general is architecture dependant.
The actual machine number, semantics of some bits in the ELF
file header and the semantics of relocations are
machine-dependent.  Everything else can be deduced with generic
ELF tools like readelf from binutils.

> and there is no supported architechture that is quite equal 
> to Etrax,

M68K comes close; it has RELA relocations which I guess is the
detail most relevant here.

> I've given up because I don't have 
> enought time for it.

Check the ELF definitions in binutils and perhaps glibc CVS if
you wish to pick it up again.

> The modutil compiles and works, except that it can't load
> CRIS elf files correctly.

Hmm, does it really work then?

> export "CC=$AXIS_DIR/tools/gcc_cris -mlinux -DCRISMMU
> -muclibc=$AXIS_DIR/eroot"

Still, you shouldn't need uclibc.

> Some parts came from asm-cris/elf.h, and the last
> two lines are assumed to be correct from using
> some "Elf Kicker tools" for ELF analysing.

As mentioned, binutils "readelf" is quite handy.  If you have
binutils release 2.11 installed on your host, it knows about
CRIS.  Even better, cris-dist-1.11 installs binutils tools by
name of "objdump-cris" and "readelf-cris" which are known to

> #define MATCH_MACHINE(x)  (x= EM_CRIS)

Should this really be an assignment; shouldn't it be "=="?

> There is no archtechture supported by modutils that has the
> same variants of "ELFCLASSM", "ELFDATAM", "SHT_RELM" and "Elf32_RelM"
> (Look in the include/ directory)

It doesn't support Linux/m68k?

> To compile a module for Etrax you do like this:
> (Thanks to Lars Viklund at Axis for help!)
> gcc_cris -fno-leading-underscore -O2 -Wall -c -I/opt/Etrax/linux/include 
> -DMODULE -D__KERNEL__ -DCRISMMU -D__linux__ foo.c

You should use "gcc-cris -mlinux", which will give you at least
-D__linux__ and -fno-leading-underscore.  It will also imply
-march=v10, so you don't get references to __Mul.

brgds, H-P