Questions tagged [symbol-table]

A `symbol table` is a data structure that maps each identifier in a program's source code to information relating to its declaration or appearance in the source.

A symbol table is used by a language translator (compiler, interpreter...) for associating each identifier in a program's source code with information relating to its declaration or appearance in the source (type, scope level, sometimes location...).

A common implementation technique is to use a hash table implementation. A compiler may use one large symbol table for all symbols or use separated, hierarchical symbol tables for different scopes.

187 questions
88
votes
6 answers

What is a symbol table?

Can someone describe what a symbol table is within the context of C and C++?
jdt141
  • 4,655
  • 6
  • 32
  • 35
56
votes
5 answers

How are variable names stored in memory in C?

In C, let's say you have a variable called variable_name. Let's say it's located at 0xaaaaaaaa, and at that memory address, you have the integer 123. So in other words, variable_name contains 123. I'm looking for clarification around the phrasing…
Tyler
  • 2,249
  • 2
  • 19
  • 28
27
votes
3 answers

Processing ELF relocations - understanding the relocs, symbols, section data, and how they work together

TL;DR I tried to make this a short question but it's a complicated problem so it ended up being long. If you can answer any part of this or give any suggestions or tips or resources or anything at all, it would be extremely helpful (even if you…
thehelix
  • 429
  • 1
  • 6
  • 10
27
votes
3 answers

How to call exported kernel module functions from another module?

I'm writing an API as a kernel module that provides device drivers with various functions. I wrote three functions in mycode.c. I then built and loaded the module, then copied mycode.h into < kernel >/include/linux. In a device driver, I have a…
jacobsowles
  • 2,143
  • 6
  • 27
  • 51
18
votes
1 answer

Dynamic loading and weak symbol resolution

Analyzing this question I found out some things about behavior of weak symbol resolution in the context of dynamic loading (dlopen) on Linux. Now I'm looking for the specifications governing this. Let's take an example. Suppose there is a program a…
MvG
  • 51,562
  • 13
  • 126
  • 251
14
votes
4 answers

Symbol Table in Python

How can we see the Symbol-Table of a python source code? I mean, Python makes a symbol table for each program before actually running it. So my question is how can I get that symbol-table as output?
Rahul Gupta
  • 197
  • 1
  • 2
  • 7
12
votes
2 answers

How to interpret the dynamic symbol table in an ELF executable?

I was looking at interpreting the dynamic symbol table (.dynsym) of an ELF executable file. I could successfully interpret the symbol table .symtab (16 bytes for each symbol) using the value attribute to denote the address of the symbol and name…
Hrishikesh Murali
  • 499
  • 1
  • 7
  • 15
11
votes
3 answers

Difference between Symbol table and Hash map data structures

While reading about different data structures, found that the Symbol table used by compilers is classified as a data structure. Can someone explain what is the difference between Symbol table data structure and a Hash map?
OutOfMind
  • 691
  • 13
  • 29
10
votes
1 answer

symbol table and relocation table in object file

From what I understand, instructions and data in an object file all have addresses. First data item start at address 0 and first instruction also start at address 0. The relocation table contains information about instructions that need to be…
Carlj901
  • 1,159
  • 4
  • 20
  • 37
9
votes
0 answers

Why does symbol definition statement inside exec() sometimes have no effect on the local symbol table?

The following code snippet works as expected: def test(): print(f'local symbol table before exec : {locals()}') exec('a = 0') print(f'local symbol table after exec : {locals()}') test() # printed result: # local symbol table before…
Alan Xu
  • 91
  • 3
9
votes
2 answers

When is the locals dictionary set?

A module holds a dictionary to keep track of itscontext, such as the names defined at some point of the execution. This dictionary can be accessed through vars(module) (or module.__dict__) if module was imported, or by a call to the locals built-in…
Right leg
  • 13,581
  • 5
  • 36
  • 68
9
votes
4 answers

How can I differentiate static functions with nm or readelf output in C

I am trying to process the output of a nm or readelf -s on an executable. However, I am having trouble differentiating static functions from each other in the output. Here is what I am working with: test.c static int foo() { int x = 6; } main()…
Andrew
  • 1,177
  • 2
  • 11
  • 25
9
votes
2 answers

symbol lookup error: ./executableName: undefined symbol: _ZN18QXmlDefaultHandlerC2Ev

I am trying to run an executable on Linux Mint 16 x64 that was compiled for Ubuntu 12 x64. The executable uses Qt 5.1.1 dynamically during runtime. I get the error: loaded the dummy plugin loaded the Linux plugin updating server status…
Daniel Arnett
  • 466
  • 2
  • 8
  • 17
8
votes
1 answer

Symbol-table: deleting entries

Why do I get the values from "$n" and "$m" after deleting the respective symbol-table-entries? #!/usr/bin/env perl use warnings; use 5.012; package Foo; our $n = 10; our $m = 20; delete $Foo::{'n'}; delete $Foo::{'m'}; say $n; # 10 say $m; # 20
sid_com
  • 21,289
  • 23
  • 89
  • 171
7
votes
1 answer

How to make a symbol table

We have as an assignment to make a compiler. We have already made the lexical and syntax analysis but we are stuck at generation of intermediate code. We realized that we have to implement a symbol table in order to proceed to intermediate code…
bottled_ghost
  • 103
  • 2
  • 7
1
2 3
12 13