Android 2.3.2 release 1
Add support for LOCAL_WHOLE_STATIC_LIBRARIES.

These libraries are linked to the final binary with the help of
-Wl,--whole-archive .. -Wl,--no-whole-archive. The main difference
is the following:

Consider the following link command:

  gcc -o libfoo.o  libfoo.a libbar.a libzoo.a

The default Unix linker behaviour is the following:
- undefined symbols in libfoo.a will be searched in libbar.a and libzoo.a
  (in this specific order)
- undefined symbols in libbar.a will only be searched in libzoo.a
- undefined symbols in libzoo.a will create an error.

Now consider:

  gcc -o libfoo.so -Wl,--whole-archive libfoo.a -Wl,--no-whole-archive libbar.a libzoo.a

Then:

- undefined symbols in libfoo.a are still search in the same way
- undefined symbols in libbar.a are searched in libfoo.a then in libzoo.a
- undefined symbols in libzoo.a are searched in libfoo.a

LOCAL_WHOLE_STATIC_LIBRARIES is a way to group static libraries in the
"whole" category when linking final binaries. This is normally only used
when there are weird circular dependencies in your libraries.

Technically, it's not required, one could instead do:

  gcc -o libfoo.o libfoo.a libbar.a libzoo.a libfoo.a

But this does not translate well with the NDK build system's definition of
LOCAL_STATIC_LIBRARIES, and forces the use of LOCAL_LDLIBS := libfoo.a which
is less elegant.

Change-Id: I4b90cad004280a78d596388911482d90bd0755f3
3 files changed