Fix dlsym() to take into account RTLD_GLOBAL/LOCAL

  Symbols from libraries opened with RTLD_LOCAL (default)
  should not be visible via dlsym(RLTD_DEFAULT/RTLD_NEXT, .)

Bug: 17512583
Bug: 18186310

(cherry picked from commit e8ba50fe0d51fbefee1a8f5bb62bf51d841512c8)

Change-Id: Idf6bbe2233fb2bfc0c88677e7d1fc518fb3f7a8b
diff --git a/linker/linker.h b/linker/linker.h
index 3b140ac..ef2fbcd 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -199,7 +199,7 @@
 #endif
   bool has_DT_SYMBOLIC;
 
-  soinfo(const char* name, const struct stat* file_stat, off64_t file_offset);
+  soinfo(const char* name, const struct stat* file_stat, off64_t file_offset, int rtld_flags);
 
   void CallConstructors();
   void CallDestructors();
@@ -214,6 +214,8 @@
   dev_t get_st_dev();
   off64_t get_file_offset();
 
+  int get_rtld_flags();
+
   soinfo_list_t& get_children();
   soinfo_list_t& get_parents();
 
@@ -246,6 +248,7 @@
 
   // version >= 1
   off64_t file_offset;
+  int rtld_flags;
 };
 
 extern soinfo* get_libdl_info();