Add support for protected local symbol lookup.

Bug: http://code.google.com/p/android/issues/detail?id=66048
Change-Id: Ib334223df27adad9477fb241ab099c5e26df4a7d
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 8b89183..18963cf 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -50,6 +50,20 @@
   ASSERT_EQ(0, dlclose(self));
 }
 
+TEST(dlfcn, dlsym_local_symbol) {
+  void* handle = dlopen("libtest_local_symbol.so", RTLD_NOW);
+  ASSERT_TRUE(handle != NULL);
+  dlerror();
+  void* sym = dlsym(handle, "private_taxicab_number");
+  ASSERT_TRUE(sym == NULL);
+  ASSERT_STREQ("undefined symbol: private_taxicab_number", dlerror());
+
+  uint32_t (*f)(void);
+  f = reinterpret_cast<uint32_t (*)(void)>(dlsym(handle, "dlsym_local_symbol_get_taxicab_number_using_dlsym"));
+  ASSERT_TRUE(f != NULL);
+  ASSERT_EQ(1729, f());
+}
+
 TEST(dlfcn, dlopen_noload) {
   void* handle = dlopen("libtest_simple.so", RTLD_NOW | RTLD_NOLOAD);
   ASSERT_TRUE(handle == NULL);