i386 architecture is incompatible with i386:x86-64 output
Posted: Wed May 28, 2014 11:51 am
I'm running 64 bit linux mint.
I've compile 32bit nasm source code using
Then I tried to linked this using ld
The link.ld script as follow:
I got this error message:
When I check ld man page, I thought I could use the -m option to specify emulation, but when I did a -V to list available emulation, only this few are listed:
and non of them are binary...
Question: how can I use ld to link 32 bit output with flat format using 32 bit input?
I've compile 32bit nasm source code using
Code: Select all
nasm start.asm -f aout -f start.o
Code: Select all
ld -T link.ld -o kernel start.o
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
.text phys : AT(phys)
{
code = .;
*(.text)
*(.rodata)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
Code: Select all
[color=#FF0000]ld: i386 architecture of input file `start.o' is incompatible with i386:x86-64 output[/color]
Code: Select all
GNU ld (GNU Binutils for Ubuntu) 2.23.52.20130913
Supported emulations:
elf_x86_64
elf32_x86_64
elf_i386
i386linux
elf_l1om
elf_k1om
i386pep
i386pe
Question: how can I use ld to link 32 bit output with flat format using 32 bit input?