[PATCH 3/3] bsps/powerpc: Fix redefinitions

2018-02-07 Thread Sebastian Huber
---
 bsps/powerpc/include/libcpu/raw_exception.h |  2 -
 bsps/powerpc/include/libcpu/vectors.h   | 60 +
 2 files changed, 1 insertion(+), 61 deletions(-)

diff --git a/bsps/powerpc/include/libcpu/raw_exception.h 
b/bsps/powerpc/include/libcpu/raw_exception.h
index dd0c483b0d..e206f326bc 100644
--- a/bsps/powerpc/include/libcpu/raw_exception.h
+++ b/bsps/powerpc/include/libcpu/raw_exception.h
@@ -55,8 +55,6 @@
 #define ASM_MEBREAK_VECTOR 0x1E
 #define ASM_NMEBREAK_VECTOR0x1F
 
-#define LAST_VALID_EXC ASM_NMEBREAK_VECTOR
-
 #ifndef ASM
 
 /*
diff --git a/bsps/powerpc/include/libcpu/vectors.h 
b/bsps/powerpc/include/libcpu/vectors.h
index 2c8914e2a4..19ddca65f0 100644
--- a/bsps/powerpc/include/libcpu/vectors.h
+++ b/bsps/powerpc/include/libcpu/vectors.h
@@ -19,68 +19,15 @@
 #ifndef _LIBCPU_VECTORS_H
 #define _LIBCPU_VECTORS_H
 
+#include 
 
 /*
  * Size of hardware vector table.
  */
 #define NUM_EXCEPTIONS 0x20
 
-/*
- * The callee (high level exception code written in C)
- * will store the Link Registers (return address) at entry r1 + 4 !!!.
- * So let room for it!!!.
- */
-#define LINK_REGISTER_CALLEE_UPDATE_ROOM 4
-#define SRR0_FRAME_OFFSET 8
-#define SRR1_FRAME_OFFSET 12
-#define EXCEPTION_NUMBER_OFFSET 16
-#define EXC_CR_OFFSET 20
-#define EXC_CTR_OFFSET 24
-#define EXC_XER_OFFSET 28
-#define EXC_LR_OFFSET 32
-#define GPR0_OFFSET 36
-#define GPR1_OFFSET 40
-#define GPR2_OFFSET 44
-#define GPR3_OFFSET 48
-#define GPR4_OFFSET 52
-#define GPR5_OFFSET 56
-#define GPR6_OFFSET 60
-#define GPR7_OFFSET 64
-#define GPR8_OFFSET 68
-#define GPR9_OFFSET 72
-#define GPR10_OFFSET 76
-#define GPR11_OFFSET 80
-#define GPR12_OFFSET 84
-#define GPR13_OFFSET 88
-#define GPR14_OFFSET 92
-#define GPR15_OFFSET 96
-#define GPR16_OFFSET 100
-#define GPR17_OFFSET 104
-#define GPR18_OFFSET 108
-#define GPR19_OFFSET 112
-#define GPR20_OFFSET 116
-#define GPR21_OFFSET 120
-#define GPR22_OFFSET 124
-#define GPR23_OFFSET 128
-#define GPR24_OFFSET 132
-#define GPR25_OFFSET 136
-#define GPR26_OFFSET 140
-#define GPR27_OFFSET 144
-#define GPR28_OFFSET 148
-#define GPR29_OFFSET 152
-#define GPR30_OFFSET 156
-#define GPR31_OFFSET 160
-/*
- * maintain the EABI requested 8 bytes aligment
- * As SVR4 ABI requires 16, make it 16 (as some
- * exception may need more registers to be processed...)
- */
-#defineEXCEPTION_FRAME_END 176
-
 #ifndef ASM
 
-#include 
-
 /*
  * default raw exception handlers
  */
@@ -90,7 +37,6 @@ externint  default_exception_vector_code_prolog_size;
 extern  void initialize_exceptions(void);
 
 typedef void rtems_exception_handler_t (CPU_Exception_frame* excPtr);
-/*DEBUG typedef rtems_exception_handler_t cpuExcHandlerType; */
 
 /*
  * Exception handler table.
@@ -106,10 +52,6 @@ typedef void rtems_exception_handler_t 
(CPU_Exception_frame* excPtr);
  */
 extern rtems_exception_handler_t* exception_handler_table[NUM_EXCEPTIONS];
 
-/* for compatability -- XXX remove */
-typedef rtems_exception_handler_t *cpuExcHandlerType;
-extern cpuExcHandlerType *globalExceptHdl;
-
 #endif /* ASM */
 
 #endif /* _LIBCPU_VECTORS_H */
-- 
2.12.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/3] network: Fix integer types

2018-02-07 Thread Sebastian Huber
---
 cpukit/libnetworking/lib/ftpfs.c   | 2 +-
 cpukit/libnetworking/rtems/rtems_syscall.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/libnetworking/lib/ftpfs.c b/cpukit/libnetworking/lib/ftpfs.c
index 1e0f180fd0..5e0cb95dd3 100644
--- a/cpukit/libnetworking/lib/ftpfs.c
+++ b/cpukit/libnetworking/lib/ftpfs.c
@@ -1294,7 +1294,7 @@ static void rtems_ftpfs_unmount_me(
 
 static int rtems_ftpfs_ioctl(
   rtems_libio_t *iop,
-  uint32_t command,
+  ioctl_command_t command,
   void *arg
 )
 {
diff --git a/cpukit/libnetworking/rtems/rtems_syscall.c 
b/cpukit/libnetworking/rtems/rtems_syscall.c
index c7ff724e0f..5225b53beb 100644
--- a/cpukit/libnetworking/rtems/rtems_syscall.c
+++ b/cpukit/libnetworking/rtems/rtems_syscall.c
@@ -762,7 +762,7 @@ so_ioctl (rtems_libio_t *iop, struct socket *so, uint32_t   
command, void *buffe
 }
 
 static int
-rtems_bsdnet_ioctl (rtems_libio_t *iop, uint32_t   command, void *buffer)
+rtems_bsdnet_ioctl (rtems_libio_t *iop, ioctl_command_t command, void *buffer)
 {
struct socket *so;
int error;
-- 
2.12.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 2/3] bsps/sparc64: Fix redefinitions

2018-02-07 Thread Sebastian Huber
---
 bsps/sparc64/include/boot/gentypes.h | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/bsps/sparc64/include/boot/gentypes.h 
b/bsps/sparc64/include/boot/gentypes.h
index a3e82d6eef..57f3725baf 100644
--- a/bsps/sparc64/include/boot/gentypes.h
+++ b/bsps/sparc64/include/boot/gentypes.h
@@ -35,11 +35,8 @@
 #ifndef BOOT_GENTYPES_H_
 #define BOOT_GENTYPES_H_
 
-#define NULL 0
-#define false 0
-#define true 1
-
-typedef unsigned long size_t;
+#include 
+#include 
 
 #endif
 
-- 
2.12.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] unhex.c: Remove unnecessary extern of errno

2018-02-07 Thread Joel Sherrill
Closes #2610.
---
 tools/build/unhex.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/build/unhex.c b/tools/build/unhex.c
index 7c3bab0..e05f05f 100644
--- a/tools/build/unhex.c
+++ b/tools/build/unhex.c
@@ -684,8 +684,6 @@ error(int error_flag, ...)
 register char *format;
 int local_errno;
 
-extern int errno;
-
 (void) fflush(stdout);  /* in case stdout/stderr same */
 
 local_errno = error_flag & ~ERR_MASK;
-- 
1.8.3.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] Move make/custom to make/ globally

2018-02-07 Thread Joel Sherrill
Updates #3285.
---
 source-builder/sb/rtemsconfig.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source-builder/sb/rtemsconfig.mk b/source-builder/sb/rtemsconfig.mk
index abf9bcf..5ea30fc 100644
--- a/source-builder/sb/rtemsconfig.mk
+++ b/source-builder/sb/rtemsconfig.mk
@@ -22,7 +22,7 @@ all:
exec_prefix=$(exec_prefix)
RTEMS_ROOT=$(prefix)
PROJECT_ROOT=$(RTEMS_ROOT)
-   RTEMS_CUSTOM=$(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
+   RTEMS_CUSTOM=$(RTEMS_ROOT)/make/$(RTEMS_BSP).cfg
RTEMS_SHARE=$(RTEMS_ROOT)/share/rtems$(RTEMS_API)
CC_FOR_TARGET=$(CC_FOR_TARGET)
CXX_FOR_TARGET=$(CXX_FOR_TARGET)
-- 
1.8.3.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Compressed patch to move make/custom/* to make/*

2018-02-07 Thread Joel Sherrill
Hi

The patch was quite large and rightly blocked from being sent to
everyone (~900k). Compressed, it is only 63K

This eliminates the custom directory and moves everything up
one level.  No failures in the build as shown here.

https://lists.rtems.org/pipermail/build/2018-February/000398.html

--joel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Compressed patch to move make/custom/* to make/*

2018-02-07 Thread Joel Sherrill
Attached this time.

On Wed, Feb 7, 2018 at 6:00 PM, Joel Sherrill  wrote:

> Hi
>
> The patch was quite large and rightly blocked from being sent to
> everyone (~900k). Compressed, it is only 63K
>
> This eliminates the custom directory and moves everything up
> one level.  No failures in the build as shown here.
>
> https://lists.rtems.org/pipermail/build/2018-February/000398.html
>
> --joel
>


0001-Move-make-custom-to-make-globally.patch.xz
Description: Binary data
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH] testsuites/libtest: The configure order effects how it works.

2018-02-07 Thread Chris Johns
Close #3297
---
 testsuites/libtests/configure.ac | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/testsuites/libtests/configure.ac b/testsuites/libtests/configure.ac
index d41d135b64..f740183206 100644
--- a/testsuites/libtests/configure.ac
+++ b/testsuites/libtests/configure.ac
@@ -12,15 +12,12 @@ AM_INIT_AUTOMAKE([no-define foreign 1.12.2])
 AM_MAINTAINER_MODE
 
 RTEMS_ENABLE_CXX
-AC_PROG_CXX
-
 RTEMS_ENV_RTEMSBSP
 RTEMS_CHECK_RTEMS_TEST_NO_PAUSE
 
 RTEMS_PROJECT_ROOT
 
 RTEMS_PROG_CC_FOR_TARGET
-
 RTEMS_PROG_CXX_FOR_TARGET
 
 RTEMS_CANONICALIZE_TOOLS
@@ -30,6 +27,8 @@ RTEMS_CHECK_CXX(RTEMS_BSP)
 RTEMS_CHECK_CPUOPTS([RTEMS_NETWORKING])
 RTEMS_CHECK_CPUOPTS([RTEMS_POSIX_API])
 
+AC_PROG_CXX
+
 AC_PROG_LN_S
 AC_PATH_PROG([PAX],[pax],no)
 
-- 
2.14.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 4/5] Update dlerror usage

2018-02-07 Thread Chris Johns
From: Patrick Gauvin 

Handles possible NULL return value

Updates #2747
---
 cpukit/libdl/dlfcn-shell.c |  8 ++--
 testsuites/libtests/dl01/dl-load.c |  7 +--
 testsuites/libtests/dl02/dl-load.c | 11 ---
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/cpukit/libdl/dlfcn-shell.c b/cpukit/libdl/dlfcn-shell.c
index 3746711ef1..12c737abb6 100644
--- a/cpukit/libdl/dlfcn-shell.c
+++ b/cpukit/libdl/dlfcn-shell.c
@@ -38,7 +38,8 @@ convert_ascii_to_voidp (const char* arg)
 int
 shell_dlopen (int argc, char* argv[])
 {
-  int arg;
+  int   arg;
+  char *err;
   for (arg = 1; arg < argc; arg++)
   {
 void* handle = dlopen (argv[arg], RTLD_NOW | RTLD_GLOBAL);
@@ -53,7 +54,10 @@ shell_dlopen (int argc, char* argv[])
   printf ("handle: %p %s\n", handle, message);
 }
 else
-  printf ("error: %s\n", dlerror ());
+{
+  err = dlerror ();
+  printf ("error: %s\n", err ? err : "");
+}
   }
   return 0;
 }
diff --git a/testsuites/libtests/dl01/dl-load.c 
b/testsuites/libtests/dl01/dl-load.c
index e8f84bd5b5..7441808b24 100644
--- a/testsuites/libtests/dl01/dl-load.c
+++ b/testsuites/libtests/dl01/dl-load.c
@@ -27,13 +27,15 @@ int dl_load_test(void)
   intcall_ret;
   intunresolved;
   char*  message = "loaded";
+  char*  err;
 
   printf("load: /dl-o1.o\n");
 
   handle = dlopen ("/dl-o1.o", RTLD_NOW | RTLD_GLOBAL);
   if (!handle)
   {
-printf("dlopen failed: %s\n", dlerror());
+err = dlerror ();
+printf ("dlopen failed: %s\n", err ? err : "");
 return 1;
   }
 
@@ -67,7 +69,8 @@ int dl_load_test(void)
 
   if (dlclose (handle) < 0)
   {
-printf("dlclose failed: %s\n", dlerror());
+err = dlerror ();
+printf ("dlclose failed: %s\n", err ? err : "");
 return 1;
   }
 
diff --git a/testsuites/libtests/dl02/dl-load.c 
b/testsuites/libtests/dl02/dl-load.c
index 5bb40dccba..5e74e0e425 100644
--- a/testsuites/libtests/dl02/dl-load.c
+++ b/testsuites/libtests/dl02/dl-load.c
@@ -21,13 +21,15 @@ static void* dl_load_obj(const char* name)
   void* handle;
   int   unresolved;
   char* message = "loaded";
+  char* err;
 
   printf("load: %s\n", name);
 
   handle = dlopen (name, RTLD_NOW | RTLD_GLOBAL);
   if (!handle)
   {
-printf("dlopen failed: %s\n", dlerror());
+err = dlerror ();
+printf ("dlopen failed: %s\n", err ? err : "");
 return NULL;
   }
 
@@ -48,6 +50,7 @@ int dl_load_test(void)
   call_t call;
   intcall_ret;
   intret;
+  char*  err;
 
   o1 = dl_load_obj("/dl-o1.o");
   if (!o1)
@@ -83,7 +86,8 @@ int dl_load_test(void)
 
   if (dlclose (o1) < 0)
   {
-printf("dlclose o1 failed: %s\n", dlerror());
+err = dlerror ();
+printf ("dlclose o1 failed: %s\n", err ? err : "");
 ret = 1;
   }
 
@@ -91,7 +95,8 @@ int dl_load_test(void)
 
   if (dlclose (o2) < 0)
   {
-printf("dlclose o1 failed: %s\n", dlerror());
+err = dlerror ();
+printf ("dlclose o2 failed: %s\n", err ? err : "");
 ret = 1;
   }
 
-- 
2.14.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 2/5] libdl: dlerror return NULL when no error

2018-02-07 Thread Chris Johns
From: Patrick Gauvin 

Updates #2747
---
 cpukit/libdl/dlfcn.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cpukit/libdl/dlfcn.c b/cpukit/libdl/dlfcn.c
index 4277caf757..55ad97b753 100644
--- a/cpukit/libdl/dlfcn.c
+++ b/cpukit/libdl/dlfcn.c
@@ -132,6 +132,8 @@ dlerror (void)
   static char msg[64];
   rtems_rtl_get_error (msg, sizeof (msg));
   rtems_rtl_clear_error ();
+  if (msg[0] == '\0')
+return NULL;
   return msg;
 }
 
-- 
2.14.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 5/5] libtest/dl01: Add dlerror tests.

2018-02-07 Thread Chris Johns
Update #2747
---
 testsuites/libtests/dl01/dl-load.c | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/testsuites/libtests/dl01/dl-load.c 
b/testsuites/libtests/dl01/dl-load.c
index 7441808b24..99c1ebf5e3 100644
--- a/testsuites/libtests/dl01/dl-load.c
+++ b/testsuites/libtests/dl01/dl-load.c
@@ -29,6 +29,37 @@ int dl_load_test(void)
   char*  message = "loaded";
   char*  err;
 
+  err = dlerror ();
+  if (err != NULL)
+  {
+printf ("dlerror failed: did not return NULL for no error\n");
+return 1;
+  }
+
+  printf("load: /abcd.o (no found)\n");
+  handle = dlopen ("/abcd.o", RTLD_NOW | RTLD_GLOBAL);
+  if (handle)
+  {
+printf ("dlopen failed: found unknown object file\n");
+return 1;
+  }
+
+  err = dlerror ();
+  if (!err)
+  {
+printf ("dlerror failed: no error message\n");
+return 1;
+  }
+
+  printf ("dlerror: %s\n", err);
+
+  err = dlerror ();
+  if (err != NULL)
+  {
+printf ("dlerror failed: did not return NULL so error no cleared\n");
+return 1;
+  }
+
   printf("load: /dl-o1.o\n");
 
   handle = dlopen ("/dl-o1.o", RTLD_NOW | RTLD_GLOBAL);
-- 
2.14.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 3/5] libdl: Fix dlerror return type

2018-02-07 Thread Chris Johns
From: Patrick Gauvin 

POSIX specifies char *, not const char *

Updates #2747
---
 cpukit/libdl/dlfcn.c | 2 +-
 cpukit/libdl/dlfcn.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/libdl/dlfcn.c b/cpukit/libdl/dlfcn.c
index 55ad97b753..c1f4a6a7b6 100644
--- a/cpukit/libdl/dlfcn.c
+++ b/cpukit/libdl/dlfcn.c
@@ -126,7 +126,7 @@ dlsym (void* handle, const char *symbol)
   return symval;
 }
 
-const char*
+char*
 dlerror (void)
 {
   static char msg[64];
diff --git a/cpukit/libdl/dlfcn.h b/cpukit/libdl/dlfcn.h
index 1ac3ba1330..d71b515d8e 100644
--- a/cpukit/libdl/dlfcn.h
+++ b/cpukit/libdl/dlfcn.h
@@ -56,7 +56,7 @@ int   dladdr(void * __restrict, Dl_info * __restrict);
 intdlctl(void *, int, void *);
 #endif
 intdlinfo(void *, int, void *);
-const char *dlerror(void);
+char *dlerror(void);
 __END_DECLS
 
 /* Values for dlopen `mode'. */
-- 
2.14.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/5] libdl: Clear error between dlerror invocations

2018-02-07 Thread Chris Johns
From: Patrick Gauvin 

Updates #2747
---
 cpukit/libdl/dlfcn.c |  2 ++
 cpukit/libdl/rtl-error.c | 12 
 cpukit/libdl/rtl-error.h |  5 +
 3 files changed, 19 insertions(+)

diff --git a/cpukit/libdl/dlfcn.c b/cpukit/libdl/dlfcn.c
index 3b31bb2e8e..4277caf757 100644
--- a/cpukit/libdl/dlfcn.c
+++ b/cpukit/libdl/dlfcn.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include "rtl-error.h"
 
 static rtems_rtl_obj_t*
 dl_get_obj_from_handle (void* handle)
@@ -130,6 +131,7 @@ dlerror (void)
 {
   static char msg[64];
   rtems_rtl_get_error (msg, sizeof (msg));
+  rtems_rtl_clear_error ();
   return msg;
 }
 
diff --git a/cpukit/libdl/rtl-error.c b/cpukit/libdl/rtl-error.c
index 5ec4b26ef7..a60074fcd0 100644
--- a/cpukit/libdl/rtl-error.c
+++ b/cpukit/libdl/rtl-error.c
@@ -52,3 +52,15 @@ rtems_rtl_get_error (char* message, size_t max_message)
 
   return EIO;
 }
+
+void
+rtems_rtl_clear_error (void)
+{
+  rtems_rtl_data_t* rtl = rtems_rtl_lock ();
+  if (rtl != NULL)
+  {
+rtl->last_errno = 0;
+rtl->last_error[0] = '\0';
+rtems_rtl_unlock ();
+  }
+}
diff --git a/cpukit/libdl/rtl-error.h b/cpukit/libdl/rtl-error.h
index 0badf51e21..f1cf4ea72c 100644
--- a/cpukit/libdl/rtl-error.h
+++ b/cpukit/libdl/rtl-error.h
@@ -37,6 +37,11 @@ extern "C" {
  */
 void rtems_rtl_set_error (int error, const char* format, ...) 
RTEMS_RTL_PRINTF_ATTR;
 
+/**
+ * Clears the error.
+ */
+void rtems_rtl_clear_error (void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
-- 
2.14.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 4.11] dlerror non-conformance

2018-02-07 Thread Chris Johns
These patches are a modified version of the patches found in ticket
#2747 from Patrick. I have added some tests.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 4/5] Update dlerror usage

2018-02-07 Thread Chris Johns
From: Patrick Gauvin 

Handles possible NULL return value

Updates #3298
---
 cpukit/libdl/dlfcn-shell.c |  8 ++--
 testsuites/libtests/dl01/dl-load.c |  7 +--
 testsuites/libtests/dl02/dl-load.c | 11 ---
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/cpukit/libdl/dlfcn-shell.c b/cpukit/libdl/dlfcn-shell.c
index 3746711ef1..12c737abb6 100644
--- a/cpukit/libdl/dlfcn-shell.c
+++ b/cpukit/libdl/dlfcn-shell.c
@@ -38,7 +38,8 @@ convert_ascii_to_voidp (const char* arg)
 int
 shell_dlopen (int argc, char* argv[])
 {
-  int arg;
+  int   arg;
+  char *err;
   for (arg = 1; arg < argc; arg++)
   {
 void* handle = dlopen (argv[arg], RTLD_NOW | RTLD_GLOBAL);
@@ -53,7 +54,10 @@ shell_dlopen (int argc, char* argv[])
   printf ("handle: %p %s\n", handle, message);
 }
 else
-  printf ("error: %s\n", dlerror ());
+{
+  err = dlerror ();
+  printf ("error: %s\n", err ? err : "");
+}
   }
   return 0;
 }
diff --git a/testsuites/libtests/dl01/dl-load.c 
b/testsuites/libtests/dl01/dl-load.c
index e8f84bd5b5..7441808b24 100644
--- a/testsuites/libtests/dl01/dl-load.c
+++ b/testsuites/libtests/dl01/dl-load.c
@@ -27,13 +27,15 @@ int dl_load_test(void)
   intcall_ret;
   intunresolved;
   char*  message = "loaded";
+  char*  err;

   printf("load: /dl-o1.o\n");

   handle = dlopen ("/dl-o1.o", RTLD_NOW | RTLD_GLOBAL);
   if (!handle)
   {
-printf("dlopen failed: %s\n", dlerror());
+err = dlerror ();
+printf ("dlopen failed: %s\n", err ? err : "");
 return 1;
   }

@@ -67,7 +69,8 @@ int dl_load_test(void)

   if (dlclose (handle) < 0)
   {
-printf("dlclose failed: %s\n", dlerror());
+err = dlerror ();
+printf ("dlclose failed: %s\n", err ? err : "");
 return 1;
   }

diff --git a/testsuites/libtests/dl02/dl-load.c 
b/testsuites/libtests/dl02/dl-load.c
index 5bb40dccba..5e74e0e425 100644
--- a/testsuites/libtests/dl02/dl-load.c
+++ b/testsuites/libtests/dl02/dl-load.c
@@ -21,13 +21,15 @@ static void* dl_load_obj(const char* name)
   void* handle;
   int   unresolved;
   char* message = "loaded";
+  char* err;

   printf("load: %s\n", name);

   handle = dlopen (name, RTLD_NOW | RTLD_GLOBAL);
   if (!handle)
   {
-printf("dlopen failed: %s\n", dlerror());
+err = dlerror ();
+printf ("dlopen failed: %s\n", err ? err : "");
 return NULL;
   }

@@ -48,6 +50,7 @@ int dl_load_test(void)
   call_t call;
   intcall_ret;
   intret;
+  char*  err;

   o1 = dl_load_obj("/dl-o1.o");
   if (!o1)
@@ -83,7 +86,8 @@ int dl_load_test(void)

   if (dlclose (o1) < 0)
   {
-printf("dlclose o1 failed: %s\n", dlerror());
+err = dlerror ();
+printf ("dlclose o1 failed: %s\n", err ? err : "");
 ret = 1;
   }

@@ -91,7 +95,8 @@ int dl_load_test(void)

   if (dlclose (o2) < 0)
   {
-printf("dlclose o1 failed: %s\n", dlerror());
+err = dlerror ();
+printf ("dlclose o2 failed: %s\n", err ? err : "");
 ret = 1;
   }

--
2.14.1
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 5/5] libtest/dl01: Add dlerror tests.

2018-02-07 Thread Chris Johns
Update #3298
---
 testsuites/libtests/dl01/dl-load.c | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/testsuites/libtests/dl01/dl-load.c 
b/testsuites/libtests/dl01/dl-load.c
index 7441808b24..99c1ebf5e3 100644
--- a/testsuites/libtests/dl01/dl-load.c
+++ b/testsuites/libtests/dl01/dl-load.c
@@ -29,6 +29,37 @@ int dl_load_test(void)
   char*  message = "loaded";
   char*  err;

+  err = dlerror ();
+  if (err != NULL)
+  {
+printf ("dlerror failed: did not return NULL for no error\n");
+return 1;
+  }
+
+  printf("load: /abcd.o (no found)\n");
+  handle = dlopen ("/abcd.o", RTLD_NOW | RTLD_GLOBAL);
+  if (handle)
+  {
+printf ("dlopen failed: found unknown object file\n");
+return 1;
+  }
+
+  err = dlerror ();
+  if (!err)
+  {
+printf ("dlerror failed: no error message\n");
+return 1;
+  }
+
+  printf ("dlerror: %s\n", err);
+
+  err = dlerror ();
+  if (err != NULL)
+  {
+printf ("dlerror failed: did not return NULL so error no cleared\n");
+return 1;
+  }
+
   printf("load: /dl-o1.o\n");

   handle = dlopen ("/dl-o1.o", RTLD_NOW | RTLD_GLOBAL);
--
2.14.1
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/5] libdl: Clear error between dlerror invocations

2018-02-07 Thread Chris Johns
From: Patrick Gauvin 

Updates #3298
---
 cpukit/libdl/dlfcn.c |  2 ++
 cpukit/libdl/rtl-error.c | 12 
 cpukit/libdl/rtl-error.h |  5 +
 3 files changed, 19 insertions(+)

diff --git a/cpukit/libdl/dlfcn.c b/cpukit/libdl/dlfcn.c
index 3b31bb2e8e..4277caf757 100644
--- a/cpukit/libdl/dlfcn.c
+++ b/cpukit/libdl/dlfcn.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include "rtl-error.h"

 static rtems_rtl_obj_t*
 dl_get_obj_from_handle (void* handle)
@@ -130,6 +131,7 @@ dlerror (void)
 {
   static char msg[64];
   rtems_rtl_get_error (msg, sizeof (msg));
+  rtems_rtl_clear_error ();
   return msg;
 }

diff --git a/cpukit/libdl/rtl-error.c b/cpukit/libdl/rtl-error.c
index 449beb5141..8e1a0829ad 100644
--- a/cpukit/libdl/rtl-error.c
+++ b/cpukit/libdl/rtl-error.c
@@ -53,3 +53,15 @@ rtems_rtl_get_error (char* message, size_t max_message)

   return EIO;
 }
+
+void
+rtems_rtl_clear_error (void)
+{
+  rtems_rtl_data_t* rtl = rtems_rtl_lock ();
+  if (rtl != NULL)
+  {
+rtl->last_errno = 0;
+rtl->last_error[0] = '\0';
+rtems_rtl_unlock ();
+  }
+}
diff --git a/cpukit/libdl/rtl-error.h b/cpukit/libdl/rtl-error.h
index 0badf51e21..f1cf4ea72c 100644
--- a/cpukit/libdl/rtl-error.h
+++ b/cpukit/libdl/rtl-error.h
@@ -37,6 +37,11 @@ extern "C" {
  */
 void rtems_rtl_set_error (int error, const char* format, ...) 
RTEMS_RTL_PRINTF_ATTR;

+/**
+ * Clears the error.
+ */
+void rtems_rtl_clear_error (void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
--
2.14.1
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 2/5] libdl: dlerror return NULL when no error

2018-02-07 Thread Chris Johns
From: Patrick Gauvin 

Updates #3298
---
 cpukit/libdl/dlfcn.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cpukit/libdl/dlfcn.c b/cpukit/libdl/dlfcn.c
index 4277caf757..55ad97b753 100644
--- a/cpukit/libdl/dlfcn.c
+++ b/cpukit/libdl/dlfcn.c
@@ -132,6 +132,8 @@ dlerror (void)
   static char msg[64];
   rtems_rtl_get_error (msg, sizeof (msg));
   rtems_rtl_clear_error ();
+  if (msg[0] == '\0')
+return NULL;
   return msg;
 }

--
2.14.1
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 3/5] libdl: Fix dlerror return type

2018-02-07 Thread Chris Johns
POSIX specifies char *, not const char *

Updates #3298
---
 cpukit/include/dlfcn.h | 2 +-
 cpukit/libdl/dlfcn.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/include/dlfcn.h b/cpukit/include/dlfcn.h
index 1ac3ba1330..95272c43ca 100644
--- a/cpukit/include/dlfcn.h
+++ b/cpukit/include/dlfcn.h
@@ -56,7 +56,7 @@ int   dladdr(void * __restrict, Dl_info * __restrict);
 intdlctl(void *, int, void *);
 #endif
 intdlinfo(void *, int, void *);
-const char *dlerror(void);
+char   *dlerror(void);
 __END_DECLS
 
 /* Values for dlopen `mode'. */
diff --git a/cpukit/libdl/dlfcn.c b/cpukit/libdl/dlfcn.c
index 55ad97b753..c1f4a6a7b6 100644
--- a/cpukit/libdl/dlfcn.c
+++ b/cpukit/libdl/dlfcn.c
@@ -126,7 +126,7 @@ dlsym (void* handle, const char *symbol)
   return symval;
 }
 
-const char*
+char*
 dlerror (void)
 {
   static char msg[64];
-- 
2.14.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[master] Port of 4.11 fixes for dlerror non-conformance

2018-02-07 Thread Chris Johns
These are the patches from ticket #2747 by Patrick for master
plus my small mods and some tests.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] rtems: Do not build the RTEMS kernel by default in releases.

2018-02-07 Thread Chris Johns
Close #3292
---
 rtems/config/tools/rtems-kernel-4-1.cfg | 2 +-
 source-builder/sb/build.py  | 7 ++-
 source-builder/sb/config.py | 3 ++-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/rtems/config/tools/rtems-kernel-4-1.cfg 
b/rtems/config/tools/rtems-kernel-4-1.cfg
index e13458d..6349be7 100644
--- a/rtems/config/tools/rtems-kernel-4-1.cfg
+++ b/rtems/config/tools/rtems-kernel-4-1.cfg
@@ -31,7 +31,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
 # Build if the RSB is released or optionally enable/disable building the RTEMS
 # kernel via the command line.
 #
-%if %{rsb_released} || %{defined with_rtems}
+%if %{defined with_rtems}
  %define rtems_kernel_build 1
 %else
  %define rtems_kernel_build 0
diff --git a/source-builder/sb/build.py b/source-builder/sb/build.py
index b995e6b..e28a831 100644
--- a/source-builder/sb/build.py
+++ b/source-builder/sb/build.py
@@ -111,11 +111,8 @@ class build:
 return name
 
 def _generate_report_(self, header, footer = None):
-label, result = self.opts.with_arg('error-report')
-if (label.startswith('without_') and result != 'yes') or \
-   (label.startswith('with_') and result != 'no'):
-ereport.generate('rsb-report-%s.txt' % self.macros['name'],
- self.opts, header, footer)
+ereport.generate('rsb-report-%s.txt' % self.macros['name'],
+ self.opts, header, footer)
 
 def __init__(self, name, create_tar_files, opts, macros = None):
 try:
diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py
index da54ba3..a4f739b 100644
--- a/source-builder/sb/config.py
+++ b/source-builder/sb/config.py
@@ -422,7 +422,8 @@ class file:
 def _pkgconfig_check(self, test):
 # Hack to by pass pkgconfig checks when just wanting to download the
 # source.
-if self.macros['_dry_run'] == '1' and self.macros['with_download'] == 
'1':
+if self.macros['_dry_run'] == '1' and \
+   ('with_download' in self.macros and self.macros['with_download'] == 
'1'):
 return '0'
 ok = False
 if type(test) == str:
-- 
2.14.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel