I'm having trouble getting modutils 2.3.10 to work on a little endian
MIPS box running a 2.4.0-test3 kernel. I am cross compiling the kernel
and modules on an i386 using egcs1.0.3a-2 and binutils2.8.1-1. It
appears that the symbol table format in the ELF file created by
mipsel-linux-gcc during a module build is incorrect.
As I read the ELF 1.1 spec - all symbols with STB_LOCAL bindings should
precede all other symbols (weak and global) in the symbol table. Then
the symbol table section's sh_info section header member holds the
symbol table index for the first non-local symbol (and thus can then be
used to determine the number of local symbols). Using the readelf
utility on a generated module shows that the local symbols are not
grouped together before all other symbols but are intermixed though out
the symbol table, and the sh_info field in the header is not set to the
first non-local symbol index.
When insmod runs it malloc's memory equal to the sh_info field and then
begins to populate the local symbols into it. Because of the bad symbol
ordering and incorrect value in sh_info, the malloc'd memory is far to
small to hold all of the local symbols so memory gets blasted and the
module fails to load correctly.
As a side test I tried to incrementally link the module.o file using
mipsel-linux-ld -r module.o -o module. Viewing the ELF output from this
stage showed a correct symbol ordering and sh_info field so it appears
that the linker is generating the correct format for the symbol table
(problem with gcc only?). Has this problem been addressed/resolved? Any