symbol-table

symbol table and relocation table in object file

╄→гoц情女王★ 提交于 2019-12-03 04:10:23
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 updated if the addresses in the file change, for example if the file is linked together with another. Line A, in the example below, would be in the relocation table. I don't think B would be in the relocation table, since the address of label "equal" is relative to B. Are these correct assumptions? I know the symbol table show the labels the file have and

Reference a variable by name in C++ by using Symbol Table

时光总嘲笑我的痴心妄想 提交于 2019-12-02 04:07:29
问题 Basically what the title asks. Being a bit unfamiliar with C++ , and the more advanced concepts such as symbol tables, I've looked into it online but am struggling to find any direction towards what my end goal is. Most of the tutorials I've seen cater to C, and the closest question I've found (here) puts me at a brick wall, as I've tried compiling it but I'm not getting the desired results, and I'm not too solid on how extern "C" works yet. By the end of this, I want to be able to access a

Reference a variable by name in C++ by using Symbol Table

不想你离开。 提交于 2019-12-01 23:51:20
Basically what the title asks. Being a bit unfamiliar with C++ , and the more advanced concepts such as symbol tables, I've looked into it online but am struggling to find any direction towards what my end goal is. Most of the tutorials I've seen cater to C, and the closest question I've found ( here ) puts me at a brick wall, as I've tried compiling it but I'm not getting the desired results, and I'm not too solid on how extern "C" works yet. By the end of this, I want to be able to access a variable from the symbol table, and change the variable. I have played around with nm and objdump (and

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

我与影子孤独终老i 提交于 2019-12-01 00:02:30
问题 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 attribute to denote the offset of the start of string in .strtab section. But I'm unable to interpret the dynamic symbol table ( .dynsym ) using the same method. I used Ali's blog [1] for reference. I looked at another blog of Ali's [2] but I'm not

Dynamic loading and weak symbol resolution

谁说我不能喝 提交于 2019-11-30 07:07:13
问题 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 which dynamically loads libraries b.so and c.so , in that order. If c.so depends on two other libraries foo.so (actually libgcc.so in that example) and bar.so (actually libpthread.so ), then usually symbols exported by bar.so can be used to

Does Symbol table for C++ code contain function names along with class names?

走远了吗. 提交于 2019-11-30 05:47:53
I have been searching through various posts regarding whether symbol table for a C++ code contains functions' name along with the class name. Something which i could find on a post is that it depends on the type of compiler, if it compiles code in one-pass then it will not need to store class name and subroutine names in your symbol table but if it is a multi-pass compiler, it could add information about the class(es) it encounters and their subroutines so that it could do argument type checking and issue meaningful error messages. I could not understand whether it is actually compiler

Symbol Table in Python

断了今生、忘了曾经 提交于 2019-11-29 03:57:57
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? If you are asking about the symbol table that is used when generating bytecode, take a look at the symtable module. Also, these two articles by Eli Bendersky are fascinating, and very detailed: Python Internals: Symbol tables, part 1 Python Internals: Symbol tables, part 2 In part 2, he details a function that can print out a description of a symtable, but it seems to have been written for Python 3

Does Symbol table for C++ code contain function names along with class names?

点点圈 提交于 2019-11-29 03:53:11
问题 I have been searching through various posts regarding whether symbol table for a C++ code contains functions' name along with the class name. Something which i could find on a post is that it depends on the type of compiler, if it compiles code in one-pass then it will not need to store class name and subroutine names in your symbol table but if it is a multi-pass compiler, it could add information about the class(es) it encounters and their subroutines so that it could do argument type

Symbol Table in Python

无人久伴 提交于 2019-11-27 18:10:15
问题 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? 回答1: If you are asking about the symbol table that is used when generating bytecode, take a look at the symtable module. Also, these two articles by Eli Bendersky are fascinating, and very detailed: Python Internals: Symbol tables, part 1 Python Internals: Symbol tables, part 2 In part 2, he

How are variable names stored in memory in C?

好久不见. 提交于 2019-11-27 10:23:51
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 " variable_name is located at 0xaaaaaaaa ". How does the compiler recognize that the string "variable_name" is associated with that particular memory address? Is the string "variable_name" stored somewhere in memory? Does the compiler just substitute variable_name for 0xaaaaaaaa whenever it sees it, and if so, wouldn't it have to use memory in order