Question

I'm trying to understand .symtab setcion type for the relocatable object files. And I know, that it contains information about static variables. But why?

All we need to do for linking relocatable object files with some other is relocate adresess of this static variable (And some others, of course, but it's don't matter for static variables). So all that we need to have -- is relocation table that stored in .rel.data and contains all information to relocate static variable, isn't it?

Was it helpful?

Solution

But for debugging it can be quite useful to know where the variables are.

OTHER TIPS

Not sure on your compiler, but for the IBM AIX Compiler, the default is to not add static variables to the symbol table.

However, for debugging it is quite useful for say, gdb, to know what the static variables contain and the related symbols so it would make sense for them to appear there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top