[問題] ld 指令問題

作者: SNSDpk5566 (5566 超強)   2015-12-09 19:01:21
請問一下 我在ubuntu 14版 64位元下 想要用ld 連結兩個 .o檔案
foo.o是C語言 bar.o是組語編出來的 我想要連結兩個檔案
輸入 ld -s -o foobar foo.o bar.o
發生下面的問題
ld: i386 architecture of input file `foo.o' is
incompatible with i386:x86-64 output
爬網路改起來是要改用 elf_i386 於是改為
ld -m elf_i386 -s -o foobar foo.o bar.o
一樣還是有相同的問題
但是單獨使用
ld -m elf_i386 -o hello hello.o 這樣可以
想問一下兩個檔案要怎麼使用ld指令
謝謝
作者: CP64 (( ̄▽ ̄#)﹏﹏)   2015-12-09 21:23:00
http://goo.gl/4uiLaI google "ld asm with c" 就有了
作者: hijkxyzuw (i,j,k) ×(x,y,z)   2015-12-09 22:39:00
?抱歉噓錯篇

Links booklink

Contact Us: admin [ a t ] ucptt.com