3

何年も前に binutils の更新ですべてのソースが壊れてしまい、断念した colorforth プロジェクトにようやく戻ることができました。何が起こっているかの例を次に示します。

jcomeau@aspire:~$ cat /tmp/test.as
    .intel_syntax
    .arch i386
    .code32
    mov eax,[foo + eax*4]
    lea    ecx,[ecx*4+0x9e0]
    mov    edx,DWORD PTR [edi*4-0x4]
    jmp    DWORD PTR [ecx*4+0x12cc]
    lea    edx,[ecx+edx*1]

最初の非ディレクティブ行は、マニュアルの例からのものです: https://sourceware.org/binutils/docs/as/i386_002dMemory.html#i386_002dMemory、残りは を使用した objdump 逆アセンブリからのもの--disassembler-options=intelです。すべてが組み立てに失敗します:

jcomeau@aspire:~$ as /tmp/test.as
/tmp/test.as: Assembler messages:
/tmp/test.as:4: Error: too many memory references for `mov'
/tmp/test.as:5: Error: too many memory references for `lea'
/tmp/test.as:6: Error: too many memory references for `mov'
/tmp/test.as:8: Error: too many memory references for `lea'
/tmp/test.as:7: Error: invalid operands (*UND* and *ABS* sections) for `*'

私は一晩中グーグルで運がなかった。私は何か間違ったことをしていると確信していますが、それが何であるかを理解できれば気になります。しましapt-get source binutilsたが、どこから調べればよいかわかりません。

jcomeau@aspire:~$ as --version
GNU assembler (GNU Binutils for Debian) 2.25.90.20151209
Copyright (C) 2015 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `i686-linux-gnu'.

gasそれで、再び料理をするための魔法の呪文は何ですか?

4

1 に答える 1

5

.intel_syntaxディレクティブで GNU Assembler を使用する場合、 ASが名前を登録するために (パーセント記号) を先頭に追加する必要がないようにするnoprefixオプションを使用する必要があります (AT&T 構文のように)。おそらく使用する必要があります:%

.intel_syntax noprefix
于 2015-12-28T06:43:52.817 に答える