Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp170788lqb; Tue, 4 Jun 2024 08:09:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXV+Jq012I7kce9w+YHi19bUEgJ5JBKtcnwoczkL7VVatnJph/jBH1Td7yT7xKcJoKbD0hWj4EX//Ei1dBTWcw++lQMyHWTev5eOOEeeQ== X-Google-Smtp-Source: AGHT+IHAymSEfEOJzmAVFlXT9/1VAeeQEUDg/aGsrAWg6ls1rVe3kmub2roED6iJ+VTC00YnsHJR X-Received: by 2002:a05:6e02:1d1d:b0:374:aba7:741a with SMTP id e9e14a558f8ab-374aba77a66mr20881065ab.17.1717513744879; Tue, 04 Jun 2024 08:09:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717513744; cv=pass; d=google.com; s=arc-20160816; b=GfpU9QUbq7L916IAgNAPGDMJm2AxwhGHfbFSoFKC5TlqYwBywYHNV1EPLbNuprf+R8 hxyxq7Z8sCkBq3hNoZlQbwJQEwhElUaR/wnaMr8gZKWNtkbnBfrxluFiSE5tkDTXPmRZ p2/nPzSk7yeB8mVwTr+9I/3Mpe1zwVwTc9O0XJkIktL4Tlm/jPWaMMrhJN4YRHeR67H3 CBUIh9wb/srvagytznQH7YZL3Ea1ZxB4N5Cs1sRVcxjPkydFCtTxkdiIVZl9zHgGzQ/V OkzER4v3J2dW+uzbiGoeP7stXW2X8+NqwFEQIUi307ZmROhRKJfYbpSLmbsFu6AGuNEB Pw4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=AnIZJ/yWjsij99MVsLXKK3ehy4rSZo426AsVl+7z5TI=; fh=Y9HqG0YrOJPATcZsRki4hKmNcvfJk7+q9o4IDfRhedM=; b=kntaM6hks5GnKzacQBjyBY9OEZ7EH/vgqK1tHfVftuxbvdMbpWIG3puNwj3hWqWxHQ m9IvU08RHbWtPxrFI/OGCS2Luqp58jLDjNnFqtCwWxdwZhk0xZUjWHZcZUaOVnZ1gLLN xF+YD5IgULU/m+xoggAdArrnszahvnqpeGUiAqqGuJxUNz2Z3pmZWHTwgzmf1zNJcUPI sQlb6T+4v8SIdax3Yf1/Ldd1fSIlVwf7M+eE1y5xgMOu8d3f1ydPlLjGyMYkqNdG9ChY 8vy7x97EHUs9cFtVv2bg2T9vPuuWR1A9zAl/UO2AlwmuP3uUnikn1z2HhJ2L3luLMU3l Ylpg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=XPkOJh9F; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-200925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35b223047si8123051a12.525.2024.06.04.08.09.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 08:09:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=XPkOJh9F; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-200925-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 454FD282EB7 for ; Tue, 4 Jun 2024 15:08:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8AB0913D531; Tue, 4 Jun 2024 15:08:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b="XPkOJh9F" Received: from xry111.site (xry111.site [89.208.246.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E0D0C13B for ; Tue, 4 Jun 2024 15:08:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.208.246.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717513708; cv=none; b=lw7YYrXBZLoNjMjXKecb/yPfjrKgUaN+5h53l1L6o33rTqdBHpURJ74dVGT9MvKMSLeqsEh9cs14s4sryQfnbsggzbZ8qzvMRzgXdbWCv1Oj70mnI1SuoAE16GIml7QpQ7t77Iox+71vBwWsGTDp5RvRPn7qVPqWvPx0ZC7v/0I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717513708; c=relaxed/simple; bh=l+dy70sDHZRUGv472okJcpGybgCB3YYbbShGSa334AE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EW9tMCdD9WA78EHkqkVRiK6Af+Kf31/0V/tAZjcbSvIfOTazEoew3N9+p7gdglZ8ix2XTNpdsEoEHB5gmhw9aQFNLsos2ORB1PduvJyht23AlKipB1KPRmPmu006OG3q8rBbWbYrUoHBMfQVfQLRXEZ2cr63WnZz//DtrkJxHKM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site; spf=pass smtp.mailfrom=xry111.site; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b=XPkOJh9F; arc=none smtp.client-ip=89.208.246.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1717513694; bh=l+dy70sDHZRUGv472okJcpGybgCB3YYbbShGSa334AE=; h=From:To:Cc:Subject:Date:From; b=XPkOJh9FSsEt9Ma5ALXJ5TT5tCLPOIr96QoVoqvptlVowV6iJLvqTrhl90/q6GFm5 L8lEH66gDtHyMSfNJ2ve+1co7mb+cDXLP6cpEvmA9sJSg8Y++koepPSf1lA4WFG4T4 JnOafEoX1iQEpSgb07q3Sqiwnm6Z2JKhbWwJWKCQ= Received: from stargazer.. (unknown [IPv6:240e:457:1110:1471:fd75:6c0d:bd6f:6068]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 1C37E67245; Tue, 4 Jun 2024 11:08:00 -0400 (EDT) From: Xi Ruoyao To: Huacai Chen , WANG Xuerui , Tiezhu Yang Cc: Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Youling Tang , Jinyang He , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, mengqinggang@loongson.cn, cailulu@loongson.cn, wanglei@loongson.cn, luweining@loongson.cn, Yujie Liu , Heng Qi , Tejun Heo , Xi Ruoyao Subject: [PATCH] loongarch: Only select HAVE_OBJTOOL and allow ORC unwinder if the inline assembler supports R_LARCH_{32,64}_PCREL Date: Tue, 4 Jun 2024 23:07:41 +0800 Message-ID: <20240604150741.30252-1-xry111@xry111.site> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit GAS <= 2.41 does not support generating R_LARCH_{32,64}_PCREL for "label - ." and it generates R_LARCH_{ADD,SUB}{32,64} pairs instead. objtool cannot handle R_LARCH_{ADD,SUB}{32,64} pair in __jump_table (static key implementation) and etc. so it will produce some warnings. This is causing the kernel CI systems to complain everywhere. For GAS we can check if -mthin-add-sub option is available to know if R_LARCH_{32,64}_PCREL are supported. For Clang, we require Clang >= 18 and Clang >= 17 already supports R_LARCH_{32,64}_PCREL, so we can always assume Clang is fine for objtool. Note that __jump_table is not generated by the compiler so -fno-jump-table is completely irrelevant for this issue. Fixes: cb8a2ef0848c ("LoongArch: Add ORC stack unwinder support") Closes: https://lore.kernel.org/loongarch/Zl5m1ZlVmGKitAof@yujie-X299/ Closes: https://lore.kernel.org/loongarch/ZlY1gDDPi_mNrwJ1@slm.duckdns.org/ Closes: https://lore.kernel.org/loongarch/1717478006.038663-1-hengqi@linux.alibaba.com/ Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=816029e06768 Link: https://github.com/llvm/llvm-project/commit/42cb3c6346fc Signed-off-by: Xi Ruoyao --- arch/loongarch/Kconfig | 5 ++++- arch/loongarch/Kconfig.debug | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index e38139c576ee..e461a6c59f15 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -143,7 +143,7 @@ config LOONGARCH select HAVE_LIVEPATCH select HAVE_MOD_ARCH_SPECIFIC select HAVE_NMI - select HAVE_OBJTOOL if AS_HAS_EXPLICIT_RELOCS + select HAVE_OBJTOOL if AS_HAS_EXPLICIT_RELOCS && AS_HAS_THIN_ADD_SUB select HAVE_PCI select HAVE_PERF_EVENTS select HAVE_PERF_REGS @@ -273,6 +273,9 @@ config AS_HAS_LBT_EXTENSION config AS_HAS_LVZ_EXTENSION def_bool $(as-instr,hvcl 0) +config AS_HAS_THIN_ADD_SUB + def_bool $(cc-option,-Wa$(comma)-mthin-add-sub) || CC_IS_CLANG + menu "Kernel type and options" source "kernel/Kconfig.hz" diff --git a/arch/loongarch/Kconfig.debug b/arch/loongarch/Kconfig.debug index 98d60630c3d4..8b2ce5b5d43e 100644 --- a/arch/loongarch/Kconfig.debug +++ b/arch/loongarch/Kconfig.debug @@ -28,6 +28,7 @@ config UNWINDER_PROLOGUE config UNWINDER_ORC bool "ORC unwinder" + depends on HAVE_OBJTOOL select OBJTOOL help This option enables the ORC (Oops Rewind Capability) unwinder for -- 2.45.2