Add -lpthread -ldl to link executable/tests

The new binutils-2.23 based linker in
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6
no longer implicity adds dependencies on *so an executable needs.
eg.

  ld -o barrier_test barrier_test.o common_runtime_test.o ... -lartd

produces error messages read

  art/runtime/thread-inl.h:43: error: undefined reference to 'pthread_getspecific'
  art/runtime/common_runtime_test.h:219: error: undefined reference to 'dlsym'
  external/gtest/src/../include/gtest/internal/gtest-port.h:1482: error: undefined reference to 'pthread_getspecific'

because libartd.so DT_NEEDED libdl.so and libpthread.so, and new linker no longer
implicitly add both to dependencies.  Explicitly add -lpthread -ldl to fix the issue

Change-Id: Ic29c68480b2ed55d282be949640b9158411f213d
diff --git a/build/Android.executable.mk b/build/Android.executable.mk
index ba54e04..551b03c 100644
--- a/build/Android.executable.mk
+++ b/build/Android.executable.mk
@@ -84,6 +84,7 @@
     else
       LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
     endif
+    LOCAL_LDLIBS += -lpthread
   endif
 
   ifeq ($$(art_ndebug_or_debug),ndebug)
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 62916e3..da0b500 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -176,6 +176,7 @@
         # GCC host compiled tests fail with this linked, presumably due to destructors that run.
         LOCAL_STATIC_LIBRARIES += libgtest_host
     endif
+    LOCAL_LDLIBS += -lpthread -ldl
     include $(BUILD_HOST_EXECUTABLE)
     art_gtest_exe := $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
     ART_HOST_GTEST_EXECUTABLES += $$(art_gtest_exe)