Page 1 of 1

undefined symbols in executable elves

Posted: Sun Dec 21, 2003 12:00 am
by Adek336
Hi all! Yey I made a simple linker :) I can now load ELFs with grub, link them and one module can use functions from the primary kernel or any other module :) But now comes the hard stuff: I could resolve undefined references from the prim kernel with symbols from other modules.. but ld does not want to link with undefined references!!! Damn that's a pain in the neck. But.. perhaps there's a way to leave'em undefined?

Cheers,
Adrian

RE:undefined symbols in executable elves

Posted: Tue Dec 23, 2003 12:00 am
by sfcoder
Try using ld -d -r

At least thats what the Nvidia Linux module Makefile does -

>>>> SNIP
make[1]: Entering directory `/usr/src/linux-2.4.22'
make -C  /backup/packages/linux-nodistro/5328-Minion.de-patched/usr/src/nv CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.22/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=athlon -DMODULE" MAKING_MODULES=1 modules
make[2]: Entering directory `/backup/packages/linux-nodistro/5328-Minion.de-patched/usr/src/nv'
ld -m elf_i386 -d -r -o nvidia.o nv-kernel.o nv.o os-agp.o os-interface.o os-registry.o
make[2]: Leaving directory `/backup/packages/linux-nodistro/5328-Minion.de-patched/usr/src/nv'
make[1]: Leaving directory `/usr/src/linux-2.4.22'
>>>> SNIP

RE:undefined symbols in executable elves

Posted: Wed Dec 24, 2003 12:00 am
by df
if you really do have a simple linker, leave your code as object files and dont 'link' them with ld. that will leave you with the undefined references, let your own linker resolve them against other modules.

unless you just mean you have written an elf LOADER.