Move dlsym and dladdr implementation to linker.cpp

Bug: http://b/25716705
Bug: http://b/22865643
Change-Id: If22fc1eda219f676b5fcc06490f7901d21d1749c
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index ed972ba..30eea4a 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -760,7 +760,7 @@
   // so it can be distinguished from the NULL handle.
   sym = dlsym(nullptr, "test");
   ASSERT_TRUE(sym == nullptr);
-  ASSERT_SUBSTR("dlsym library handle is null", dlerror());
+  ASSERT_STREQ("dlsym failed: library handle is null", dlerror());
 #endif
 
   // NULL symbol name.
@@ -768,7 +768,7 @@
   // glibc marks this parameter non-null and SEGVs if you cheat.
   sym = dlsym(self, nullptr);
   ASSERT_TRUE(sym == nullptr);
-  ASSERT_SUBSTR("", dlerror());
+  ASSERT_STREQ("dlsym failed: symbol name is null", dlerror());
 #endif
 
   // Symbol that doesn't exist.