天天看點

2009-10-15 16:49 64位彙編編譯器(整理)

http://hi.baidu.com/ballmillsap/item/f665554966cb690dc11613fb

在支援64位彙編編譯器已經很多很多了,這裡隻把我知道的幾個,簡單羅列一下,不足之處還請其他大俠予以糾正和加以補充:

(一)

·ml64.exe

這是VC++   2005裡帶的彙編編譯器,隻要你安裝了Visual   Studio   2005軟體,這個就有了。它的目錄一般是在“Program   Files\Microsoft   Visual   Studio   8\VC\bin\amd64”,你在這裡一定可以發現有個ml64.exe檔案。從[開始菜單]-> [Microsoft   Visual   Studio   2005]-> [Visual   Studio   Tools]-> [Visual   Studio   2005   x64   相容工具指令提示]也可以啟動它,它啟動指令行視窗一般先要執行一個批處理檔案,就是“Program   Files\Microsoft   Visual   Studio   8\VC\vcvarsall.bat”,然後有了這個環境才可運作ml64.exe。

ml64.exe的詳細用法可檢視“ml64   /?”

Microsoft   (R)   Macro   Assembler   (x64)   Version   8.00.50727.762

Copyright   (C)   Microsoft   Corporation.     All   rights   reserved.

ML64   [   /options   ]   filelist   [   /link   linkoptions   ]

/Bl <linker>   Use   alternate   linker                     /Sf   Generate   first   pass   listing

/c   Assemble   without   linking                               /Sl <width>   Set   line   width

/Cp   Preserve   case   of   user   identifiers           /Sn   Suppress   symbol-table   listing

/Cx   Preserve   case   in   publics,   externs           /Sp <length>   Set   page   length

/D <name> [=text]   Define   text   macro                   /Ss <string>   Set   subtitle

/EP   Output   preprocessed   listing   to   stdout   /St <string>   Set   title

/F   <hex>   Set   stack   size   (bytes)                       /Sx   List   false   conditionals

/Fe <file>   Name   executable                                   /Ta <file>   Assemble   non-.ASM   file

/Fl[file]   Generate   listing                                 /w   Same   as   /W0   /WX

/Fm[file]   Generate   map                                         /WX   Treat   warnings   as   errors

/Fo <file>   Name   object   file                                 /W <number>   Set   warning   level

/Fr[file]   Generate   limited   browser   info       /X   Ignore   INCLUDE   environment   path

/FR[file]   Generate   full   browser   info             /Zd   Add   line   number   debug   info

/I <name>   Add   include   path                                   /Zf   Make   all   symbols   public

/link   <linker   options   and   libraries>             /Zi   Add   symbolic   debug   info

/nologo   Suppress   copyright   message                 /Zp[n]   Set   structure   alignment

/Sa   Maximize   source   listing                               /Zs   Perform   syntax   check   only

/errorReport: <option>   Report   internal   assembler   errors   to   Microsoft

none   -   do   not   send   report

prompt   -   prompt   to   immediately   send   report

queue   -   at   next   admin   logon,   prompt   to   send   report

send   -   send   report   automatically

(二)

·GoASM

下載下傳位址:

http://www.jorgon.freeserve.co.uk

這個支援64位,它的編譯器是GoAsm.exe,還有連結器GoLink.exe、資源編譯器GoRC.exe、除錯測試工具GoBug.exe和TestBug.exe等。

GoAsm.exe的詳細用法可檢視“goasm   -h”:

GoAsm.Exe   Version   0.56.03a-   Copyright   Jeremy   Gordon   2001/7   -   [email protected]

Use   this   syntax   in   the   command   line:-

GoAsm   [command   line   switches]   inputfile[.ext]

(.asm   assumed   if   file   not   found   and   no   extension   specified)

Command   line   switches:-

/b=beep   on   error

/c=force   output   to   current   directory

/d=define   a   word   (eg.   /d   WORD=0x345)

/e=empty   output   file   allowed

/fo=specify   output   path/file   eg.   /fo   asm\myprog.obj

/h=this   help

/l=create   listing   output   file

/ms=decorate   for   ms   linker

/ne=no   error   messages         /ni=no   information   messages

/nw=no   warning   messages     /no=no   output   messages   at   all

/x64=assemble   for   AMD64   or   EM64T

/x86=assemble   64-bit   source   in   32-bit   compatible   mode

(三)

·YASM

YASM是一個跨平台、支援多種目标檔案格式的彙編編譯器,它有Windows/Linux/DOS等版本,它重寫了停滞的NASM項目。并支援GAS(GNU   assembler)文法和AMD64(EM64T)架構,它的源代碼在三條款BSD等授權下發放。

下載下傳位址:

http://www.tortall.net/projects/yasm

它的源代碼是以“.tar.gz”作檔案擴充名的,比如yasm-0.6.0.tar.gz,源碼用c語言和彙編寫成,可以參考一下。64位編譯器檔案名 含有“win64”,比如yasm-0.6.0-win64.exe。下載下傳了yasm-0.6.0-win64.exe可執行檔案後,可将其改名為 “yasm.exe”以友善今後使用。yasm.exe的用法大緻象這樣:yasm   -o   object.o   source.asm

它還有許多選項參數,這些更具體用法請參考指令行“yasm   -h”

(四)

·FASM

它的全稱是“Flat   Assembler”,支援64Bit彙編。

下載下傳位址:

http://flatassembler.net

它的Windows版本運作檔案FASMW.EXE可以在Windows下直接輕按兩下打開視窗,也可以帶參數執行編譯。fasmw直接編譯源碼檔案的用法如下:

usage:   fasmw   <source>   [output]

optional   settings:

-m   <limit>     set   the   limit   in   kilobytes   for   the   memory   available   to   assembler

-p   <limit>     set   the   maximum   allowed   number   of   passes

(五)

·GAS

上面都說了不少支援Windows系統平台的,再說一個Linux下的64位編譯器,就是GAS(GNU   Assembler)。GAS的編譯器是“as”,它的連結器是“ld”,GAS的網址是“http://www.gnu.org/software /binutils”,GAS被包含在GNU   BinUtils包裡,這個binutils最新版本是2.17。

下載下傳位址:

http://ftp.gnu.org/gnu/binutils

在這個位址找到其最新版本的源代碼檔案,比如“binutils-2.17.tar.gz”,然後下載下傳。

然後在Linux裡解開這個“.tar.gz”檔案并編譯它的源碼,關于怎樣編譯請參考README檔案,無外乎:

./configure  

make

make   install

這樣的指令。

編譯後就可以運作“as”指令來編譯彙編源檔案了,as的進一步用法請參考“as   -help”。

應該還有其他很多支援64位彙編的編譯器,我沒說到的請其他人補充。

2009-10-15 16:49 64位彙編編譯器(整理)