Page 1 of 1

Understanding Linker Error-Output Format

Posted: Sun Dec 20, 2009 9:09 pm
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?

Re: Understanding Linker Error-Output Format

Posted: Mon Dec 21, 2009 5:04 am
by absabs
OUTPUT_FORMAT(elf64-x86-64)=>
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")

Re: Understanding Linker Error-Output Format

Posted: Mon Dec 21, 2009 7:42 am
by nekros
I think I'm seeing why I should make a cross compiler....