Ubuntu 10.10 64位。 GNU as。使用cvtps2dq和cvttps2dq的分段錯誤
.section .data
value1:
.float 1.25 , 124.79 , 200.0 , -312.5
.section .text
.globl _start
_start:
nop
cvtps2dq value1 , %xmm0
cvttps2dq value1 , %xmm1
movl $1 , %eax
movl $0 , %ebx
int $0x80
運行在分段錯誤的程序的結果:
~/scratch $ as --64 test.s -o test.o && ld test.o -o test -dynamic-linker /lib64/ld-linux-x86-64.so.2 -lc
~/scratch $ ./test
Segmentation fault
~/scratch $
有趣的是,如果我編譯的程序,只有這兩條線中的一個(任一個):
cvtps2dq value1 , %xmm0
cvttps2dq value1 , %xmm1
它運行良好。
有什麼建議嗎?
順便說一句,這個例子是基於Richard Blum着的「專業彙編語言」一書的。這些例子是爲32位Linux編寫的,我必須做相應的轉換。所以也許這是一個32/64位的東西。 :-)
謝謝!
埃德
這不會讓我崩潰。當然,它看不到任何可見的東西。你可以簡化你的鏈接到'ld test.o -o test'。注意命名可執行文件「test」:在/ usr/bin/test中有一個/ bin/test,如果你自己的程序具有相同的名字,它最終會讓你感到驚訝。 – 2010-11-11 01:48:30
嗨,本。如果我通過'as -64 test.s -o test.o && ld test.o -o test'來構建,那麼它就可以工作。 – dharmatech 2010-11-11 02:02:28
這也適用:'-64 test.s -o test.o && ld test.o -o test -dynamic-linker/lib64/ld-linux-x86-64.so.2'。 – dharmatech 2010-11-11 02:03:17