[rtems commit] libtest/dl08: Add a test for archives.

Chris Johns chrisj at rtems.org
Fri Feb 8 23:07:58 UTC 2019


Module:    rtems
Branch:    master
Commit:    a7c6176293b93fdf30abd96f2ae0b12c26b8f982
Changeset: http://git.rtems.org/rtems/commit/?id=a7c6176293b93fdf30abd96f2ae0b12c26b8f982

Author:    Chris Johns <chrisj at rtems.org>
Date:      Mon Dec 17 17:48:30 2018 +1100

libtest/dl08: Add a test for archives.

- Create 2 archives.
- Load 1 object file which loads 6 object files from the libraries.

Updates #3686

---

 cpukit/headers.am                                  |   1 +
 testsuites/libtests/Makefile.am                    |  55 ++++-
 testsuites/libtests/configure.ac                   |   1 +
 testsuites/libtests/dl08/dl-load.c                 | 136 ++++++++++
 testsuites/libtests/dl08/dl-load.h                 |  21 ++
 testsuites/libtests/dl08/dl-o1.c                   |  61 +++++
 testsuites/libtests/dl08/dl-o1.h                   |  23 ++
 testsuites/libtests/dl08/dl-o2.c                   |  39 +++
 testsuites/libtests/dl08/dl-o2.h                   |  25 ++
 testsuites/libtests/dl08/dl-o3.c                   |  40 +++
 testsuites/libtests/dl08/dl-o3.h                   |  15 ++
 testsuites/libtests/dl08/dl-o4.c                   |  40 +++
 testsuites/libtests/dl08/dl-o4.h                   |  29 +++
 testsuites/libtests/dl08/dl-o5.c                   |  39 +++
 testsuites/libtests/dl08/dl-o5.h                   |  30 +++
 .../libtests/dl08/dl-o6-123456789-123456789.c      |  50 ++++
 testsuites/libtests/dl08/dl-o6.h                   |  17 ++
 testsuites/libtests/dl08/dl08.doc                  |  27 ++
 testsuites/libtests/dl08/dl08.scn                  | 273 +++++++++++++++++++++
 testsuites/libtests/dl08/init.c                    |  90 +++++++
 20 files changed, 1011 insertions(+), 1 deletion(-)

diff --git a/cpukit/headers.am b/cpukit/headers.am
index fba976e..d81cd01 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -295,6 +295,7 @@ include_rtems_rtl_HEADERS += include/rtems/rtl/rtl-obj-cache.h
 include_rtems_rtl_HEADERS += include/rtems/rtl/rtl-obj-comp.h
 include_rtems_rtl_HEADERS += include/rtems/rtl/rtl-obj-fwd.h
 include_rtems_rtl_HEADERS += include/rtems/rtl/rtl-obj.h
+include_rtems_rtl_HEADERS += include/rtems/rtl/rtl-shell.h
 include_rtems_rtl_HEADERS += include/rtems/rtl/rtl-sym.h
 include_rtems_rtl_HEADERS += include/rtems/rtl/rtl-trace.h
 include_rtems_rtl_HEADERS += include/rtems/rtl/rtl-unresolved.h
diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am
index dfeea3a..a5801d3 100644
--- a/testsuites/libtests/Makefile.am
+++ b/testsuites/libtests/Makefile.am
@@ -548,7 +548,60 @@ dl07-sym.o: dl07.pre
 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
+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 DLTESTS
+if TEST_dl08
+lib_tests += dl08
+lib_screens += dl08/dl08.scn
+lib_docs += dl08/dl08.doc
+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
+	$(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 $@ $<
+dl08-o2.o: dl08/dl-o2.c Makefile
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl08-o3.o: dl08/dl-o3.c Makefile
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl08-o4.o: dl08/dl-o4.c Makefile
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl08-o5.o: dl08/dl-o5.c Makefile
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl08-o6-123456789-123456789.o: dl08/dl-o6-123456789-123456789.c Makefile
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
+#	echo "#" > etc/rtl-libs.conf
+#	echo "  # blah blah" >> etc/rtl-libs.conf
+etc/rtl-libs.conf:
+	mkdir etc; \
+	echo "/libdl08*.a" >> etc/rtl-libs.conf
+noinst_LIBRARIES = libdl08_1.a libdl08_2.a
+libdl08_1_a_SOURCES = dl08-o2.c dl08-o4.c
+libdl08_2_a_SOURCES = dl08-o3.c dl08-o5.c \
+			dl08-o6-123456789-123456789.c
+dl08.tar: etc/rtl-libs.conf dl08-o1.o libdl08_1.a libdl08_2.a
+	@rm -f $@
+	$(AM_V_GEN)$(PAX) -w -f $@ $+
+dl08-tar.c: dl08.tar
+	$(AM_V_GEN)$(BIN2C) -C $< $@
+dl08-tar.h: dl08.tar
+	$(AM_V_GEN)$(BIN2C) -H $< $@
+dl08-tar.o: dl08-tar.c dl08-tar.h
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl08-sym.o: dl08.pre
+	$(AM_V_GEN)rtems-syms -e -c "$(CFLAGS)" -o $@ $<
+dl08$(EXEEXT):  $(dl08_OBJECTS) $(dl08_DEPENDENCIES) dl08-sym.o
+	@rm -f $@
+	$(AM_V_CCLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+CLEANFILES += dl08.pre dl08-sym.o libdl08_1.a libdl08_2.a dl08-o1.o dl08-o2.o \
+		dl08-o3.o dl08-o4.o dl08-o5.o dl08-o6-123456789-123456789.o \
+		dl08.tar dl08-tar.h etc/rtl-libs.conf
 endif
 endif
 
diff --git a/testsuites/libtests/configure.ac b/testsuites/libtests/configure.ac
index c76fb79..b32d06e 100644
--- a/testsuites/libtests/configure.ac
+++ b/testsuites/libtests/configure.ac
@@ -132,6 +132,7 @@ RTEMS_TEST_CHECK([dl04])
 RTEMS_TEST_CHECK([dl05])
 RTEMS_TEST_CHECK([dl06])
 RTEMS_TEST_CHECK([dl07])
+RTEMS_TEST_CHECK([dl08])
 RTEMS_TEST_CHECK([dumpbuf01])
 RTEMS_TEST_CHECK([dup2])
 RTEMS_TEST_CHECK([exit01])
diff --git a/testsuites/libtests/dl08/dl-load.c b/testsuites/libtests/dl08/dl-load.c
new file mode 100644
index 0000000..3fd3597
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-load.c
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2014 Chris Johns <chrisj at 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 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
+
+#include <dlfcn.h>
+
+#include "dl-load.h"
+
+#include <tmacros.h>
+
+#include <rtems/rtl/rtl-shell.h>
+#include <rtems/rtl/rtl-trace.h>
+
+typedef int (*call_sig)(void);
+
+static void dl_load_dump (void)
+{
+#if DL08_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);
+    }
+  }
+  printf ("handel: %p: no unresolved externals\n", handle);
+}
+
+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;
+
+  printf ("Test source (link in strstr): %s\n", dl_localise_file (__FILE__));
+
+#if DL08_DEBUG_TRACE
+  rtems_rtl_trace_set_mask (DL08_DEBUG_TRACE);
+#endif
+
+  o1 = dl_load_obj("/dl08-o1.o", false);
+  if (!o1)
+    return 1;
+
+  dl_check_resolved (o1, false);
+
+  dl_load_dump ();
+
+  printf ("\n\n\nRunning rtems_main_o1:\n\n");
+  if (dl_call (o1, "rtems_main_o1"))
+    return 1;
+
+  dl_close (o1);
+
+  return 0;
+}
diff --git a/testsuites/libtests/dl08/dl-load.h b/testsuites/libtests/dl08/dl-load.h
new file mode 100644
index 0000000..7287291
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-load.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2014, 2018 Chris Johns <chrisj at 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/dl08/dl-o1.c b/testsuites/libtests/dl08/dl-o1.c
new file mode 100644
index 0000000..22b839a
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-o1.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj at 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/dl08/dl-o1.h b/testsuites/libtests/dl08/dl-o1.h
new file mode 100644
index 0000000..f6a10f1
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-o1.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj at 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/dl08/dl-o2.c b/testsuites/libtests/dl08/dl-o2.c
new file mode 100644
index 0000000..907fe9a
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-o2.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014 Chris Johns <chrisj at 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/dl08/dl-o2.h b/testsuites/libtests/dl08/dl-o2.h
new file mode 100644
index 0000000..d6c1820
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-o2.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj at 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/dl08/dl-o3.c b/testsuites/libtests/dl08/dl-o3.c
new file mode 100644
index 0000000..4333f34
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-o3.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014 Chris Johns <chrisj at 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/dl08/dl-o3.h b/testsuites/libtests/dl08/dl-o3.h
new file mode 100644
index 0000000..8c5d18d
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-o3.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj at 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/dl08/dl-o4.c b/testsuites/libtests/dl08/dl-o4.c
new file mode 100644
index 0000000..60ada7a
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-o4.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014 Chris Johns <chrisj at 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/dl08/dl-o4.h b/testsuites/libtests/dl08/dl-o4.h
new file mode 100644
index 0000000..bab9fc1
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-o4.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj at 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/dl08/dl-o5.c b/testsuites/libtests/dl08/dl-o5.c
new file mode 100644
index 0000000..28bee5a
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-o5.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014 Chris Johns <chrisj at 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 "dl-o6.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));
+
+  rtems_main_o6 ();
+
+  return 0;
+}
diff --git a/testsuites/libtests/dl08/dl-o5.h b/testsuites/libtests/dl08/dl-o5.h
new file mode 100644
index 0000000..bb4ce46
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-o5.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj at 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/dl08/dl-o6-123456789-123456789.c b/testsuites/libtests/dl08/dl-o6-123456789-123456789.c
new file mode 100644
index 0000000..d308b85
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-o6-123456789-123456789.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014 Chris Johns <chrisj at 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-o6.h"
+
+#include <inttypes.h>
+#include <rtems/test.h>
+
+#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
+
+uint64_t dl06_unresolv_1;
+uint16_t dl06_unresolv_2;
+uint32_t dl06_unresolv_3;
+uint8_t  dl06_unresolv_4;
+int64_t  dl06_unresolv_5;
+
+#define DL_NAME       "dlo6"
+#define PAINT_VAR(_v) sizeof(_v), &_v, _v
+
+void dl06_constructor (void) __attribute__ ((constructor));
+void dl06_destructor (void) __attribute__ ((destructor));
+
+void dl06_constructor (void)
+{
+  printf (DL_NAME ": CONSTRUCTOR: %s\n", dl_localise_file (__FILE__));
+  printf (DL_NAME ":   dl06_unresolv_1: %4u: %p: %" PRIu64 "\n", PAINT_VAR (dl06_unresolv_1));
+  printf (DL_NAME ":   dl06_unresolv_2: %4u: %p: %" PRIu16 "\n", PAINT_VAR (dl06_unresolv_2));
+  printf (DL_NAME ":   dl06_unresolv_3: %4u: %p: %" PRIu32 "\n", PAINT_VAR (dl06_unresolv_3));
+  printf (DL_NAME ":   dl06_unresolv_4: %4u: %p: %" PRIu8  "\n", PAINT_VAR (dl06_unresolv_4));
+  printf (DL_NAME ":   dl06_unresolv_5: %4u: %p: %" PRIi64 "\n", PAINT_VAR (dl06_unresolv_5));
+}
+
+void dl06_destructor (void)
+{
+  printf (DL_NAME ": DESTRUCTOR: %s\n", dl_localise_file (__FILE__));
+}
+
+int rtems_main_o6 (void)
+{
+  printf (DL_NAME ": module: %s\n", dl_localise_file (__FILE__));
+  printf (DL_NAME ":  long file name to test extended name loading\n");
+
+  return 0;
+}
diff --git a/testsuites/libtests/dl08/dl-o6.h b/testsuites/libtests/dl08/dl-o6.h
new file mode 100644
index 0000000..0dde928
--- /dev/null
+++ b/testsuites/libtests/dl08/dl-o6.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj at 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(DL06_H)
+#define DL06_H
+
+int rtems_main_o6 (void);
+
+#endif
diff --git a/testsuites/libtests/dl08/dl08.doc b/testsuites/libtests/dl08/dl08.doc
new file mode 100644
index 0000000..29819bb
--- /dev/null
+++ b/testsuites/libtests/dl08/dl08.doc
@@ -0,0 +1,27 @@
+# Copyright (c) 2018 Chris Johns <chrisj at 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: dl08
+
+directives:
+
+  dlopen
+  dlinfo
+  dlsym
+  dlclose
+
+concepts:
+
++ Provide an archive config file. Parse and load the archive symbol table.
++ Load 1 ELF object file which loads 5 object files from 2 archives.
++ Check there are no unreolved externals.
++ Locate the main symbol in the lodaed object file and call. This will call
+  each loaded object file.
++ Unload the ELF file which unloads the orphaned object files.
++ Repeat 100 times.
diff --git a/testsuites/libtests/dl08/dl08.scn b/testsuites/libtests/dl08/dl08.scn
new file mode 100644
index 0000000..b273428
--- /dev/null
+++ b/testsuites/libtests/dl08/dl08.scn
@@ -0,0 +1,273 @@
+*** BEGIN OF TEST libdl (RTL) 8 ***
+*** TEST VERSION: 5.0.0.e6835265a37d465b9100d7d4d234fece18e4626c-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
+Test source (link in strstr): testsuites/libtests/dl08/dl-load.c
+load: /dl08-o1.o
+handel: 0x2077328: no unresolved externals
+handle: 0x2077328 loaded
+handel: 0x2077328: no unresolved externals
+Running rtems_main_o1:
+dlo1: module: testsuites/libtests/dl08/dl-o1.c
+dlo1:         dl01_bss1:    4: 0x2077d70: 0
+dlo1:         dl01_bss2:    4: 0x2077d74: %f
+dlo1:         dl01_bss3:    1: 0x2077df0: 00
+dlo1:        dl01_data1:    4: 0x2077d5c: 1
+dlo1:        dl01_data2:    4: 0x2077d58: %f
+dlo1:       dl01_const1:    4: 0x2077d38: 3
+dlo1:       dl01_const2:    4: 0x2077d34: %f
+dlo1:        dl01_func1:    1: 0x2077a20
+dlo2: module: testsuites/libtests/dl08/dl-o2.c
+dlo2:         dl02_bss1:    4: 0x2078f30: 0
+dlo2:         dl02_bss2:    4: 0x2078f34: %f
+dlo2:         dl02_bss3:    1: 0x2078f50: 00
+dlo2:        dl02_data1:    4: 0x2078f68: 0
+dlo2:        dl02_data2:    4: 0x2078f6c: %f
+dlo3: module: testsuites/libtests/dl08/dl-o3.c
+dlo3:   dl04_unresolv_1:    4: 0x207a5a8: 0
+dlo3:   dl04_unresolv_2:    4: 0x207a5ac: %f
+dlo3:   dl04_unresolv_3:    1: 0x207a5b0: 00
+dlo3:   dl04_unresolv_4:    4: 0x207a5b4: 0
+dlo3:   dl04_unresolv_5:    4: 0x207a578: 4
+dlo3:   dl04_unresolv_6:    4: 0x207a598: dl-O4
+dlo3:   dl05_unresolv_1:    8: 0x207af78: 0
+dlo3:   dl05_unresolv_2:    2: 0x207af80: 0
+dlo3:   dl05_unresolv_3:    4: 0x207af84: 0
+dlo3:   dl05_unresolv_4:    1: 0x207af88: 0
+dlo3:   dl05_unresolv_5:    8: 0x207af90: 0
+dlo4: module: testsuites/libtests/dl08/dl-o4.c
+dlo4:   dl04_unresolv_1:    4: 0x207a5a8: 0
+dlo4:   dl04_unresolv_2:    4: 0x207a5ac: %f
+dlo4:   dl04_unresolv_3:    1: 0x207a5b0: 00
+dlo4:   dl04_unresolv_4:    4: 0x207a5b4: 0
+dlo4:   dl04_unresolv_5:    4: 0x207a578: 4
+dlo4:   dl04_unresolv_6:    4: 0x207a598: dl-O4
+dlo5: module: testsuites/libtests/dl08/dl-o5.c
+dlo5:   dl05_unresolv_1:    8: 0x207af78: 0
+dlo5:   dl05_unresolv_2:    2: 0x207af80: 0
+dlo5:   dl05_unresolv_3:    4: 0x207af84: 0
+dlo5:   dl05_unresolv_4:    1: 0x207af88: 0
+dlo5:   dl05_unresolv_5:    8: 0x207af90: 0
+dlo5: module: testsuites/libtests/dl08/dl-o6-123456789-123456789.c
+dlo5:  long file name to test extended name loading
+handle: 0x2077328 closing
+--------------------------------------------------
+ Run: 1
+Test source (link in strstr): testsuites/libtests/dl08/dl-load.c
+load: /dl08-o1.o
+handel: 0x207a630: no unresolved externals
+handle: 0x207a630 loaded
+handel: 0x207a630: no unresolved externals
+Running rtems_main_o1:
+dlo1: module: testsuites/libtests/dl08/dl-o1.c
+dlo1:         dl01_bss1:    4: 0x2077b30: 0
+dlo1:         dl01_bss2:    4: 0x2077b34: %f
+dlo1:         dl01_bss3:    1: 0x2077bb0: 00
+dlo1:        dl01_data1:    4: 0x2077b1c: 1
+dlo1:        dl01_data2:    4: 0x2077b18: %f
+dlo1:       dl01_const1:    4: 0x2077af8: 3
+dlo1:       dl01_const2:    4: 0x2077af4: %f
+dlo1:        dl01_func1:    1: 0x20777e0
+dlo2: module: testsuites/libtests/dl08/dl-o2.c
+dlo2:         dl02_bss1:    4: 0x2078cf0: 0
+dlo2:         dl02_bss2:    4: 0x2078cf4: %f
+dlo2:         dl02_bss3:    1: 0x2078d10: 00
+dlo2:        dl02_data1:    4: 0x2078d28: 0
+dlo2:        dl02_data2:    4: 0x2078d2c: %f
+dlo3: module: testsuites/libtests/dl08/dl-o3.c
+dlo3:   dl04_unresolv_1:    4: 0x207a3c0: 0
+dlo3:   dl04_unresolv_2:    4: 0x207a3c4: %f
+dlo3:   dl04_unresolv_3:    1: 0x207a3c8: 00
+dlo3:   dl04_unresolv_4:    4: 0x207a3cc: 0
+dlo3:   dl04_unresolv_5:    4: 0x207a390: 4
+dlo3:   dl04_unresolv_6:    4: 0x207a3b0: dl-O4
+dlo3:   dl05_unresolv_1:    8: 0x207af78: 0
+dlo3:   dl05_unresolv_2:    2: 0x207af80: 0
+dlo3:   dl05_unresolv_3:    4: 0x207af84: 0
+dlo3:   dl05_unresolv_4:    1: 0x207af88: 0
+dlo3:   dl05_unresolv_5:    8: 0x207af90: 0
+dlo4: module: testsuites/libtests/dl08/dl-o4.c
+dlo4:   dl04_unresolv_1:    4: 0x207a3c0: 0
+dlo4:   dl04_unresolv_2:    4: 0x207a3c4: %f
+dlo4:   dl04_unresolv_3:    1: 0x207a3c8: 00
+dlo4:   dl04_unresolv_4:    4: 0x207a3cc: 0
+dlo4:   dl04_unresolv_5:    4: 0x207a390: 4
+dlo4:   dl04_unresolv_6:    4: 0x207a3b0: dl-O4
+dlo5: module: testsuites/libtests/dl08/dl-o5.c
+dlo5:   dl05_unresolv_1:    8: 0x207af78: 0
+dlo5:   dl05_unresolv_2:    2: 0x207af80: 0
+dlo5:   dl05_unresolv_3:    4: 0x207af84: 0
+dlo5:   dl05_unresolv_4:    1: 0x207af88: 0
+dlo5:   dl05_unresolv_5:    8: 0x207af90: 0
+dlo5: module: testsuites/libtests/dl08/dl-o6-123456789-123456789.c
+dlo5:  long file name to test extended name loading
+handle: 0x207a630 closing
+--------------------------------------------------
+ Run: 2
+Test source (link in strstr): testsuites/libtests/dl08/dl-load.c
+load: /dl08-o1.o
+handel: 0x207a648: no unresolved externals
+handle: 0x207a648 loaded
+handel: 0x207a648: no unresolved externals
+Running rtems_main_o1:
+dlo1: module: testsuites/libtests/dl08/dl-o1.c
+dlo1:         dl01_bss1:    4: 0x2077bb0: 0
+dlo1:         dl01_bss2:    4: 0x2077bb4: %f
+dlo1:         dl01_bss3:    1: 0x2077c30: 00
+dlo1:        dl01_data1:    4: 0x2077b9c: 1
+dlo1:        dl01_data2:    4: 0x2077b98: %f
+dlo1:       dl01_const1:    4: 0x2077b78: 3
+dlo1:       dl01_const2:    4: 0x2077b74: %f
+dlo1:        dl01_func1:    1: 0x2077860
+dlo2: module: testsuites/libtests/dl08/dl-o2.c
+dlo2:         dl02_bss1:    4: 0x2078d70: 0
+dlo2:         dl02_bss2:    4: 0x2078d74: %f
+dlo2:         dl02_bss3:    1: 0x2078d90: 00
+dlo2:        dl02_data1:    4: 0x2078da8: 0
+dlo2:        dl02_data2:    4: 0x2078dac: %f
+dlo3: module: testsuites/libtests/dl08/dl-o3.c
+dlo3:   dl04_unresolv_1:    4: 0x207a440: 0
+dlo3:   dl04_unresolv_2:    4: 0x207a444: %f
+dlo3:   dl04_unresolv_3:    1: 0x207a448: 00
+dlo3:   dl04_unresolv_4:    4: 0x207a44c: 0
+dlo3:   dl04_unresolv_5:    4: 0x207a410: 4
+dlo3:   dl04_unresolv_6:    4: 0x207a430: dl-O4
+dlo3:   dl05_unresolv_1:    8: 0x207af78: 0
+dlo3:   dl05_unresolv_2:    2: 0x207af80: 0
+dlo3:   dl05_unresolv_3:    4: 0x207af84: 0
+dlo3:   dl05_unresolv_4:    1: 0x207af88: 0
+dlo3:   dl05_unresolv_5:    8: 0x207af90: 0
+dlo4: module: testsuites/libtests/dl08/dl-o4.c
+dlo4:   dl04_unresolv_1:    4: 0x207a440: 0
+dlo4:   dl04_unresolv_2:    4: 0x207a444: %f
+dlo4:   dl04_unresolv_3:    1: 0x207a448: 00
+dlo4:   dl04_unresolv_4:    4: 0x207a44c: 0
+dlo4:   dl04_unresolv_5:    4: 0x207a410: 4
+dlo4:   dl04_unresolv_6:    4: 0x207a430: dl-O4
+dlo5: module: testsuites/libtests/dl08/dl-o5.c
+dlo5:   dl05_unresolv_1:    8: 0x207af78: 0
+dlo5:   dl05_unresolv_2:    2: 0x207af80: 0
+dlo5:   dl05_unresolv_3:    4: 0x207af84: 0
+dlo5:   dl05_unresolv_4:    1: 0x207af88: 0
+dlo5:   dl05_unresolv_5:    8: 0x207af90: 0
+dlo5: module: testsuites/libtests/dl08/dl-o6-123456789-123456789.c
+dlo5:  long file name to test extended name loading
+handle: 0x207a648 closing
+--------------------------------------------------
+ Run: 3
+Test source (link in strstr): testsuites/libtests/dl08/dl-load.c
+load: /dl08-o1.o
+handel: 0x207a648: no unresolved externals
+handle: 0x207a648 loaded
+handel: 0x207a648: no unresolved externals
+Running rtems_main_o1:
+dlo1: module: testsuites/libtests/dl08/dl-o1.c
+dlo1:         dl01_bss1:    4: 0x2077b60: 0
+dlo1:         dl01_bss2:    4: 0x2077b64: %f
+dlo1:         dl01_bss3:    1: 0x2077be0: 00
+dlo1:        dl01_data1:    4: 0x2077b4c: 1
+dlo1:        dl01_data2:    4: 0x2077b48: %f
+dlo1:       dl01_const1:    4: 0x2077b28: 3
+dlo1:       dl01_const2:    4: 0x2077b24: %f
+dlo1:        dl01_func1:    1: 0x2077810
+dlo2: module: testsuites/libtests/dl08/dl-o2.c
+dlo2:         dl02_bss1:    4: 0x2078d20: 0
+dlo2:         dl02_bss2:    4: 0x2078d24: %f
+dlo2:         dl02_bss3:    1: 0x2078d40: 00
+dlo2:        dl02_data1:    4: 0x2078d58: 0
+dlo2:        dl02_data2:    4: 0x2078d5c: %f
+dlo3: module: testsuites/libtests/dl08/dl-o3.c
+dlo3:   dl04_unresolv_1:    4: 0x207a3f0: 0
+dlo3:   dl04_unresolv_2:    4: 0x207a3f4: %f
+dlo3:   dl04_unresolv_3:    1: 0x207a3f8: 00
+dlo3:   dl04_unresolv_4:    4: 0x207a3fc: 0
+dlo3:   dl04_unresolv_5:    4: 0x207a3c0: 4
+dlo3:   dl04_unresolv_6:    4: 0x207a3e0: dl-O4
+dlo3:   dl05_unresolv_1:    8: 0x207af78: 0
+dlo3:   dl05_unresolv_2:    2: 0x207af80: 0
+dlo3:   dl05_unresolv_3:    4: 0x207af84: 0
+dlo3:   dl05_unresolv_4:    1: 0x207af88: 0
+dlo3:   dl05_unresolv_5:    8: 0x207af90: 0
+dlo4: module: testsuites/libtests/dl08/dl-o4.c
+dlo4:   dl04_unresolv_1:    4: 0x207a3f0: 0
+dlo4:   dl04_unresolv_2:    4: 0x207a3f4: %f
+dlo4:   dl04_unresolv_3:    1: 0x207a3f8: 00
+dlo4:   dl04_unresolv_4:    4: 0x207a3fc: 0
+dlo4:   dl04_unresolv_5:    4: 0x207a3c0: 4
+dlo4:   dl04_unresolv_6:    4: 0x207a3e0: dl-O4
+dlo5: module: testsuites/libtests/dl08/dl-o5.c
+dlo5:   dl05_unresolv_1:    8: 0x207af78: 0
+dlo5:   dl05_unresolv_2:    2: 0x207af80: 0
+dlo5:   dl05_unresolv_3:    4: 0x207af84: 0
+dlo5:   dl05_unresolv_4:    1: 0x207af88: 0
+dlo5:   dl05_unresolv_5:    8: 0x207af90: 0
+dlo5: module: testsuites/libtests/dl08/dl-o6-123456789-123456789.c
+dlo5:  long file name to test extended name loading
+handle: 0x207a648 closing
+--------------------------------------------------
+
+  REPEAT 100 TIMES
+
+--------------------------------------------------
+ Run: 99
+Test source (link in strstr): testsuites/libtests/dl08/dl-load.c
+load: /dl08-o1.o
+handel: 0x207ca80: no unresolved externals
+handle: 0x207ca80 loaded
+handel: 0x207ca80: no unresolved externals
+Running rtems_main_o1:
+dlo1: module: testsuites/libtests/dl08/dl-o1.c
+dlo1:         dl01_bss1:    4: 0x207d4f8: 0
+dlo1:         dl01_bss2:    4: 0x207d4fc: %f
+dlo1:         dl01_bss3:    1: 0x207d578: 00
+dlo1:        dl01_data1:    4: 0x207d4e4: 1
+dlo1:        dl01_data2:    4: 0x207d4e0: %f
+dlo1:       dl01_const1:    4: 0x207d4c0: 3
+dlo1:       dl01_const2:    4: 0x207d4bc: %f
+dlo1:        dl01_func1:    1: 0x207d1a8
+dlo2: module: testsuites/libtests/dl08/dl-o2.c
+dlo2:         dl02_bss1:    4: 0x207e6b8: 0
+dlo2:         dl02_bss2:    4: 0x207e6bc: %f
+dlo2:         dl02_bss3:    1: 0x207e6d8: 00
+dlo2:        dl02_data1:    4: 0x207e6f0: 0
+dlo2:        dl02_data2:    4: 0x207e6f4: %f
+dlo3: module: testsuites/libtests/dl08/dl-o3.c
+dlo3:   dl04_unresolv_1:    4: 0x207fd88: 0
+dlo3:   dl04_unresolv_2:    4: 0x207fd8c: %f
+dlo3:   dl04_unresolv_3:    1: 0x207fd90: 00
+dlo3:   dl04_unresolv_4:    4: 0x207fd94: 0
+dlo3:   dl04_unresolv_5:    4: 0x207fd58: 4
+dlo3:   dl04_unresolv_6:    4: 0x207fd78: dl-O4
+dlo3:   dl05_unresolv_1:    8: 0x207af78: 0
+dlo3:   dl05_unresolv_2:    2: 0x207af80: 0
+dlo3:   dl05_unresolv_3:    4: 0x207af84: 0
+dlo3:   dl05_unresolv_4:    1: 0x207af88: 0
+dlo3:   dl05_unresolv_5:    8: 0x207af90: 0
+dlo4: module: testsuites/libtests/dl08/dl-o4.c
+dlo4:   dl04_unresolv_1:    4: 0x207fd88: 0
+dlo4:   dl04_unresolv_2:    4: 0x207fd8c: %f
+dlo4:   dl04_unresolv_3:    1: 0x207fd90: 00
+dlo4:   dl04_unresolv_4:    4: 0x207fd94: 0
+dlo4:   dl04_unresolv_5:    4: 0x207fd58: 4
+dlo4:   dl04_unresolv_6:    4: 0x207fd78: dl-O4
+dlo5: module: testsuites/libtests/dl08/dl-o5.c
+dlo5:   dl05_unresolv_1:    8: 0x207af78: 0
+dlo5:   dl05_unresolv_2:    2: 0x207af80: 0
+dlo5:   dl05_unresolv_3:    4: 0x207af84: 0
+dlo5:   dl05_unresolv_4:    1: 0x207af88: 0
+dlo5:   dl05_unresolv_5:    8: 0x207af90: 0
+dlo5: module: testsuites/libtests/dl08/dl-o6-123456789-123456789.c
+dlo5:  long file name to test extended name loading
+handle: 0x207ca80 closing
+*** END OF TEST libdl (RTL) 8 ***
+*** FATAL ***
+fatal source: 5 (RTEMS_FATAL_SOURCE_EXIT)
+fatal code: 0 (0x00000000)
+RTEMS version: 5.0.0.e6835265a37d465b9100d7d4d234fece18e4626c-modified
+RTEMS tools: 7.3.0 20180125 (RTEMS 5, RSB 30da0c720b78eba16a3f5272206c07415368617b, Newlib 2ab57ad59bc35dafffa69cd4da5e228971de069f)
+executing thread ID: 0x08a010001
+executing thread name: UI1
+Run time     : 0:00:04.208332
diff --git a/testsuites/libtests/dl08/init.c b/testsuites/libtests/dl08/init.c
new file mode 100644
index 0000000..87f7f9b
--- /dev/null
+++ b/testsuites/libtests/dl08/init.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2018 Chris Johns <chrisj at 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) 8";
+
+/* forward declarations to avoid warnings */
+static rtems_task Init(rtems_task_argument argument);
+
+#include "dl08-tar.h"
+
+#define TARFILE_START dl08_tar
+#define TARFILE_SIZE  dl08_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>




More information about the vc mailing list