Problems when linking kernel to elf

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
Whatever5k

Problems when linking kernel to elf

Post 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?
Dave_Hunt

Re:Problems when linking kernel to elf

Post 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.
Whatever5k

Re:Problems when linking kernel to elf

Post by Whatever5k »

Ok, here it is:

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

Re:Problems when linking kernel to elf

Post 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?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Problems when linking kernel to elf

Post by Pype.Clicker »

just a question, are you using DjGPP (dos) or Linux gcc ?
Whatever5k

Re:Problems when linking kernel to elf

Post by Whatever5k »

I am using gcc and ld, both linux
Post Reply