Home > Software engineering >  Why does the program work after removing the symbol information?
Why does the program work after removing the symbol information?

Time:07-26

I made one SO file and compiled it with a compile option called "-Xlinker --strip-all " to counter any reverse engineering (use clang).

Thanks to this, most of the symbols of functions other than functions directly exposed to the outside do not appear (objdump -TC test.so).
The question is, if a symbol is deleted like this, it should not be used inside the program, so I think it is normal.
What am I missing?

CodePudding user response:

You're right, debugging symbols aren't needed by the program itself to execute; the linker computes (and therefore knows at link-time) what the memory-address of each function/global-variable/etc will be at run-time, so it can just place that memory-address directly into the executable where necessary.

The symbols are there for a debugger to use, to make the debugging output easier for a human (or a debugging tool) to use and understand.

  • Related