Open-Source Internship opportunity by OpenGenus for programmers. Apply now.
Binutils stand for "Binary Utilities" in Linux/ UNIX variants. It is a collection of different tools such as ld, ar, gold and much more. Binutils is a project of GNU funded by Free Software Foundation (FSF).
Binutils is an open-source project. The source code is available at: github.com/bminor/binutils-gdb
.
If you have ever compiled any program, then you have used ar tool of binutils.
Current version of Binutils
The latest version of binutils is v2.39.0 as of September 2022.
Binutils and GDB is merged
Binutils and GDB were two separate projects but were merged together in 2015.
Important tools from Binutils
There are different core utilities such as follows:
-
as
-
nm
-
objdump
-
ar
-
objcopy
-
strings
-
size
-
as: This tool is the assembler. It converts assembly code to binary that can be executed on the system. It is used by compilers like GCC internally. GCC convert code to assembly code and using as tool of binutils to convert the assembly code to binary. The output of ar is in a format known as ELF (Executable and Linkable Format). ELF files include binary code along with symbols which can be extracted using nm and objdump tool of binutils.
This is used as follows:
as code.s -o code.o
- nm: This tool is used to display the symbol table of a binary file (which is generated by ar tool). This is used as follows:
nm binary.o
- objdump: This tool is used to extract information from object files and has an option -d to enable it is act as a disassemble (opposite of as tool).
objdump binary.o
- ar: This tool is used to create and extract archive files which is an alternative to so files. This is optionally used in the compilation process.
Do not confuse ar with as tool.
-
objcopy: This tool is used to convert an object file from one format to another. Note as tool generates binary/ object file in ELF format and hence, objcopy tool makes it complete.
-
strings: This tool is used to search a string in a binary file which cannot be handled by any standard text editor.
-
size: This tool is used to get the total size of object files and size of specific parts of an object file as well.
The tools available in binutils are quite useful in debugging for an end user and if you are working at the low level of compilation. Binutils is a core component of any UNIX system.