简体   繁体   English

我如何剥离符号表?

[英]How do I strip the symbol table in so?

I used the strip command under MAC to remove the symbol table.我用MAC下的strip命令去掉了符号表。 And then I'm going to check it with the strings and grep command.然后我将使用stringsgrep命令检查它。 Then I found that even class private function names can be grep .然后我发现即使是类私有函数名也可以是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?如何去除类中的公共和私有函数名称?

Because there's .so in your output I assume you're doing all that on Linux?因为在你的输出中有.so我假设你在 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"))) .修改您的构建脚本/制作文件/cmake 列表/您使用的任何构建环境,添加以下编译器开关: -fvisibility=hidden -fvisibility-inlines-hidden您很可能会丢失导出的符号,请在源代码中使用__attribute__((visibility("default")))

  2. Use the strip binary that shipped with the OS.使用操作系统附带的strip二进制文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何解决libmysqlclient_r.so符号引用链接错误? - how do I solve libmysqlclient_r.so symbol referencing linking errors? 如何在使用triangle_strip创建的OpenGL中构建圆柱体? - How do I texture a cylinder in OpenGL created with triangle_strip? 如何将元组 &lt;&gt; 剥离回可变参数模板类型列表? - How do I strip a tuple<> back into a variadic template list of types? 我如何剥离C ++中某个类型的所有信息? - How do i strip all info of a type in C++? 如何处理此Linux C ++警告? “找不到`sockaddr_in&#39;的虚拟表的链接器符号” - How do I approach this Linux C++ warning? “can't find linker symbol for virtual table for `sockaddr_in'” 如何列出 a.so 文件中的符号 - How do I list the symbols in a .so file 如何在OSX中打印.so文件的符号列表? - How to print symbol list for .so file in OSX? 如何使用gcc / g ++预处理器去除非活动的#if指令? - How do I strip out inactive #if directives with the gcc/g++ preprocessor? 如何将箭头符号写入文件然后再读回? - How do I write arrow symbol to a file and then read it back? 如何在Visual Studio中读取未解决的外部符号错误? - How do I read an unresolved external symbol error in Visual Studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM