[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit

Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/libc/glibc/glibc-2.22/elf/lateglobal.c b/ap/libc/glibc/glibc-2.22/elf/lateglobal.c
new file mode 100644
index 0000000..4a1a7cd
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/elf/lateglobal.c
@@ -0,0 +1,47 @@
+#include <dlfcn.h>
+#include <mcheck.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+  void *h[2];
+  int fail;
+  int (*fp) (void);
+
+  mtrace ();
+
+  h[0] = dlopen ("ltglobmod1.so", RTLD_LAZY);
+  if (h[0] == NULL)
+    {
+      printf ("%s: cannot open %s: %s",
+	      __FUNCTION__, "ltglobmod1.so", dlerror ());
+      exit (EXIT_FAILURE);
+    }
+  h[1] = dlopen ("ltglobmod2.so", RTLD_LAZY);
+  if (h[1] == NULL)
+    {
+      printf ("%s: cannot open %s: %s",
+	      __FUNCTION__, "ltglobmod2.so", dlerror ());
+      exit (EXIT_FAILURE);
+    }
+
+  puts ("loaded \"ltglobmod1.so\" without RTLD_GLOBAL");
+
+  fp = dlsym (h[1], "foo");
+  if (fp == NULL)
+    {
+      printf ("cannot get address of `foo': %s", dlerror ());
+      exit (EXIT_FAILURE);
+    }
+
+  fail = fp ();
+
+  puts ("back in main");
+
+  dlclose (h[1]);
+  dlclose (h[0]);
+
+  return fail;
+}