AndLightLight
AndLightLight

Reputation: 185

How do I strip the symbol table in so?

I used the strip command under MAC to remove the symbol table. And then I'm going to check it with the strings and grep command. Then I found that even class private function names can be grep.

class ModuleBarn
{
public:
    /***/
    
private:
    void m_Link( FunctionSet* fs, const char* functionName );
    Field* m_FindField( Function* fun, uint32_t argIdx );
    Function* m_FindCall( const char* functionName, const char* moduleName );
}

alldeMac-mini:~ all$ strip libBootloader.so

alldeMac-mini:~ all$ strings libBootloader.so | grep m_Link
_ZN10ModuleBarn6m_LinkEPNS_11FunctionSetEPKc

How do I strip the public and private function names in a class?

Upvotes: 2

Views: 1149

Answers (1)

Soonts
Soonts

Reputation: 21946

Because there’s .so in your output I assume you’re doing all that on Linux? If yes, you need to do 2 things.

  1. Modify your build scripts/make files/cmake lists/whatever build environment you use adding following compiler switches: -fvisibility=hidden -fvisibility-inlines-hidden Very likely you’ll lose exported symbols, mark them individually in the source code with __attribute__((visibility("default"))).

  2. Use the strip binary that shipped with the OS.

Upvotes: 1

Related Questions