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 中。)

相关内容