質問: raspbiangccは '.intel_syntax'を知りませんか? 私は実行しようとしました:gcc -o main main.c squrt.s -lm -no-pie これは別のコンピューターで機能しましたが、今回は単一の命令を知りませんでした。squrt.s: assembler messages: squrt.s:7: error: unknown pseudo-op: `.intel_syntax' squrt.s:12: error: junk at end of line, first unrecognized character is `#' squrt.s:17: error: bad instruction `movq rax,xmm0#bits from xmm0 to rax' squrt.s:18: error: bad instruction `shl rax,1' squrt.s:19: error: bad instruction `shr rax,53#exponent of the argument' squrt.s:20: error: arm register expected -- `cmp rax,2047#checks if x is real' squrt.s:21: error: bad instruction `je end' squrt.s:22: error: arm register expected -- `mov rcx,1#sgn(x)' squrt.s:23: error: arm register expected -- `mov rax,0' squrt.s:24: error: bad instruction `cvtsi2sd xmm1,rax' squrt.s:25: error: bad instruction `comisd xmm0,xmm1#vergleicht die double xmm0,xmm1 und setzt das statusregister entsprechend' squrt.s:26: error: bad instruction `jae notnegative#sprung wenn double x in xmm0>=0.0' squrt.s:27: error: arm register expected -- `mov rcx,-1#x<0,deswegen sgn(x)=-1' squrt.s:28: error: bad instruction `cvtsi2sd xmm1,rcx' squrt.s:29: error: bad instruction `mulsd xmm0,xmm1' squrt.s:31: error: bad instruction `movsd xmm2,[power]' squrt.s:32: error: bad instruction `comisd xmm0,xmm2' squrt.s:33: error: bad instruction `jbe nichtriesig' squrt.s:34: error: bad instruction `call ln#|x|>2^28' squrt.s:35: error: bad instruction `movsd xmm1,[ln2]' squrt.s:36: error: bad instruction `addsd xmm0,xmm1' squrt.s:37: error: bad instruction `cvtsi2sd xmm1,rcx' squrt.s:38: error: bad instruction `mulsd xmm0,xmm1' squrt.s:39: error: bad instruction `ret #arsinh(x):=sgn(x)(ln(x)+ln(2))' squrt.s:41: error: bad instruction `movsd xmm1,xmm0' squrt.s:42: error: bad instruction `mulsd xmm0,xmm0' squrt.s:43: error: arm register expected -- `mov rax,1' squrt.s:44: error: bad instruction `cvtsi2sd xmm2,rax' squrt.s:45: error: bad instruction `addsd xmm0,xmm2' squrt.s:46: error: bad instruction `call .lsqrt' squrt.s:47: error: bad instruction `addsd xmm0,xmm1' squrt.s:48: error: bad instruction `call ln' squrt.s:49: error: bad instruction `cvtsi2sd xmm1,rcx' squrt.s:50: error: bad instruction `mulsd xmm0,xmm1' squrt.s:52: error: bad instruction `ret' squrt.s:65: error: bad instruction `movq rdx,xmm0' squrt.s:66: error: bad instruction `shr rdx,52#mantisse wegschieben' squrt.s:68: error: arm register expected -- `sub rdx,1022#e+1' squrt.s:70: error: bad instruction `movq rax,xmm0' squrt.s:71: error: bad instruction `shl rax,12#setze vorzeichen' squrt.s:72: error: bad instruction `shr rax,12#und exponenten auf 0' squrt.s:73: error: arm register expected -- `mov rdi,1022' squrt.s:74: error: bad instruction `shl rdi,52#verschiebe(-1+1023)in die oberen 12 bit von rdi(oder genauer gesagt 11 bit,das 12. wird nicht verändert)' squrt.s:75: error: arm register expected -- `add rax,rdi#neuer exponent mit alter mantisse m durch addition' squrt.s:76: error: bad instruction `movq xmm0,rax#enthält m*0,5' squrt.s:77: error: arm register expected -- `mov rax,1' squrt.s:78: error: bad instruction `cvtsi2sd xmm3,rax#xmm3=1' squrt.s:79: error: bad instruction `movsd xmm4,xmm3' squrt.s:80: error: bad instruction `addsd xmm4,xmm3#2' squrt.s:81: error: bad instruction `movsd xmm1,xmm3#1=2k+1,da k am anfang 0 ist' squrt.s:82: error: bad instruction `movsd xmm5,xmm0#x' squrt.s:83: error: bad instruction `movsd xmm6,xmm0#x' squrt.s:84: error: bad instruction `subsd xmm5,xmm3#x-1' squrt.s:85: error: bad instruction `addsd xmm6,xmm3#x+1' squrt.s:86: error: bad instruction `divsd xmm5,xmm6#((x-1)/(x+1))^(2k+1),wobei k noch 0' squrt.s:87: error: bad instruction `movsd xmm7,xmm5' squrt.s:88: error: bad instruction `mulsd xmm7,xmm7#(x-1)/(x+1)^2' squrt.s:89: error: arm register expected -- `mov rax,0' squrt.s:90: error: bad instruction `movq xmm0,rax#0' squrt.s:91: error: arm register expected -- `mov rsi,5' squrt.s:93: error: bad instruction `movsd xmm2,xmm4#2' squrt.s:94: error: bad instruction `divsd xmm2,xmm1#2/(2k+1)' squrt.s:95: error: bad instruction `mulsd xmm2,xmm5#2/(2k+1))*(((x-1)/(x+1))^(2k+1))' squrt.s:96: error: bad instruction `addsd xmm0,xmm2' squrt.s:97: error: bad instruction `addsd xmm1,xmm4' squrt.s:98: error: bad instruction `mulsd xmm5,xmm7' squrt.s:99: error: bad instruction `dec rsi' squrt.s:100: error: bad instruction `jg lnloop' squrt.s:102: error: bad instruction `movsd xmm1,[ln2]' squrt.s:103: error: bad instruction `cvtsi2sd xmm2,rdx' squrt.s:104: error: bad instruction `mulsd xmm1,xmm2' squrt.s:105: error: bad instruction `addsd xmm0,xmm1#(ln(x)+(exponent+1)*ln(2))' squrt.s:106: error: bad instruction `ret' squrt.s:109: error: bad instruction `movsd xmm13,xmm0' squrt.s:110: error: bad instruction `movq rax,xmm0' squrt.s:111: error: bad instruction `shl rax,1' squrt.s:112: error: bad instruction `shr rax,53' squrt.s:113: error: arm register expected -- `sub rax,1023' squrt.s:114: error: arm register expected -- `add rax,1' squrt.s:115: error: bad instruction `sar rax,1' squrt.s:116: error: arm register expected -- `add rax,1023' squrt.s:117: error: bad instruction `shl rax,52' squrt.s:118: error: bad instruction `movq xmm0,rax' squrt.s:119: error: bad instruction `movsd xmm15,xmm0' squrt.s:120: error: bad instruction `movsd xmm0,xmm13' squrt.s:122: error: arm register expected -- `mov rax,2' squrt.s:123: error: bad instruction `cvtsi2sd xmm14,rax#2' squrt.s:124: error: arm register expected -- `mov rax,8#anzahl wiederholungen-1' squrt.s:126: error: bad instruction `movsd xmm13,xmm0' squrt.s:127: error: bad instruction `divsd xmm13,xmm15' squrt.s:128: error: bad instruction `addsd xmm13,xmm15' squrt.s:129: error: bad instruction `divsd xmm13,xmm14' squrt.s:130: error: bad instruction `movsd xmm15,xmm13' squrt.s:131: error: bad instruction `dec rax' squrt.s:132: error: bad instruction `jle sqrtend' squrt.s:133: error: bad instruction `jmp sqrtloop' squrt.s:135: error: bad instruction `movsd xmm0,xmm13' squrt.s:136: error: bad instruction `ret' make: *** [makefile:2: main] fehler 1 インストールする必要のあるパッケージはありますか?
回答: 「アセンブリ」言語はアーキテクチャに依存します。これは、cpu命令を直接書き込むことがそのポイントであり、cpuタイプごとに異なるものがあるためです。プログラム全体はamd64/intel x86_64アセンブリコードで記述されていますが、raspbianはそれらでは実行されません– armデバイスで実行されるため、標準のgccが付属していますarmアセンブリも必要です。(lscpuとgcc -dumpmachineを見て、使用しているcpuタイプを確認してください。)プログラムをarm cpuで実行する場合は、すべてを書き直す必要があります。x86アセンブリをコンパイルしてarmで実行できるgccパッケージは(おそらく)ありませんが、かもしれない書き直しを手伝ってくれる翻訳者になる。プログラムをamd64/x86_64 cpuで実行したいが、raspbianでのみコンパイルする場合は、クロスコンパイラーをインストールする必要があります。 (gcc-x86-64-linux-gnu + binutils-x86-64-linux-gnuにある可能性があります。)