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.
This commit is contained in:
@@ -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)
|
||||
|
||||
11
src/RTEMS/base/rtems_dummyreg.c
Normal file
11
src/RTEMS/base/rtems_dummyreg.c
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Provide a dummy version of iocshRegister to be used with test applications.
|
||||
*/
|
||||
|
||||
#include <iocsh.h>
|
||||
|
||||
void
|
||||
iocshRegister(const iocshFuncDef *piocshFuncDef, iocshCallFunc func)
|
||||
{
|
||||
printf ("No iocsh -- %s not registered\n", piocshFuncDef->name);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user