@@ -78,11 +78,16 @@ int odp_override_log(odp_log_level_e level, const char *fmt, ...);
* Instead of directly calling abort, all abort calls in the implementation
* should be done via this function or its wrappers.
*
- * An Application can override the ODP implementation default abort function
- * odp_override_abort() by providing an alternative to this weak symbol.
+ * The application can provide this function to the ODP implementation in two
+ * ways:
+ *
+ * - A callback passed in via odp_init_t and odp_init_global()
+ * - By overriding the ODP implementation default abort function
+ * odp_override_abort().
*
- * @warning The override option is not portable and GNU linker dependent
- * (utilizes function attribute "weak").
+ * @warning The latter option is less portable and GNU linker dependent
+ * (utilizes function attribute "weak"). If both are defined, the odp_init_t
+ * function pointer has priority over the override function.
*
* @warning this function shall not return
*/
@@ -101,6 +106,7 @@ typedef void (*odp_abort_func_t)(void) ODP_NORETURN;
*/
typedef struct odp_init_t {
odp_log_func_t log_fn;
+ odp_abort_func_t abort_fn;
} odp_init_t;
/** ODP platform initialization data.
@@ -19,6 +19,8 @@ int odp_init_global(odp_init_t *params ODP_UNUSED,
if (params != NULL) {
if (params->log_fn != NULL)
odp_global_data.log_fn = params->log_fn;
+ if (params->abort_fn != NULL)
+ odp_global_data.abort_fn = params->abort_fn;
}
Signed-off-by: Mike Holmes <mike.holmes@linaro.org> --- include/odp/api/init.h | 14 ++++++++++---- platform/linux-generic/odp_init.c | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-)