open-obfuscator / o-mvll

:electron: O-MVLL is a LLVM-based obfuscator for native code (Android & iOS)
https://obfuscator.re/omvll
Apache License 2.0
574 stars 62 forks source link

Duplicate Symbol omvll_decode #34

Closed marcobrador closed 3 months ago

marcobrador commented 4 months ago

Root cause and conditions to reproduce are not yet clear, but under some circumstances enabling String Encoding will result in the compiler raising an error about omvll_decode symbol being duplicated.

This was detected as part of https://github.com/open-obfuscator/o-mvll/issues/33

weliveindetail commented 4 months ago

The plugin runs on each translation unit in isolation. If it needs encode/decode, then the decode routine is injected. If this applies to multiple compile units, the injected routines clash at link-time. If it's ok to keep the duplicates, switch the injected routine to private linkage and the symbol to hidden. Otherwise make sure they are all equivalent and handle it as ODR (resulting in a weak symbol at link-time).