Created
April 27, 2021 13:01
-
-
Save yehgdotnet/b88fa0bcd3845678d5d8434753a88566 to your computer and use it in GitHub Desktop.
Debugging symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Purpose: To prevent deobfuscation | |
Symbols are usually stripped during the build process, so you need the compiled byte-code and libraries to verify whether any unnecessary metadata has been discarded. | |
First find the nm binary in your Android NDK and export it (or create an alias). | |
export $NM = $ANDROID_NDK_DIR/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-nm | |
To display debug symbols: | |
$ $NM -a libfoo.so | |
/tmp/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-nm: libfoo.so: no symbols | |
To display dynamic symbols: | |
$ $NM -D libfoo.so | |
Alternatively, open the file in your favorite disassembler and check the symbol tables manually. | |
Dynamic symbols can be stripped using the visibility compiler flag. Adding this flag causes gcc to discard the function names while still preserving the names of functions declared as JNIEXPORT. | |
Check if the following was added to build.gradle: | |
externalNativeBuild { | |
cmake { | |
cppFlags "-fvisibility=hidden" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment