The first version of GAS was released in 1986–1987.1 It was written by Dean Elsner and supported the VAX architecture.2
GAS supports a general syntax that works for all of the supported architectures. The general syntax includes assembler directives and a method for commenting. The default syntax is AT&T syntax.
GAS 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. While most of the available assembler directives are valid regardless of the target architecture, some directives are machine dependent.3
Since version 2.10, Intel syntax can be used through use of the .intel_syntax directive.456
GAS supports two comment styles.7
Multi-line
As in C, multi-line comments start and end with mirroring slash-asterisk pairs:
Single-line
Single line comments have a few different formats varying on which architecture is being assembled for.
Being the back-end for a popular compiler suite, namely GCC, the GNU Assembler is very widely used in compiling modern free and open source software. GAS is often used as the assembler on Linux operating systems in conjunction with other GNU software. A modified version of GAS can also be found in the macOS development tools package.
A standard "Hello, world!" program for Linux on IA-32:
"The GNU Assembler". CiteSeerX 10.1.1.32.4503. /wiki/CiteSeerX_(identifier) ↩
"The GNU Assembler - Assembler Directives". Archived from the original on 2012-02-22. Retrieved 2008-04-13. https://web.archive.org/web/20120222005603/http://sources.redhat.com/binutils/docs-2.12/as.info/Pseudo-Ops.html#Pseudo%20Ops ↩
"GNU Assembler News". A new pseudo-op .intel_syntax has been implemented to allow gas to parse i386 assembly programs with intel syntax. https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gas/NEWS;hb=HEAD ↩
"AT&T Syntax versus Intel Syntax". Archived from the original on 20 June 2011. Retrieved 28 July 2014. https://web.archive.org/web/20110620054249/http://sources.redhat.com/binutils/docs-2.12/as.info/i386-Syntax.html ↩
Ram Narayan (2007-10-17). "Linux assemblers: A comparison of GAS and NASM". IBM DeveloperWorks. Archived from the original on 3 March 2009. Retrieved 28 July 2014. https://web.archive.org/web/20090303224539/http://ibm.com/developerworks/linux/library/l-gas-nasm.html ↩
Red Hat Inc. "Using as". Archived from the original on June 20, 2011. Retrieved Jan 10, 2013. https://web.archive.org/web/20110620054223/http://sources.redhat.com/binutils/docs-2.12/as.info/Comments.html#Comments ↩