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: 194513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1711085dyb; Tue, 30 Jan 2024 22:53:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKsy9cjgzq0BO/HPlVygsMfm5muUhmZZz63bC9vmydMvmYDGs6vmYyh11TNEkMCYJkrOCH X-Received: by 2002:a05:620a:2901:b0:785:3e5d:1319 with SMTP id m1-20020a05620a290100b007853e5d1319mr269189qkp.68.1706684038366; Tue, 30 Jan 2024 22:53:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706684038; cv=pass; d=google.com; s=arc-20160816; b=NyJrenyU8lG0/WN5ASCR2ZZIuDp8OgxLWMOIWXXhcVqTtkR1UhAkcpO1tmekkHWJOS xhbteHlVWfZWduyh/Qmq92x7UV1HboO4+Snm5zgIxUvjF0S5XAeMBWLIG90A1vb8WVi2 sng5rf6U6H371rB6uKY1i0qealUPF1TNVThV6quspvlGpozuCwxtOpNI8yPLi+ZDlfFn Bt3JXqhVY4+K19qLEeCUeVMhd7eFLQE0dmLvFC5RbfNjpNDUs+6VJrpa+xx5rucD+9GM cve6pzVsGC0dHKtmCRYNhBgEsAEa7h1YSsfXiFZCuioh0G3/o4triUZZMmIB3+Nnuceu Prlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=8dMZ3OwOckg/8nEeQlzzg6EqDAiFIDc7gYYU0A2bM1c=; fh=gX9740RucBnYm9lw9+WyPTp7iS8dnYUYNTopoqC8aS4=; b=RmrQt3i3EhHQjBDv4AyqN7zVnXBNvwKoiOpqlIRlES87tFr9G2TrLxwQC0+LzFv5gL z9rC8Cd1ovtaUfzzcrit201oOxoTJHYmEz8qtN9RpWeKD2FQuyjYm6/U3CQunW63e9o2 vMfBw+KJJOSHV+vHGXSHGtrhrzwKQ7kiL1w5kb8M8iTnn4+qzNrfnDqeZgq4H2BBwPjq 2w1BJyNwtw9sJ8aoPkyjId+oTcmkaxUPGSHlOZjQ+MTc3M/y7eKSfq6IsMpj5aFIHFvP R9IpS032UidTYOt9mxJ+qzBM76Z/SCl2Cbwqzuyp26XGE4ilAQ/k9yWVn6y2bHMmY0FU Iq2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=tDX0evQ8; arc=pass (i=1 spf=pass spfdomain=flex--maskray.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-45845-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45845-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=1; AJvYcCU+Fx7O+hqsfeAQfg2dWq8BLoueM08Zv5Mue74QDP+C56+Bj7rfEL7gmwZjjOTgFDZGoc61p0G7Tvp1F94dwKJqZpLKwA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bj12-20020a05620a190c00b00783f6341996si8037120qkb.295.2024.01.30.22.53.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 22:53:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45845-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=tDX0evQ8; arc=pass (i=1 spf=pass spfdomain=flex--maskray.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-45845-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45845-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2AF251C268DD for ; Wed, 31 Jan 2024 06:53:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F41FE55782; Wed, 31 Jan 2024 06:53:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="tDX0evQ8" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F00B15102A for ; Wed, 31 Jan 2024 06:53:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706684024; cv=none; b=Sv+aFLCoJgPyRRI0ACC1zdD906h5r4vZVZZ3XBeVkFhkNgujB114NyaBxBiyNKbkGYBC54FmKRCViZ4diN6o429fefjt8fOxUv5r7SUMsA81PZBlbkJiuM6wAGrP4SJwED3CrnWHU/TNMIChZhq1SS+P6/9Gs/TVcz+CO1pBWkc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706684024; c=relaxed/simple; bh=/V9Rglm98djqCs8KSL/PzgVQzNmWOOniqe3fv5n82uk=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=dZI9xzpAAiligrCxxWoIiU7DQDmdtXvf3d5uOs1Iq7Pbbo8gpVXbdzATXByWVXS4GDfu4vDwHMdB867w19Q9gp95lAK34YjhgaSKjcvCMU/iNE+Y+k+RVm98nLcNOPimcHvDuQNfPGKLyol1Vs9EndRW4bv9Ac6kwoiyStOX7HI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--maskray.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=tDX0evQ8; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--maskray.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc6bad01539so723308276.3 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=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=8dMZ3OwOckg/8nEeQlzzg6EqDAiFIDc7gYYU0A2bM1c=; b=tDX0evQ83kB053vtN120fkPeVd6r4wClFnCakaCvMmxq/4Ld3v1MPKauEkC5o8DfYj v4DdRSCDpYm08rvxneWApirhgCH00yH+9HWkSPa+KwKx1Dr6MCmnppYO+oI+GUvyU3DB bY2y4TppWbIw+HJhjRLiF2ILxBmcm8Zzj3Z8H60no4yLXQ/NwUXEFAIUij1yhjFYSB3o i17DSrWVwR6fzTQhB82VFn8hf9ycpCjEiFwkhwHIJYpQ3G853ewWm4HcXRndYQ4nkq52 7BRy7gDEXy8naGL7wakzxsrsg5T+yGuXY68hliBQined/Fq/sFek31VyTvvEV/h07NZK FZhw== 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=gtuk5GhUV2e4iWZxsR42vqGGFrpcWUo96XLJLACFePw/c/V5yhtpMyQStyrjfRfRAG GKCajVkXd49/+2T3hp5yuR8pJjvcS53rvus39D73ckooddiXD6Xpl7vZhCzbQfBQwy0o x3XYXoDsKrgv1zw21lblwzfZq0Zm2SwpGj/g2+4w45S25yYCJIRH9qJu/rb34/KaGwLp 2rIzXtCQC9ZNHGeH0eIp3z2wGmXpzovur+uAAzjyjSO2CKqfFXu3qQw+GJDUMdgl6DB9 ap1BbwwVuUehMSAjGuehbDkNID/vFQJ3Y5Di8f8umwsaPkJ9KoxhmOUtKCy3ii15B1lo RqXg== X-Gm-Message-State: AOJu0Yy/N/mMGBiAA0lyZnKwR7q5E/D6wJDrnjefeGV7fifRKJONtU3g gQ4DEcQcm+eSC0/+ddbKPmV2Bx2IGqS/6TYXDWaw6zVK/6Ant6/eBcIwyEz3lbQzUkBzvfaaCDY tgpgMYQ== 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789587922476133054 X-GMAIL-MSGID: 1789587922476133054 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: