I'm interested in how implements that an appropriate name bind to a specify entity in the compiler internal (g++
in my case). Is there exist something like symbol table recorded every name and a corresponding entity depends on scope in which name appeared?
Asked
Active
Viewed 560 times
0

St.Antario
- 26,175
- 41
- 130
- 318
-
_'Is there exist something like symbol table ...'_ I'd suspect there's something like that at least when linkage is done, yes. – πάντα ῥεῖ May 25 '14 at 13:48
-
$ nm -D object.so | less; – erenon May 25 '14 at 14:26
1 Answers
2
Of course, compilers construct the symbol table in order to determine, name, type and scope. It's depends on the output format, but those symbol tables can be 'burnt' into the file, so that linker can resolve any external references.
For example, when you use printf()
the compiler does not know anything about it, however the linker can resolve it appropriately through linking it with the C standard library.
This question addresses how to access that symbol table in the ELF format (standard on Linux systems) . Accessing ELF symbol table in C