From patchwork Thu Jan 29 22:52:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 43993 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3900224128 for ; Thu, 29 Jan 2015 22:53:06 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id l4sf24830515lbv.1 for ; Thu, 29 Jan 2015 14:53:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=nys4clSmODLFwqOBGfito+8MtiYxjCbxawF0TTLG2J4=; b=fX2thyaAj+NDpouiXYLjrEtQw5hQuAqbSDTfCV5dJSTScnSn/bSnxGMYJsGDOPbuR6 M+qunOg2ayog15bKEIAX3Ju3hbURXA3u2QvoK7L5P+zneKYjNTaJdBIg0fUjlb/3nWQe lq+OI54ZlrryIjUoseD9CJYtiQyv/CdpOqut2uqN205CkT3LKWzFfNSC/thGgHW4UCvE j7+2Uqz0+9QrFxVq4Ae9R9MV8X/TI+Fh7kr4HoIdaypvS1r0OQbPsovgAildfDx9OGqS /Zub8kbtU+nv0+Iy2+CzZNEZrjdeBWNr/u38JtfpT58b/T5uLqLrapwJwOyiVWTWC87U T4LA== X-Gm-Message-State: ALoCoQkFpNw/3Yb0wfbDmefYJ59BLfQVG/oP4nMtD9zVchKDAEzTisDVeb2ZrkMbaTjOEBLkk1ZA X-Received: by 10.112.161.201 with SMTP id xu9mr420196lbb.11.1422571985156; Thu, 29 Jan 2015 14:53:05 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.35 with SMTP id p3ls414430lap.49.gmail; Thu, 29 Jan 2015 14:53:04 -0800 (PST) X-Received: by 10.112.132.67 with SMTP id os3mr3623460lbb.90.1422571984948; Thu, 29 Jan 2015 14:53:04 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id ye3si8722616lab.107.2015.01.29.14.53.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Jan 2015 14:53:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id f15so33484732lbj.0 for ; Thu, 29 Jan 2015 14:53:04 -0800 (PST) X-Received: by 10.112.180.135 with SMTP id do7mr3562428lbc.23.1422571984784; Thu, 29 Jan 2015 14:53:04 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp95420lbj; Thu, 29 Jan 2015 14:53:04 -0800 (PST) X-Received: by 10.140.92.33 with SMTP id a30mr6061463qge.30.1422571983516; Thu, 29 Jan 2015 14:53:03 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id w34si12036728qgw.36.2015.01.29.14.53.01 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 Jan 2015 14:53:03 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YGxxL-0008LI-Sv; Thu, 29 Jan 2015 22:52:59 +0000 Received: from mail-qg0-f41.google.com ([209.85.192.41]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YGxx9-0008Ke-6R for lng-odp@lists.linaro.org; Thu, 29 Jan 2015 22:52:47 +0000 Received: by mail-qg0-f41.google.com with SMTP id q108so35501134qgd.0 for ; Thu, 29 Jan 2015 14:52:42 -0800 (PST) X-Received: by 10.140.31.163 with SMTP id f32mr2515778qgf.23.1422571962038; Thu, 29 Jan 2015 14:52:42 -0800 (PST) Received: from mike-desktop.?.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id q5sm8304624qat.47.2015.01.29.14.52.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jan 2015 14:52:41 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Thu, 29 Jan 2015 17:52:29 -0500 Message-Id: <1422571952-5132-2-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422571952-5132-1-git-send-email-mike.holmes@linaro.org> References: <1422571952-5132-1-git-send-email-mike.holmes@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 2/5] api: abort: add weak replacement for abort X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mike.holmes@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Introduce replaceable abort function using weak symbols. Signed-off-by: Mike Holmes --- include/odp/api/init.h | 16 ++++++++++++++++ platform/linux-generic/include/odp_debug_internal.h | 4 ++-- platform/linux-generic/odp_weak.c | 5 +++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/include/odp/api/init.h b/include/odp/api/init.h index c73b321..4b9296b 100644 --- a/include/odp/api/init.h +++ b/include/odp/api/init.h @@ -29,6 +29,7 @@ extern "C" { #include +#include /** @defgroup odp_initialization ODP INITIALIZATION * Initialisation operations. @@ -71,6 +72,21 @@ typedef enum odp_log_level { */ int odp_override_log(odp_log_level_e level, const char *fmt, ...); +/** + * ODP abort function + * + * 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. + * + * @warning The override option is not portable and GNU linker dependent + * (utilizes function attribute "weak"). + * + * @warning this function shall not return + */ +void odp_override_abort(void) ODP_NORETURN; /** Replaceable logging function */ typedef int (*odp_log_func_t)(odp_log_level_e level, const char *fmt, ...); diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h index a665644..20b6fcc 100644 --- a/platform/linux-generic/include/odp_debug_internal.h +++ b/platform/linux-generic/include/odp_debug_internal.h @@ -54,7 +54,7 @@ extern "C" { #define ODP_ASSERT(cond, msg) \ do { if ((ODP_DEBUG == 1) && (!(cond))) { \ ODP_ERR("%s\n", msg); \ - abort(); } \ + odp_override_abort(); } \ } while (0) /** @@ -86,7 +86,7 @@ extern "C" { #define ODP_ABORT(fmt, ...) \ do { \ ODP_LOG(ODP_LOG_ABORT, fmt, ##__VA_ARGS__); \ - abort(); \ + odp_override_abort(); \ } while (0) /** diff --git a/platform/linux-generic/odp_weak.c b/platform/linux-generic/odp_weak.c index 2592fe9..9dc3a4a 100644 --- a/platform/linux-generic/odp_weak.c +++ b/platform/linux-generic/odp_weak.c @@ -21,3 +21,8 @@ ODP_WEAK_SYMBOL int odp_override_log(odp_log_level_e level ODP_UNUSED, return r; } + +ODP_WEAK_SYMBOL void odp_override_abort(void) +{ + abort(); +}