From 65efdb4c296f7fdb16118b0c586cd72ab8dc16aa Mon Sep 17 00:00:00 2001 From: "W. Eric Norum" Date: Fri, 17 May 2002 19:24:30 +0000 Subject: [PATCH] With the release of gcc-3.1, the weak reference to iocshRegister is overridden by the first non-weak declaration in the iocsh.h header. This caused iocshRegister to be undefined when building the test applications. Fix the problem by adding a file which provides a dummy version of iocshRegister if the real routine is not present. --- src/RTEMS/base/Makefile | 1 + src/RTEMS/base/rtems_dummyreg.c | 11 +++++++++++ src/RTEMS/base/rtems_init.c | 18 +++++------------- 3 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 src/RTEMS/base/rtems_dummyreg.c diff --git a/src/RTEMS/base/Makefile b/src/RTEMS/base/Makefile index 8ece8ef9d..6f3067621 100644 --- a/src/RTEMS/base/Makefile +++ b/src/RTEMS/base/Makefile @@ -5,6 +5,7 @@ SRCS += rtems_init.c SRCS += rtems_config.c SRCS += rtems_netconfig.c SRCS += rtems_util.c +SRCS += rtems_dummyreg.c LIBRARY_RTEMS = rtemsCom LIBRARY_SRCS = $(SRCS) $(BUILD_ARCHS) diff --git a/src/RTEMS/base/rtems_dummyreg.c b/src/RTEMS/base/rtems_dummyreg.c new file mode 100644 index 000000000..5b2ecf18d --- /dev/null +++ b/src/RTEMS/base/rtems_dummyreg.c @@ -0,0 +1,11 @@ +/* + * Provide a dummy version of iocshRegister to be used with test applications. + */ + +#include + +void +iocshRegister(const iocshFuncDef *piocshFuncDef, iocshCallFunc func) +{ + printf ("No iocsh -- %s not registered\n", piocshFuncDef->name); +} diff --git a/src/RTEMS/base/rtems_init.c b/src/RTEMS/base/rtems_init.c index ff6dea1a8..e46c56f56 100644 --- a/src/RTEMS/base/rtems_init.c +++ b/src/RTEMS/base/rtems_init.c @@ -145,21 +145,13 @@ static void stackCheckCallFunc(const iocshArgBuf *args) Stack_check_Dump_usage (); } +/* + * Register RTEMS-specific commands + */ static void iocshRegisterRTEMS (void) { - /* - * By using a weak reference this code will work with full IOC applications - * (where iocshRegister is present) and also with test applications - * (where iocshRegister is not present). - */ - extern void iocshRegister(const iocshFuncDef *piocshFuncDef, - iocshCallFunc func) __attribute__((weak)) ; - void (*rtemsEpicsIocshRegisterFunc)(const iocshFuncDef *piocshFuncDef, - iocshCallFunc func) = iocshRegister; - if (!rtemsEpicsIocshRegisterFunc) - return; - (*rtemsEpicsIocshRegisterFunc)(&netStatFuncDef, netStatCallFunc); - (*rtemsEpicsIocshRegisterFunc)(&stackCheckFuncDef, stackCheckCallFunc); + iocshRegister(&netStatFuncDef, netStatCallFunc); + iocshRegister(&stackCheckFuncDef, stackCheckCallFunc); } /*