LOADERS AND LINKERS
1. What are the basic functions of loaders?
* Loading - brings the object program into memory for execution
* Relocation - modifies the object program so that it can be loaded
at an address different from the location originally specified
* Linking - combines two or more separate object programs and also
supplies the information needed to reference them.
2. Define absolute loader.
The loader, which is used only for loading, is known as absolute loader.
e.g. Bootstrap loader
3. What is meant by bootstrap loader?
This is a special type of absolute loader which loads the first program
to be run by the computer. (usually an operating system)
4. What are relative (relocative) loaders?
Loaders that allow for program relocation are called relocating
(relocative) loaders.
5. What is the use of modification record?
Modification record is used for program relocation. Each modification
record specifies the starting address and the length of the field
whose value is to be altered and also describes the modification to
be performed.
6. What are the 2 different techniques used for relocation?
Modification record method and relocation bit method.
7. Define Relocation bit method.
If the relocation bit corresponding to a word of object code is set
to 1, the program's starting address is to be added to this word when
the program is relocated. Bit value 0 indicates no modification is required.
8. Define bit mask.
The relocation bits are gathered together following the length indicator
in each text record and which is called as bit mask. For e.g. the bit
mask FFC(111111111100) specifies that the first 10 words of object code
are to be modified during relocation.
9. What is the need of ESTAB?
It is used to store the name and address of the each external symbol.
It also indicates in which control section the symbol is defined.
10. What is the use of the variable PROGADDR?
It gives the beginning address in memory where the linked program
is to be loaded. The starting address is obtained from the operating
system.
11. Write the two passes of a linking loader.
Pass1: assigns address to all external symbols
Pass2: it performs actual loading, relocation and linking.
12. Define automatic library search.
In many linking loaders the subroutines called by the program being
loaded are automatically fetched from the library, linked with the
main program and loaded. This feature is referred to as automatic library
search.
13. List the loader options INCLUDE &DELETE.
The general format of INCLUDE is INCLUDE program_name (library name)
This command direct the loader to read the designated object program
from a library and treat it as the primary loader input.
The general format of DELETE command is
DELETE Csect-name
It instructs the loader to delete the named control sections from
the sets of programs loaded.
14. Give the functions of the linking loader.
The linking loader performs the process of linking and relocation.
It
includes the operation of automatic library search and the linked
programs are directly loaded into the memory.
15. Define dynamic linking.
If the subroutine is loaded and linked to the program during its first
call (run time), then it is called as dynamic loading or dynamic linking.
16. Write the advantage of dynamic linking.
* It has the ability to load the routine only when they are needed.
* The dynamic linking avoids the loading of entire library for each
execution.
17. What is meant by static executable and dynamic executable?
In static executable, all external symbols are bound and ready to
run. In dynamic executables some symbols are bound at run time.
18. What is shared and private data?
The data divided among processing element is called shared data. If
the data is not shared among processing elements then it is called private
data.
19. Write the absolute loader algorithm.
Begin
Read Header record
Verify program name and length
Read first text record
While record type != 'E' do
Begin
Moved object code to specified location in memory
Read next object program record
End
Jump to address specified in End record
MACRO PROCESSORS
1. Define macro processor.
Macro processor is system software that replaces each macro instruction
with the corresponding group of source language statements. This is
also called as expanding of macros.
2. What do macro expansion statements mean?
These statements give the name of the macro instruction being invoked
and the arguments to be used in expanding the macros. These statements
are also known as macro call.
3. What are the directives used in macro definition?
MACRO - it identifies the beginning of the macro definition
MEND - it marks the end of the macro definition
4. What are the data structures used in macro processor?
DEFTAB - the macro definitions are stored in a definition table i.e.
it contains a macro prototype and the statements that make up the macro
body.
NAMTAB - it is used to store the macro names and it contains two
pointers for each macro instruction which indicate the starting and
end location of macro definition in DEFTAB. it also serves as an index
to DEFTAB
ARGTAB - it is used to store the arguments during the expansion of
macro invocations.
5. Define conditional macro expansion.
If the macro is expanded depends upon some conditions in macro
definition (depending on the arguments supplied in the macro expansion)
then it is called as conditional macro expansion.
6. What is the use of macro time variable?
Macro time variable can be used to store working values during the
macro expansion. Any symbol that begins with the character & and
then is not a macro instruction parameter is assumed to be a macro time
variable.
7. What are the statements used for conditional macro expansion?
IF-ELSE-ENDIF statement
WHILE-ENDW statement
8. What is meant by positional parameters?
If the parameters and arguments were associated with each other
according to their positions in the macro prototype and the macro
invocation statement, then these parameters in macro definitions are
called as positional parameters.
9. Consider the macro definition
#define DISPLAY (EXPR) Printf ("EXPR = %d\n", EXPR) Expand
the macro instruction DISPLAY (ANS)
Ans.: Printf ("EXPR = %d\n", ANS)
10. What are known as nested macro call?
The statement, in which a macro calls on another macro, is called
nested macro call. In the nested macro call, the call is done by outer
macro and the macro called is the inner macro.
11. How the macro is processed using two passes?
Pass1: processing of definitions
Pass 2:actual-macro expansion.
12. Give the advantage of line by line processors.
* It avoids the extra pass over the source program during assembling.
* It may use some of the utility that can be used by language translators
so that can be loaded once.
13. What is meant by line by line processor?
This macro processor reads the source program statements, process
the
statements and then the output lines are passed to the language translators
as they are generated, instead of being written in an expanded file.
14. Give the advantages of general-purpose macro processors.
* The programmer does not need to learn about a macro facility for
each compiler.
* Overall saving in software development cost and maintenance cost.
15. What is meant by general-purpose macro processors?
The macro processors that are not dependent on any particular
programming language, but can be used with a variety of different
languages are known as general purpose macro processors.
Eg. The ELENA macro processor.
16. What are the important factors considered while designing general
purpose macro processors?
* comments
* grouping of statements
* tokens
* syntax used for macro definitions
17. What is the symbol used to generate unique labels?
$ symbol is used in macro definition to generate unique symbols. Each
macro expansion the $ symbol is replaced by $XX, where XX is the alpha
numeric character.
18. How the nested macro calls are executed?
The execution of nested macro call follows the LIFO rule. In case
of nested macro calls the expansion of the latest macro call is completed
first.
19. Mention the tasks involved in macro expansion.
* identify the macro calls in the program
* the values of formal parameters are identified
* maintain the values of expansion time variables declared in a macro
* expansion time control flow is organized
* determining the values of sequencing symbols
* expansion of a model statement is performed
20. How to design the pass structure of a macro assembler?
To design the structure of macro-assembler, the functions of macro
preprocessor and the conventional assembler are merged. After merging,
the functions are structured into passes of the macro assembler.
MORE>>>>>