From patchwork Tue Jan 6 20:07:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 42798 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4EFCF2062F for ; Tue, 6 Jan 2015 20:07:52 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gd6sf36735lab.0 for ; Tue, 06 Jan 2015 12:07:50 -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=wN1KUq91nQv6ZsA1XE4i8Ucoc0bExLxal73o4bjOLmE=; b=Jm07ivhFgxhfqIFoZI0m1I+3fsW8KF0mf9Mr0mHbW0bbgDT6ixPuu0vhLIumCFuspj sVe3TTadeaABQZP/SNA5qj5jumt7bKck+rQDyqUfw5spECaWn27Bjkz+JdXdBEI10KYQ bkSYD/Bhl3a8ahIWX2JaPrLRlrWUYOyx7jQqSw+lpgMldsKlFLPxQY6TEa2o2F5DiIMA VxSCLk0uRB4vGY9/WYaf4wNSHJ6mPyMUF0lhcP855z9JlZtOBKcmm9uDduscmaP0Y5LB r1WJ8GSt10a/z4gS7ZaS9Nz4+MTZ+P05mkp06ttDOAMIcZ9dUVSG059CAZhoR1/sYIX/ I7Fg== X-Gm-Message-State: ALoCoQnTghRcPCgg+zauS6vtF80mBevclj5G2snFDCHqcDBAU/XfSYyQBljMI3sNC1GNG+vUUarQ X-Received: by 10.152.2.40 with SMTP id 8mr417821lar.7.1420574870716; Tue, 06 Jan 2015 12:07:50 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.10 with SMTP id lc10ls84259lac.22.gmail; Tue, 06 Jan 2015 12:07:50 -0800 (PST) X-Received: by 10.112.14.6 with SMTP id l6mr103781047lbc.91.1420574870570; Tue, 06 Jan 2015 12:07:50 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id lb3si67535744lab.20.2015.01.06.12.07.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Jan 2015 12:07:50 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id gm9so78368lab.12 for ; Tue, 06 Jan 2015 12:07:50 -0800 (PST) X-Received: by 10.112.84.225 with SMTP id c1mr80594221lbz.22.1420574870463; Tue, 06 Jan 2015 12:07:50 -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.9.200 with SMTP id c8csp1275382lbb; Tue, 6 Jan 2015 12:07:49 -0800 (PST) X-Received: by 10.224.120.8 with SMTP id b8mr146347960qar.36.1420574869030; Tue, 06 Jan 2015 12:07:49 -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 f51si65422545qga.113.2015.01.06.12.07.47 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 06 Jan 2015 12:07:49 -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 1Y8aPp-0006mU-UW; Tue, 06 Jan 2015 20:07:45 +0000 Received: from mail-qg0-f50.google.com ([209.85.192.50]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y8aPY-0006lj-Ks for lng-odp@lists.linaro.org; Tue, 06 Jan 2015 20:07:28 +0000 Received: by mail-qg0-f50.google.com with SMTP id z60so17496961qgd.9 for ; Tue, 06 Jan 2015 12:07:23 -0800 (PST) X-Received: by 10.140.48.105 with SMTP id n96mr123121585qga.17.1420574843390; Tue, 06 Jan 2015 12:07:23 -0800 (PST) Received: from localhost.localdomain ([98.221.136.245]) by mx.google.com with ESMTPSA id u20sm42325261qaj.5.2015.01.06.12.07.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jan 2015 12:07:22 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Tue, 6 Jan 2015 15:07:14 -0500 Message-Id: <1420574834-18901-2-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1420574834-18901-1-git-send-email-mike.holmes@linaro.org> References: <1420574834-18901-1-git-send-email-mike.holmes@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH] api: odp_debug: make ODP_ABORT a weak symbol 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.53 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 Add a weak definition of ODP_ABORT so that it may be overridden by an application. Signed-off-by: Mike Holmes --- platform/linux-generic/include/api/odp_debug.h | 14 ++++++++++++++ platform/linux-generic/include/api/odp_hints.h | 5 +++++ platform/linux-generic/include/odp_debug_internal.h | 4 ++-- platform/linux-generic/odp_weak.c | 5 +++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/platform/linux-generic/include/api/odp_debug.h b/platform/linux-generic/include/api/odp_debug.h index a4ce1d9..dd4eb89 100644 --- a/platform/linux-generic/include/api/odp_debug.h +++ b/platform/linux-generic/include/api/odp_debug.h @@ -12,6 +12,7 @@ #ifndef ODP_DEBUG_H_ #define ODP_DEBUG_H_ +#include #ifdef __cplusplus extern "C" { @@ -75,6 +76,19 @@ typedef enum odp_log_level { */ extern int odp_override_log(odp_log_level_e level, const char *fmt, ...); +/** + * ODP abort function + * + * Where a fatal event can be identified within the ODP implementation an + * ODP_ASSERT may used which can be controlled via ODP_DEBUG. In cases where + * an abort must always be called ODP_ABORT may be called directly. In + * both cases these macros will call odp_override_abort + * ODP platform MUST provide a default *weak* implementation of this function. + * Application MAY override the function if needed by providing a strong + * function. + * @note This function must never return. + */ +extern void odp_override_abort(void) ODP_NORETURN; /** diff --git a/platform/linux-generic/include/api/odp_hints.h b/platform/linux-generic/include/api/odp_hints.h index 7f04886..7eb9e36 100644 --- a/platform/linux-generic/include/api/odp_hints.h +++ b/platform/linux-generic/include/api/odp_hints.h @@ -32,6 +32,11 @@ extern "C" { #define ODP_WEAK_SYMBOL __attribute__((__weak__)) /** + * Function never returns + */ +#define ODP_NORETURN __attribute__((__noreturn__)) + +/** * Hot code section */ #define ODP_HOT_CODE __attribute__((__hot__)) diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h index f6180d1..bbbe591 100644 --- a/platform/linux-generic/include/odp_debug_internal.h +++ b/platform/linux-generic/include/odp_debug_internal.h @@ -53,7 +53,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) /** @@ -85,7 +85,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 fccbc3f..ce87119 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(); +}