Question

In: Computer Science

What is a Symbol table? Please explain how a symbol table is created and used by...

  1. What is a Symbol table? Please explain how a symbol table is created and used by assemblers.

Solutions

Expert Solution

Symbol Tables

The symbol table contains information to locate and relocate symbolic definitions and references. The assembler creates the symbol table section for the object file. It makes an entry in the symbol table for each symbol that is defined or referenced in the input file and is needed during linking.

The symbol table is then used by the link editor during relocation. The symbol table's section header contains the symbol table index for the first non-local symbol.

The symbol table contains the following information:

st_name

Index into the object file symbol string table. A value of zero indicates the corresponding entry in the symbol table has no name; otherwise, the value represents the string table index that gives the symbol name.

st_value

Value of the associated symbol. This value is dependent on the context; for example, it can be an address, or it can be an absolute value.

st_size

Size of symbol. A value of 0 indicates that the symbol has either no size or an unknown size.

st_info

Specifies the symbol type and binding attributes. Table 3-6 and Table 3-7 describe the symbol types and binding attributes.

st_other

Undefined meaning. Current value is 0.

st_shndx

Contains the section header table index to another relevant section, if specified. As a section moves during relocation, references to the symbol continue to point to the same location because the value of the symbol changes as well.

Table 3-6 Symbol Types

Value

Type

Description

0

notype

Type not specified.

1

object

Symbol is associated with a data object; for example, a variable or an array.

2

func

Symbol is associated with a function or other executable code. When another object file references a function from a shared object, the link editor automatically creates a procedure linkage table entry for the referenced symbol.

3

section

Symbol is associated with a section. These types of symbols are primarily used for relocation.

4

file

Gives the name of the source file associated with the object file.

13

15

loproc

hiproc

Values reserved for processor-specific semantics.

Table 3-7 Binding Attributes

Value

Binding

Description

0

local

Symbol is defined in the object file and not accessible in other files. Local symbols of the same name can exist in multiple files.

1

global

Symbol is either defined externally or defined in the object file and accessible in other files.

2

weak

Symbol is either defined externally or defined in the object file and accessible in other files; however, these definitions have a lower precedence than globally defined symbols.

13

15

loproc

hiproc

Values reserved for processor-specific semantics.


Related Solutions

what role does the symbol table play in compiler when it is created
what role does the symbol table play in compiler when it is created
7. What role does the symbol table play in a compiler? When is it created?
7. What role does the symbol table play in a compiler? When is it created? 8. What are two unique advantages of implementing a language with a runtime interpreter i.e. scheme, python) versus a standalone executable file (i.e. C, C++)? 
What is a sampling distribution of means? How is it created and what is it used...
What is a sampling distribution of means? How is it created and what is it used for?
What is an antibiogram? How is it created and used to prevent the growth of multidrug...
What is an antibiogram? How is it created and used to prevent the growth of multidrug resistant organisms?
what resources are used when LWP is created and how do they differ when  HWP is created?
what resources are used when LWP is created and how do they differ when  HWP is created?
a) Please explain what the Durbin-Watson statistic tests for and how it is used. b) Please...
a) Please explain what the Durbin-Watson statistic tests for and how it is used. b) Please explain how to perform both the Bruesch-Pagan and White tests (STATA can do both tests automatically, but this question is asking you to explain what is going on.) c) What is ρ in the study of serial correlation, and what is its role in Generalized Least Squares?
Please explain the APIC Cycle and explain what it is used for.
Please explain the APIC Cycle and explain what it is used for.
PLEASE USE EXCEL FORMULAS, AND SHOW THEM + HOW YOU USED THEM. NEEDS TO BE CREATED...
PLEASE USE EXCEL FORMULAS, AND SHOW THEM + HOW YOU USED THEM. NEEDS TO BE CREATED IN EXCEL! IF YOU DO NOT CREATE THIS IN EXCEL WITH ALL THE RIGHT FORMULAS (SHOW ME HOW AND WHAT FORMULAS) YOU WILL NOT GET A POSITIVE REVIEW. DO NOT COPY THE OTHER ANSWERS, DO IT YOURSELF!!!! A company is considering three capital budgeting projects. Data relative to each is given below. Each project has a life of 5 years. The company uses the...
PLEASE USE EXCEL FORMULAS, AND SHOW THEM + HOW YO USED THEM. NEEDS TO BE CREATED...
PLEASE USE EXCEL FORMULAS, AND SHOW THEM + HOW YO USED THEM. NEEDS TO BE CREATED IN EXCEL! A company is considering three capital budgeting projects. Data relative to each is given below. Each project has a life of 5 years. The company uses the NPV method to evaluate capital budgeting projects and its discount rate is 9%. Project A Project B Project C Initial cash outlay (cost) -$5,000,000 -$6,000,000 -$3,000,000 Cash inflows per year $1,500,000 $1,800,000 $ 600,000 Residual...
please describe what a consumer psychology is. Explain how a consumer is used by marketers to...
please describe what a consumer psychology is. Explain how a consumer is used by marketers to segment potential customers and position their products and services in your own word provide two examples.Your answers to the question should be 4-5 pages long
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT