Understanding Linker Error-Output Format

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
User avatar
nekros
Member
Member
Posts: 391
Joined: Wed Mar 05, 2008 9:10 pm
Contact:

Understanding Linker Error-Output Format

Post by nekros »

Geez, it's always the "simple" stuff.... Well, I've decided to move my kernel to 64 bit but have run into a slight problem when linking.

Code: Select all

ld: i386:x86-64 architecture of input file `bootstrap.o' is incompatible with i386 output
ld: i386:x86-64 architecture of input file `kernel.o' is incompatible with i386 output
What confuses me, is that to my knowledge I am not trying to output i386. I'm using this as my linker script trying to follow the 64 bit kernel tutorial:

Code: Select all

OUTPUT_FORMAT(elf64-x86-64)
ENTRY(bootstrap)

SECTIONS{
	. = 0x00100000;
	KSTART = .;
	
    .bootstrap :{
	bootstrap.o(.text)
    }
END_BOOTSTRAP =.;

    .text  :{
        *(.text)
    }
END_TEXT =.;

    .rodata ALIGN (0x1000) : {
        *(.rodata)
    }
END_RODATA =.;

    .data ALIGN (0x1000) : {
        *(.data)
    }
END_DATA = .;

    .bss : {
        sbss = .;
        *(COMMON)
        *(.bss)
        ebss = .;
    }
END_BSS =.;
KERNEL_END = .;

}
(The important part at the top.)
When I compiling I am also using nasm's elf64 and gcc's -m64 options, so can somebody please explain what I am misunderstanding here?
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
absabs
Posts: 1
Joined: Wed Jul 22, 2009 1:28 am

Re: Understanding Linker Error-Output Format

Post by absabs »

OUTPUT_FORMAT(elf64-x86-64)=>
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
User avatar
nekros
Member
Member
Posts: 391
Joined: Wed Mar 05, 2008 9:10 pm
Contact:

Re: Understanding Linker Error-Output Format

Post by nekros »

I think I'm seeing why I should make a cross compiler....
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Post Reply