Home      Discussion      Topics      Dictionary      Almanac
Signup       Login
GNU Assembler

GNU Assembler

Overview
The GNU Assembler, commonly known as Gas, is the assembler used by the GNU Project
GNU Project
The GNU Project is a free software, mass collaboration project, announced on September 27 1983, by Richard Stallman at MIT. It initiated the GNU operating system, software development for which began in January 1984...

. It is the default back-end of gcc
GNU Compiler Collection
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...

. It is used to compile the GNU operating system and the Linux kernel
Linux kernel
The Linux kernel is an operating system kernel used by the Linux family of Unix-like operating systems. It is one of the most prominent examples of free and open source software....

, and various other software. It is a part of the GNU Binutils package.

Gas's executable
Executable
In computing, an executable causes a computer "to perform indicated tasks according to encoded instructions," as opposed to a file that only contains data. Files that contain instructions for an interpreter or virtual machine may be considered executables, but are more specifically called scripts...

 is named after as
As (Unix)
as is a generic name for an assembler on Unix. The GNU Project's assembler is named Gas....

, a Unix
Unix
Unix is a computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 assembler. Gas is cross-platform
Cross-platform
In computing, cross-platform is a term used to refer to computer software or computing methods and concepts that are implemented and inter-operate on multiple computer platforms...

, and both runs on and assembles for a number of different computer architecture
Computer architecture
In computer engineering, computer architecture is the conceptual design and fundamental operational structure of a computer system. It is a blueprint and functional description of requirements and design implementations for the various parts of a computer, focusing largely on the way by which the...

s.
Discussion
Ask a question about 'GNU Assembler'
Start a new discussion about 'GNU Assembler'
Answer questions from other users
Full Discussion Forum
 
Encyclopedia
The GNU Assembler, commonly known as Gas, is the assembler used by the GNU Project
GNU Project
The GNU Project is a free software, mass collaboration project, announced on September 27 1983, by Richard Stallman at MIT. It initiated the GNU operating system, software development for which began in January 1984...

. It is the default back-end of gcc
GNU Compiler Collection
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...

. It is used to compile the GNU operating system and the Linux kernel
Linux kernel
The Linux kernel is an operating system kernel used by the Linux family of Unix-like operating systems. It is one of the most prominent examples of free and open source software....

, and various other software. It is a part of the GNU Binutils package.

Gas's executable
Executable
In computing, an executable causes a computer "to perform indicated tasks according to encoded instructions," as opposed to a file that only contains data. Files that contain instructions for an interpreter or virtual machine may be considered executables, but are more specifically called scripts...

 is named after as
As (Unix)
as is a generic name for an assembler on Unix. The GNU Project's assembler is named Gas....

, a Unix
Unix
Unix is a computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 assembler. Gas is cross-platform
Cross-platform
In computing, cross-platform is a term used to refer to computer software or computing methods and concepts that are implemented and inter-operate on multiple computer platforms...

, and both runs on and assembles for a number of different computer architecture
Computer architecture
In computer engineering, computer architecture is the conceptual design and fundamental operational structure of a computer system. It is a blueprint and functional description of requirements and design implementations for the various parts of a computer, focusing largely on the way by which the...

s. Released under the GNU General Public License
GNU General Public License
The GNU General Public License is a widely used free software license, originally written by Richard Stallman for the GNU project....

, Gas is free software
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with minimal restrictions only to ensure that further recipients can also...

.

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.

Assembler directives


The GNU Assembler uses assembler directives (also known as pseudo ops), which are keywords beginning with a period that behave similarly to preprocessor directives in the C programming language
Programming language
A programming language is an artificial language designed to express computations that can be performed by a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine, to express algorithms precisely, or as a mode of human...

. Most of the available assembler directives are valid regardless of the target architecture, however some directives are machine dependent.

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.

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
  1. as well as this

movl %edx,%eax

Criticisms


One source of criticism is the fact that on the x86 and x86-64
X86-64
In processor design, x86-64 is an extension of the x86 instruction set. It allows far larger virtual and physical address spaces than x86, doubles the width of the integer registers from 32 to 64 bits, increases the number of integer registers, and provides other enhancements...

 architecture it uses the AT&T
AT&T
AT&T Inc. is the largest provider of local, long distance telephone services in the United States, and also serves digital subscriber line Internet access. AT&T is the second largest provider of wireless service in the United States, with over 77 million wireless customers, and more than 150...

 assembler syntax, rather than the Intel syntax used in many other assemblers; however, since version 2.10, support for the Intel syntax via the .intel_syntax directive has been added.

See also



  • GNU toolchain
    GNU toolchain
    The GNU toolchain is a blanket term for a collection of programming tools produced by the GNU Project. These tools form a toolchain used for developing applications and operating systems....

  • Binary File Descriptor library
  • List of assemblers

External links