aj3423
aj3423

Reputation: 2561

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. The problem is the final .so file contains function names, in IDA Pro:

enter image description here

I thought it's because linking to dynamic library, so I build boost static library, but boost function names still visible.

I tried strip the .so file:

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?

Upvotes: 0

Views: 881

Answers (2)

yugr
yugr

Reputation: 21886

You should

  • compile with -fvisibility=hidden (functions which are actually exported should be marked with __attribute__((visibility("default"))) in code
  • link against static versions of external libraries (by using -l:libXYZ.a syntax in LDFLAGS); of course they need to be present on your system.

Upvotes: 0

user9938830
user9938830

Reputation: 41

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

Upvotes: 2

Related Questions