GNU Assembler
From Wikipedia, the free encyclopedia
| Stable release | 2.19 / 2008-10-27 |
|---|---|
| Platform | Cross-platform |
| Website | http://www.gnu.org/software/binutils/ |
The GNU Assembler, commonly known as Gas, is the assembler used by the GNU Project. It is the default back-end of gcc. It is used to compile the GNU operating system and the Linux kernel, and various other software. It is a part of the GNU Binutils package.
Gas's executable is named after as, a Unix assembler. Gas is cross-platform, and both runs on and assembles for a number of different computer architectures. Released under the GNU General Public License, Gas is free software.
Contents |
[edit] General syntax
The GNU Assembler has a general syntax that works for all of the supported architectures. The general syntax includes assembler directives and a method for commenting.
[edit] Assembler directives
The GNU Assembler uses assembler directives (also known as pseudo ops), which are keywords beginning with a period that behave similarly to preprocesser directives in the C programming language. Most of the available assembler directives are valid regardless of the target architecture, however some directives are machine dependent.[1]
[edit] Comments
Similar to the C programming language is Gas's implementation of multiline comments which uses /* to begin a comment and */ to end a comment.[2]
For example:
movl %eax,%edx /* this is a comment sandwich,
it is made of description
and linebreak */
Gas uses the # symbol for a single-line comment.
For example:
pop %edx # this is a comment
# as well as this
movl %edx,%eax
[edit] Criticisms
One source of criticism is the fact that on the x86 and x86-64 architecture it uses the AT&T assembler syntax, rather than the Intel syntax used in many other assemblers; however, since version 2.10[3], support for the Intel syntax via the .intel_syntax directive has been added.[4][5]
[edit] See also
[edit] References
- ^ "The GNU Assembler - Assembler Directives". http://sources.redhat.com/binutils/docs-2.12/as.info/Pseudo-Ops.html#Pseudo%20Ops.
- ^ "The GNU Assembler - Comments". http://sources.redhat.com/binutils/docs-2.12/as.info/Comments.html#Comments.
- ^ "GNU Assembler News". http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/NEWS?rev=1.93&content-type=text/x-cvsweb-markup&cvsroot=src.
- ^ "AT&T Syntax versus Intel Syntax". Using as, the GNU Assembler. http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/gnu-assembler/i386-syntax.html.
- ^ Ram Narayan (2007-10-17). "Linux assemblers: A comparison of GAS and NASM". IBM DeveloperWorks. http://www.ibm.com/developerworks/linux/library/l-gas-nasm.html. Retrieved on 2007-10-17.
[edit] External links
| The Wikibook X86 Assembly has a page on the topic of |
- Binutils homepage
- Gas manual
- : the portable GNU assembler – Linux man page
|
|||||||||||||||||||

