Generated by GPT-5-mini| GAS (GNU Assembler) | |
|---|---|
| Name | GNU Assembler |
| Othernames | GAS |
| Developer | GNU Project |
| Released | 1986 |
| Operating system | Unix-like, Windows |
| License | GNU General Public License |
GAS (GNU Assembler) GAS is the assembler component of the GNU Binutils used to translate human-writable assembly language into machine code for multiple x86 architecture, ARM architecture, MIPS architecture and other processor families. It was created to support the GNU Project's goal of providing a free software toolchain and integrates closely with compilers such as GCC and linkers such as GNU ld to produce executable binaries for systems running Linux, FreeBSD, and Microsoft Windows (via MinGW and Cygwin). The project has interacted with many notable computing efforts including Linux Kernel, NetBSD, and Debian distributions.
GAS originated within the GNU Project in the mid-1980s to complement tools like GCC and GNU Make, influenced by prior assemblers used on Unix systems at institutions such as Bell Labs and projects like BSD. Contributors associated with organizations such as the Free Software Foundation and individuals active in X Consortium-era development extended support for new instruction sets as processors from Intel, AMD, ARM Limited, and MIPS Technologies evolved. Over time, GAS's codebase was maintained in repositories coordinated by developers who also worked on GDB, Binutils, and toolchain components used by distributions including Red Hat and SUSE. Major milestones tied to toolchain modernization include integration for ELF object formats, support for new relocations needed by PIC used by Android, and backend changes prompted by processors such as Itanium and PowerPC.
GAS implements a single-pass and multi-pass assembler design optimized for the needs of compilers like GCC and linkers such as GNU gold. It supports object file formats including ELF, COFF, and Mach-O allowing interoperability with projects like LLVM and toolchains used by Apple Inc.. GAS provides macro capabilities, conditional assembly, and flexible relocation handling required by systems such as glibc and musl libc. Its design emphasizes portability across operating systems such as NetBSD, OpenBSD, and Haiku while remaining extensible for instruction encodings introduced by vendors like ARM Ltd. and RISC-V International.
GAS traditionally uses the AT&T syntax for x86 architecture assembly, contrasting with the Intel syntax used by assemblers from Intel Corporation and others; it also supports syntax adaptations needed by projects like GNU Assembler documentation and vendor-specific assemblers used by Microsoft Corporation. Directives such as .section, .globl, .text, and .data control assembly of segments used by linkers in ELF toolchains; macro and conditional directives assist porting code across architectures used by Sony, NVIDIA, and Qualcomm. Integration with compiler-generated directives allows cooperation with languages and runtime systems from projects like GCC, Clang, and runtime libraries such as libstdc++ and libgcc.
GAS supports an extensive list of architectures, including but not limited to x86 architecture (32-bit and 64-bit variants used by Intel and AMD), ARM architecture (including ARMv7 and ARMv8 used in devices by Apple Inc. and Samsung), MIPS architecture (employed historically by Silicon Graphics and embedded vendors), PowerPC (used by IBM and legacy Apple Inc. hardware), RISC-V International designs, SPARC (from Sun Microsystems), and others supported in projects used by Embedded systems vendors. Platforms running GAS include Linux, MinGW, Cygwin, FreeBSD, NetBSD, and macOS-based development environments that interoperate with toolchains like LLVM.
GAS is a core component of the GNU toolchain and interacts closely with GCC, GNU ld, and GDB to support build systems such as Autotools and CMake. It consumes assembler output from compilers in projects like GCC frontend passes and emits object code compatible with linkers used in distributions like Debian and Fedora. Cross-compilation toolchains targeting embedded platforms in projects sponsored by ARM Limited, RISC-V International, and vendors like NXP Semiconductors and STMicroelectronics rely on GAS variants or ported binutils. Integration with binary utilities such as objdump and readelf from Binutils facilitates debugging workflows involving GDB and performance tools used by Valgrind.
Common idioms in GAS-based assembly include function prologues/epilogues compatible with calling conventions defined by System V and platform-specific ABIs used by projects such as Android NDK and iOS toolchains. Example patterns include use of .globl to export symbols consumed by GCC-compiled object files, label-local symbols for link-time optimizations in GNU ld, and section directives to place code and data in regions expected by bootloaders developed for systems like GRUB and firmware used by UEFI vendors. Developers porting assembly between assemblers from Microsoft or vendor toolchains often adapt syntax or directive usage to accommodate differences in symbol naming and relocation semantics found in COFF versus ELF based workflows.
GAS is developed as part of the GNU Project and distributed under the GNU General Public License to ensure compatibility with free software ecosystems embraced by organizations such as the Free Software Foundation and communities around Debian and GNU Savannah. Contributions historically come from individuals affiliated with companies and institutions including Red Hat, IBM, and academic groups that maintain compatibility with evolving processor standards from ARM Limited, Intel Corporation, and open standards bodies like RISC-V International. Maintenance occurs in public repositories where coordination with projects like GCC and Binutils ensures ongoing support for new architectures and object formats.
Category:Assemblers