summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2019-01-15 17:47:41 +1100
committerChris Johns <chrisj@rtems.org>2019-02-09 10:06:34 +1100
commitd8c70ba65b13cd023b50b8aed5d91e455017cdd5 (patch)
treef78c3441ef74a7315ef4f7850bd27631bf0d2502 /testsuites
parentlibdl: Fix the support for constructors and desctructors. (diff)
downloadrtems-d8c70ba65b13cd023b50b8aed5d91e455017cdd5.tar.bz2
libdl: Add support for trampolines
- Trampolines or fixups for veneers provide long jump support for instruciton sets that implement short relative address branches. The linker provides trampolines when creating a static image. This patch adds trampoline support to libdl and the ARM architecture. - The dl09 test requires enough memory so modules are outside the relative branch instruction ranges for the architecture. Updates #3685
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/libtests/Makefile.am48
-rw-r--r--testsuites/libtests/configure.ac1
-rw-r--r--testsuites/libtests/dl01/dl-load.c41
-rw-r--r--testsuites/libtests/dl08/dl-load.c36
-rw-r--r--testsuites/libtests/dl09/dl-load.c195
-rw-r--r--testsuites/libtests/dl09/dl-load.h21
-rw-r--r--testsuites/libtests/dl09/dl-o1.c61
-rw-r--r--testsuites/libtests/dl09/dl-o1.h23
-rw-r--r--testsuites/libtests/dl09/dl-o2.c39
-rw-r--r--testsuites/libtests/dl09/dl-o2.h25
-rw-r--r--testsuites/libtests/dl09/dl-o3.c40
-rw-r--r--testsuites/libtests/dl09/dl-o3.h15
-rw-r--r--testsuites/libtests/dl09/dl-o4.c40
-rw-r--r--testsuites/libtests/dl09/dl-o4.h29
-rw-r--r--testsuites/libtests/dl09/dl-o5.c36
-rw-r--r--testsuites/libtests/dl09/dl-o5.h30
-rw-r--r--testsuites/libtests/dl09/dl09.doc23
-rw-r--r--testsuites/libtests/dl09/dl09.scn390
-rw-r--r--testsuites/libtests/dl09/init.c90
19 files changed, 1163 insertions, 20 deletions
diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am
index a5801d3cb3..22cf613dd3 100644
--- a/testsuites/libtests/Makefile.am
+++ b/testsuites/libtests/Makefile.am
@@ -440,7 +440,7 @@ dl05_SOURCES = dl05/init.c dl05/dl-load.c dl05/dl-cpp.cpp dl05-tar.c \
dl05_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_dl05) $(support_includes)
dl05/init.c: dl05-tar.o
dl05.pre: $(dl05_OBJECTS) $(dl05_DEPENDENCIES)
- @rm -f dl05.pre
+ @rm -f dl05.pre dl05-sym.o
$(AM_V_CXXLD)$(LINK.cc) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
dl05-o5.o: dl05/dl-o5.cpp
$(AM_V_CXX)$(CXXCOMPILE) -c -o $@ $<
@@ -484,7 +484,7 @@ dl06-pre-init.o: dl06-pre-tar.o
$(AM_V_CC)$(COMPILE) $(dl06_CPPFLAGS) $(CPU_CFLAGS) $(AM_CFLAGS) \
-DDL06_PRE -c -o $@ $(srcdir)/dl06/init.c
dl06.pre: dl06-pre-init.o dl06/dl06-dl-load.o dl06-pre-tar.o
- @rm -f $@
+ @rm -f $@ dl06-sym.o
$(AM_V_CCLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+ $(LDADD)
dl06-o1.o: dl06/dl06-o1.c Makefile
$(AM_V_CC)$(COMPILE) -c -o $@ $<
@@ -522,7 +522,7 @@ 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
+ @rm -f dl07.pre dl07-sym.o
$(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 $@ $<
@@ -562,7 +562,7 @@ dl08_SOURCES = dl08/init.c dl08/dl-load.c dl08-tar.c dl08-tar.h
dl08_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_dl08) $(support_includes)
dl08/init.c: dl08-tar.o
dl08.pre: $(dl08_OBJECTS) $(dl08_DEPENDENCIES)
- @rm -f dl08.pre
+ @rm -f dl08.pre dl08-syms.o
$(AM_V_CCLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
dl08-o1.o: dl08/dl-o1.c Makefile
$(AM_V_CC)$(COMPILE) -c -o $@ $<
@@ -605,6 +605,46 @@ CLEANFILES += dl08.pre dl08-sym.o libdl08_1.a libdl08_2.a dl08-o1.o dl08-o2.o \
endif
endif
+if DLTESTS
+if TEST_dl09
+lib_tests += dl09
+lib_screens += dl09/dl09.scn
+lib_docs += dl09/dl09.doc
+dl09_SOURCES = dl09/init.c dl09/dl-load.c dl09-tar.c dl09-tar.h
+dl09_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_dl09) $(support_includes)
+dl09/init.c: dl09-tar.o
+dl09.pre: $(dl09_OBJECTS) $(dl09_DEPENDENCIES)
+ @rm -f dl09.pre dl09-syms.o
+ $(AM_V_CCLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+dl09-o1.o: dl09/dl-o1.c Makefile
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl09-o2.o: dl09/dl-o2.c Makefile
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl09-o3.o: dl09/dl-o3.c Makefile
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl09-o4.o: dl09/dl-o4.c Makefile
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl09-o5.o: dl09/dl-o5.c Makefile
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl09.tar: dl09-o1.o dl09-o2.o dl09-o3.o dl09-o4.o dl09-o5.o
+ @rm -f $@
+ $(AM_V_GEN)$(PAX) -w -f $@ $+
+dl09-tar.c: dl09.tar
+ $(AM_V_GEN)$(BIN2C) -C $< $@
+dl09-tar.h: dl09.tar
+ $(AM_V_GEN)$(BIN2C) -H $< $@
+dl09-tar.o: dl09-tar.c dl09-tar.h
+ $(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl09-sym.o: dl09.pre
+ $(AM_V_GEN)rtems-syms -e -C $(CC) -c "$(CFLAGS)" -o $@ $<
+dl09$(EXEEXT): $(dl09_OBJECTS) $(dl09_DEPENDENCIES) dl09-sym.o
+ @rm -f $@
+ $(AM_V_CCLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+CLEANFILES += dl09.pre dl09-sym.o dl09-o1.o dl09-o2.o dl09-o3.o dl09-o4.o \
+ dl09-o5.o dl09.tar dl09-tar.h
+endif
+endif
+
if TEST_dumpbuf01
lib_tests += dumpbuf01
lib_screens += dumpbuf01/dumpbuf01.scn
diff --git a/testsuites/libtests/configure.ac b/testsuites/libtests/configure.ac
index b32d06eb22..3bcc0ec5c4 100644
--- a/testsuites/libtests/configure.ac
+++ b/testsuites/libtests/configure.ac
@@ -133,6 +133,7 @@ RTEMS_TEST_CHECK([dl05])
RTEMS_TEST_CHECK([dl06])
RTEMS_TEST_CHECK([dl07])
RTEMS_TEST_CHECK([dl08])
+RTEMS_TEST_CHECK([dl09])
RTEMS_TEST_CHECK([dumpbuf01])
RTEMS_TEST_CHECK([dup2])
RTEMS_TEST_CHECK([exit01])
diff --git a/testsuites/libtests/dl01/dl-load.c b/testsuites/libtests/dl01/dl-load.c
index 5438196e67..d93550d15b 100644
--- a/testsuites/libtests/dl01/dl-load.c
+++ b/testsuites/libtests/dl01/dl-load.c
@@ -12,8 +12,41 @@
#include "dl-load.h"
-typedef int (*call_t)(int argc, const char* argv[]);
+#include <rtems/rtl/rtl-shell.h>
+#include <rtems/rtl/rtl-trace.h>
+
+#define TEST_TRACE 0
+#if TEST_TRACE
+ #define DEBUG_TRACE (RTEMS_RTL_TRACE_DETAIL | \
+ RTEMS_RTL_TRACE_WARNING | \
+ RTEMS_RTL_TRACE_LOAD | \
+ RTEMS_RTL_TRACE_UNLOAD | \
+ RTEMS_RTL_TRACE_SYMBOL | \
+ RTEMS_RTL_TRACE_RELOC | \
+ RTEMS_RTL_TRACE_ALLOCATOR | \
+ RTEMS_RTL_TRACE_UNRESOLVED | \
+ RTEMS_RTL_TRACE_ARCHIVES | \
+ RTEMS_RTL_TRACE_DEPENDENCY)
+ #define DL_DEBUG_TRACE DEBUG_TRACE /* RTEMS_RTL_TRACE_ALL */
+ #define DL_RTL_CMDS 1
+#else
+ #define DL_DEBUG_TRACE 0
+ #define DL_RTL_CMDS 0
+#endif
+
+static void dl_load_dump (void)
+{
+#if DL_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
+}
+typedef int (*call_t)(int argc, const char* argv[]);
static const char* call_1[] = { "Line 1", "Line 2" };
static const char* call_2[] = { "Call 2, line 1",
@@ -28,6 +61,10 @@ int dl_load_test(void)
int unresolved;
char* message = "loaded";
+#if DL_DEBUG_TRACE
+ rtems_rtl_trace_set_mask (DL_DEBUG_TRACE);
+#endif
+
printf("load: /dl01-o1.o\n");
handle = dlopen ("/dl01-o1.o", RTLD_NOW | RTLD_GLOBAL);
@@ -44,6 +81,8 @@ int dl_load_test(void)
printf ("handle: %p %s\n", handle, message);
+ dl_load_dump ();
+
call = dlsym (handle, "rtems_main");
if (call == NULL)
{
diff --git a/testsuites/libtests/dl08/dl-load.c b/testsuites/libtests/dl08/dl-load.c
index 615a837b39..6f4c6f3fa4 100644
--- a/testsuites/libtests/dl08/dl-load.c
+++ b/testsuites/libtests/dl08/dl-load.c
@@ -7,18 +7,24 @@
* http://www.rtems.org/license/LICENSE.
*/
-#define ARCHIVE_TRACE (RTEMS_RTL_TRACE_DETAIL | \
- RTEMS_RTL_TRACE_WARNING | \
- RTEMS_RTL_TRACE_LOAD | \
- RTEMS_RTL_TRACE_UNLOAD | \
- RTEMS_RTL_TRACE_SYMBOL | \
- RTEMS_RTL_TRACE_RELOC | \
- RTEMS_RTL_TRACE_ALLOCATOR | \
- RTEMS_RTL_TRACE_UNRESOLVED | \
- RTEMS_RTL_TRACE_ARCHIVES | \
- RTEMS_RTL_TRACE_DEPENDENCY)
-#define DL08_DEBUG_TRACE 0 /* RTEMS_RTL_TRACE_ALL */
-#define DL08_RTL_CMDS 0
+#define TEST_TRACE 0
+#if TEST_TRACE
+ #define DEBUG_TRACE (RTEMS_RTL_TRACE_DETAIL | \
+ RTEMS_RTL_TRACE_WARNING | \
+ RTEMS_RTL_TRACE_LOAD | \
+ RTEMS_RTL_TRACE_UNLOAD | \
+ RTEMS_RTL_TRACE_SYMBOL | \
+ RTEMS_RTL_TRACE_RELOC | \
+ RTEMS_RTL_TRACE_ALLOCATOR | \
+ RTEMS_RTL_TRACE_UNRESOLVED | \
+ RTEMS_RTL_TRACE_ARCHIVES | \
+ RTEMS_RTL_TRACE_DEPENDENCY)
+ #define DL_DEBUG_TRACE DEBUG_TRACE /* RTEMS_RTL_TRACE_ALL */
+ #define DL_RTL_CMDS 1
+#else
+ #define DL_DEBUG_TRACE 0
+ #define DL_RTL_CMDS 0
+#endif
#include <dlfcn.h>
@@ -33,7 +39,7 @@ typedef int (*call_sig)(void);
static void dl_load_dump (void)
{
-#if DL08_RTL_CMDS
+#if DL_RTL_CMDS
char* list[] = { "rtl", "list", NULL };
char* sym[] = { "rtl", "sym", NULL };
printf ("RTL List:\n");
@@ -114,8 +120,8 @@ int dl_load_test(void)
printf ("Test source (link in strstr): %s\n", dl_localise_file (__FILE__));
-#if DL08_DEBUG_TRACE
- rtems_rtl_trace_set_mask (DL08_DEBUG_TRACE);
+#if DL_DEBUG_TRACE
+ rtems_rtl_trace_set_mask (DL_DEBUG_TRACE);
#endif
o1 = dl_load_obj("/dl08-o1.o", false);
diff --git a/testsuites/libtests/dl09/dl-load.c b/testsuites/libtests/dl09/dl-load.c
new file mode 100644
index 0000000000..ee0ef0a335
--- /dev/null
+++ b/testsuites/libtests/dl09/dl-load.c
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2019 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 TEST_TRACE 0
+#if TEST_TRACE
+ #define DEBUG_TRACE (RTEMS_RTL_TRACE_DETAIL | \
+ RTEMS_RTL_TRACE_WARNING | \
+ RTEMS_RTL_TRACE_LOAD | \
+ RTEMS_RTL_TRACE_UNLOAD | \
+ RTEMS_RTL_TRACE_SYMBOL | \
+ RTEMS_RTL_TRACE_RELOC | \
+ RTEMS_RTL_TRACE_ALLOCATOR | \
+ RTEMS_RTL_TRACE_UNRESOLVED | \
+ RTEMS_RTL_TRACE_ARCHIVES | \
+ RTEMS_RTL_TRACE_DEPENDENCY)
+ #define DL09_DEBUG_TRACE DEBUG_TRACE /* RTEMS_RTL_TRACE_ALL */
+ #define DL09_RTL_CMDS 1
+#else
+ #define DL09_DEBUG_TRACE 0
+ #define DL09_RTL_CMDS 0
+#endif
+
+#include <dlfcn.h>
+
+#include "dl-load.h"
+
+#include <tmacros.h>
+
+#include <rtems/malloc.h>
+#include <rtems/rtl/rtl-shell.h>
+#include <rtems/rtl/rtl-trace.h>
+
+extern void rtems_shell_print_heap_info(
+ const char *c,
+ const Heap_Information *h
+);
+
+typedef struct
+{
+ void* handle;
+ void* space;
+} objects;
+
+typedef struct
+{
+ const char* name;
+ bool has_unresolved;
+ size_t space;
+} object_def;
+
+#define MBYTES(_m) ((_m) * 1024UL * 1024UL)
+#define NUMOF(_a) (sizeof(_a) / sizeof(_a[0]))
+
+typedef int (*call_sig)(void);
+
+static void dl_load_dump (void)
+{
+#if DL09_RTL_CMDS
+ char* list[] = { "rtl", "list", NULL };
+ char* sym[] = { "rtl", "sym", NULL };
+ Heap_Information_block info;
+ malloc_info( &info );
+ printf ("RTL List:\n");
+ rtems_rtl_shell_command (2, list);
+ printf ("RTL Sym:\n");
+ rtems_rtl_shell_command (2, sym);
+ printf ("Malloc:\n");
+ rtems_shell_print_heap_info("free", &info.Free);
+#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);
+ }
+ }
+ printf ("handel: %p: %sunresolved externals\n",
+ handle, unresolved != 0 ? "" : "no ");
+}
+
+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;
+}
+
+static void dl_object_open (object_def* od, objects* o)
+{
+ o->handle = dl_load_obj(od->name, od->has_unresolved);
+ rtems_test_assert (o->handle != NULL);
+ if (!od->has_unresolved)
+ dl_check_resolved (o->handle, false);
+ if (od->space != 0)
+ {
+ o->space = malloc (od->space);
+ printf("space alloc: %s: %d: %p\n", od->name, od->space, o->space);
+ rtems_test_assert (o->space != NULL);
+ }
+ dl_load_dump ();
+}
+
+static void dl_object_close (objects* o)
+{
+ dl_close (o->handle);
+ printf("space dealloc: %p\n", o->space);
+ free (o->space);
+}
+
+int dl_load_test(void)
+{
+ object_def od[5] = { { "/dl09-o1.o", true, MBYTES(32) },
+ { "/dl09-o2.o", true, MBYTES(32) },
+ { "/dl09-o3.o", true, MBYTES(32) },
+ { "/dl09-o4.o", true, MBYTES(32) },
+ { "/dl09-o5.o", false, 0 } };
+ objects o[5] = { 0 };
+ size_t i;
+
+ printf ("Test source (link in strstr): %s\n", dl_localise_file (__FILE__));
+
+#if DL09_DEBUG_TRACE
+ rtems_rtl_trace_set_mask (DL09_DEBUG_TRACE);
+#endif
+
+ for (i = 0; i < NUMOF(od); ++i)
+ dl_object_open (&od[i], &o[i]);
+
+ dl_load_dump ();
+
+ printf ("Running rtems_main_o1:\n");
+ if (dl_call (o[0].handle, "rtems_main_o1"))
+ return 1;
+
+ for (i = 0; i < NUMOF(od); ++i)
+ dl_object_close (&o[i]);
+
+ return 0;
+}
diff --git a/testsuites/libtests/dl09/dl-load.h b/testsuites/libtests/dl09/dl-load.h
new file mode 100644
index 0000000000..72872917aa
--- /dev/null
+++ b/testsuites/libtests/dl09/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/dl09/dl-o1.c b/testsuites/libtests/dl09/dl-o1.c
new file mode 100644
index 0000000000..22b839a438
--- /dev/null
+++ b/testsuites/libtests/dl09/dl-o1.c
@@ -0,0 +1,61 @@
+/*
+ * 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"
+#include "dl-o1.h"
+#include "dl-o2.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);
+
+ rtems_main_o2 ();
+
+ return 0;
+}
diff --git a/testsuites/libtests/dl09/dl-o1.h b/testsuites/libtests/dl09/dl-o1.h
new file mode 100644
index 0000000000..f6a10f1481
--- /dev/null
+++ b/testsuites/libtests/dl09/dl-o1.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(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/dl09/dl-o2.c b/testsuites/libtests/dl09/dl-o2.c
new file mode 100644
index 0000000000..907fe9a268
--- /dev/null
+++ b/testsuites/libtests/dl09/dl-o2.c
@@ -0,0 +1,39 @@
+/*
+ * 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-o2.h"
+#include "dl-o3.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;
+
+#define DL_NAME "dlo2"
+#define PAINT_VAR(_v) sizeof(_v), &_v, _v
+
+int rtems_main_o2 (void)
+{
+ printf (DL_NAME ": module: %s\n", dl_localise_file (__FILE__));
+ 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));
+
+ rtems_main_o3 ();
+
+ return 0;
+}
diff --git a/testsuites/libtests/dl09/dl-o2.h b/testsuites/libtests/dl09/dl-o2.h
new file mode 100644
index 0000000000..d6c1820f46
--- /dev/null
+++ b/testsuites/libtests/dl09/dl-o2.h
@@ -0,0 +1,25 @@
+/*
+ * 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;
+
+int rtems_main_o2 (void);
+
+#endif
diff --git a/testsuites/libtests/dl09/dl-o3.c b/testsuites/libtests/dl09/dl-o3.c
new file mode 100644
index 0000000000..4333f34057
--- /dev/null
+++ b/testsuites/libtests/dl09/dl-o3.c
@@ -0,0 +1,40 @@
+/*
+ * 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-o3.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__);
+
+#define DL_NAME "dlo3"
+#define PAINT_VAR(_v) sizeof(_v), &_v, _v
+
+int rtems_main_o3 ()
+{
+ printf (DL_NAME ": module: %s\n", dl_localise_file (__FILE__));
+ 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));
+
+ rtems_main_o4 ();
+
+ return 0;
+}
diff --git a/testsuites/libtests/dl09/dl-o3.h b/testsuites/libtests/dl09/dl-o3.h
new file mode 100644
index 0000000000..8c5d18dfb1
--- /dev/null
+++ b/testsuites/libtests/dl09/dl-o3.h
@@ -0,0 +1,15 @@
+/*
+ * 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(DL03_H)
+#define DL03_H
+
+int rtems_main_o3 (void);
+
+#endif
diff --git a/testsuites/libtests/dl09/dl-o4.c b/testsuites/libtests/dl09/dl-o4.c
new file mode 100644
index 0000000000..60ada7ac68
--- /dev/null
+++ b/testsuites/libtests/dl09/dl-o4.c
@@ -0,0 +1,40 @@
+/*
+ * 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-o4.h"
+#include "dl-o5.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";
+
+#define DL_NAME "dlo4"
+#define PAINT_VAR(_v) sizeof(_v), &_v, _v
+
+int rtems_main_o4 (void)
+{
+ printf (DL_NAME ": module: %s\n", dl_localise_file (__FILE__));
+ 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));
+
+ rtems_main_o5 ();
+
+ return 0;
+}
diff --git a/testsuites/libtests/dl09/dl-o4.h b/testsuites/libtests/dl09/dl-o4.h
new file mode 100644
index 0000000000..bab9fc1ae4
--- /dev/null
+++ b/testsuites/libtests/dl09/dl-o4.h
@@ -0,0 +1,29 @@
+/*
+ * 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;
+
+int rtems_main_o4 (void);
+
+#endif
diff --git a/testsuites/libtests/dl09/dl-o5.c b/testsuites/libtests/dl09/dl-o5.c
new file mode 100644
index 0000000000..84e8c84173
--- /dev/null
+++ b/testsuites/libtests/dl09/dl-o5.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2019 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-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;
+
+#define DL_NAME "dlo5"
+#define PAINT_VAR(_v) sizeof(_v), &_v, _v
+
+int rtems_main_o5 (void)
+{
+ printf (DL_NAME ": module: %s\n", dl_localise_file (__FILE__));
+ 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/dl09/dl-o5.h b/testsuites/libtests/dl09/dl-o5.h
new file mode 100644
index 0000000000..bb4ce468a2
--- /dev/null
+++ b/testsuites/libtests/dl09/dl-o5.h
@@ -0,0 +1,30 @@
+/*
+ * 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;
+
+int rtems_main_o5 (void);
+
+#endif
diff --git a/testsuites/libtests/dl09/dl09.doc b/testsuites/libtests/dl09/dl09.doc
new file mode 100644
index 0000000000..4c5d97ef2a
--- /dev/null
+++ b/testsuites/libtests/dl09/dl09.doc
@@ -0,0 +1,23 @@
+# Copyright (c) 2019 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: dl09
+
+directives:
+
+ dlopen
+ dlinfo
+ dlsym
+ dlclose
+
+concepts:
+
++ Load modules with a space between then so short address range relative
+ instructions require trampolines.
++ Repeat 100 times.
diff --git a/testsuites/libtests/dl09/dl09.scn b/testsuites/libtests/dl09/dl09.scn
new file mode 100644
index 0000000000..f4b258f25b
--- /dev/null
+++ b/testsuites/libtests/dl09/dl09.scn
@@ -0,0 +1,390 @@
+*** BEGIN OF TEST libdl (RTL) 9 ***
+*** TEST VERSION: 5.0.0.ab08681fe52cad071f3a8d554af28c8bfc53b28f-modified
+*** TEST STATE: EXPECTED-PASS
+*** TEST BUILD: RTEMS_POSIX_API
+*** TEST TOOLS: 7.4.0 20181206 (RTEMS 5, RSB 257c9267cfce362138a265764c6a799c12c6b181, Newlib dc6e94551f09d3a983afd571478d63a09d6f66fa)
+--------------------------------------------------
+ Run: 0
+Test source (link in strstr): testsuites/libtests/dl09/dl-load.c
+load: /dl09-o1.o
+handel: 0x123510: unresolved externals
+handle: 0x123510 loaded
+space alloc: /dl09-o1.o: 33554432: 0x124d10
+load: /dl09-o2.o
+handel: 0x124390: unresolved externals
+handle: 0x124390 loaded
+space alloc: /dl09-o2.o: 33554432: 0x2125978
+load: /dl09-o3.o
+handel: 0x4125980: unresolved externals
+handle: 0x4125980 loaded
+space alloc: /dl09-o3.o: 33554432: 0x41267f0
+load: /dl09-o4.o
+handel: 0x41266b0: unresolved externals
+handle: 0x41266b0 loaded
+space alloc: /dl09-o4.o: 33554432: 0x6127528
+load: /dl09-o5.o
+handel: 0x8127530: no unresolved externals
+handle: 0x8127530 loaded
+handel: 0x8127530: no unresolved externals
+Running rtems_main_o1:
+dlo1: module: testsuites/libtests/dl09/dl-o1.c
+dlo1: dl01_bss1: 4: 0x124088: 0
+dlo1: dl01_bss2: 4: 0x12408c: %f
+dlo1: dl01_bss3: 1: 0x124104: 00
+dlo1: dl01_data1: 4: 0x124070: 1
+dlo1: dl01_data2: 4: 0x124074: %f
+dlo1: dl01_const1: 4: 0x124050: 3
+dlo1: dl01_const2: 4: 0x124054: %f
+dlo1: dl01_func1: 1: 0x123cf9
+dlo2: module: testsuites/libtests/dl09/dl-o2.c
+dlo2: dl02_bss1: 4: 0x2125468: 0
+dlo2: dl02_bss2: 4: 0x212546c: %f
+dlo2: dl02_bss3: 1: 0x2125488: 00
+dlo2: dl02_data1: 4: 0x21254a0: 0
+dlo2: dl02_data2: 4: 0x21254a4: %f
+dlo3: module: testsuites/libtests/dl09/dl-o3.c
+dlo3: dl04_unresolv_1: 4: 0x61270e8: 0
+dlo3: dl04_unresolv_2: 4: 0x61270ec: %f
+dlo3: dl04_unresolv_3: 1: 0x61270f0: 00
+dlo3: dl04_unresolv_4: 4: 0x61270f4: 0
+dlo3: dl04_unresolv_5: 4: 0x61270bc: 4
+dlo3: dl04_unresolv_6: 4: 0x61270d8: dl-O4
+dlo3: dl05_unresolv_1: 8: 0x8127d20: 0
+dlo3: dl05_unresolv_2: 2: 0x8127d28: 0
+dlo3: dl05_unresolv_3: 4: 0x8127d2c: 0
+dlo3: dl05_unresolv_4: 1: 0x8127d30: 0
+dlo3: dl05_unresolv_5: 8: 0x8127d38: 0
+dlo4: module: testsuites/libtests/dl09/dl-o4.c
+dlo4: dl04_unresolv_1: 4: 0x61270e8: 0
+dlo4: dl04_unresolv_2: 4: 0x61270ec: %f
+dlo4: dl04_unresolv_3: 1: 0x61270f0: 00
+dlo4: dl04_unresolv_4: 4: 0x61270f4: 0
+dlo4: dl04_unresolv_5: 4: 0x61270bc: 4
+dlo4: dl04_unresolv_6: 4: 0x61270d8: dl-O4
+dlo5: module: testsuites/libtests/dl09/dl-o5.c
+dlo5: dl05_unresolv_1: 8: 0x8127d20: 0
+dlo5: dl05_unresolv_2: 2: 0x8127d28: 0
+dlo5: dl05_unresolv_3: 4: 0x8127d2c: 0
+dlo5: dl05_unresolv_4: 1: 0x8127d30: 0
+dlo5: dl05_unresolv_5: 8: 0x8127d38: 0
+handle: 0x123510 closing
+space dealloc: 0x124d10
+handle: 0x124390 closing
+space dealloc: 0x2125978
+handle: 0x4125980 closing
+space dealloc: 0x41267f0
+handle: 0x41266b0 closing
+space dealloc: 0x6127528
+handle: 0x8127530 closing
+space dealloc: 0
+--------------------------------------------------
+ Run: 1
+Test source (link in strstr): testsuites/libtests/dl09/dl-load.c
+load: /dl09-o1.o
+handel: 0x123510: unresolved externals
+handle: 0x123510 loaded
+space alloc: /dl09-o1.o: 33554432: 0x124d10
+load: /dl09-o2.o
+handel: 0x124390: unresolved externals
+handle: 0x124390 loaded
+space alloc: /dl09-o2.o: 33554432: 0x2125978
+load: /dl09-o3.o
+handel: 0x4125980: unresolved externals
+handle: 0x4125980 loaded
+space alloc: /dl09-o3.o: 33554432: 0x41267f0
+load: /dl09-o4.o
+handel: 0x41266b0: unresolved externals
+handle: 0x41266b0 loaded
+space alloc: /dl09-o4.o: 33554432: 0x6127528
+load: /dl09-o5.o
+handel: 0x8127530: no unresolved externals
+handle: 0x8127530 loaded
+handel: 0x8127530: no unresolved externals
+Running rtems_main_o1:
+dlo1: module: testsuites/libtests/dl09/dl-o1.c
+dlo1: dl01_bss1: 4: 0x124088: 0
+dlo1: dl01_bss2: 4: 0x12408c: %f
+dlo1: dl01_bss3: 1: 0x124104: 00
+dlo1: dl01_data1: 4: 0x124070: 1
+dlo1: dl01_data2: 4: 0x124074: %f
+dlo1: dl01_const1: 4: 0x124050: 3
+dlo1: dl01_const2: 4: 0x124054: %f
+dlo1: dl01_func1: 1: 0x123cf9
+dlo2: module: testsuites/libtests/dl09/dl-o2.c
+dlo2: dl02_bss1: 4: 0x2125468: 0
+dlo2: dl02_bss2: 4: 0x212546c: %f
+dlo2: dl02_bss3: 1: 0x2125488: 00
+dlo2: dl02_data1: 4: 0x21254a0: 0
+dlo2: dl02_data2: 4: 0x21254a4: %f
+dlo3: module: testsuites/libtests/dl09/dl-o3.c
+dlo3: dl04_unresolv_1: 4: 0x61270e8: 0
+dlo3: dl04_unresolv_2: 4: 0x61270ec: %f
+dlo3: dl04_unresolv_3: 1: 0x61270f0: 00
+dlo3: dl04_unresolv_4: 4: 0x61270f4: 0
+dlo3: dl04_unresolv_5: 4: 0x61270bc: 4
+dlo3: dl04_unresolv_6: 4: 0x61270d8: dl-O4
+dlo3: dl05_unresolv_1: 8: 0x8127d20: 0
+dlo3: dl05_unresolv_2: 2: 0x8127d28: 0
+dlo3: dl05_unresolv_3: 4: 0x8127d2c: 0
+dlo3: dl05_unresolv_4: 1: 0x8127d30: 0
+dlo3: dl05_unresolv_5: 8: 0x8127d38: 0
+dlo4: module: testsuites/libtests/dl09/dl-o4.c
+dlo4: dl04_unresolv_1: 4: 0x61270e8: 0
+dlo4: dl04_unresolv_2: 4: 0x61270ec: %f
+dlo4: dl04_unresolv_3: 1: 0x61270f0: 00
+dlo4: dl04_unresolv_4: 4: 0x61270f4: 0
+dlo4: dl04_unresolv_5: 4: 0x61270bc: 4
+dlo4: dl04_unresolv_6: 4: 0x61270d8: dl-O4
+dlo5: module: testsuites/libtests/dl09/dl-o5.c
+dlo5: dl05_unresolv_1: 8: 0x8127d20: 0
+dlo5: dl05_unresolv_2: 2: 0x8127d28: 0
+dlo5: dl05_unresolv_3: 4: 0x8127d2c: 0
+dlo5: dl05_unresolv_4: 1: 0x8127d30: 0
+dlo5: dl05_unresolv_5: 8: 0x8127d38: 0
+handle: 0x123510 closing
+space dealloc: 0x124d10
+handle: 0x124390 closing
+space dealloc: 0x2125978
+handle: 0x4125980 closing
+space dealloc: 0x41267f0
+handle: 0x41266b0 closing
+space dealloc: 0x6127528
+handle: 0x8127530 closing
+space dealloc: 0
+--------------------------------------------------
+ Run: 2
+Test source (link in strstr): testsuites/libtests/dl09/dl-load.c
+load: /dl09-o1.o
+handel: 0x123510: unresolved externals
+handle: 0x123510 loaded
+space alloc: /dl09-o1.o: 33554432: 0x124d10
+load: /dl09-o2.o
+handel: 0x124390: unresolved externals
+handle: 0x124390 loaded
+space alloc: /dl09-o2.o: 33554432: 0x2125978
+load: /dl09-o3.o
+handel: 0x4125980: unresolved externals
+handle: 0x4125980 loaded
+space alloc: /dl09-o3.o: 33554432: 0x41267f0
+load: /dl09-o4.o
+handel: 0x41266b0: unresolved externals
+handle: 0x41266b0 loaded
+space alloc: /dl09-o4.o: 33554432: 0x6127528
+load: /dl09-o5.o
+handel: 0x8127530: no unresolved externals
+handle: 0x8127530 loaded
+handel: 0x8127530: no unresolved externals
+Running rtems_main_o1:
+dlo1: module: testsuites/libtests/dl09/dl-o1.c
+dlo1: dl01_bss1: 4: 0x124088: 0
+dlo1: dl01_bss2: 4: 0x12408c: %f
+dlo1: dl01_bss3: 1: 0x124104: 00
+dlo1: dl01_data1: 4: 0x124070: 1
+dlo1: dl01_data2: 4: 0x124074: %f
+dlo1: dl01_const1: 4: 0x124050: 3
+dlo1: dl01_const2: 4: 0x124054: %f
+dlo1: dl01_func1: 1: 0x123cf9
+dlo2: module: testsuites/libtests/dl09/dl-o2.c
+dlo2: dl02_bss1: 4: 0x2125468: 0
+dlo2: dl02_bss2: 4: 0x212546c: %f
+dlo2: dl02_bss3: 1: 0x2125488: 00
+dlo2: dl02_data1: 4: 0x21254a0: 0
+dlo2: dl02_data2: 4: 0x21254a4: %f
+dlo3: module: testsuites/libtests/dl09/dl-o3.c
+dlo3: dl04_unresolv_1: 4: 0x61270e8: 0
+dlo3: dl04_unresolv_2: 4: 0x61270ec: %f
+dlo3: dl04_unresolv_3: 1: 0x61270f0: 00
+dlo3: dl04_unresolv_4: 4: 0x61270f4: 0
+dlo3: dl04_unresolv_5: 4: 0x61270bc: 4
+dlo3: dl04_unresolv_6: 4: 0x61270d8: dl-O4
+dlo3: dl05_unresolv_1: 8: 0x8127d20: 0
+dlo3: dl05_unresolv_2: 2: 0x8127d28: 0
+dlo3: dl05_unresolv_3: 4: 0x8127d2c: 0
+dlo3: dl05_unresolv_4: 1: 0x8127d30: 0
+dlo3: dl05_unresolv_5: 8: 0x8127d38: 0
+dlo4: module: testsuites/libtests/dl09/dl-o4.c
+dlo4: dl04_unresolv_1: 4: 0x61270e8: 0
+dlo4: dl04_unresolv_2: 4: 0x61270ec: %f
+dlo4: dl04_unresolv_3: 1: 0x61270f0: 00
+dlo4: dl04_unresolv_4: 4: 0x61270f4: 0
+dlo4: dl04_unresolv_5: 4: 0x61270bc: 4
+dlo4: dl04_unresolv_6: 4: 0x61270d8: dl-O4
+dlo5: module: testsuites/libtests/dl09/dl-o5.c
+dlo5: dl05_unresolv_1: 8: 0x8127d20: 0
+dlo5: dl05_unresolv_2: 2: 0x8127d28: 0
+dlo5: dl05_unresolv_3: 4: 0x8127d2c: 0
+dlo5: dl05_unresolv_4: 1: 0x8127d30: 0
+dlo5: dl05_unresolv_5: 8: 0x8127d38: 0
+handle: 0x123510 closing
+space dealloc: 0x124d10
+handle: 0x124390 closing
+space dealloc: 0x2125978
+handle: 0x4125980 closing
+space dealloc: 0x41267f0
+handle: 0x41266b0 closing
+space dealloc: 0x6127528
+handle: 0x8127530 closing
+space dealloc: 0
+--------------------------------------------------
+ Run: 3
+Test source (link in strstr): testsuites/libtests/dl09/dl-load.c
+load: /dl09-o1.o
+handel: 0x123510: unresolved externals
+handle: 0x123510 loaded
+space alloc: /dl09-o1.o: 33554432: 0x124d10
+load: /dl09-o2.o
+handel: 0x124390: unresolved externals
+handle: 0x124390 loaded
+space alloc: /dl09-o2.o: 33554432: 0x2125978
+load: /dl09-o3.o
+handel: 0x4125980: unresolved externals
+handle: 0x4125980 loaded
+space alloc: /dl09-o3.o: 33554432: 0x41267f0
+load: /dl09-o4.o
+handel: 0x41266b0: unresolved externals
+handle: 0x41266b0 loaded
+space alloc: /dl09-o4.o: 33554432: 0x6127528
+load: /dl09-o5.o
+handel: 0x8127530: no unresolved externals
+handle: 0x8127530 loaded
+handel: 0x8127530: no unresolved externals
+Running rtems_main_o1:
+dlo1: module: testsuites/libtests/dl09/dl-o1.c
+dlo1: dl01_bss1: 4: 0x124088: 0
+dlo1: dl01_bss2: 4: 0x12408c: %f
+dlo1: dl01_bss3: 1: 0x124104: 00
+dlo1: dl01_data1: 4: 0x124070: 1
+dlo1: dl01_data2: 4: 0x124074: %f
+dlo1: dl01_const1: 4: 0x124050: 3
+dlo1: dl01_const2: 4: 0x124054: %f
+dlo1: dl01_func1: 1: 0x123cf9
+dlo2: module: testsuites/libtests/dl09/dl-o2.c
+dlo2: dl02_bss1: 4: 0x2125468: 0
+dlo2: dl02_bss2: 4: 0x212546c: %f
+dlo2: dl02_bss3: 1: 0x2125488: 00
+dlo2: dl02_data1: 4: 0x21254a0: 0
+dlo2: dl02_data2: 4: 0x21254a4: %f
+dlo3: module: testsuites/libtests/dl09/dl-o3.c
+dlo3: dl04_unresolv_1: 4: 0x61270e8: 0
+dlo3: dl04_unresolv_2: 4: 0x61270ec: %f
+dlo3: dl04_unresolv_3: 1: 0x61270f0: 00
+dlo3: dl04_unresolv_4: 4: 0x61270f4: 0
+dlo3: dl04_unresolv_5: 4: 0x61270bc: 4
+dlo3: dl04_unresolv_6: 4: 0x61270d8: dl-O4
+dlo3: dl05_unresolv_1: 8: 0x8127d20: 0
+dlo3: dl05_unresolv_2: 2: 0x8127d28: 0
+dlo3: dl05_unresolv_3: 4: 0x8127d2c: 0
+dlo3: dl05_unresolv_4: 1: 0x8127d30: 0
+dlo3: dl05_unresolv_5: 8: 0x8127d38: 0
+dlo4: module: testsuites/libtests/dl09/dl-o4.c
+dlo4: dl04_unresolv_1: 4: 0x61270e8: 0
+dlo4: dl04_unresolv_2: 4: 0x61270ec: %f
+dlo4: dl04_unresolv_3: 1: 0x61270f0: 00
+dlo4: dl04_unresolv_4: 4: 0x61270f4: 0
+dlo4: dl04_unresolv_5: 4: 0x61270bc: 4
+dlo4: dl04_unresolv_6: 4: 0x61270d8: dl-O4
+dlo5: module: testsuites/libtests/dl09/dl-o5.c
+dlo5: dl05_unresolv_1: 8: 0x8127d20: 0
+dlo5: dl05_unresolv_2: 2: 0x8127d28: 0
+dlo5: dl05_unresolv_3: 4: 0x8127d2c: 0
+dlo5: dl05_unresolv_4: 1: 0x8127d30: 0
+dlo5: dl05_unresolv_5: 8: 0x8127d38: 0
+handle: 0x123510 closing
+space dealloc: 0x124d10
+handle: 0x124390 closing
+space dealloc: 0x2125978
+handle: 0x4125980 closing
+space dealloc: 0x41267f0
+handle: 0x41266b0 closing
+space dealloc: 0x6127528
+handle: 0x8127530 closing
+space dealloc: 0
+--------------------------------------------------
+
+ REPEAT 100 TIMES
+
+--------------------------------------------------
+ Run: 99
+Test source (link in strstr): testsuites/libtests/dl09/dl-load.c
+load: /dl09-o1.o
+handel: 0x123510: unresolved externals
+handle: 0x123510 loaded
+space alloc: /dl09-o1.o: 33554432: 0x124d10
+load: /dl09-o2.o
+handel: 0x124390: unresolved externals
+handle: 0x124390 loaded
+space alloc: /dl09-o2.o: 33554432: 0x2125978
+load: /dl09-o3.o
+handel: 0x4125980: unresolved externals
+handle: 0x4125980 loaded
+space alloc: /dl09-o3.o: 33554432: 0x41267f0
+load: /dl09-o4.o
+handel: 0x41266b0: unresolved externals
+handle: 0x41266b0 loaded
+space alloc: /dl09-o4.o: 33554432: 0x6127528
+load: /dl09-o5.o
+handel: 0x8127530: no unresolved externals
+handle: 0x8127530 loaded
+handel: 0x8127530: no unresolved externals
+Running rtems_main_o1:
+dlo1: module: testsuites/libtests/dl09/dl-o1.c
+dlo1: dl01_bss1: 4: 0x124088: 0
+dlo1: dl01_bss2: 4: 0x12408c: %f
+dlo1: dl01_bss3: 1: 0x124104: 00
+dlo1: dl01_data1: 4: 0x124070: 1
+dlo1: dl01_data2: 4: 0x124074: %f
+dlo1: dl01_const1: 4: 0x124050: 3
+dlo1: dl01_const2: 4: 0x124054: %f
+dlo1: dl01_func1: 1: 0x123cf9
+dlo2: module: testsuites/libtests/dl09/dl-o2.c
+dlo2: dl02_bss1: 4: 0x2125468: 0
+dlo2: dl02_bss2: 4: 0x212546c: %f
+dlo2: dl02_bss3: 1: 0x2125488: 00
+dlo2: dl02_data1: 4: 0x21254a0: 0
+dlo2: dl02_data2: 4: 0x21254a4: %f
+dlo3: module: testsuites/libtests/dl09/dl-o3.c
+dlo3: dl04_unresolv_1: 4: 0x61270e8: 0
+dlo3: dl04_unresolv_2: 4: 0x61270ec: %f
+dlo3: dl04_unresolv_3: 1: 0x61270f0: 00
+dlo3: dl04_unresolv_4: 4: 0x61270f4: 0
+dlo3: dl04_unresolv_5: 4: 0x61270bc: 4
+dlo3: dl04_unresolv_6: 4: 0x61270d8: dl-O4
+dlo3: dl05_unresolv_1: 8: 0x8127d20: 0
+dlo3: dl05_unresolv_2: 2: 0x8127d28: 0
+dlo3: dl05_unresolv_3: 4: 0x8127d2c: 0
+dlo3: dl05_unresolv_4: 1: 0x8127d30: 0
+dlo3: dl05_unresolv_5: 8: 0x8127d38: 0
+dlo4: module: testsuites/libtests/dl09/dl-o4.c
+dlo4: dl04_unresolv_1: 4: 0x61270e8: 0
+dlo4: dl04_unresolv_2: 4: 0x61270ec: %f
+dlo4: dl04_unresolv_3: 1: 0x61270f0: 00
+dlo4: dl04_unresolv_4: 4: 0x61270f4: 0
+dlo4: dl04_unresolv_5: 4: 0x61270bc: 4
+dlo4: dl04_unresolv_6: 4: 0x61270d8: dl-O4
+dlo5: module: testsuites/libtests/dl09/dl-o5.c
+dlo5: dl05_unresolv_1: 8: 0x8127d20: 0
+dlo5: dl05_unresolv_2: 2: 0x8127d28: 0
+dlo5: dl05_unresolv_3: 4: 0x8127d2c: 0
+dlo5: dl05_unresolv_4: 1: 0x8127d30: 0
+dlo5: dl05_unresolv_5: 8: 0x8127d38: 0
+handle: 0x123510 closing
+space dealloc: 0x124d10
+handle: 0x124390 closing
+space dealloc: 0x2125978
+handle: 0x4125980 closing
+space dealloc: 0x41267f0
+handle: 0x41266b0 closing
+space dealloc: 0x6127528
+handle: 0x8127530 closing
+space dealloc: 0
+
+*** END OF TEST libdl (RTL) 9 ***
+
+
+*** FATAL ***
+fatal source: 5 (RTEMS_FATAL_SOURCE_EXIT)
+fatal code: 0 (0x00000000)
+RTEMS version: 5.0.0.ab08681fe52cad071f3a8d554af28c8bfc53b28f-modified
+RTEMS tools: 7.4.0 20181206 (RTEMS 5, RSB 257c9267cfce362138a265764c6a799c12c6b181, Newlib dc6e94551f09d3a983afd571478d63a09d6f66fa)
+executing thread ID: 0x08a010001
+executing thread name: UI1
diff --git a/testsuites/libtests/dl09/init.c b/testsuites/libtests/dl09/init.c
new file mode 100644
index 0000000000..dbcc7ba84c
--- /dev/null
+++ b/testsuites/libtests/dl09/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) 9";
+
+/* forward declarations to avoid warnings */
+static rtems_task Init(rtems_task_argument argument);
+
+#include "dl09-tar.h"
+
+#define TARFILE_START dl09_tar
+#define TARFILE_SIZE dl09_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>