thp/apkenv — pull request #52 by krnlyng (2014-10-09 15:32:24+00:00)
Title: libhybris and apkenv conflict

This solves a conflict between libhybris and apkenv on SailfishOS powered devices which utilize libhybris.

Problem:
apkenv and libhybris have many common function names because they
both use the android linker for the magic they achieve.
If one would start apkenv without this patch the glibc linker ld
will get confused and calls apkenvs version of the linker functions
where it should call the libhybris ones. This happens when apkenv
is not fully initialized (before main, while libhybris is linking
the android driver blobs) which is bad because the hooks in apkenv
will not be initialized at that time so no functions will be
hooked. This will result in the output of
"Unimplemented: pthread_*" and the termination of apkenv (because
pthread functions in apkenv must be hooked). Also it is probably
a bad idea that the libhybris hooks get overwritten with apkenvs
hooks.

Solution:
Prefix all functions in linker/*.{c,h} (and as an addition add
static where possible). This will avoid function name clashes and
enables apkenv to be run on SailfishOS.