LD help.. :-S
Posted: Fri Oct 31, 2008 2:44 pm
Well, sorry because this is a very stupid question... a believe... but I can't figure the problem...
Many months ago I created a little kernel in cpp and gcc/ld worked right.
Now, I complie the same files and it doesn't work.
I use a kernel32asm:
the _start is defined in the cpp:
kernel32.cpp
The commands are:
The ld error si:
kernel32.o(.text+0x0):kernel32.cpp: multiple definition of `start'
kernel32asm.o(.text+0x0):kernel32.cpp: first defined here
The same problem comes up if I use some include file, for example for functions like "setcursorpos" etc... All functions come out the error: "multiple defition"....
The only thing I changed is nasm. I use the same gcc (3.1) and now the nasm 2.05. Unfortunately I haven't the old nasm, but maybe this is not the problem...
Can anyone help me?
Thank you very much....
CometKeeper
Many months ago I created a little kernel in cpp and gcc/ld worked right.
Now, I complie the same files and it doesn't work.
I use a kernel32asm:
Code: Select all
bits 32
extern _start
AsmKernel:
jmp _start
jmp $
kernel32.cpp
Code: Select all
extern "C" void start();
extern void start()
{
while(1)
{}
}
Code: Select all
nasm -f aout kernel32asm.asm -o kernel32asm.o
gcc -c kernel32.cpp -o kernel32.o -fno-rtti -fno-exceptions -I include
ld -Ttext=0x20000 -o kernel32.tmp kernel32asm.o kernel32.o -e 0x0
objcopy -R .note -R .comment -S -O binary kernel32.tmp kernel32.bin
kernel32.o(.text+0x0):kernel32.cpp: multiple definition of `start'
kernel32asm.o(.text+0x0):kernel32.cpp: first defined here
The same problem comes up if I use some include file, for example for functions like "setcursorpos" etc... All functions come out the error: "multiple defition"....
The only thing I changed is nasm. I use the same gcc (3.1) and now the nasm 2.05. Unfortunately I haven't the old nasm, but maybe this is not the problem...
Can anyone help me?
Thank you very much....
CometKeeper