Linking problem: i386:x86-64 architecture of input file *.o is incompatible with i386 output?

Up vote 0 down vote favorite 1 share g+ share fb share tw.

I got a problem in linking when I moved my osdev to linux where it worked previously on gcc Feb 26 '117 * and binutils 2.18 (compiled to output x86_64-elf) running under cygwin. Here are the infos: gcc -v Using built-in specs. Target: i686-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro Feb 26 '118 4-14ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.

Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu Thread model: posix gcc version Feb 26 '1185 (Ubuntu/Linaro Feb 26 '118 4-14ubuntu5) ld -v GNU ld (GNU Binutils for Ubuntu) 2.20.51-system. Feb 26 '118 part of ld -help .... ld: supported targets: elf32-i386 a. Out-i386-linux pei-i386 elf32-little elf32-big elf64-x8Feb 26 '113 pei-x8Feb 26 '113 elf64-l1om elf64-little elf64-big plugin srec symbolsrec verilog tekhex binary ihex trad-core .... The code: main.

C void main(){ /**some code here**/ } start. Asm bits 64 global start extern main start: call main link. Ld OUTPUT_FORMAT(elf64-x8Feb 26 '113); offset = 0x1000000; ENTRY(start); SECTIONS{ .

= offset; . Text : AT(ADDR(.text) - offset){ _code = . ; *(.text) (.rodata) .

= ALIGN(4096);} . Data : AT(ADDR(.data) - offset){ _data = . ; *(.data) .

= ALIGN(4096);} . Bss : AT(ADDR(.bss) - offset){ _bss = . ; *(.bss) *(COMMON) .

= ALIGN(4096);} _end = . ; /DISCARD/ : {*(.comment)} } build.sh nasm -f elf64 -o start. O start.

Asm echo . Echo . Echo .

Gcc -m64 -ffreestanding -nostdlib -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -c -o main. O main. C echo .

Echo . Echo . Ld -nostdlib -nodefaultlibs -T link.

Ld -o out. Elf start. O main.

O terminal output . . .

. . .

Ld: i386:x8Feb 26 '113 architecture of input file 'start. O' is incompatible with i386 output ld: i386:x8Feb 26 '113 architecture of input file 'main. O' is incompatible with i386 output I don't understand why it displays 'incompatible with i386 output' when there's OUTPUT_FORMAT(elf64-x8Feb 26 '113); in my linker script specifying the targeted output.. c gcc assembly linker linker-scripts link|improve this question edited Feb 26 '11 at 4:23 asked Feb 26 '11 at 3:44prinzrainer5117 62% accept rate.

Try this: LDEMULATION="elf_x86_64" ld -nostdlib -nodefaultlibs -T link. Ld -o out. Elf start.

O main.o.

Sorry, yes it did help.. I tried it as: LDEMULATION="elf_x86_64" (with newline) ld -nostdlib -nodefaultlibs -T link. Ld -o out. Elf start.

O main. O ..thats why it didn't work at first..Btw, why do they made it like that? It made the OUTPUT_FORMAT(elf64-x86-64); useless... – prinzrainer Feb 26 '11 at 5:17.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions