简体   繁体   English

如何在共享库中隐藏依赖项的 function 名称?

[英]How to hide the dependencies' function names in shared library?

I'm buiding a shared library on Linux, which reference to other library like boost , CryptoPP , jsoncpp .我在 Linux 上建立了一个共享库,它引用了其他库,如boostCryptoPPjsoncpp The problem is the final.so file contains function names, in IDA Pro :问题是 final.so 文件包含 function 个名称,在IDA Pro中:

在此处输入图像描述

I thought it's because linking to dynamic library, so I build boost static library, but boost function names still visible.我以为是因为链接到动态库,所以我构建了boost static 库,但是boost function 名称仍然可见。

I tried strip the.so file:我尝试剥离.so 文件:

strip my.so
strip --strip-unneeded -x my.so

Still no luck.仍然没有运气。

Some competitors may reverse engineer my library, how to hide these function names to make it more difficult to crack?一些竞争对手可能会对我的库进行反向工程,如何隐藏这些 function 名称以使其更难破解?

LOCAL_LDFLAGS += -Wl,--exclude-libs,ALL, -Wl,--gc-sections 

You should你应该

  • compile with -fvisility=hidden (functions which are actually exported should be marked with __attribute__((visibility("default"))) in code在代码中使用-fvisility=hidden编译(实际导出的函数应使用__attribute__((visibility("default")))标记
  • link against static versions of external libraries (by using -l:libXYZ.a syntax in LDFLAGS );链接到外部库的 static 版本(通过在LDFLAGS中使用-l:libXYZ.a语法); of course they need to be present on your system.当然,它们需要存在于您的系统中。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM