From patchwork Wed Jan 31 06:53:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fangrui Song X-Patchwork-Id: 13538786 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4081C47258 for ; Wed, 31 Jan 2024 06:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: Mime-Version:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=YIyN5ABaMiVlitM8WxzGDEdF78QSgsXPE9Eh/eoXi4A=; b=lKo aWxbEeeEurXe7pXQBzMiXpCMMNwYg0jrH47ctTwalmr0rokOakLlQetpTwV4pn57tRYJfm+i1AQCy 6jpXGcBvxnV19wM2z0WOm6OA5u4fqnccpa2X6tWyc0XKkmqYL5Rh7nwOIW7X6SyGPz0+h0emoIryY ZYL2Fk0shH+YG68ZYWZ+BdiFpnFoPzYpEuZZktmbYTZ3ivOl0q1Cxgf/k9HhiM1AGBKPqb9Hg3CcZ lPkEPxCm08on4B93MRnwjpm//85mQlTAzaMLhv4du5YBv3fLRO8c96s+Duay1bMqcLRE1TBBmXpfG uwiwk2ymV2Zqj0hnnsKdrqIBok6c69w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rV4Th-00000001heq-0bYS; Wed, 31 Jan 2024 06:53:45 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rV4Te-00000001heW-3cMr for linux-arm-kernel@lists.infradead.org; Wed, 31 Jan 2024 06:53:44 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-dc604c99e95so5588904276.1 for ; Tue, 30 Jan 2024 22:53:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706684021; x=1707288821; darn=lists.infradead.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=8dMZ3OwOckg/8nEeQlzzg6EqDAiFIDc7gYYU0A2bM1c=; b=3TjfZasiALaC0RIx1YwvV8ahSAvnF2u4V/NclliLFewxKjiZgJ+/xSgpM+zIx1ToNY BHwkUcTPMTn5GWac2x+teCplPHqQtOW1fwxy4M+bGdrL0Xs7TNqDojNnexnQYBrK9cHQ eLM79zGZaU5OZy0rx2b6wW6n17Oujgy44M2QVWdRtu2tcjM+JORjuEAVMqCtEqJPM0wZ 0vBisnDqP5YNf8M8UChJnxP/xdTy3Tr7GwDY/vhRdAdwPowyG3gVB9R5pyLX8gJ1XMwB Ww19Y1Nv6Y8m1lv9HvhPuHdHmn8a4Ccuci8k1bWlNGz0eOg2FHocwk/KEmvRRShy9a87 l5cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706684021; x=1707288821; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=8dMZ3OwOckg/8nEeQlzzg6EqDAiFIDc7gYYU0A2bM1c=; b=YQHN9JLp1UScpwo0E+TEyBBr4pkZV3ecURDLdI6adIQmA4tlp7HWoHP1VIdUHmAX9W PP7tYe0MQH3mvxRd1oCeXB8tDXSapUNGr6zNQg35ATxSrYgmSqHiFhksYtKjgJ1p/5P7 X7FozWgknLZV+mFiMi91pY0mylV8KCiVlBplgXRQtypnqu0TSM10JW3Oo48OyZedKsF+ sDKoRdhHwcQ4bRsrUL7v9XeJv3oUfBo+Q9h6W8v+vtCdcGgRfsiKWiFjDloyaYOjTi9g /fEbir7QSex//EVHRvZr5jxu0urBGImCmSyr7GaWGpdVkFdGvFp76NjrAXC5SorenI50 pYEQ== X-Gm-Message-State: AOJu0YzJuu6rUC+MW3GS3mVpg6YYGYC+HuvIBY/nEgqEZYqf3ocpMJlN pTN8if+EH11RFWwu+0svTkZ4wVxCdAA62AdJrCRHUFMnlUnF/bp+ebZZuBT44cJNNlE0RLtVOHC O4DF9VA== X-Google-Smtp-Source: AGHT+IHYBZ61Hkmf065FzDbmISs1w+H1s+kPtfBvIanyUT0Z/nhLrWER1j7n3G0iOTAUij8aXk2uZrIboMe4 X-Received: from maskray.svl.corp.google.com ([2620:15c:2d3:205:bc85:d604:bdab:a3ed]) (user=maskray job=sendgmr) by 2002:a05:6902:1188:b0:dbe:30cd:8fcb with SMTP id m8-20020a056902118800b00dbe30cd8fcbmr35684ybu.0.1706684020985; Tue, 30 Jan 2024 22:53:40 -0800 (PST) Date: Tue, 30 Jan 2024 22:53:22 -0800 Mime-Version: 1.0 Message-ID: <20240131065322.1126831-1-maskray@google.com> Subject: [PATCH] arm64: jump_label: use constraint "S" instead of "i" From: Fangrui Song To: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org Cc: Jisheng Zhang , Ard Biesheuvel , llvm@lists.linux.dev, linux-kernel@vger.kernel.org, Fangrui Song X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_225342_921035_E21462CE X-CRM114-Status: UNSURE ( 9.47 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The constraint "i" seems to be copied from x86 (and with a redundant modifier "c"). It works with -fno-PIE but not with -fPIE/-fPIC in GCC's aarch64 port. The constraint "S", which denotes a symbol reference (e.g. function, global variable) or label reference, is more appropriate, and has been available in GCC since 2012 and in Clang since 7.0. Signed-off-by: Fangrui Song Link: https://maskray.me/blog/2024-01-30-raw-symbol-names-in-inline-assembly --- arch/arm64/include/asm/jump_label.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/jump_label.h b/arch/arm64/include/asm/jump_label.h index 48ddc0f45d22..31862b3bb33d 100644 --- a/arch/arm64/include/asm/jump_label.h +++ b/arch/arm64/include/asm/jump_label.h @@ -23,9 +23,9 @@ static __always_inline bool arch_static_branch(struct static_key * const key, " .pushsection __jump_table, \"aw\" \n\t" " .align 3 \n\t" " .long 1b - ., %l[l_yes] - . \n\t" - " .quad %c0 - . \n\t" + " .quad %0 - . \n\t" " .popsection \n\t" - : : "i"(&((char *)key)[branch]) : : l_yes); + : : "S"(&((char *)key)[branch]) : : l_yes); return false; l_yes: @@ -40,9 +40,9 @@ static __always_inline bool arch_static_branch_jump(struct static_key * const ke " .pushsection __jump_table, \"aw\" \n\t" " .align 3 \n\t" " .long 1b - ., %l[l_yes] - . \n\t" - " .quad %c0 - . \n\t" + " .quad %0 - . \n\t" " .popsection \n\t" - : : "i"(&((char *)key)[branch]) : : l_yes); + : : "S"(&((char *)key)[branch]) : : l_yes); return false; l_yes: