[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/nextmod1.c b/ap/libc/glibc/glibc-2.22/elf/nextmod1.c
new file mode 100644
index 0000000..56de353
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/elf/nextmod1.c
@@ -0,0 +1,30 @@
+#include <dlfcn.h>
+
+extern int successful_rtld_next_test (void);
+extern void *failing_rtld_next_use (void);
+
+int nextmod1_dummy_var;
+
+int
+successful_rtld_next_test (void)
+{
+ int (*fp) (void);
+
+ /* Get the next function... */
+ fp = (int (*) (void)) dlsym (RTLD_NEXT, __FUNCTION__);
+
+ /* ...and simply call it. */
+ return fp ();
+}
+
+
+void *
+failing_rtld_next_use (void)
+{
+ void *ret = dlsym (RTLD_NEXT, __FUNCTION__);
+
+ /* Ensure we are not tail call optimized, because then RTLD_NEXT
+ might return this function. */
+ ++nextmod1_dummy_var;
+ return ret;
+}