SlideShare a Scribd company logo
Assembly and Linking: From
Instructions to Execution
Assembly and linking are crucial steps in the compilation process,
transforming instructions into a program's memory image. Loading
then places the program in memory for execution. This presentation
explores the techniques required for assembly and linking, providing
insights into the complete compilation and loading process.
by ARTHI Thenraj
The Role of Assemblers and Linkers
Assembler
Translates symbolic assembly language into bit-level
representations of instructions, known as object code. It
handles instruction formats and partially translates labels
into addresses.
Linker
Completes the translation of labels into addresses and
produces an executable binary file. It combines multiple
object files into a single executable program.
Compilers often generate human-readable assembly language, freeing them from instruction format and address details.
The linker ensures the executable is ready for loading into memory.
Assembler Functionality: Translating Assembly to
Object Code
1 Opcode Translation
Translates assembly code opcodes
into their binary equivalents.
2 Instruction Formatting
Formats the bits in each instruction
according to the architecture's
specifications.
3 Label Translation
Translates labels into memory
addresses, enabling symbolic
addressing.
The assembler translates assembly code into object code, handling opcodes, instruction formats, and labels. Labels are a crucial
abstraction, allowing programmers to avoid specifying exact memory locations.
Two-Pass Assembly Process
First Pass: Symbol Table Creation
Scans the assembly code to determine the address of
each label, storing the name and address in a symbol
table.
Second Pass: Instruction Assembly
Assembles the instructions using the label values
computed in the first pass, substituting label names with
their corresponding addresses.
The assembly process involves two passes. The first pass identifies label
addresses, and the second pass assembles instructions using these
addresses. The program location counter (PLC) tracks the current
memory location during the first pass.
Program Location Counter
(PLC) and Origin
Program Location Counter (PLC)
Keeps track of the current location in memory during the assembly process.
It is incremented as the assembler scans through the code.
Origin (ORG)
A pseudo-op that specifies the starting address of the program. It sets the
PLC's value to the specified address, determining where the program begins
in memory.
The PLC assigns memory locations to labels during assembly, while the ORG
statement sets the program's starting address. Assemblers allow multiple ORG
statements to spread instructions and data across memory.
Linking: Stitching Together Program Pieces
Modularity
Breaking a large program into
smaller files helps delineate
program modularity.
1
Library Routines
If the program uses library routines,
those will already be preassembled.
2
Linker
A linker allows a program to be
stitched together out of several
smaller pieces.
3
The linker combines smaller program pieces, operating on object files and modifying assembled code to link files. Breaking
programs into smaller files enhances modularity and allows the use of preassembled library routines.
Entry Points and External References
1
Entry Point
The location in a file where a label is defined.
2
External Reference
The location in a file where a label is used but not defined.
Labels can be defined and used in the same file, or defined in one file and used in others. Entry points define labels, while
external references use them. The linker resolves these references.
Loader's Role: Resolving
External References
Resolve
The main job of the loader is to
resolve external references based
on available entry points.
Symbol Table
As a result of the need to know
how definitions and references
connect, the assembler passes to
the linker not only the object file
but also the symbol table.
The loader resolves external references using entry points, requiring the
assembler to pass the object file and symbol table to the linker. This
ensures that all references are correctly linked.
Linker's Two-Phase Process
1
Phase 1: Address Determination
Determines the starting address of each object file based on the load order specified by
the user or a load map file.
2
Phase 2: Symbol Table Merging and Address
Editing
Merges all symbol tables from the object files into a single
table and edits the object files to change relative
addresses into absolute addresses.
The linker operates in two phases. First, it determines the starting address of each object file. Second, it merges symbol
tables and edits object files to convert relative addresses to absolute addresses.
Key Takeaways and Next
Steps
Assembly and Linking
Essential steps in
transforming code into
executable programs.
Assemblers and
Linkers
Play distinct roles in
translating and combining
code.
Understanding the Process
Provides insights into software compilation and execution.
Assembly and linking are vital for creating executable programs.
Assemblers and linkers have distinct roles in translating and combining
code. Understanding this process provides valuable insights into
software compilation and execution.

More Related Content

PPT
Assembler
manpreetgrewal
 
PPTX
System software module 1 presentation file
jithujithin657
 
PPTX
linker & loader presentation in Compiler Design
AbhishekKumar117405
 
PPTX
Linker and Loader
sonalikharade3
 
PPT
assem.ppt
SonaliAjankar
 
PPTX
Loader and Its types
Parth Dodiya
 
PDF
loaders and linkers
Temesgen Molla
 
PPTX
Linkers in compiler
Asaad Al-nour
 
Assembler
manpreetgrewal
 
System software module 1 presentation file
jithujithin657
 
linker & loader presentation in Compiler Design
AbhishekKumar117405
 
Linker and Loader
sonalikharade3
 
assem.ppt
SonaliAjankar
 
Loader and Its types
Parth Dodiya
 
loaders and linkers
Temesgen Molla
 
Linkers in compiler
Asaad Al-nour
 

Similar to Assembly-and-Linking-From-Instructions-to-Execution.pptx (20)

PPT
Loaders and Linkers
kunj desai
 
PPT
loaderfffffffffffffffffffffffffffflinker.ppt
ATHMARANJANBhandary
 
PDF
Linker and Loader Explained
Adarsh Kr Sinha
 
PDF
Module-4 Program Design and Anyalysis.pdf
Sitamarhi Institute of Technology
 
PPT
System software-loaders
kitturashmikittu
 
PDF
Unit 3
pm_ghate
 
PDF
Hm system programming class 1
Hitesh Mohapatra
 
DOCX
Loaders
Sona Endow
 
PPT
Part I_Translating & Starting a Program_Compiler, Linker, Assembler, Loader_L...
Suresh D.S.
 
PDF
Aecs 132 the Assembly Language Presentation
Onekai
 
PDF
Handout#11
Sunita Milind Dol
 
PPTX
Loaders
Koganti Ravikumar
 
PPTX
Build process ppt.pptx
SHIVANISRECECE
 
PPTX
Loaders ( system programming )
Adarsh Patel
 
PPTX
Ch 4 linker loader
Malek Sumaiya
 
PPT
Loader
jayashri kolekar
 
PDF
system prgramming - loaders-linkers.pdf
SATHYABAMAMADHANKUMA
 
PPTX
SPOS UNIT 3 notes SPOS UNIT 3 notes SPOS UNIT 3 notes
22510707dypit
 
PPTX
linkerloader ss-2.pptx
SUKHPREET SINGH
 
Loaders and Linkers
kunj desai
 
loaderfffffffffffffffffffffffffffflinker.ppt
ATHMARANJANBhandary
 
Linker and Loader Explained
Adarsh Kr Sinha
 
Module-4 Program Design and Anyalysis.pdf
Sitamarhi Institute of Technology
 
System software-loaders
kitturashmikittu
 
Unit 3
pm_ghate
 
Hm system programming class 1
Hitesh Mohapatra
 
Loaders
Sona Endow
 
Part I_Translating & Starting a Program_Compiler, Linker, Assembler, Loader_L...
Suresh D.S.
 
Aecs 132 the Assembly Language Presentation
Onekai
 
Handout#11
Sunita Milind Dol
 
Build process ppt.pptx
SHIVANISRECECE
 
Loaders ( system programming )
Adarsh Patel
 
Ch 4 linker loader
Malek Sumaiya
 
system prgramming - loaders-linkers.pdf
SATHYABAMAMADHANKUMA
 
SPOS UNIT 3 notes SPOS UNIT 3 notes SPOS UNIT 3 notes
22510707dypit
 
linkerloader ss-2.pptx
SUKHPREET SINGH
 
Ad

Recently uploaded (20)

PPTX
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
PDF
The Effect of Artifact Removal from EEG Signals on the Detection of Epileptic...
Partho Prosad
 
PDF
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
PPTX
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
PDF
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
PDF
CAD-CAM U-1 Combined Notes_57761226_2025_04_22_14_40.pdf
shailendrapratap2002
 
PPTX
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
PDF
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
PDF
Machine Learning All topics Covers In This Single Slides
AmritTiwari19
 
PPTX
quantum computing transition from classical mechanics.pptx
gvlbcy
 
PPTX
Tunnel Ventilation System in Kanpur Metro
220105053
 
PDF
AI-Driven IoT-Enabled UAV Inspection Framework for Predictive Maintenance and...
ijcncjournal019
 
PDF
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
PDF
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
PDF
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
PDF
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
Mohanumar S
 
PDF
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
PDF
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 
PPTX
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 
PPTX
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
The Effect of Artifact Removal from EEG Signals on the Detection of Epileptic...
Partho Prosad
 
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
CAD-CAM U-1 Combined Notes_57761226_2025_04_22_14_40.pdf
shailendrapratap2002
 
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
Machine Learning All topics Covers In This Single Slides
AmritTiwari19
 
quantum computing transition from classical mechanics.pptx
gvlbcy
 
Tunnel Ventilation System in Kanpur Metro
220105053
 
AI-Driven IoT-Enabled UAV Inspection Framework for Predictive Maintenance and...
ijcncjournal019
 
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
Mohanumar S
 
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
Ad

Assembly-and-Linking-From-Instructions-to-Execution.pptx

  • 1. Assembly and Linking: From Instructions to Execution Assembly and linking are crucial steps in the compilation process, transforming instructions into a program's memory image. Loading then places the program in memory for execution. This presentation explores the techniques required for assembly and linking, providing insights into the complete compilation and loading process. by ARTHI Thenraj
  • 2. The Role of Assemblers and Linkers Assembler Translates symbolic assembly language into bit-level representations of instructions, known as object code. It handles instruction formats and partially translates labels into addresses. Linker Completes the translation of labels into addresses and produces an executable binary file. It combines multiple object files into a single executable program. Compilers often generate human-readable assembly language, freeing them from instruction format and address details. The linker ensures the executable is ready for loading into memory.
  • 3. Assembler Functionality: Translating Assembly to Object Code 1 Opcode Translation Translates assembly code opcodes into their binary equivalents. 2 Instruction Formatting Formats the bits in each instruction according to the architecture's specifications. 3 Label Translation Translates labels into memory addresses, enabling symbolic addressing. The assembler translates assembly code into object code, handling opcodes, instruction formats, and labels. Labels are a crucial abstraction, allowing programmers to avoid specifying exact memory locations.
  • 4. Two-Pass Assembly Process First Pass: Symbol Table Creation Scans the assembly code to determine the address of each label, storing the name and address in a symbol table. Second Pass: Instruction Assembly Assembles the instructions using the label values computed in the first pass, substituting label names with their corresponding addresses. The assembly process involves two passes. The first pass identifies label addresses, and the second pass assembles instructions using these addresses. The program location counter (PLC) tracks the current memory location during the first pass.
  • 5. Program Location Counter (PLC) and Origin Program Location Counter (PLC) Keeps track of the current location in memory during the assembly process. It is incremented as the assembler scans through the code. Origin (ORG) A pseudo-op that specifies the starting address of the program. It sets the PLC's value to the specified address, determining where the program begins in memory. The PLC assigns memory locations to labels during assembly, while the ORG statement sets the program's starting address. Assemblers allow multiple ORG statements to spread instructions and data across memory.
  • 6. Linking: Stitching Together Program Pieces Modularity Breaking a large program into smaller files helps delineate program modularity. 1 Library Routines If the program uses library routines, those will already be preassembled. 2 Linker A linker allows a program to be stitched together out of several smaller pieces. 3 The linker combines smaller program pieces, operating on object files and modifying assembled code to link files. Breaking programs into smaller files enhances modularity and allows the use of preassembled library routines.
  • 7. Entry Points and External References 1 Entry Point The location in a file where a label is defined. 2 External Reference The location in a file where a label is used but not defined. Labels can be defined and used in the same file, or defined in one file and used in others. Entry points define labels, while external references use them. The linker resolves these references.
  • 8. Loader's Role: Resolving External References Resolve The main job of the loader is to resolve external references based on available entry points. Symbol Table As a result of the need to know how definitions and references connect, the assembler passes to the linker not only the object file but also the symbol table. The loader resolves external references using entry points, requiring the assembler to pass the object file and symbol table to the linker. This ensures that all references are correctly linked.
  • 9. Linker's Two-Phase Process 1 Phase 1: Address Determination Determines the starting address of each object file based on the load order specified by the user or a load map file. 2 Phase 2: Symbol Table Merging and Address Editing Merges all symbol tables from the object files into a single table and edits the object files to change relative addresses into absolute addresses. The linker operates in two phases. First, it determines the starting address of each object file. Second, it merges symbol tables and edits object files to convert relative addresses to absolute addresses.
  • 10. Key Takeaways and Next Steps Assembly and Linking Essential steps in transforming code into executable programs. Assemblers and Linkers Play distinct roles in translating and combining code. Understanding the Process Provides insights into software compilation and execution. Assembly and linking are vital for creating executable programs. Assemblers and linkers have distinct roles in translating and combining code. Understanding this process provides valuable insights into software compilation and execution.