Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp1426645imb; Sat, 2 Mar 2019 15:10:03 -0800 (PST) X-Google-Smtp-Source: APXvYqzTiowS+E29MLc1Mkm1jm8VwEX7FyfjImzR5v1vhiyCqhOnGb1QtkjDtACa0jM+DMYGapxx X-Received: by 2002:a65:620f:: with SMTP id d15mr11724383pgv.112.1551568203073; Sat, 02 Mar 2019 15:10:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551568203; cv=none; d=google.com; s=arc-20160816; b=s/Qlqtw0Ne6Kx+Wr05La6kmrB02CP0i/reqam6c7L/maJVQ6wLA1APvhe7CuuCUM5L 8b+bJ1VivYJG4mHf4fgnfCMaNexO9wpIQuyGX6aCStODE/6v5iUoQ8POfqIlMtZnzibE 3IbKRslvTUpehvp78U1LNSi29s6mFs0kKahtCs665j1q6f1Es5fnIppCsj5ShNrzSCzC u5C7duGzRwJteks4EsxoWUWuqrZnSIpOGWuuKpo7VXJNmjUaUprJhQ/hMDBKLDPbPFAq d9IFWKczpcqVScPYe8mRiMr5+Bfwgir3P3DmDDVbaylp41U+A6BodZImaH4DcOec3DPA Wg2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=DFt2kZHnj0NjV7f4nRSfqhXB8i9yVn0VsTHIdlAvBNw=; b=HLfCnZJa13P8q4r7twsbx3C+vtul8qC/xsqNgxjecRRPhqQZm0OGZpJkysunruNHer g9pjsMA1/VlZ8g56PEdbjS1GpmqUH6FJ4GfMSZZUr5PpHO+3ZAAFrsWSN80alcoUwfMS MLKS3KpDRhnWdK8XMXshYzNP2yFPSIcxa/EsJb8ic5mfxkLU9IneVnjzC5Vf/8pogfIl jrzc12w0lOQhwxZTVhVU//fllkiGZrol/L7HXnpS0tGo5Yf+npVfwUmFxu5JP/a/fTmL 9IsXPtbWgoOH0FWAwlQpylrhg7gCLMy1ZDQvVtHAQgbKCNes/ChoH7gjOpZKSUfx6NP5 L+UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=wZXidubZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r15si1530591pgv.389.2019.03.02.15.09.48; Sat, 02 Mar 2019 15:10:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=wZXidubZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727099AbfCBXHl (ORCPT + 99 others); Sat, 2 Mar 2019 18:07:41 -0500 Received: from mail.kmu-office.ch ([178.209.48.109]:42846 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726529AbfCBXHj (ORCPT ); Sat, 2 Mar 2019 18:07:39 -0500 Received: from zyt.lan (unknown [IPv6:2a02:169:3465:0:5054:ff:fe4f:85bd]) by mail.kmu-office.ch (Postfix) with ESMTPSA id CD0315C0086; Sun, 3 Mar 2019 00:07:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1551568056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=DFt2kZHnj0NjV7f4nRSfqhXB8i9yVn0VsTHIdlAvBNw=; b=wZXidubZ0WNTMII8zWEizaC8kqKKWFG3Y3KvvQFRHhYEg+U2Ft0HY5Rb3XLW806S8mvVf/ O+jsdV4AS2trY/K4mJ1VqGkD0wwXpmYBv+/Gry9D8jU33capxMntlvgGEEMUkNHycc7k7j WpIzwAPymhQKK14ifUr2EC/YQMm0elA= From: Stefan Agner To: linux@armlinux.org.uk Cc: ndesaulniers@google.com, natechancellor@gmail.com, arnd@arndb.de, ard.biesheuvel@linaro.org, nicolas.pitre@linaro.org, thierry.reding@gmail.com, will.deacon@arm.com, julien.thierry@arm.com, mark.rutland@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stefan Agner Subject: [PATCH 1/2] ARM: add TUSERCOND() macro for conditional postfix Date: Sun, 3 Mar 2019 00:08:18 +0100 Message-Id: <1ed0a317c3e9ae1cdd1b05fad5e1bd13a58a9036.1551567941.git.stefan@agner.ch> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unified assembly syntax requires conditionals to be postfixes. TUSER() currently only takes a single argument which then gets appended t (with translation) on every instruction. This fixes a build error when using LLVM's integrated assembler: In file included from kernel/futex.c:72: ./arch/arm/include/asm/futex.h:116:3: error: invalid instruction, did you mean: strt? "2: " TUSER(streq) " %3, [%4]\n" ^ :5:4: note: instantiated into assembly here 2: streqt r2, [r4] ^~~~~~ Additionally, for GCC ".syntax unified" for inline assembly. When compiling non-Thumb2 GCC always emits a ".syntax divided" at the beginning of the inline assembly which makes the assembler fail. Since GCC 5 there is the -masm-syntax-unified GCC option which make GCC assume unified syntax asm and hence emits ".syntax unified" even in ARM mode. However, the option is broken since GCC version 6 (see GCC PR88648 [1]). Work around by adding ".syntax unified" as part of the inline assembly. [0] https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html#index-masm-syntax-unified [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88648 Signed-off-by: Stefan Agner --- arch/arm/include/asm/domain.h | 6 ++++-- arch/arm/include/asm/futex.h | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h index 99d9f630d6b6..1888c2d15da5 100644 --- a/arch/arm/include/asm/domain.h +++ b/arch/arm/include/asm/domain.h @@ -133,9 +133,11 @@ static inline void modify_domain(unsigned dom, unsigned type) { } * instructions (inline assembly) */ #ifdef CONFIG_CPU_USE_DOMAINS -#define TUSER(instr) #instr "t" +#define TUSER(instr) TUSERCOND(instr, ) +#define TUSERCOND(instr, cond) #instr "t" #cond #else -#define TUSER(instr) #instr +#define TUSER(instr) TUSERCOND(instr, ) +#define TUSERCOND(instr, cond) #instr #cond #endif #else /* __ASSEMBLY__ */ diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h index 0a46676b4245..83c391b597d4 100644 --- a/arch/arm/include/asm/futex.h +++ b/arch/arm/include/asm/futex.h @@ -110,10 +110,11 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, preempt_disable(); __ua_flags = uaccess_save_and_enable(); __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n" + " .syntax unified\n" "1: " TUSER(ldr) " %1, [%4]\n" " teq %1, %2\n" " it eq @ explicit IT needed for the 2b label\n" - "2: " TUSER(streq) " %3, [%4]\n" + "2: " TUSERCOND(str, eq) " %3, [%4]\n" __futex_atomic_ex_table("%5") : "+r" (ret), "=&r" (val) : "r" (oldval), "r" (newval), "r" (uaddr), "Ir" (-EFAULT) -- 2.20.1