Raspbian gcc 不知道「.intel_syntax」?

Raspbian gcc 不知道「.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

有什麼我必須安裝的軟體包嗎?

答案1

「彙編」語言是依賴體系結構的,因為它的本質是直接編寫CPU指令,並且每種CPU類型都有不同的指令。您的整個程式是用 amd64 / Intel x86_64 彙編程式碼編寫的,但 Raspbian 不能在這些程式碼上運行 - 它在 ARM 裝置上運行,因此gcc它附帶的標準也需要 ARM 彙編。

(查看lscpugcc -dumpmachine找出您擁有的 CPU 類型。)

如果你想讓程式在ARM CPU上運行,你必須全部重寫。 (可能)沒有 gcc 軟體包可以編譯 x86 程序集以在 ARM 上運行,儘管有可能成為翻譯人員來幫助您重寫。

如果您希望程式在 amd64/x86_64 CPU 上執行,但只在 Raspbian 上編譯,則必須安裝交叉編譯器。 (它可能位於 gcc-x86-64-linux-gnu + binutils-x86-64-linux-gnu 中。)

相關內容