From patchwork Tue Feb 3 11:35:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 44217 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3CCBC21513 for ; Tue, 3 Feb 2015 11:36:09 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id u56sf20376277wes.2 for ; Tue, 03 Feb 2015 03:36:08 -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=OwDScWbw12V0KQwvYHu0LQy5w4Rt5IOekS/mLGwJcOlSs7yq05aztH9VFyi5CTQsBg m4OVThcnww+YdZhxNTTnavNNLCsuyZjrHf49Nl8taadVrygjqp0vPT4o0lJIwkuhe5sA jeD0P7J8rh4kxrB+xXOVLKzz75DQaXuRMNkv9aMvr9yhxcwux77WvL60reg1nKC67Xny CaWrirq/2h3yFwDFZ4ogh7jCUe6wnAFUJm22fRXMrJYPFIqJbK8iqvc4GaJodN6vX3FY elVQYfXYIrFe4uewKhgHdI7ue2fspQlRDNDk8VwYD8WCF4e/JqcMg1s4Qi6vgAczP1ch kPWg== X-Gm-Message-State: ALoCoQlNYJDscdrW5n9QUTKdpWVAlQta0sDOWVSqf8DWl0gArdRAzFSSzGOhGwp9CsFH/VR4Jv29 X-Received: by 10.152.10.65 with SMTP id g1mr1684686lab.5.1422963368507; Tue, 03 Feb 2015 03:36:08 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.113 with SMTP id v17ls179847lal.3.gmail; Tue, 03 Feb 2015 03:36:08 -0800 (PST) X-Received: by 10.112.235.194 with SMTP id uo2mr23449591lbc.57.1422963368289; Tue, 03 Feb 2015 03:36:08 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id z7si16647667laa.64.2015.02.03.03.36.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 03:36:08 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id hs14so50485414lab.9 for ; Tue, 03 Feb 2015 03:36:08 -0800 (PST) X-Received: by 10.152.20.169 with SMTP id o9mr24050199lae.50.1422963368132; Tue, 03 Feb 2015 03:36:08 -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 h5csp1879203lbj; Tue, 3 Feb 2015 03:36:07 -0800 (PST) X-Received: by 10.224.127.6 with SMTP id e6mr4914205qas.42.1422963366686; Tue, 03 Feb 2015 03:36:06 -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 41si28524140qgc.42.2015.02.03.03.36.05 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Feb 2015 03:36:06 -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 1YIblz-0000HD-Vj; Tue, 03 Feb 2015 11:36:03 +0000 Received: from mail-qc0-f176.google.com ([209.85.216.176]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIbln-0000F7-2s for lng-odp@lists.linaro.org; Tue, 03 Feb 2015 11:35:51 +0000 Received: by mail-qc0-f176.google.com with SMTP id c9so34834374qcz.7 for ; Tue, 03 Feb 2015 03:35:46 -0800 (PST) X-Received: by 10.140.84.20 with SMTP id k20mr2688468qgd.45.1422963345907; Tue, 03 Feb 2015 03:35:45 -0800 (PST) Received: from mike-desktop.?.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id e88sm20973034qgf.22.2015.02.03.03.35.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Feb 2015 03:35:45 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Tue, 3 Feb 2015 06:35:25 -0500 Message-Id: <1422963328-31760-3-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422963328-31760-1-git-send-email-mike.holmes@linaro.org> References: <1422963328-31760-1-git-send-email-mike.holmes@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v2 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.215.50 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(); +}