Page 1 of 1

Problems when linking kernel to elf

Posted: Mon Aug 26, 2002 9:47 am
by Whatever5k
I have a .asm-file and a .c-file...
I assemble the .asm-file like this:
nasm -f elf boot.asm

Ok, I also have a linker file (link.ld).
First line is:
OUPUT_FORMAT("elf32-i386")

Ok, when I want to link it, ld sais:
"ld: gipp: Not enough room for program headers, try linking with -N
ld: final link failed: Bad value"

When I change the nasm command line to:
nasm -f aout ....
and change the linker file to
OUTPUT_FORMAT("binary")
everything works fine. But GRUB cannot load this...
So whats wrong with elf?

Re:Problems when linking kernel to elf

Posted: Tue Aug 27, 2002 8:25 am
by Dave_Hunt
Post your link.ld file. We can't tell you why ld doesn't like it, if we can't see it.

Re:Problems when linking kernel to elf

Posted: Tue Aug 27, 2002 10:50 am
by Whatever5k
Ok, here it is:

OUTPUT_FORMAT("elf32-i386")
ENTRY(start)
SECTIONS
{
.text 0x1000000 : {
*(.text)
}
.data : {
*(.data)
}
.bss :
{                
*(.bss)
}
}

Re:Problems when linking kernel to elf

Posted: Thu Aug 29, 2002 8:05 am
by Dave_Hunt
I don't see anything obviously wrong with the link file. What command-line are you using for compiling the .c file and for the link step?

Re:Problems when linking kernel to elf

Posted: Thu Aug 29, 2002 8:07 am
by Pype.Clicker
just a question, are you using DjGPP (dos) or Linux gcc ?

Re:Problems when linking kernel to elf

Posted: Thu Aug 29, 2002 10:20 am
by Whatever5k
I am using gcc and ld, both linux