SlideShare a Scribd company logo
1 of 16
Linking In MS-DOS
Shubham Shah
Yashashwi Mahindrakar
Sagar Nadgauda
Linking In MS Dos System
 First of All lets see what is linking…
 Linking is the Process of collecting and combining various pieces of code
and data into single fie.
 Thus this file can be Loaded (Copied) into Main MEMORY and executed.
 Linking can be performed at compile time, when the source code is
translated into machine code, at load time, when the program is loaded
into memory and executed by the loader, and even at run time, by
application programs.
Linkers Intro.
 On early computer systems, linking was performed manually.
 On modern systems, linking is performed automatically by programs called
linkers.
 Linkers play a crucial role in software development because they enable
separate compilation.
 Instead of organizing a large application as one monolithic source file, we
can decompose it into smaller, more manageable modules that can be
modified and compiled separately.
 When we change one of these modules, we simply recompile it and relink
the application, without having to recompile the other files
Understanding Linkers will do???
 Understanding linkers will help you build large programs. Programmers
who build large programs often encounter linker errors caused by
missing modules, missing libraries, or incompatible library versions. Unless
you understand how a linker resolves references, what a library is, and
how a linker uses a library to resolve references, these kinds of errors will
be baffling and frustrating.
 Understanding linkers will help you avoid dangerous programming
errors. The decisions that Unix linkers make when they resolve symbol
references can silently affect the correctness of your programs.
Programs that incorrectly define multiple global variables pass through
the linker without any warnings in the default case. The resulting
programs can exhibit baffling run-time behavior and are extremely
difficult to debug.
 Understanding linking will help you understand other important systems
concepts. The executable object files produced by linkers play key
roles in important systems functions such as loading and running
programs, virtual memory., paging, and memory mapping.
 Understanding linking will enable you to exploit shared libraries. For
many years, linking was considered to be fairly straightforward and
uninteresting. However, with the increased importance of shared
libraries and dynamic linking in modern operating systems, linking is
a sophisticated process that provides the knowledgeable
programmer with significant power. For example, many software
products use shared libraries to upgrade shrink-wrapped binaries at
run time. Also, most Web servers rely on dynamic linking of shared
libraries to serve dynamic content.
===== LinKing =====
 The Linker Diagram:-
More about Linking
 Static Linking
 all code modules are copied into a single executable file
the same shared module may exist in many files
 a location in this file implies the location in the memory image
 target address for cross-module reference can be determined before
run time
 Dynamic Linking
 needs help from OS ( that means the scheme varies depending on OS)
 library modules are usually linked dynamically
 inserts symbolic references in the executable file
 these symbols are resolved at run time
Object Model Format
 The Object Module of MS DOS differs from the intel specification in
some respects .We also make some simplification for the purpose of this
discussion. Details of the object module are as follows:
 “An Object module is a sequence of object records.”
 There are 14 types of object records, in which they contain 5 kinds of
information :-
 Binary Image , i.e the code and data generated by translator.
 External references.
 Public Definitions
 Debugging information such as line number in the source program.
 Miscellaneous information such as comments in the source program.
Object Records Of Intel 8088
Record Type Id(Hex) Description
THREADR 80 Translator header record
LNAMES 96 List of names record
SEGDEF 99 Segment definition record
EXTDEF 8C External names definition
PUBDEF 91 Public names definition record
LEDATA A1 Enumerated data(Binary Image)
LIDATA A3 Repeated data(binary Image)
FIXUPP 9D Fix up (i.e. relocation) record
MODEND 8B Module end record
Sample MS DOS assembly language
program
Sr.no Statement Offset
0001 NAME FIRST
0002 COMPUTE SEGMENT
0003 EXTERN
PHI:BYTE,PSI:WORD
0004 PUBLI APLHA, BETA
0007 ALPHA . . . . . . . 0015
. . .
. . .
. . .
0012 MOV AX, SEG PHI 0028
. . .
. . .
. . .
0029 BETA .. . . . . . . . . 0084
0036 COMPUTE ENDS
Design of Linker
 For linking in MS Dos system we will design a program named LINKER which
performs both linking and relocation of absolute segments and of re
locatable segments that cannot be combined with other re
locatable segments.
 Its output is a binary program which resembles a program with .COM
extension in MS DOS.
 This program is not relocated by the loader prior the execution .
 (Note:- the difference between the LINKER and the LINK program of MS DOS
:LINK produces a program with .EXE extension, which is relocated by the
loader prior to execution)
Specification
 The LINKER invocation command has the following format:
 LINKER <object module names> ,<executable file>,
<load origin>, <list of library files>
 The linker performs relocation and linking of all named object modules to
produce a binary program with the specified load origin.
 The program is stored in the file with the name <executable file>.If the
LINKER comes across an external symbol that is not defined in any of the
object modules named in th LINKER command, it locates ian object
module in one of the library files included in <list of library files>that contains
a public definitions.
 This method of resolving an external reference by automatically including
an object module form a library file is called “AUTOLINKING”.
Datastructures.
 Here the linker program has two pass organization .
 In first pass object modules are processed to collect information concering
segments and public definations into name table(NTAB)
 The second pass performs relocation and linking to produce a binary
program.
General Shortcut to remember of ms
dos linking
 pass 1:
allocates segments defined in SEGDEF
resolve external symbols
 pass 2:
prepare memory image
if needed, disk space is also used
expand LIDATA
relocations within segment
write .EXE file
General Difference between linux and
ms dos linker
 Linux linker GOT(Global Offset table ) & lazy modeling.
 Where as the ms dos linker does pass 1 & pass2 linking wise
Thank you
 Any questions

More Related Content

What's hot (20)

Unit 4 sp macro
Unit 4 sp macroUnit 4 sp macro
Unit 4 sp macro
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
Unit 3
Unit 3Unit 3
Unit 3
 
System software - macro expansion,nested macro calls
System software - macro expansion,nested macro callsSystem software - macro expansion,nested macro calls
System software - macro expansion,nested macro calls
 
Language processors
Language processorsLanguage processors
Language processors
 
loaders and linkers
 loaders and linkers loaders and linkers
loaders and linkers
 
System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1
 
Loaders
LoadersLoaders
Loaders
 
Direct linking loader
Direct linking loaderDirect linking loader
Direct linking loader
 
Software tools
Software toolsSoftware tools
Software tools
 
Language processing activity
Language processing activityLanguage processing activity
Language processing activity
 
Macro assembler
 Macro assembler Macro assembler
Macro assembler
 
Interactive debugging system
Interactive debugging systemInteractive debugging system
Interactive debugging system
 
System Programming- Unit I
System Programming- Unit ISystem Programming- Unit I
System Programming- Unit I
 
Pass Structure of Assembler
Pass Structure of AssemblerPass Structure of Assembler
Pass Structure of Assembler
 
Linker and Loader
Linker and Loader Linker and Loader
Linker and Loader
 
Loaders
LoadersLoaders
Loaders
 
Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction tools
 
Design of a two pass assembler
Design of a two pass assemblerDesign of a two pass assembler
Design of a two pass assembler
 
System Programming Overview
System Programming OverviewSystem Programming Overview
System Programming Overview
 

Viewers also liked

Viewers also liked (20)

Linkers
LinkersLinkers
Linkers
 
MASM -UNIT-III
MASM -UNIT-IIIMASM -UNIT-III
MASM -UNIT-III
 
UNIX introduction
UNIX introductionUNIX introduction
UNIX introduction
 
Lecture11 syntax analysis_7
Lecture11 syntax analysis_7Lecture11 syntax analysis_7
Lecture11 syntax analysis_7
 
C LANGUAGE - BESTECH SOLUTIONS
C LANGUAGE - BESTECH SOLUTIONSC LANGUAGE - BESTECH SOLUTIONS
C LANGUAGE - BESTECH SOLUTIONS
 
Unix Introduction
Unix IntroductionUnix Introduction
Unix Introduction
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
Loader
LoaderLoader
Loader
 
Structure of c_program_to_input_output
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_output
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
 
Inline functions & macros
Inline functions & macrosInline functions & macros
Inline functions & macros
 
Solaris basics
Solaris basicsSolaris basics
Solaris basics
 
C material
C materialC material
C material
 
Direct linking loaders
Direct linking loadersDirect linking loaders
Direct linking loaders
 
Linkers And Loaders
Linkers And LoadersLinkers And Loaders
Linkers And Loaders
 
SYSTEM SOFTWARE
SYSTEM SOFTWARESYSTEM SOFTWARE
SYSTEM SOFTWARE
 
Overview of c language
Overview of c languageOverview of c language
Overview of c language
 
Unix system programming
Unix system programmingUnix system programming
Unix system programming
 
System software and Application software
System software and Application softwareSystem software and Application software
System software and Application software
 
Operating system (remuel)
Operating system (remuel)Operating system (remuel)
Operating system (remuel)
 

Similar to Linking in MS-Dos System

Loaders and Linkers
Loaders and LinkersLoaders and Linkers
Loaders and Linkerskunj desai
 
Hm system programming class 1
Hm system programming class 1Hm system programming class 1
Hm system programming class 1Hitesh Mohapatra
 
DLL Tutor maXbox starter28
DLL Tutor maXbox starter28DLL Tutor maXbox starter28
DLL Tutor maXbox starter28Max Kleiner
 
An isas presentation on .net framework 2.0 by vikash chandra das
An isas presentation on .net framework 2.0 by vikash chandra dasAn isas presentation on .net framework 2.0 by vikash chandra das
An isas presentation on .net framework 2.0 by vikash chandra dasVikash Chandra Das
 
Automatic answer checker
Automatic answer checkerAutomatic answer checker
Automatic answer checkerYesu Raj
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNicole Gomez
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008guestd9065
 
.Net framework interview questions
.Net framework interview questions.Net framework interview questions
.Net framework interview questionsMir Majid
 
Address Binding Scheme
Address Binding SchemeAddress Binding Scheme
Address Binding SchemeRajesh Piryani
 
C++ shared libraries and loading
C++ shared libraries and loadingC++ shared libraries and loading
C++ shared libraries and loadingRahul Jamwal
 
Aspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NETAspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NETWaqas Tariq
 
Interview Question of Aspdotnet
Interview Question of AspdotnetInterview Question of Aspdotnet
Interview Question of AspdotnetMohitKumar1985
 

Similar to Linking in MS-Dos System (20)

Loaders and Linkers
Loaders and LinkersLoaders and Linkers
Loaders and Linkers
 
Linkers in compiler
Linkers in compilerLinkers in compiler
Linkers in compiler
 
Hm system programming class 1
Hm system programming class 1Hm system programming class 1
Hm system programming class 1
 
DLL Tutor maXbox starter28
DLL Tutor maXbox starter28DLL Tutor maXbox starter28
DLL Tutor maXbox starter28
 
Linkers
LinkersLinkers
Linkers
 
An isas presentation on .net framework 2.0 by vikash chandra das
An isas presentation on .net framework 2.0 by vikash chandra dasAn isas presentation on .net framework 2.0 by vikash chandra das
An isas presentation on .net framework 2.0 by vikash chandra das
 
Linkers
LinkersLinkers
Linkers
 
Automatic answer checker
Automatic answer checkerAutomatic answer checker
Automatic answer checker
 
Revers engineering
Revers engineeringRevers engineering
Revers engineering
 
Project seminar
Project seminarProject seminar
Project seminar
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language Analysis
 
Microsoft data access components
Microsoft data access componentsMicrosoft data access components
Microsoft data access components
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008
 
.Net framework interview questions
.Net framework interview questions.Net framework interview questions
.Net framework interview questions
 
dot NET Framework
dot NET Frameworkdot NET Framework
dot NET Framework
 
Address Binding Scheme
Address Binding SchemeAddress Binding Scheme
Address Binding Scheme
 
C++ shared libraries and loading
C++ shared libraries and loadingC++ shared libraries and loading
C++ shared libraries and loading
 
Aspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NETAspect Oriented Programming Through C#.NET
Aspect Oriented Programming Through C#.NET
 
Interview Question of Aspdotnet
Interview Question of AspdotnetInterview Question of Aspdotnet
Interview Question of Aspdotnet
 
Module-4 Program Design and Anyalysis.pdf
Module-4 Program Design and Anyalysis.pdfModule-4 Program Design and Anyalysis.pdf
Module-4 Program Design and Anyalysis.pdf
 

More from Satyamevjayte Haxor (16)

Processes and threads
Processes and threadsProcesses and threads
Processes and threads
 
Patterns
PatternsPatterns
Patterns
 
Uml class Diagram
Uml class DiagramUml class Diagram
Uml class Diagram
 
Uml Common Mechanism
Uml Common MechanismUml Common Mechanism
Uml Common Mechanism
 
Types and roles
Types and rolesTypes and roles
Types and roles
 
States machine
States machineStates machine
States machine
 
What is symbol table?
What is symbol table?What is symbol table?
What is symbol table?
 
Lexical
LexicalLexical
Lexical
 
Linker
LinkerLinker
Linker
 
sCode optimization
sCode optimizationsCode optimization
sCode optimization
 
Single Pass Assembler
Single Pass AssemblerSingle Pass Assembler
Single Pass Assembler
 
Nested micro
Nested microNested micro
Nested micro
 
Multiplier control unit
Multiplier control unitMultiplier control unit
Multiplier control unit
 
Control unit design
Control unit designControl unit design
Control unit design
 
Compilers
CompilersCompilers
Compilers
 
Keyword Presentation
Keyword PresentationKeyword Presentation
Keyword Presentation
 

Recently uploaded

%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 

Recently uploaded (20)

%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 

Linking in MS-Dos System

  • 1. Linking In MS-DOS Shubham Shah Yashashwi Mahindrakar Sagar Nadgauda
  • 2. Linking In MS Dos System  First of All lets see what is linking…  Linking is the Process of collecting and combining various pieces of code and data into single fie.  Thus this file can be Loaded (Copied) into Main MEMORY and executed.  Linking can be performed at compile time, when the source code is translated into machine code, at load time, when the program is loaded into memory and executed by the loader, and even at run time, by application programs.
  • 3. Linkers Intro.  On early computer systems, linking was performed manually.  On modern systems, linking is performed automatically by programs called linkers.  Linkers play a crucial role in software development because they enable separate compilation.  Instead of organizing a large application as one monolithic source file, we can decompose it into smaller, more manageable modules that can be modified and compiled separately.  When we change one of these modules, we simply recompile it and relink the application, without having to recompile the other files
  • 4. Understanding Linkers will do???  Understanding linkers will help you build large programs. Programmers who build large programs often encounter linker errors caused by missing modules, missing libraries, or incompatible library versions. Unless you understand how a linker resolves references, what a library is, and how a linker uses a library to resolve references, these kinds of errors will be baffling and frustrating.  Understanding linkers will help you avoid dangerous programming errors. The decisions that Unix linkers make when they resolve symbol references can silently affect the correctness of your programs. Programs that incorrectly define multiple global variables pass through the linker without any warnings in the default case. The resulting programs can exhibit baffling run-time behavior and are extremely difficult to debug.
  • 5.  Understanding linking will help you understand other important systems concepts. The executable object files produced by linkers play key roles in important systems functions such as loading and running programs, virtual memory., paging, and memory mapping.  Understanding linking will enable you to exploit shared libraries. For many years, linking was considered to be fairly straightforward and uninteresting. However, with the increased importance of shared libraries and dynamic linking in modern operating systems, linking is a sophisticated process that provides the knowledgeable programmer with significant power. For example, many software products use shared libraries to upgrade shrink-wrapped binaries at run time. Also, most Web servers rely on dynamic linking of shared libraries to serve dynamic content.
  • 6. ===== LinKing =====  The Linker Diagram:-
  • 7. More about Linking  Static Linking  all code modules are copied into a single executable file the same shared module may exist in many files  a location in this file implies the location in the memory image  target address for cross-module reference can be determined before run time  Dynamic Linking  needs help from OS ( that means the scheme varies depending on OS)  library modules are usually linked dynamically  inserts symbolic references in the executable file  these symbols are resolved at run time
  • 8. Object Model Format  The Object Module of MS DOS differs from the intel specification in some respects .We also make some simplification for the purpose of this discussion. Details of the object module are as follows:  “An Object module is a sequence of object records.”  There are 14 types of object records, in which they contain 5 kinds of information :-  Binary Image , i.e the code and data generated by translator.  External references.  Public Definitions  Debugging information such as line number in the source program.  Miscellaneous information such as comments in the source program.
  • 9. Object Records Of Intel 8088 Record Type Id(Hex) Description THREADR 80 Translator header record LNAMES 96 List of names record SEGDEF 99 Segment definition record EXTDEF 8C External names definition PUBDEF 91 Public names definition record LEDATA A1 Enumerated data(Binary Image) LIDATA A3 Repeated data(binary Image) FIXUPP 9D Fix up (i.e. relocation) record MODEND 8B Module end record
  • 10. Sample MS DOS assembly language program Sr.no Statement Offset 0001 NAME FIRST 0002 COMPUTE SEGMENT 0003 EXTERN PHI:BYTE,PSI:WORD 0004 PUBLI APLHA, BETA 0007 ALPHA . . . . . . . 0015 . . . . . . . . . 0012 MOV AX, SEG PHI 0028 . . . . . . . . . 0029 BETA .. . . . . . . . . 0084 0036 COMPUTE ENDS
  • 11. Design of Linker  For linking in MS Dos system we will design a program named LINKER which performs both linking and relocation of absolute segments and of re locatable segments that cannot be combined with other re locatable segments.  Its output is a binary program which resembles a program with .COM extension in MS DOS.  This program is not relocated by the loader prior the execution .  (Note:- the difference between the LINKER and the LINK program of MS DOS :LINK produces a program with .EXE extension, which is relocated by the loader prior to execution)
  • 12. Specification  The LINKER invocation command has the following format:  LINKER <object module names> ,<executable file>, <load origin>, <list of library files>  The linker performs relocation and linking of all named object modules to produce a binary program with the specified load origin.  The program is stored in the file with the name <executable file>.If the LINKER comes across an external symbol that is not defined in any of the object modules named in th LINKER command, it locates ian object module in one of the library files included in <list of library files>that contains a public definitions.  This method of resolving an external reference by automatically including an object module form a library file is called “AUTOLINKING”.
  • 13. Datastructures.  Here the linker program has two pass organization .  In first pass object modules are processed to collect information concering segments and public definations into name table(NTAB)  The second pass performs relocation and linking to produce a binary program.
  • 14. General Shortcut to remember of ms dos linking  pass 1: allocates segments defined in SEGDEF resolve external symbols  pass 2: prepare memory image if needed, disk space is also used expand LIDATA relocations within segment write .EXE file
  • 15. General Difference between linux and ms dos linker  Linux linker GOT(Global Offset table ) & lazy modeling.  Where as the ms dos linker does pass 1 & pass2 linking wise
  • 16. Thank you  Any questions

Editor's Notes

  1. Differnce between ms dos linker and linux linker