From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: [PATCH] eal/x86: fix clang build with -O0 Date: Fri, 3 Jun 2016 10:15:23 +0200 Message-ID: <1464941723-18154-1-git-send-email-thomas.monjalon@6wind.com> Cc: Damjan Marion To: dev@dpdk.org Return-path: Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id 91C562BBD for ; Fri, 3 Jun 2016 10:15:28 +0200 (CEST) Received: by mail-wm0-f48.google.com with SMTP id a136so264160131wme.0 for ; Fri, 03 Jun 2016 01:15:28 -0700 (PDT) List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Damjan Marion Clang seems to have a bug with asm inside inline function rte_xabort(): rte_rtm.h:56:15: error: invalid operand for inline asm constraint 'i' asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); ^ It is seen only when building with EXTRA_CFLAGS=-O0. The workaround is to replace the inline function by a macro. Fixes: ba7468997ea6 ("spinlock: add HTM lock elision for x86") Signed-off-by: Damjan Marion Signed-off-by: Thomas Monjalon --- lib/librte_eal/common/include/arch/x86/rte_rtm.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/librte_eal/common/include/arch/x86/rte_rtm.h b/lib/librte_eal/common/include/arch/x86/rte_rtm.h index d935641..0649f79 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_rtm.h +++ b/lib/librte_eal/common/include/arch/x86/rte_rtm.h @@ -50,11 +50,10 @@ void rte_xend(void) asm volatile(".byte 0x0f,0x01,0xd5" ::: "memory"); } -static __attribute__((__always_inline__)) inline -void rte_xabort(const unsigned int status) -{ - asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); -} +/* not an inline function to workaround a clang bug with -O0 */ +#define rte_xabort(status) do { \ + asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); \ +} while (0) static __attribute__((__always_inline__)) inline int rte_xtest(void) -- 2.7.0