Tool Chain in x86 Assembly

Tool Chain in x86 Assembly

Sep 21, 2023·

2 min read

In general, the set of programming tools used to create a program is referred to as the toolchain

The toolchain in ASM consists of the following:

  • Assembler

  • Linker

  • Loader

  • Debbuger

Assemble/Link/Load Overview

In broad terms, the assemble, link, and load process is how programmer-written source files are converted into an executable program.

The human-readable source file is converted into an object file by the assembler.

In the most basic form, the object file is converted into an executable file by the linker. The loader will load the executable file into memory.

Screenshot from 2023-09-07 20-24-05.png

Assembler

The assembler is a program that will read an assembly language input file and convert the code into a machine language binary file.

The machine language output is referred to as an object file.

The assembler used here is yasm assembler

Assemble Commands

The appropriate yasm assembler command for reading the assembly language source file is as follows:

yasm -g dwarf2 -f elf64 hello.asm -l hello.lst

-g dwarf2: used to inform the assembler to include debugging information in the final object file

-f elf64: informs the assembler to create the object file in ELF64 format

List file

The list file shows the line number, the relative address, the machine language version of the instruction, and the original source line. The list file can be useful when debugging

Linker

The linker, sometimes referred to as linkage editor, will combine one or more object files into a single executable file.

The GNU gold linker, ld is used

The appropriate linker command for the example program is:

ld -g -o hello hello.o

Loader

The loader is part of the system that will load the program from secondary storage into primary storage (ie main memory)

The loader is implicitly invoked by typing the program name.

./hello

Debugger

The debugger is used to control the execution of a program. This allows for testing and debugging activities to be performed.