elf: function for finding shared-object containing an address

Add a function program::object_containing_addr() which looks for a loaded
module (elf::object *) which contains a symbol with a given address.

This function is linear in the number of loaded modules, but when only
a few modules are loaded it is pretty quick - for each module we just
need to check if the given address is between the module's start and
end addresses.

I'll need this function in the next patch.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix thread_local support on recent gcc

Recently (see https://gcc.gnu.org/ml/gcc-patches/2014-07/msg02091.html)
gcc changed the way they implement destruction of thread_local variables.
It now requires us to implement a function __cxa_thread_atexit_impl(),
but we only had a do-nothing implementation.

Without a complete implementation, thread_local objects do not get
destroyed when threads end, and tests/tst-thread-local.so fails.

This patch adds the missing implementation, and the test now succeeds
again.

Fixes #501.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>