From patchwork Thu May 19 07:20:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 68104 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp3043101qge; Thu, 19 May 2016 00:21:00 -0700 (PDT) X-Received: by 10.50.4.101 with SMTP id j5mr1763676igj.8.1463642460015; Thu, 19 May 2016 00:21:00 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id k4si23404945igp.11.2016.05.19.00.20.59; Thu, 19 May 2016 00:21:00 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 622D3616D6; Thu, 19 May 2016 07:20:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5F6BD61661; Thu, 19 May 2016 07:20:55 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id CB2BC61697; Thu, 19 May 2016 07:20:52 +0000 (UTC) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) by lists.linaro.org (Postfix) with ESMTPS id D6DF261645 for ; Thu, 19 May 2016 07:20:51 +0000 (UTC) Received: by mail-lf0-f54.google.com with SMTP id y84so30408971lfc.0 for ; Thu, 19 May 2016 00:20:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=gyEmgd21d45sHb/Xrui2IyqL5NPyQ+6502cAe8Xn2io=; b=UZggEMtEyhHqdGgj9wifWpG98hqo7XkDLXFoyjGuCNM1R/MiC9gzMM0nOWXaDntGRP IsGMwnp3oEV4BQJtHWuFQbqln9lA8GRwsCMnFgaOrxdD1xdZO3PmaNjJINlbhn0OEC2b snz/BH9PgR5EQv2ATi055lkpYVw4+wM3ylbhuSnn0tP/PO9uW1mXdS7C/zZ7riJvA7BB +QSuxEtA5gLB8LxBeHQmsjoiQQUeWAQ7B5FYF+O4W36URf+7Vkrr0f4UseAE+FY7qRxf OnaphCqTQMlsUSRd3NmS3h+fzRRuPhShYQ5/FRmNx0HR5NGgtmxm4TNmPbdtYwkaWdI7 EMRQ== X-Gm-Message-State: AOPr4FUylaXc5HhLzeL1MEsWGfIsEq6LtynSSOc7OnERYk5jKTQ8ZAixMjNf3P+AiWAWwVDfhH8= X-Received: by 10.25.83.82 with SMTP id h79mr3940271lfb.138.1463642450558; Thu, 19 May 2016 00:20:50 -0700 (PDT) Received: from localhost.localdomain (ppp91-77-173-31.pppoe.mtu-net.ru. [91.77.173.31]) by smtp.gmail.com with ESMTPSA id f129sm567758lff.10.2016.05.19.00.20.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 May 2016 00:20:49 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 19 May 2016 10:20:33 +0300 Message-Id: <1463642433-3104-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.7.1.250.gff4ea60 X-Topics: timers patch Subject: [lng-odp] [PATCHv2] linux-generic: timer: disable 128 bit timer optimization for clang X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" Fix compilation error for clang: In function `_odp_atomic_u128_xchg_mm': undefined reference to `__atomic_exchange' Clang less than 3.6 has issue with defined _SIZEOF_INT128_ and __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 but not supported __atomic_exchange(). This patch adds additional check for clang version. Signed-off-by: Maxim Uvarov Reviewed-by: Bill Fischofer --- v2: add check for clang version platform/linux-generic/include/odp_atomic_internal.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/platform/linux-generic/include/odp_atomic_internal.h b/platform/linux-generic/include/odp_atomic_internal.h index 3c5606c..67e8f82 100644 --- a/platform/linux-generic/include/odp_atomic_internal.h +++ b/platform/linux-generic/include/odp_atomic_internal.h @@ -589,12 +589,21 @@ static inline void _odp_atomic_flag_clear(_odp_atomic_flag_t *flag) /* Check if target and compiler supports 128-bit scalars and corresponding * exchange and CAS operations */ -/* GCC on x86-64 needs -mcx16 compiler option */ +/* GCC/clang on x86-64 needs -mcx16 compiler option */ #if defined __SIZEOF_INT128__ && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 -/** Preprocessor symbol that indicates support for 128-bit atomics */ +#if defined(__clang__) + +#if ((__clang_major__ * 100 + __clang_minor__) >= 306) +#define ODP_ATOMIC_U128 +#endif + +#else /* gcc */ #define ODP_ATOMIC_U128 +#endif +#endif +#ifdef ODP_ATOMIC_U128 /** An unsigned 128-bit (16-byte) scalar type */ typedef __int128 _uint128_t;