summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2018-11-20 14:56:11 +1100
committerChris Johns <chrisj@rtems.org>2018-11-22 12:43:31 +1100
commit03139d5b1cf95d5b2f699e8f56e1f0ba2d7f89e4 (patch)
tree33fd489eac7497cdebe61560bc43e613b3eef0a9 /testsuites
parentlibdl: Reindex unresolved names after removing used records. (diff)
downloadrtems-03139d5b1cf95d5b2f699e8f56e1f0ba2d7f89e4.tar.bz2
libdl: Add object file dependencies to track references
Tracking references lets us manage when an object file can be unloaded. If an object file has references to it, it cannot be unloaded. Modules that depend on each other cannot be unloaded. Updates #3605
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/libtests/Makefile.am40
-rw-r--r--testsuites/libtests/configure.ac1
-rw-r--r--testsuites/libtests/dl02/dl-load.c11
-rw-r--r--testsuites/libtests/dl07/dl-load.c165
-rw-r--r--testsuites/libtests/dl07/dl-load.h21
-rw-r--r--testsuites/libtests/dl07/dl-o1.c56
-rw-r--r--testsuites/libtests/dl07/dl-o1.h22
-rw-r--r--testsuites/libtests/dl07/dl-o2.c51
-rw-r--r--testsuites/libtests/dl07/dl-o2.h23
-rw-r--r--testsuites/libtests/dl07/dl-o3.c59
-rw-r--r--testsuites/libtests/dl07/dl-o4.c53
-rw-r--r--testsuites/libtests/dl07/dl-o4.h27
-rw-r--r--testsuites/libtests/dl07/dl-o5.c52
-rw-r--r--testsuites/libtests/dl07/dl-o5.h28
-rw-r--r--testsuites/libtests/dl07/dl07.doc27
-rw-r--r--testsuites/libtests/dl07/dl07.scn510
-rw-r--r--testsuites/libtests/dl07/init.c90
17 files changed, 1234 insertions, 2 deletions
diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am
index 9e3d2143d6..810f65db8e 100644
--- a/testsuites/libtests/Makefile.am
+++ b/testsuites/libtests/Makefile.am
@@ -512,6 +512,45 @@ CLEANFILES += dl06.pre dl06-sym.o dl06-o1.o dl06-o2.o dl06.tar dl06-tar.h
endif
endif
+if DLTESTS
+if TEST_dl07
+lib_tests += dl07
+lib_screens += dl07/dl07.scn
+lib_docs += dl07/dl07.doc
+dl07_SOURCES = dl07/init.c dl07/dl-load.c dl07-tar.c dl07-tar.h
+dl07_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_dl07) $(support_includes)
+dl07/init.c: dl07-tar.o
+dl07.pre: $(dl07_OBJECTS) $(dl07_DEPENDENCIES)
+ @rm -f dl07.pre
+ $(AM_V_CCLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+dl07-o1.o: dl07/dl-o1.c Makefile
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl07-o2.o: dl07/dl-o2.c Makefile
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl07-o3.o: dl07/dl-o3.c Makefile
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl07-o4.o: dl07/dl-o4.c Makefile
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl07-o5.o: dl07/dl-o5.c Makefile
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl07.tar: dl07-o1.o dl07-o2.o dl07-o3.o dl07-o4.o dl07-o5.o
+ @rm -f $@
+ $(AM_V_GEN)$(PAX) -w -f $@ $+
+dl07-tar.c: dl07.tar
+ $(AM_V_GEN)$(BIN2C) -C $< $@
+dl07-tar.h: dl07.tar
+ $(AM_V_GEN)$(BIN2C) -H $< $@
+dl07-tar.o: dl07-tar.c dl07-tar.h
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl07-sym.o: dl07.pre
+ $(AM_V_GEN)rtems-syms -e -c "$(CFLAGS)" -o $@ $<
+dl07$(EXEEXT): $(dl07_OBJECTS) $(dl07_DEPENDENCIES) dl07-sym.o
+ @rm -f $@
+ $(AM_V_CCLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+CLEANFILES += dl07.pre dl07-sym.o dl07-o1.o dl07-o2.o dl07-o3.o dl07-o4.o dl07-o5.o dl07.tar dl07-tar.h
+endif
+endif
+
if TEST_dumpbuf01
lib_tests += dumpbuf01
lib_screens += dumpbuf01/dumpbuf01.scn
@@ -1358,4 +1397,3 @@ endif
rtems_tests_PROGRAMS = $(lib_tests)
dist_rtems_tests_DATA = $(lib_screens) $(lib_docs)
-
diff --git a/testsuites/libtests/configure.ac b/testsuites/libtests/configure.ac
index 303a165731..a2a0df01f1 100644
--- a/testsuites/libtests/configure.ac
+++ b/testsuites/libtests/configure.ac
@@ -131,6 +131,7 @@ RTEMS_TEST_CHECK([dl03])
RTEMS_TEST_CHECK([dl04])
RTEMS_TEST_CHECK([dl05])
RTEMS_TEST_CHECK([dl06])
+RTEMS_TEST_CHECK([dl07])
RTEMS_TEST_CHECK([dumpbuf01])
RTEMS_TEST_CHECK([dup2])
RTEMS_TEST_CHECK([exit01])
diff --git a/testsuites/libtests/dl02/dl-load.c b/testsuites/libtests/dl02/dl-load.c
index 601d62113c..a00581ab42 100644
--- a/testsuites/libtests/dl02/dl-load.c
+++ b/testsuites/libtests/dl02/dl-load.c
@@ -12,6 +12,11 @@
#include "dl-load.h"
+#include <rtems/rtl/rtl-trace.h>
+
+#define DL02_DEBUG_TRACE 0 /* RTEMS_RTL_TRACE_ALL */
+#define DL02_RTL_CMDS 0
+
typedef int (*call_t)(int argc, const char* argv[]);
static const char* call_args[] = { "1", "2", "3", "4" };
@@ -49,6 +54,10 @@ int dl_load_test(void)
int call_ret;
int ret;
+#if DL02_DEBUG_TRACE
+ rtems_rtl_trace_set_mask (DL02_DEBUG_TRACE);
+#endif
+
o1 = dl_load_obj("/dl02-o1.o");
if (!o1)
return 1;
@@ -56,7 +65,7 @@ int dl_load_test(void)
if (!o1)
return 1;
-#if 0
+#if DL02_RTL_CMDS
{
char* list[] = { "rtl", "list", NULL };
rtems_rtl_shell_command (2, list);
diff --git a/testsuites/libtests/dl07/dl-load.c b/testsuites/libtests/dl07/dl-load.c
new file mode 100644
index 0000000000..6e0262c7df
--- /dev/null
+++ b/testsuites/libtests/dl07/dl-load.c
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2014 Chris Johns <chrisj@rtems.org>.
+ * All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#define DL07_DEBUG_TRACE 0 /* RTEMS_RTL_TRACE_ALL */
+#define DL07_RTL_CMDS 0
+
+#include <dlfcn.h>
+
+#include "dl-load.h"
+
+#include <tmacros.h>
+
+#include <rtems/rtl/rtl-trace.h>
+
+typedef int (*call_sig)(void);
+
+int rtems_rtl_shell_command (int argc, char* argv[]);
+
+static void dl_load_dump (void)
+{
+#if DL07_RTL_CMDS
+ char* list[] = { "rtl", "list", NULL };
+ char* sym[] = { "rtl", "sym", NULL };
+ printf ("RTL List:\n");
+ rtems_rtl_shell_command (2, list);
+ printf ("RTL Sym:\n");
+ rtems_rtl_shell_command (2, sym);
+#endif
+}
+
+static void dl_check_resolved(void* handle, bool has_unresolved)
+{
+ int unresolved = 0;
+ rtems_test_assert (dlinfo (handle, RTLD_DI_UNRESOLVED, &unresolved) == 0);
+ if (has_unresolved)
+ {
+ if (unresolved == 0)
+ {
+ dl_load_dump();
+ rtems_test_assert (unresolved != 0);
+ }
+ }
+ else
+ {
+ if (unresolved != 0)
+ {
+ dl_load_dump();
+ rtems_test_assert (unresolved == 0);
+ }
+ }
+}
+
+static void* dl_load_obj(const char* name, bool has_unresolved)
+{
+ void* handle;
+
+ printf("load: %s\n", name);
+
+ handle = dlopen (name, RTLD_NOW | RTLD_GLOBAL);
+ if (!handle)
+ {
+ printf("dlopen failed: %s\n", dlerror());
+ return NULL;
+ }
+
+ dl_check_resolved (handle, has_unresolved);
+
+ printf ("handle: %p loaded\n", handle);
+
+ return handle;
+}
+
+static void dl_close (void* handle)
+{
+ int r;
+ printf ("handle: %p closing\n", handle);
+ r = dlclose (handle);
+ if (r != 0)
+ printf("dlclose failed: %s\n", dlerror());
+ rtems_test_assert (r == 0);
+}
+
+static int dl_call (void* handle, const char* func)
+{
+ call_sig call = dlsym (handle, func);
+ if (call == NULL)
+ {
+ printf("dlsym failed: symbol not found: %s\n", func);
+ return 1;
+ }
+ call ();
+ return 0;
+}
+
+int dl_load_test(void)
+{
+ void* o1;
+ void* o2;
+ void* o3;
+ void* o4;
+ void* o5;
+
+ printf ("Test source (link in strstr): %s\n", dl_localise_file (__FILE__));
+
+#if DL07_DEBUG_TRACE
+ rtems_rtl_trace_set_mask (DL07_DEBUG_TRACE);
+#endif
+
+ o1 = dl_load_obj("/dl07-o1.o", false);
+ if (!o1)
+ return 1;
+ o2 = dl_load_obj("/dl07-o2.o", false);
+ if (!o1)
+ return 1;
+ o3 = dl_load_obj("/dl07-o3.o", true);
+ if (!o1)
+ return 1;
+ o4 = dl_load_obj("/dl07-o4.o", false);
+ if (!o1)
+ return 1;
+ o5 = dl_load_obj("/dl07-o5.o", false);
+ if (!o1)
+ return 1;
+
+ dl_check_resolved (o3, false);
+
+ dl_load_dump ();
+
+ printf ("\n\nRun mains in each module:\n\n");
+ if (dl_call (o1, "rtems_main_o1"))
+ return 1;
+ if (dl_call (o2, "rtems_main_o2"))
+ return 1;
+ if (dl_call (o3, "rtems_main_o3"))
+ return 1;
+ if (dl_call (o4, "rtems_main_o4"))
+ return 1;
+ if (dl_call (o5, "rtems_main_o5"))
+ return 1;
+
+ /*
+ * Try and close the dependent modules, we should get an error.
+ */
+ rtems_test_assert (dlclose (o1) != 0);
+ rtems_test_assert (dlclose (o2) != 0);
+ rtems_test_assert (dlclose (o4) != 0);
+ rtems_test_assert (dlclose (o5) != 0);
+
+ dl_close (o3);
+ rtems_test_assert (dlclose (o1) != 0);
+ dl_close (o4);
+ rtems_test_assert (dlclose (o1) != 0);
+ dl_close (o5);
+ rtems_test_assert (dlclose (o1) != 0);
+ dl_close (o2);
+ dl_close (o1);
+
+ return 0;
+}
diff --git a/testsuites/libtests/dl07/dl-load.h b/testsuites/libtests/dl07/dl-load.h
new file mode 100644
index 0000000000..72872917aa
--- /dev/null
+++ b/testsuites/libtests/dl07/dl-load.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2014, 2018 Chris Johns <chrisj@rtems.org>. All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include <string.h>
+
+#if !defined(_DL_LOAD_H_)
+#define _DL_LOAD_H_
+
+static inline const char* dl_localise_file (const char* file)
+{
+ return (const char*) strstr (file, "testsuites");
+}
+
+int dl_load_test(void);
+
+#endif
diff --git a/testsuites/libtests/dl07/dl-o1.c b/testsuites/libtests/dl07/dl-o1.c
new file mode 100644
index 0000000000..af5ad1bd17
--- /dev/null
+++ b/testsuites/libtests/dl07/dl-o1.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj@rtems.org>.
+ * All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include "dl-o1.h"
+
+#include <rtems/test.h>
+#include "dl-load.h"
+
+#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
+
+/*
+ * Create some symbols. The uninitialised will be in the common section with
+ * separated text and data and this means there is no actual section in the ELF
+ * file, the details for this are in the symbols.
+ */
+int dl01_bss1; /* unitialised, .bss */
+float dl01_bss2[30]; /* unitialised, .bss */
+char dl01_bss3[10]; /* unitialised, .bss */
+int dl01_data1 = 1; /* initialised, .data */
+float dl01_data2 = 0.3333; /* initialised, .data */
+const int dl01_const1 = 3; /* read-only, .const */
+const float dl01_const2 = 0.666; /* read-only, .const */
+int dl01_func1(void) /* code, .text */
+{
+ return 4;
+}
+
+/*
+ * Yes a decl in the source. This is a modules main and I could not find which
+ * header main is defined in.
+ */
+int rtems_main_o1 (void);
+
+#define DL_NAME "dlo1"
+#define PAINT_VAR(_v) sizeof(_v), &_v, _v
+
+int rtems_main_o1 (void)
+{
+ printf (DL_NAME ": module: %s\n", dl_localise_file (__FILE__));
+ printf (DL_NAME ": dl01_bss1: %4u: %p: %d\n", PAINT_VAR (dl01_bss1));
+ printf (DL_NAME ": dl01_bss2: %4u: %p: %f\n", PAINT_VAR (dl01_bss2[0]));
+ printf (DL_NAME ": dl01_bss3: %4u: %p: %02x\n", PAINT_VAR (dl01_bss3[0]));
+ printf (DL_NAME ": dl01_data1: %4u: %p: %d\n", PAINT_VAR (dl01_data1));
+ /* no %f in the rtems test printer */
+ printf (DL_NAME ": dl01_data2: %4u: %p: %f\n", PAINT_VAR (dl01_data2));
+ printf (DL_NAME ": dl01_const1: %4u: %p: %d\n", PAINT_VAR (dl01_const1));
+ printf (DL_NAME ": dl01_const2: %4u: %p: %f\n", PAINT_VAR (dl01_const2));
+ printf (DL_NAME ": dl01_func1: %4u: %p\n", sizeof(dl01_func1), &dl01_func1);
+ return 0;
+}
diff --git a/testsuites/libtests/dl07/dl-o1.h b/testsuites/libtests/dl07/dl-o1.h
new file mode 100644
index 0000000000..bf07eb6a45
--- /dev/null
+++ b/testsuites/libtests/dl07/dl-o1.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj@rtems.org>.
+ * All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if !defined(DL01_H)
+#define DL01_H
+
+extern int dl01_bss1;
+extern float dl01_bss2[30];
+extern char dl01_bss3[10];
+extern int dl01_data1;
+extern float dl01_data2;
+extern const int dl01_const1;
+extern const float dl01_const2;
+int dl01_func1(void);
+
+#endif
diff --git a/testsuites/libtests/dl07/dl-o2.c b/testsuites/libtests/dl07/dl-o2.c
new file mode 100644
index 0000000000..423f05a16a
--- /dev/null
+++ b/testsuites/libtests/dl07/dl-o2.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014 Chris Johns <chrisj@rtems.org>. All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include "dl-load.h"
+#include "dl-o1.h"
+#include "dl-o2.h"
+
+#include <rtems/test.h>
+
+#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
+
+int dl02_bss1;
+float dl02_bss2[7];
+char dl02_bss3[21];
+int dl02_data1;
+float dl02_data2;
+
+/*
+ * Yes a decl in the source. This is a modules main and I could not find which
+ * header main is defined in.
+ */
+int rtems_main_o2 (int argc, const char* argv[]);
+
+#define DL_NAME "dlo2"
+#define PAINT_VAR(_v) sizeof(_v), &_v, _v
+
+int rtems_main_o2 (int argc, const char* argv[])
+{
+ printf (DL_NAME ": module: %s\n", dl_localise_file (__FILE__));
+ printf (DL_NAME ": dl01_bss1: %4u: %p: %d\n", PAINT_VAR (dl01_bss1));
+ printf (DL_NAME ": dl01_bss2: %4u: %p: %f\n", PAINT_VAR (dl01_bss2[0]));
+ printf (DL_NAME ": dl01_bss3: %4u: %p: %02x\n", PAINT_VAR (dl01_bss3[0]));
+ printf (DL_NAME ": dl01_data1: %4u: %p: %d\n", PAINT_VAR (dl01_data1));
+ /* no %f in the rtems test printer */
+ printf (DL_NAME ": dl01_data2: %4u: %p: %f\n", PAINT_VAR (dl01_data2));
+ printf (DL_NAME ": dl01_const1: %4u: %p: %d\n", PAINT_VAR (dl01_const1));
+ printf (DL_NAME ": dl01_const2: %4u: %p: %f\n", PAINT_VAR (dl01_const2));
+ printf (DL_NAME ": dl01_func1: %4u: %p\n", sizeof(dl01_func1), &dl01_func1);
+ printf (DL_NAME ": dl02_bss1: %4u: %p: %d\n", PAINT_VAR (dl02_bss1));
+ printf (DL_NAME ": dl02_bss2: %4u: %p: %f\n", PAINT_VAR (dl02_bss2[0]));
+ printf (DL_NAME ": dl02_bss3: %4u: %p: %02x\n", PAINT_VAR (dl02_bss3[0]));
+ printf (DL_NAME ": dl02_data1: %4u: %p: %d\n", PAINT_VAR (dl02_data1));
+ /* no %f in the rtems test printer */
+ printf (DL_NAME ": dl02_data2: %4u: %p: %f\n", PAINT_VAR (dl02_data2));
+ return 0;
+}
diff --git a/testsuites/libtests/dl07/dl-o2.h b/testsuites/libtests/dl07/dl-o2.h
new file mode 100644
index 0000000000..0d97c5cff9
--- /dev/null
+++ b/testsuites/libtests/dl07/dl-o2.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj@rtems.org>.
+ * All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if !defined(DL02_H)
+#define DL02_H
+
+/*
+ * A set of variables in dl-o2 reference by dl-03.
+ */
+
+extern int dl02_bss1;
+extern float dl02_bss2[7];
+extern char dl02_bss3[21];
+extern int dl02_data1;
+extern float dl02_data2;
+
+#endif
diff --git a/testsuites/libtests/dl07/dl-o3.c b/testsuites/libtests/dl07/dl-o3.c
new file mode 100644
index 0000000000..573e3df1a0
--- /dev/null
+++ b/testsuites/libtests/dl07/dl-o3.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014 Chris Johns <chrisj@rtems.org>. All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include "dl-load.h"
+#include "dl-o1.h"
+#include "dl-o2.h"
+#include "dl-o4.h"
+#include "dl-o5.h"
+
+#include <inttypes.h>
+#include <rtems/test.h>
+
+#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
+
+/*
+ * Yes a decl in the source. This is a modules main and I could not find which
+ * header main is defined in.
+ */
+int rtems_main_o3 (int argc, const char* argv[]);
+
+#define DL_NAME "dlo3"
+#define PAINT_VAR(_v) sizeof(_v), &_v, _v
+
+int rtems_main_o3 (int argc, const char* argv[])
+{
+ printf (DL_NAME ": module: %s\n", dl_localise_file (__FILE__));
+ printf (DL_NAME ": dl01_bss1: %4u: %p: %d\n", PAINT_VAR (dl01_bss1));
+ printf (DL_NAME ": dl01_bss2: %4u: %p: %f\n", PAINT_VAR (dl01_bss2[0]));
+ printf (DL_NAME ": dl01_bss3: %4u: %p: %02x\n", PAINT_VAR (dl01_bss3[0]));
+ printf (DL_NAME ": dl01_data1: %4u: %p: %d\n", PAINT_VAR (dl01_data1));
+ /* no %f in the rtems test printer */
+ printf (DL_NAME ": dl01_data2: %4u: %p: %f\n", PAINT_VAR (dl01_data2));
+ printf (DL_NAME ": dl01_const1: %4u: %p: %d\n", PAINT_VAR (dl01_const1));
+ printf (DL_NAME ": dl01_const2: %4u: %p: %f\n", PAINT_VAR (dl01_const2));
+ printf (DL_NAME ": dl01_func1: %4u: %p\n", sizeof(dl01_func1), &dl01_func1);
+ printf (DL_NAME ": dl02_bss1: %4u: %p: %d\n", PAINT_VAR (dl02_bss1));
+ printf (DL_NAME ": dl02_bss2: %4u: %p: %f\n", PAINT_VAR (dl02_bss2[0]));
+ printf (DL_NAME ": dl02_bss3: %4u: %p: %02x\n", PAINT_VAR (dl02_bss3[0]));
+ printf (DL_NAME ": dl02_data1: %4u: %p: %d\n", PAINT_VAR (dl02_data1));
+ /* no %f in the rtems test printer */
+ printf (DL_NAME ": dl02_data2: %4u: %p: %f\n", PAINT_VAR (dl02_data2));
+ printf (DL_NAME ": dl04_unresolv_1: %4u: %p: %d\n", PAINT_VAR (dl04_unresolv_1));
+ printf (DL_NAME ": dl04_unresolv_2: %4u: %p: %f\n", PAINT_VAR (dl04_unresolv_2));
+ printf (DL_NAME ": dl04_unresolv_3: %4u: %p: %02x\n", PAINT_VAR (dl04_unresolv_3));
+ printf (DL_NAME ": dl04_unresolv_4: %4u: %p: %p\n", PAINT_VAR (dl04_unresolv_4));
+ printf (DL_NAME ": dl04_unresolv_5: %4u: %p: %d\n", PAINT_VAR (dl04_unresolv_5));
+ printf (DL_NAME ": dl04_unresolv_6: %4u: %p: %s\n", PAINT_VAR (dl04_unresolv_6));
+ printf (DL_NAME ": dl05_unresolv_1: %4u: %p: %" PRIu64 "\n", PAINT_VAR (dl05_unresolv_1));
+ printf (DL_NAME ": dl05_unresolv_2: %4u: %p: %" PRIu16 "\n", PAINT_VAR (dl05_unresolv_2));
+ printf (DL_NAME ": dl05_unresolv_3: %4u: %p: %" PRIu32 "\n", PAINT_VAR (dl05_unresolv_3));
+ printf (DL_NAME ": dl05_unresolv_4: %4u: %p: %" PRIu8 "\n", PAINT_VAR (dl05_unresolv_4));
+ printf (DL_NAME ": dl05_unresolv_5: %4u: %p: %" PRIi64 "\n", PAINT_VAR (dl05_unresolv_5));
+ return 0;
+}
diff --git a/testsuites/libtests/dl07/dl-o4.c b/testsuites/libtests/dl07/dl-o4.c
new file mode 100644
index 0000000000..a3cb1fb6c5
--- /dev/null
+++ b/testsuites/libtests/dl07/dl-o4.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014 Chris Johns <chrisj@rtems.org>. All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include "dl-load.h"
+#include "dl-o1.h"
+#include "dl-o4.h"
+
+#include <rtems/test.h>
+
+#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
+
+
+int dl04_unresolv_1;
+float dl04_unresolv_2;
+char dl04_unresolv_3;
+char* dl04_unresolv_4;
+const int dl04_unresolv_5 = 4;
+const char* dl04_unresolv_6 = "dl-O4";
+
+/*
+ * Yes a decl in the source. This is a modules main and I could not find which
+ * header main is defined in.
+ */
+int rtems_main_o4 (int argc, const char* argv[]);
+
+#define DL_NAME "dlo4"
+#define PAINT_VAR(_v) sizeof(_v), &_v, _v
+
+int rtems_main_o4 (int argc, const char* argv[])
+{
+ printf (DL_NAME ": module: %s\n", dl_localise_file (__FILE__));
+ printf (DL_NAME ": dl01_bss1: %4u: %p: %d\n", PAINT_VAR (dl01_bss1));
+ printf (DL_NAME ": dl01_bss2: %4u: %p: %f\n", PAINT_VAR (dl01_bss2[0]));
+ printf (DL_NAME ": dl01_bss3: %4u: %p: %02x\n", PAINT_VAR (dl01_bss3[0]));
+ printf (DL_NAME ": dl01_data1: %4u: %p: %d\n", PAINT_VAR (dl01_data1));
+ /* no %f in the rtems test printer */
+ printf (DL_NAME ": dl01_data2: %4u: %p: %f\n", PAINT_VAR (dl01_data2));
+ printf (DL_NAME ": dl01_const1: %4u: %p: %d\n", PAINT_VAR (dl01_const1));
+ printf (DL_NAME ": dl01_const2: %4u: %p: %f\n", PAINT_VAR (dl01_const2));
+ printf (DL_NAME ": dl01_func1: %4u: %p\n", sizeof(dl01_func1), &dl01_func1);
+ printf (DL_NAME ": dl04_unresolv_1: %4u: %p: %d\n", PAINT_VAR (dl04_unresolv_1));
+ printf (DL_NAME ": dl04_unresolv_2: %4u: %p: %f\n", PAINT_VAR (dl04_unresolv_2));
+ printf (DL_NAME ": dl04_unresolv_3: %4u: %p: %02x\n", PAINT_VAR (dl04_unresolv_3));
+ printf (DL_NAME ": dl04_unresolv_4: %4u: %p: %p\n", PAINT_VAR (dl04_unresolv_4));
+ printf (DL_NAME ": dl04_unresolv_5: %4u: %p: %d\n", PAINT_VAR (dl04_unresolv_5));
+ printf (DL_NAME ": dl04_unresolv_6: %4u: %p: %s\n", PAINT_VAR (dl04_unresolv_6));
+ return 0;
+}
diff --git a/testsuites/libtests/dl07/dl-o4.h b/testsuites/libtests/dl07/dl-o4.h
new file mode 100644
index 0000000000..371279be9e
--- /dev/null
+++ b/testsuites/libtests/dl07/dl-o4.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj@rtems.org>.
+ * All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if !defined(DL04_H)
+#define DL04_H
+
+/*
+ * A set of variables in dl-o4 referenced by dl-03 and unresolved when dl-o3 is
+ * loaded. They are all uninitialised variables with various sizes in a mixed
+ * order to get various alignments. These and dl-o5 variables are designed to
+ * force the dependent tables to grow.
+ */
+
+extern int dl04_unresolv_1;
+extern float dl04_unresolv_2;
+extern char dl04_unresolv_3;
+extern char* dl04_unresolv_4;
+extern const int dl04_unresolv_5;
+extern const char* dl04_unresolv_6;
+
+#endif
diff --git a/testsuites/libtests/dl07/dl-o5.c b/testsuites/libtests/dl07/dl-o5.c
new file mode 100644
index 0000000000..49502b3247
--- /dev/null
+++ b/testsuites/libtests/dl07/dl-o5.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014 Chris Johns <chrisj@rtems.org>. All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include "dl-load.h"
+#include "dl-o1.h"
+#include "dl-o5.h"
+
+#include <inttypes.h>
+#include <rtems/test.h>
+
+#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
+
+
+uint64_t dl05_unresolv_1;
+uint16_t dl05_unresolv_2;
+uint32_t dl05_unresolv_3;
+uint8_t dl05_unresolv_4;
+int64_t dl05_unresolv_5;
+
+/*
+ * Yes a decl in the source. This is a modules main and I could not find which
+ * header main is defined in.
+ */
+int rtems_main_o5 (int argc, const char* argv[]);
+
+#define DL_NAME "dlo5"
+#define PAINT_VAR(_v) sizeof(_v), &_v, _v
+
+int rtems_main_o5 (int argc, const char* argv[])
+{
+ printf (DL_NAME ": module: %s\n", dl_localise_file (__FILE__));
+ printf (DL_NAME ": dl01_bss1: %4u: %p: %d\n", PAINT_VAR (dl01_bss1));
+ printf (DL_NAME ": dl01_bss2: %4u: %p: %f\n", PAINT_VAR (dl01_bss2[0]));
+ printf (DL_NAME ": dl01_bss3: %4u: %p: %02x\n", PAINT_VAR (dl01_bss3[0]));
+ printf (DL_NAME ": dl01_data1: %4u: %p: %d\n", PAINT_VAR (dl01_data1));
+ /* no %f in the rtems test printer */
+ printf (DL_NAME ": dl01_data2: %4u: %p: %f\n", PAINT_VAR (dl01_data2));
+ printf (DL_NAME ": dl01_const1: %4u: %p: %d\n", PAINT_VAR (dl01_const1));
+ printf (DL_NAME ": dl01_const2: %4u: %p: %f\n", PAINT_VAR (dl01_const2));
+ printf (DL_NAME ": dl01_func1: %4u: %p\n", sizeof(dl01_func1), &dl01_func1);
+ printf (DL_NAME ": dl05_unresolv_1: %4u: %p: %" PRIu64 "\n", PAINT_VAR (dl05_unresolv_1));
+ printf (DL_NAME ": dl05_unresolv_2: %4u: %p: %" PRIu16 "\n", PAINT_VAR (dl05_unresolv_2));
+ printf (DL_NAME ": dl05_unresolv_3: %4u: %p: %" PRIu32 "\n", PAINT_VAR (dl05_unresolv_3));
+ printf (DL_NAME ": dl05_unresolv_4: %4u: %p: %" PRIu8 "\n", PAINT_VAR (dl05_unresolv_4));
+ printf (DL_NAME ": dl05_unresolv_5: %4u: %p: %" PRIi64 "\n", PAINT_VAR (dl05_unresolv_5));
+ return 0;
+}
diff --git a/testsuites/libtests/dl07/dl-o5.h b/testsuites/libtests/dl07/dl-o5.h
new file mode 100644
index 0000000000..04974a03d4
--- /dev/null
+++ b/testsuites/libtests/dl07/dl-o5.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj@rtems.org>.
+ * All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include <stdint.h>
+
+#if !defined(DL05_H)
+#define DL05_H
+
+/*
+ * A set of variables in dl-o5 referenced by dl-03 and unresolved when dl-o3 is
+ * loaded. They are all uninitialised variables with various sizes in a mixed
+ * order to get various alignments. These and dl-o4 variables are designed to
+ * force the dependent tables to grow.
+ */
+
+extern uint64_t dl05_unresolv_1;
+extern uint16_t dl05_unresolv_2;
+extern uint32_t dl05_unresolv_3;
+extern uint8_t dl05_unresolv_4;
+extern int64_t dl05_unresolv_5;
+
+#endif
diff --git a/testsuites/libtests/dl07/dl07.doc b/testsuites/libtests/dl07/dl07.doc
new file mode 100644
index 0000000000..9a06de16fc
--- /dev/null
+++ b/testsuites/libtests/dl07/dl07.doc
@@ -0,0 +1,27 @@
+# Copyright (c) 2018 Chris Johns <chrisj@rtems.org>
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.org/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: dl07
+
+directives:
+
+ dlopen
+ dlinfo
+ dlsym
+ dlclose
+
+concepts:
+
++ Load 5 interdependent ELF object files.
++ Check there are no unreolved externals. There should be unresolved
+ externals after dl07-o3.c is loaded but resolved with o4 and o5.
++ Locate the main symbol in each lodaed object file and call.
++ Unload the ELF files in an order that checks dependent objects cannot
+ be unloaded until the references have been unloaded.
++ Repeat 100 times.
diff --git a/testsuites/libtests/dl07/dl07.scn b/testsuites/libtests/dl07/dl07.scn
new file mode 100644
index 0000000000..0c8f7891b2
--- /dev/null
+++ b/testsuites/libtests/dl07/dl07.scn
@@ -0,0 +1,510 @@
+*** BEGIN OF TEST libdl (RTL) 7 ***
+*** TEST VERSION: 5.0.0.6de8cc8ad871a197d7233a9221786d8efee87840-modified
+*** TEST STATE: EXPECTED-PASS
+*** TEST BUILD: RTEMS_NETWORKING RTEMS_POSIX_API
+*** TEST TOOLS: 7.3.0 20180125 (RTEMS 5, RSB 30da0c720b78eba16a3f5272206c07415368617b, Newlib 2ab57ad59bc35dafffa69cd4da5e228971de069f)
+--------------------------------------------------
+ Run: 0
+load: /dl07-o1.o
+handle: 0x2091160 loaded
+load: /dl07-o2.o
+handle: 0x2091ef8 loaded
+load: /dl07-o3.o
+handle: 0x2092c88 loaded
+load: /dl07-o4.o
+handle: 0x2094190 loaded
+load: /dl07-o5.o
+handle: 0x2095008 loaded
+
+
+Run mains in each module:
+
+dlo1: module: testsuites/libtests/dl07/dl-o1.c
+dlo1: dl01_bss1: 4: 0x2091bd0: 0
+dlo1: dl01_bss2: 4: 0x2091bd4: %f
+dlo1: dl01_bss3: 1: 0x2091c50: 00
+dlo1: dl01_data1: 4: 0x2091bbc: 1
+dlo1: dl01_data2: 4: 0x2091bb8: %f
+dlo1: dl01_const1: 4: 0x2091b98: 3
+dlo1: dl01_const2: 4: 0x2091b94: %f
+dlo1: dl01_func1: 1: 0x2091888
+dlo2: module: testsuites/libtests/dl07/dl-o2.c
+dlo2: dl01_bss1: 4: 0x2091bd0: 0
+dlo2: dl01_bss2: 4: 0x2091bd4: %f
+dlo2: dl01_bss3: 1: 0x2091c50: 00
+dlo2: dl01_data1: 4: 0x2091bbc: 1
+dlo2: dl01_data2: 4: 0x2091bb8: %f
+dlo2: dl01_const1: 4: 0x2091b98: 3
+dlo2: dl01_const2: 4: 0x2091b94: %f
+dlo2: dl01_func1: 1: 0x2091888
+dlo2: dl02_bss1: 4: 0x2092928: 0
+dlo2: dl02_bss2: 4: 0x209292c: %f
+dlo2: dl02_bss3: 1: 0x2092948: 00
+dlo2: dl02_data1: 4: 0x2092960: 0
+dlo2: dl02_data2: 4: 0x2092964: %f
+dlo3: module: testsuites/libtests/dl07/dl-o3.c
+dlo3: dl01_bss1: 4: 0x2091bd0: 0
+dlo3: dl01_bss2: 4: 0x2091bd4: %f
+dlo3: dl01_bss3: 1: 0x2091c50: 00
+dlo3: dl01_data1: 4: 0x2091bbc: 1
+dlo3: dl01_data2: 4: 0x2091bb8: %f
+dlo3: dl01_const1: 4: 0x2091b98: 3
+dlo3: dl01_const2: 4: 0x2091b94: %f
+dlo3: dl01_func1: 1: 0x2091888
+dlo3: dl02_bss1: 4: 0x2092928: 0
+dlo3: dl02_bss2: 4: 0x209292c: %f
+dlo3: dl02_bss3: 1: 0x2092948: 00
+dlo3: dl02_data1: 4: 0x2092960: 0
+dlo3: dl02_data2: 4: 0x2092964: %f
+dlo3: dl04_unresolv_1: 4: 0x2094d98: 0
+dlo3: dl04_unresolv_2: 4: 0x2094d9c: %f
+dlo3: dl04_unresolv_3: 1: 0x2094da0: 00
+dlo3: dl04_unresolv_4: 4: 0x2094da4: 0
+dlo3: dl04_unresolv_5: 4: 0x2094d68: 4
+dlo3: dl04_unresolv_6: 4: 0x2094d88: dl-O4
+dlo3: dl05_unresolv_1: 8: 0x2095a20: 0
+dlo3: dl05_unresolv_2: 2: 0x2095a28: 0
+dlo3: dl05_unresolv_3: 4: 0x2095a2c: 0
+dlo3: dl05_unresolv_4: 1: 0x2095a30: 0
+dlo3: dl05_unresolv_5: 8: 0x2095a38: 0
+dlo4: module: testsuites/libtests/dl07/dl-o4.c
+dlo4: dl01_bss1: 4: 0x2091bd0: 0
+dlo4: dl01_bss2: 4: 0x2091bd4: %f
+dlo4: dl01_bss3: 1: 0x2091c50: 00
+dlo4: dl01_data1: 4: 0x2091bbc: 1
+dlo4: dl01_data2: 4: 0x2091bb8: %f
+dlo4: dl01_const1: 4: 0x2091b98: 3
+dlo4: dl01_const2: 4: 0x2091b94: %f
+dlo4: dl01_func1: 1: 0x2091888
+dlo4: dl04_unresolv_1: 4: 0x2094d98: 0
+dlo4: dl04_unresolv_2: 4: 0x2094d9c: %f
+dlo4: dl04_unresolv_3: 1: 0x2094da0: 00
+dlo4: dl04_unresolv_4: 4: 0x2094da4: 0
+dlo4: dl04_unresolv_5: 4: 0x2094d68: 4
+dlo4: dl04_unresolv_6: 4: 0x2094d88: dl-O4
+dlo5: module: testsuites/libtests/dl07/dl-o5.c
+dlo5: dl01_bss1: 4: 0x2091bd0: 0
+dlo5: dl01_bss2: 4: 0x2091bd4: %f
+dlo5: dl01_bss3: 1: 0x2091c50: 00
+dlo5: dl01_data1: 4: 0x2091bbc: 1
+dlo5: dl01_data2: 4: 0x2091bb8: %f
+dlo5: dl01_const1: 4: 0x2091b98: 3
+dlo5: dl01_const2: 4: 0x2091b94: %f
+dlo5: dl01_func1: 1: 0x2091888
+dlo5: dl05_unresolv_1: 8: 0x2095a20: 0
+dlo5: dl05_unresolv_2: 2: 0x2095a28: 0
+dlo5: dl05_unresolv_3: 4: 0x2095a2c: 0
+dlo5: dl05_unresolv_4: 1: 0x2095a30: 0
+dlo5: dl05_unresolv_5: 8: 0x2095a38: 0
+handle: 0x2092c88 closing
+handle: 0x2094190 closing
+handle: 0x2095008 closing
+handle: 0x2091ef8 closing
+handle: 0x2091160 closing
+--------------------------------------------------
+ Run: 1
+load: /dl07-o1.o
+handle: 0x2091178 loaded
+load: /dl07-o2.o
+handle: 0x2091f40 loaded
+load: /dl07-o3.o
+handle: 0x2095010 loaded
+load: /dl07-o4.o
+handle: 0x20964e0 loaded
+load: /dl07-o5.o
+handle: 0x2097358 loaded
+
+
+Run mains in each module:
+
+dlo1: module: testsuites/libtests/dl07/dl-o1.c
+dlo1: dl01_bss1: 4: 0x2091d00: 0
+dlo1: dl01_bss2: 4: 0x2091d04: %f
+dlo1: dl01_bss3: 1: 0x2091d80: 00
+dlo1: dl01_data1: 4: 0x2091bd4: 1
+dlo1: dl01_data2: 4: 0x2091bd0: %f
+dlo1: dl01_const1: 4: 0x2091bb0: 3
+dlo1: dl01_const2: 4: 0x2091bac: %f
+dlo1: dl01_func1: 1: 0x20918a0
+dlo2: module: testsuites/libtests/dl07/dl-o2.c
+dlo2: dl01_bss1: 4: 0x2091d00: 0
+dlo2: dl01_bss2: 4: 0x2091d04: %f
+dlo2: dl01_bss3: 1: 0x2091d80: 00
+dlo2: dl01_data1: 4: 0x2091bd4: 1
+dlo2: dl01_data2: 4: 0x2091bd0: %f
+dlo2: dl01_const1: 4: 0x2091bb0: 3
+dlo2: dl01_const2: 4: 0x2091bac: %f
+dlo2: dl01_func1: 1: 0x20918a0
+dlo2: dl02_bss1: 4: 0x2094df8: 0
+dlo2: dl02_bss2: 4: 0x2094dfc: %f
+dlo2: dl02_bss3: 1: 0x2094e18: 00
+dlo2: dl02_data1: 4: 0x2094e30: 0
+dlo2: dl02_data2: 4: 0x2094e34: %f
+dlo3: module: testsuites/libtests/dl07/dl-o3.c
+dlo3: dl01_bss1: 4: 0x2091d00: 0
+dlo3: dl01_bss2: 4: 0x2091d04: %f
+dlo3: dl01_bss3: 1: 0x2091d80: 00
+dlo3: dl01_data1: 4: 0x2091bd4: 1
+dlo3: dl01_data2: 4: 0x2091bd0: %f
+dlo3: dl01_const1: 4: 0x2091bb0: 3
+dlo3: dl01_const2: 4: 0x2091bac: %f
+dlo3: dl01_func1: 1: 0x20918a0
+dlo3: dl02_bss1: 4: 0x2094df8: 0
+dlo3: dl02_bss2: 4: 0x2094dfc: %f
+dlo3: dl02_bss3: 1: 0x2094e18: 00
+dlo3: dl02_data1: 4: 0x2094e30: 0
+dlo3: dl02_data2: 4: 0x2094e34: %f
+dlo3: dl04_unresolv_1: 4: 0x20970e8: 0
+dlo3: dl04_unresolv_2: 4: 0x20970ec: %f
+dlo3: dl04_unresolv_3: 1: 0x20970f0: 00
+dlo3: dl04_unresolv_4: 4: 0x20970f4: 0
+dlo3: dl04_unresolv_5: 4: 0x20970b8: 4
+dlo3: dl04_unresolv_6: 4: 0x20970d8: dl-O4
+dlo3: dl05_unresolv_1: 8: 0x2097d70: 0
+dlo3: dl05_unresolv_2: 2: 0x2097d78: 0
+dlo3: dl05_unresolv_3: 4: 0x2097d7c: 0
+dlo3: dl05_unresolv_4: 1: 0x2097d80: 0
+dlo3: dl05_unresolv_5: 8: 0x2097d88: 0
+dlo4: module: testsuites/libtests/dl07/dl-o4.c
+dlo4: dl01_bss1: 4: 0x2091d00: 0
+dlo4: dl01_bss2: 4: 0x2091d04: %f
+dlo4: dl01_bss3: 1: 0x2091d80: 00
+dlo4: dl01_data1: 4: 0x2091bd4: 1
+dlo4: dl01_data2: 4: 0x2091bd0: %f
+dlo4: dl01_const1: 4: 0x2091bb0: 3
+dlo4: dl01_const2: 4: 0x2091bac: %f
+dlo4: dl01_func1: 1: 0x20918a0
+dlo4: dl04_unresolv_1: 4: 0x20970e8: 0
+dlo4: dl04_unresolv_2: 4: 0x20970ec: %f
+dlo4: dl04_unresolv_3: 1: 0x20970f0: 00
+dlo4: dl04_unresolv_4: 4: 0x20970f4: 0
+dlo4: dl04_unresolv_5: 4: 0x20970b8: 4
+dlo4: dl04_unresolv_6: 4: 0x20970d8: dl-O4
+dlo5: module: testsuites/libtests/dl07/dl-o5.c
+dlo5: dl01_bss1: 4: 0x2091d00: 0
+dlo5: dl01_bss2: 4: 0x2091d04: %f
+dlo5: dl01_bss3: 1: 0x2091d80: 00
+dlo5: dl01_data1: 4: 0x2091bd4: 1
+dlo5: dl01_data2: 4: 0x2091bd0: %f
+dlo5: dl01_const1: 4: 0x2091bb0: 3
+dlo5: dl01_const2: 4: 0x2091bac: %f
+dlo5: dl01_func1: 1: 0x20918a0
+dlo5: dl05_unresolv_1: 8: 0x2097d70: 0
+dlo5: dl05_unresolv_2: 2: 0x2097d78: 0
+dlo5: dl05_unresolv_3: 4: 0x2097d7c: 0
+dlo5: dl05_unresolv_4: 1: 0x2097d80: 0
+dlo5: dl05_unresolv_5: 8: 0x2097d88: 0
+handle: 0x2095010 closing
+handle: 0x20964e0 closing
+handle: 0x2097358 closing
+handle: 0x2091f40 closing
+handle: 0x2091178 closing
+--------------------------------------------------
+ Run: 2
+load: /dl07-o1.o
+handle: 0x2091190 loaded
+load: /dl07-o2.o
+handle: 0x2092000 loaded
+load: /dl07-o3.o
+handle: 0x20951b0 loaded
+load: /dl07-o4.o
+handle: 0x2095b40 loaded
+load: /dl07-o5.o
+handle: 0x20989a0 loaded
+
+
+Run mains in each module:
+
+dlo1: module: testsuites/libtests/dl07/dl-o1.c
+dlo1: dl01_bss1: 4: 0x2091d00: 0
+dlo1: dl01_bss2: 4: 0x2091d04: %f
+dlo1: dl01_bss3: 1: 0x2091d80: 00
+dlo1: dl01_data1: 4: 0x2091bec: 1
+dlo1: dl01_data2: 4: 0x2091be8: %f
+dlo1: dl01_const1: 4: 0x2091bc8: 3
+dlo1: dl01_const2: 4: 0x2091bc4: %f
+dlo1: dl01_func1: 1: 0x20918b8
+dlo2: module: testsuites/libtests/dl07/dl-o2.c
+dlo2: dl01_bss1: 4: 0x2091d00: 0
+dlo2: dl01_bss2: 4: 0x2091d04: %f
+dlo2: dl01_bss3: 1: 0x2091d80: 00
+dlo2: dl01_data1: 4: 0x2091bec: 1
+dlo2: dl01_data2: 4: 0x2091be8: %f
+dlo2: dl01_const1: 4: 0x2091bc8: 3
+dlo2: dl01_const2: 4: 0x2091bc4: %f
+dlo2: dl01_func1: 1: 0x20918b8
+dlo2: dl02_bss1: 4: 0x2092738: 0
+dlo2: dl02_bss2: 4: 0x209273c: %f
+dlo2: dl02_bss3: 1: 0x2092758: 00
+dlo2: dl02_data1: 4: 0x2092770: 0
+dlo2: dl02_data2: 4: 0x2092774: %f
+dlo3: module: testsuites/libtests/dl07/dl-o3.c
+dlo3: dl01_bss1: 4: 0x2091d00: 0
+dlo3: dl01_bss2: 4: 0x2091d04: %f
+dlo3: dl01_bss3: 1: 0x2091d80: 00
+dlo3: dl01_data1: 4: 0x2091bec: 1
+dlo3: dl01_data2: 4: 0x2091be8: %f
+dlo3: dl01_const1: 4: 0x2091bc8: 3
+dlo3: dl01_const2: 4: 0x2091bc4: %f
+dlo3: dl01_func1: 1: 0x20918b8
+dlo3: dl02_bss1: 4: 0x2092738: 0
+dlo3: dl02_bss2: 4: 0x209273c: %f
+dlo3: dl02_bss3: 1: 0x2092758: 00
+dlo3: dl02_data1: 4: 0x2092770: 0
+dlo3: dl02_data2: 4: 0x2092774: %f
+dlo3: dl04_unresolv_1: 4: 0x2098730: 0
+dlo3: dl04_unresolv_2: 4: 0x2098734: %f
+dlo3: dl04_unresolv_3: 1: 0x2098738: 00
+dlo3: dl04_unresolv_4: 4: 0x209873c: 0
+dlo3: dl04_unresolv_5: 4: 0x2098700: 4
+dlo3: dl04_unresolv_6: 4: 0x2098720: dl-O4
+dlo3: dl05_unresolv_1: 8: 0x20993b8: 0
+dlo3: dl05_unresolv_2: 2: 0x20993c0: 0
+dlo3: dl05_unresolv_3: 4: 0x20993c4: 0
+dlo3: dl05_unresolv_4: 1: 0x20993c8: 0
+dlo3: dl05_unresolv_5: 8: 0x20993d0: 0
+dlo4: module: testsuites/libtests/dl07/dl-o4.c
+dlo4: dl01_bss1: 4: 0x2091d00: 0
+dlo4: dl01_bss2: 4: 0x2091d04: %f
+dlo4: dl01_bss3: 1: 0x2091d80: 00
+dlo4: dl01_data1: 4: 0x2091bec: 1
+dlo4: dl01_data2: 4: 0x2091be8: %f
+dlo4: dl01_const1: 4: 0x2091bc8: 3
+dlo4: dl01_const2: 4: 0x2091bc4: %f
+dlo4: dl01_func1: 1: 0x20918b8
+dlo4: dl04_unresolv_1: 4: 0x2098730: 0
+dlo4: dl04_unresolv_2: 4: 0x2098734: %f
+dlo4: dl04_unresolv_3: 1: 0x2098738: 00
+dlo4: dl04_unresolv_4: 4: 0x209873c: 0
+dlo4: dl04_unresolv_5: 4: 0x2098700: 4
+dlo4: dl04_unresolv_6: 4: 0x2098720: dl-O4
+dlo5: module: testsuites/libtests/dl07/dl-o5.c
+dlo5: dl01_bss1: 4: 0x2091d00: 0
+dlo5: dl01_bss2: 4: 0x2091d04: %f
+dlo5: dl01_bss3: 1: 0x2091d80: 00
+dlo5: dl01_data1: 4: 0x2091bec: 1
+dlo5: dl01_data2: 4: 0x2091be8: %f
+dlo5: dl01_const1: 4: 0x2091bc8: 3
+dlo5: dl01_const2: 4: 0x2091bc4: %f
+dlo5: dl01_func1: 1: 0x20918b8
+dlo5: dl05_unresolv_1: 8: 0x20993b8: 0
+dlo5: dl05_unresolv_2: 2: 0x20993c0: 0
+dlo5: dl05_unresolv_3: 4: 0x20993c4: 0
+dlo5: dl05_unresolv_4: 1: 0x20993c8: 0
+dlo5: dl05_unresolv_5: 8: 0x20993d0: 0
+handle: 0x20951b0 closing
+handle: 0x2095b40 closing
+handle: 0x20989a0 closing
+handle: 0x2092000 closing
+handle: 0x2091190 closing
+--------------------------------------------------
+ Run: 3
+load: /dl07-o1.o
+handle: 0x20911a8 loaded
+load: /dl07-o2.o
+handle: 0x2092040 loaded
+load: /dl07-o3.o
+handle: 0x2095290 loaded
+load: /dl07-o4.o
+handle: 0x2095890 loaded
+load: /dl07-o5.o
+handle: 0x209a338 loaded
+
+
+Run mains in each module:
+
+dlo1: module: testsuites/libtests/dl07/dl-o1.c
+dlo1: dl01_bss1: 4: 0x2091d18: 0
+dlo1: dl01_bss2: 4: 0x2091d1c: %f
+dlo1: dl01_bss3: 1: 0x2091d98: 00
+dlo1: dl01_data1: 4: 0x2091d04: 1
+dlo1: dl01_data2: 4: 0x2091d00: %f
+dlo1: dl01_const1: 4: 0x2091be0: 3
+dlo1: dl01_const2: 4: 0x2091bdc: %f
+dlo1: dl01_func1: 1: 0x20918d0
+dlo2: module: testsuites/libtests/dl07/dl-o2.c
+dlo2: dl01_bss1: 4: 0x2091d18: 0
+dlo2: dl01_bss2: 4: 0x2091d1c: %f
+dlo2: dl01_bss3: 1: 0x2091d98: 00
+dlo2: dl01_data1: 4: 0x2091d04: 1
+dlo2: dl01_data2: 4: 0x2091d00: %f
+dlo2: dl01_const1: 4: 0x2091be0: 3
+dlo2: dl01_const2: 4: 0x2091bdc: %f
+dlo2: dl01_func1: 1: 0x20918d0
+dlo2: dl02_bss1: 4: 0x2095078: 0
+dlo2: dl02_bss2: 4: 0x209507c: %f
+dlo2: dl02_bss3: 1: 0x2095098: 00
+dlo2: dl02_data1: 4: 0x20950b0: 0
+dlo2: dl02_data2: 4: 0x20950b4: %f
+dlo3: module: testsuites/libtests/dl07/dl-o3.c
+dlo3: dl01_bss1: 4: 0x2091d18: 0
+dlo3: dl01_bss2: 4: 0x2091d1c: %f
+dlo3: dl01_bss3: 1: 0x2091d98: 00
+dlo3: dl01_data1: 4: 0x2091d04: 1
+dlo3: dl01_data2: 4: 0x2091d00: %f
+dlo3: dl01_const1: 4: 0x2091be0: 3
+dlo3: dl01_const2: 4: 0x2091bdc: %f
+dlo3: dl01_func1: 1: 0x20918d0
+dlo3: dl02_bss1: 4: 0x2095078: 0
+dlo3: dl02_bss2: 4: 0x209507c: %f
+dlo3: dl02_bss3: 1: 0x2095098: 00
+dlo3: dl02_data1: 4: 0x20950b0: 0
+dlo3: dl02_data2: 4: 0x20950b4: %f
+dlo3: dl04_unresolv_1: 4: 0x209a0c8: 0
+dlo3: dl04_unresolv_2: 4: 0x209a0cc: %f
+dlo3: dl04_unresolv_3: 1: 0x209a0d0: 00
+dlo3: dl04_unresolv_4: 4: 0x209a0d4: 0
+dlo3: dl04_unresolv_5: 4: 0x209a098: 4
+dlo3: dl04_unresolv_6: 4: 0x209a0b8: dl-O4
+dlo3: dl05_unresolv_1: 8: 0x209ad50: 0
+dlo3: dl05_unresolv_2: 2: 0x209ad58: 0
+dlo3: dl05_unresolv_3: 4: 0x209ad5c: 0
+dlo3: dl05_unresolv_4: 1: 0x209ad60: 0
+dlo3: dl05_unresolv_5: 8: 0x209ad68: 0
+dlo4: module: testsuites/libtests/dl07/dl-o4.c
+dlo4: dl01_bss1: 4: 0x2091d18: 0
+dlo4: dl01_bss2: 4: 0x2091d1c: %f
+dlo4: dl01_bss3: 1: 0x2091d98: 00
+dlo4: dl01_data1: 4: 0x2091d04: 1
+dlo4: dl01_data2: 4: 0x2091d00: %f
+dlo4: dl01_const1: 4: 0x2091be0: 3
+dlo4: dl01_const2: 4: 0x2091bdc: %f
+dlo4: dl01_func1: 1: 0x20918d0
+dlo4: dl04_unresolv_1: 4: 0x209a0c8: 0
+dlo4: dl04_unresolv_2: 4: 0x209a0cc: %f
+dlo4: dl04_unresolv_3: 1: 0x209a0d0: 00
+dlo4: dl04_unresolv_4: 4: 0x209a0d4: 0
+dlo4: dl04_unresolv_5: 4: 0x209a098: 4
+dlo4: dl04_unresolv_6: 4: 0x209a0b8: dl-O4
+dlo5: module: testsuites/libtests/dl07/dl-o5.c
+dlo5: dl01_bss1: 4: 0x2091d18: 0
+dlo5: dl01_bss2: 4: 0x2091d1c: %f
+dlo5: dl01_bss3: 1: 0x2091d98: 00
+dlo5: dl01_data1: 4: 0x2091d04: 1
+dlo5: dl01_data2: 4: 0x2091d00: %f
+dlo5: dl01_const1: 4: 0x2091be0: 3
+dlo5: dl01_const2: 4: 0x2091bdc: %f
+dlo5: dl01_func1: 1: 0x20918d0
+dlo5: dl05_unresolv_1: 8: 0x209ad50: 0
+dlo5: dl05_unresolv_2: 2: 0x209ad58: 0
+dlo5: dl05_unresolv_3: 4: 0x209ad5c: 0
+dlo5: dl05_unresolv_4: 1: 0x209ad60: 0
+dlo5: dl05_unresolv_5: 8: 0x209ad68: 0
+handle: 0x2095290 closing
+handle: 0x2095890 closing
+handle: 0x209a338 closing
+handle: 0x2092040 closing
+handle: 0x20911a8 closing
+--------------------------------------------------
+
+ REPEAT 100 TIMES
+
+--------------------------------------------------
+ Run: 99
+load: /dl07-o1.o
+handle: 0x211fbc0 loaded
+load: /dl07-o2.o
+handle: 0x212ed58 loaded
+load: /dl07-o3.o
+handle: 0x214d6d0 loaded
+load: /dl07-o4.o
+handle: 0x214eba0 loaded
+load: /dl07-o5.o
+handle: 0x214fa18 loaded
+
+
+Run mains in each module:
+
+dlo1: module: testsuites/libtests/dl07/dl-o1.c
+dlo1: dl01_bss1: 4: 0x2136578: 0
+dlo1: dl01_bss2: 4: 0x213657c: %f
+dlo1: dl01_bss3: 1: 0x21365f8: 00
+dlo1: dl01_data1: 4: 0x2136564: 1
+dlo1: dl01_data2: 4: 0x2136560: %f
+dlo1: dl01_const1: 4: 0x213fa18: 3
+dlo1: dl01_const2: 4: 0x213fa14: %f
+dlo1: dl01_func1: 1: 0x213f560
+dlo2: module: testsuites/libtests/dl07/dl-o2.c
+dlo2: dl01_bss1: 4: 0x2136578: 0
+dlo2: dl01_bss2: 4: 0x213657c: %f
+dlo2: dl01_bss3: 1: 0x21365f8: 00
+dlo2: dl01_data1: 4: 0x2136564: 1
+dlo2: dl01_data2: 4: 0x2136560: %f
+dlo2: dl01_const1: 4: 0x213fa18: 3
+dlo2: dl01_const2: 4: 0x213fa14: %f
+dlo2: dl01_func1: 1: 0x213f560
+dlo2: dl02_bss1: 4: 0x214d460: 0
+dlo2: dl02_bss2: 4: 0x214d464: %f
+dlo2: dl02_bss3: 1: 0x214d480: 00
+dlo2: dl02_data1: 4: 0x214d498: 0
+dlo2: dl02_data2: 4: 0x214d49c: %f
+dlo3: module: testsuites/libtests/dl07/dl-o3.c
+dlo3: dl01_bss1: 4: 0x2136578: 0
+dlo3: dl01_bss2: 4: 0x213657c: %f
+dlo3: dl01_bss3: 1: 0x21365f8: 00
+dlo3: dl01_data1: 4: 0x2136564: 1
+dlo3: dl01_data2: 4: 0x2136560: %f
+dlo3: dl01_const1: 4: 0x213fa18: 3
+dlo3: dl01_const2: 4: 0x213fa14: %f
+dlo3: dl01_func1: 1: 0x213f560
+dlo3: dl02_bss1: 4: 0x214d460: 0
+dlo3: dl02_bss2: 4: 0x214d464: %f
+dlo3: dl02_bss3: 1: 0x214d480: 00
+dlo3: dl02_data1: 4: 0x214d498: 0
+dlo3: dl02_data2: 4: 0x214d49c: %f
+dlo3: dl04_unresolv_1: 4: 0x214f7a8: 0
+dlo3: dl04_unresolv_2: 4: 0x214f7ac: %f
+dlo3: dl04_unresolv_3: 1: 0x214f7b0: 00
+dlo3: dl04_unresolv_4: 4: 0x214f7b4: 0
+dlo3: dl04_unresolv_5: 4: 0x214f778: 4
+dlo3: dl04_unresolv_6: 4: 0x214f798: dl-O4
+dlo3: dl05_unresolv_1: 8: 0x2150430: 0
+dlo3: dl05_unresolv_2: 2: 0x2150438: 0
+dlo3: dl05_unresolv_3: 4: 0x215043c: 0
+dlo3: dl05_unresolv_4: 1: 0x2150440: 0
+dlo3: dl05_unresolv_5: 8: 0x2150448: 0
+dlo4: module: testsuites/libtests/dl07/dl-o4.c
+dlo4: dl01_bss1: 4: 0x2136578: 0
+dlo4: dl01_bss2: 4: 0x213657c: %f
+dlo4: dl01_bss3: 1: 0x21365f8: 00
+dlo4: dl01_data1: 4: 0x2136564: 1
+dlo4: dl01_data2: 4: 0x2136560: %f
+dlo4: dl01_const1: 4: 0x213fa18: 3
+dlo4: dl01_const2: 4: 0x213fa14: %f
+dlo4: dl01_func1: 1: 0x213f560
+dlo4: dl04_unresolv_1: 4: 0x214f7a8: 0
+dlo4: dl04_unresolv_2: 4: 0x214f7ac: %f
+dlo4: dl04_unresolv_3: 1: 0x214f7b0: 00
+dlo4: dl04_unresolv_4: 4: 0x214f7b4: 0
+dlo4: dl04_unresolv_5: 4: 0x214f778: 4
+dlo4: dl04_unresolv_6: 4: 0x214f798: dl-O4
+dlo5: module: testsuites/libtests/dl07/dl-o5.c
+dlo5: dl01_bss1: 4: 0x2136578: 0
+dlo5: dl01_bss2: 4: 0x213657c: %f
+dlo5: dl01_bss3: 1: 0x21365f8: 00
+dlo5: dl01_data1: 4: 0x2136564: 1
+dlo5: dl01_data2: 4: 0x2136560: %f
+dlo5: dl01_const1: 4: 0x213fa18: 3
+dlo5: dl01_const2: 4: 0x213fa14: %f
+dlo5: dl01_func1: 1: 0x213f560
+dlo5: dl05_unresolv_1: 8: 0x2150430: 0
+dlo5: dl05_unresolv_2: 2: 0x2150438: 0
+dlo5: dl05_unresolv_3: 4: 0x215043c: 0
+dlo5: dl05_unresolv_4: 1: 0x2150440: 0
+dlo5: dl05_unresolv_5: 8: 0x2150448: 0
+handle: 0x214d6d0 closing
+handle: 0x214eba0 closing
+handle: 0x214fa18 closing
+handle: 0x212ed58 closing
+handle: 0x211fbc0 closing
+
+*** END OF TEST libdl (RTL) 7 ***
+
+
+*** FATAL ***
+fatal source: 5 (RTEMS_FATAL_SOURCE_EXIT)
+fatal code: 0 (0x00000000)
+RTEMS version: 5.0.0.6de8cc8ad871a197d7233a9221786d8efee87840-modified
+RTEMS tools: 7.3.0 20180125 (RTEMS 5, RSB 30da0c720b78eba16a3f5272206c07415368617b, Newlib 2ab57ad59bc35dafffa69cd4da5e228971de069f)
+executing thread ID: 0x08a010001
+executing thread name: UI1
diff --git a/testsuites/libtests/dl07/init.c b/testsuites/libtests/dl07/init.c
new file mode 100644
index 0000000000..7c482c4944
--- /dev/null
+++ b/testsuites/libtests/dl07/init.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj@rtems.org>. All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include "tmacros.h"
+
+#include <errno.h>
+#include <string.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#include <rtems/rtl/rtl.h>
+#include <rtems/untar.h>
+
+#include "dl-load.h"
+
+const char rtems_test_name[] = "libdl (RTL) 7";
+
+/* forward declarations to avoid warnings */
+static rtems_task Init(rtems_task_argument argument);
+
+#include "dl07-tar.h"
+
+#define TARFILE_START dl07_tar
+#define TARFILE_SIZE dl07_tar_size
+
+static int test(void)
+{
+ int ret;
+ ret = dl_load_test();
+ if (ret)
+ rtems_test_exit(ret);
+ return 0;
+}
+
+static void Init(rtems_task_argument arg)
+{
+ int te;
+ int i;
+
+ TEST_BEGIN();
+
+ te = Untar_FromMemory((void *)TARFILE_START, (size_t)TARFILE_SIZE);
+ if (te != 0)
+ {
+ printf("untar failed: %d\n", te);
+ rtems_test_exit(1);
+ exit (1);
+ }
+
+ for (i = 0; i < 100; ++i)
+ {
+ printf ("--------------------------------------------------\n");
+ printf (" Run: %d\n", i);
+ test();
+ }
+
+ TEST_END();
+
+ rtems_test_exit(0);
+}
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
+
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#define CONFIGURE_MAXIMUM_SEMAPHORES 1
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT_TASK_STACK_SIZE (8U * 1024U)
+
+#define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT)
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>