Linking Flashcards

1
Q

The process of collecting and combining various pieces of code and data into a single file that can be loaded (coped) into memory and executed

A

Linking

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The process of adjusting addresses in object modules when modules are linked with other modules to create and executable

A

Relocation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When can linking be dome

A

Compile time
Load time
Run time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Programs are translated and linked using a ______ ______

A

Compile driver

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

First reason why linkers are useful

A

Modularity: program can be written as a collection of smaller source files rather than one monolithic mass
Can build libraries of common functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What do linkers do?

A

Step 1: symbol resolution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Symbol definitions are stored in object file in a _____ ____

A

Symbol table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Symbol table is an ______ of ____

A

Array, structs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the next step of linking

A

Relocation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Relocation merges separate code and data sections into _____ sections

A

Single

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Contains code and data in a form that can be combined with other relocatable object files to form executable object file

A

Relocatable object file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Contains code and data in a form that can be copied directly into memory and then executed

A

Executable object file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Special type of relocatable object file that can be loaded into memory and linked dynamically either load time or run time

A

Shared object file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

ELF

A

Executable and Linkable Format

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Word size, byte ordering, file type, machine type, etc

A

Elf header

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Page size, virtual address memory segments, segments sizes

A

Segments header table

17
Q

Code

A

.text section

18
Q

Read only data: jump tables, ….

A

.rodata section

19
Q

Unitialized global variables

A

.bss section

20
Q

Symbols defined by module m that can be referenced by other modules

A

File cope (global) symbols

21
Q

Fil;e scope symbols that are referenced by module m buy defined by some other module

A

External symbols

22
Q

Symbols that are defined and referenced exclusively my module m

A

Local symbols
Local linker symbols are not block scope variables

23
Q

Local non-static c-variables:

A

Stored on the stack

24
Q

Local static C variables:

A

Stored in either .bss or .data

25
Procedure/functions and initializes file scope variables
Strong
26
Uninitialized file scope variables
Weak
27
Rule 1: Mutiple strong symbols are not allowed. Each items can be defined only once, otherwise: ________
Linker error
28
Rule 2: Given a strong symbol and multiple weak symbols, choose the _____ symbol. References to _____ symbol resolve to ____ symbol.
Strong. Weak/strong
29
Rule 3: If there are multiple weak symbols, pick and _____ one
Arbitrary
30
Use ____ if you reference an external global variable.
Extern
31
In _____ ______, all the libraries and object files that a program needs a bundled directly into the executable at compile time. The resulting executable contains all the code is needs to run, including external library functions, and desn’t require additional dependencies at run time
Static linking
32
Disadvantage of static libraries
1. Duplication in the stored executables Duplication in the running executables 3. Minor bug fixes of system libraries require each application to explicitly re link
33
In _____ ______, the linker does not include the code for external libraries directly into the exectuable. Instead, it references external shared libraries, which are linked at run time. WHen the program is executed, the operating system loads the shared libraries into memory and resolves external function calls.
Dynamic linking
34
A ____ ____ _____ is a compiled object file that contains functions and data that can be used my multiple program simultaneously at _______
Shared object file, runtime