undefined symbols in executable elves

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Adek336

undefined symbols in executable elves

Post 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
sfcoder

RE:undefined symbols in executable elves

Post 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
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

RE:undefined symbols in executable elves

Post 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.
-- Stu --
Post Reply