Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1007507rdb; Fri, 2 Feb 2024 10:24:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvBxMNbyPqpDngZ/o2uGgz8DQNGkBHTulSuyOprVw5YYZgG03xvN+fFMZPzcdgDh5/faGf X-Received: by 2002:a17:902:6803:b0:1d9:5b4d:6ffe with SMTP id h3-20020a170902680300b001d95b4d6ffemr4332308plk.52.1706898248066; Fri, 02 Feb 2024 10:24:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706898248; cv=pass; d=google.com; s=arc-20160816; b=o1EQhnp6MATwsf5f7eeZt//qNyPDuoMNlOgl14z5+ac6TtI0yDA7YZpFVDmB2Cp4yG qmGsyBncREKd0nMO0p6XoDmAi9+xJ+mcOiWE8reMoN0l748/wSuZLHz3UIOkj4XThxIz xHZ1+dMyjgoz597ITGd62878RJOgfdMZJMnq85JiFDWBiPHlUkoyqW8ivXrkgQMZduTb 1ZAICIUMYuQvz4HTX9rVu8yIUF+547Jo0MH3sXMxAvpUX0a4G5KY8h/EU5B3DoWsSbT5 jHk+9dqwW5ZYJLqkl0WD6ibjTEiMuxWVn+L2dAoKNFxkAvZos7GX8sahY0LG8v1Zomss HhxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:feedback-id:dkim-signature:dkim-signature; bh=emcywIphRaq4Lx/jCRr9GZGkq7nczp4uQNYi6N38LSE=; fh=4xfnzhG2+0Ez4bqCxtPvYzRC6MTM67rpr3vvH43bgvw=; b=Mbmo5ixbywzd0rp76RXL5Xfd0GXrBJ33nQPq1ombYoeWxy5GRftRM0Sl4d+xSf7nwr 6wDC1qg7MqnXmOj/ijbA1YgZgHgtu7lK7ajWzQ45UeMU0RksPeOE1vqXNGV+bwjDZvoA YhpMvpXR2TTtIwht6Y6g84stYNgXVSmFbvH9i4BRL0iMeaxhFImDCnazzo74MeGwBMjV Ax5aH8d9yulLk3z0iIPz0ujfpPSPfZys4SffrOO0EMG+G++1SC3NMsVq14JF2beUIDW6 z4NZsNJ/H8+vPNBlyT5YlCG0j+3Hfs5yARKW5dsVWIiD5Rp3lIwLZUijNG0XBgtJ3orr BVsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=NzM2wZlS; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=cfUC+lbU; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-50310-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50310-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com X-Forwarded-Encrypted: i=1; AJvYcCWFv4IHrjmPqoXYaPEz+OM1Cwh2cPIxtnJjQr8xv/vV5p6pd0gOJrvG8RdM6bdmBHqe1VmyfNUYO7eYLPFlWhT5ofcqnm9fBV1iBXUVeQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ix3-20020a170902f80300b001d8a47ef51esi1985095plb.621.2024.02.02.10.24.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 10:24:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50310-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=@flygoat.com header.s=fm1 header.b=NzM2wZlS; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=cfUC+lbU; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-50310-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50310-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B4C79292036 for ; Fri, 2 Feb 2024 18:23:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E55E91509B1; Fri, 2 Feb 2024 18:22:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="NzM2wZlS"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="cfUC+lbU" Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (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 8A9F415099F; Fri, 2 Feb 2024 18:22:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706898125; cv=none; b=eATd3mG0a3TRYDFw15spMSR991GRXFEV2fdjhBUPjbsVE+5HEDgaawK+k7DbSqA78X7/v7Dlox8NNzcWeFABlRd7Pwq5NS6XfhWNRtWuVt4RoBCE927iwIQovSzsSK1h2bhH4taKXROcKRpmwPISYcQ1xRRCmkWb+sLBK5h6SVg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706898125; c=relaxed/simple; bh=3pIaTRooovaG0E4dcQJ7FyxUskX83he+uJFNra6jZ64=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NYxxgXaZZUmGhse4rJk4+K6GFZd1ahxolmjwNx6Zjs2+x6nI5KSaCp0ENNqtvdYqmeO4UJsvunIx94yMDqawN9utNfY+tJKxU0iRle5tiKv6XEDa8T6YLnshw8te7ICVznteWGKVaawzPbQg4hW7eHQ90HtEsK4i/ykkDKP0bCo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com; spf=pass smtp.mailfrom=flygoat.com; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b=NzM2wZlS; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=cfUC+lbU; arc=none smtp.client-ip=64.147.123.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.west.internal (Postfix) with ESMTP id 077E83200AF4; Fri, 2 Feb 2024 13:22:01 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Fri, 02 Feb 2024 13:22:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1706898121; x=1706984521; bh=emcywIphRaq4Lx/jCRr9GZGkq7nczp4uQNYi6N38LSE=; b= NzM2wZlSP0m2rswR4Bg25pV1/EwYtaRgy4INDUAvQPBMHeigpRFLvP0+ZOtdeHe5 FjAhFX6mVycxh3UXVP00PXuYr0CfFyLCYQcV0LLyn5zAOBYEpAr46mtKBcFUfZAo zt7/bgnsV7Kb2SZM5tvyD6QUhe4a4DpO0tU8QoQojOX3PTgtOF7+2z0do+Wefbnn vV7lAHw8BhoCdPVeoIcn+Pmxho68uIleJWwHSnKOWDKSZ6PMkGLADqb5KPx6PNpP GgC6xCIan/valeLe36nxjJhIqkdh1Eo5U9szUNC2vQEk66lOtuFbcpgmpPYcuGGf bjlBNHM1KLumtA+ix9HkTw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1706898121; x= 1706984521; bh=emcywIphRaq4Lx/jCRr9GZGkq7nczp4uQNYi6N38LSE=; b=c fUC+lbU356dfgiCSoob5VJnSnBsmVYoaIQk9xzs07CI9E2S9ep5syv3yJQaqb7GS uqGhtwi5Xsuw8tnHuLx73Ggq+Ve/m0o+1vs79JHmuOBe0TqaF7zBAKvuluYgIra3 ZNci4v4nRuyFVY+I+HzNyNQmHQF4/2mRuuamkLqelhsQA6cU2t6M8Xnn3LYogSjn MWhR9rD+x4IGyZ3JX2jBMoFLOurs2j56A74JLUXegAskK5HWHir8gHhvTJFFpa79 ASGDOch1h/Q15VEUxetKjena36dvjZqZDtn8iFJuqfrv4BIeZvcEQ7oBCvBfPU6U dCUns01DVTzBi1Lbt1s0w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfedugedguddtlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheplfhi rgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhmqe enucggtffrrghtthgvrhhnpeffveeifeeljeejfeetgfeiueejieffgeeuieegtdekffek geduudduteejleevtdenucffohhmrghinhepghhithhhuhgsrdgtohhmpdhkvghrnhgvlh drohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 2 Feb 2024 13:21:59 -0500 (EST) From: Jiaxun Yang Date: Fri, 02 Feb 2024 18:21:42 +0000 Subject: [PATCH 3/8] MIPS: Fallback CPU -march flag to ISA level if unsupported Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240202-llvm-msym32-v1-3-52f0631057d6@flygoat.com> References: <20240202-llvm-msym32-v1-0-52f0631057d6@flygoat.com> In-Reply-To: <20240202-llvm-msym32-v1-0-52f0631057d6@flygoat.com> To: Thomas Bogendoerfer , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Jiaxun Yang X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=4062; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=3pIaTRooovaG0E4dcQJ7FyxUskX83he+uJFNra6jZ64=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhtS9Rnts7QrWMnn7PVFYoXRr2sJa8bSnH67+32D1YkavW 8sVldwlHaUsDGJcDLJiiiwhAkp9GxovLrj+IOsPzBxWJpAhDFycAjCRrQcZGe6p/Ph06O5q53+i xofyy1Y5RRxXmLWjqcx36s37uTsbdisx/K9S2mThPvWkWE4e26aHNsbee56klf1I5L3g9jNiWcx jOV4A X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 LLVM does not implement some of -march options. However those options are not mandatory for kernel to build for those CPUs. Fallback -march CFLAG to ISA level if unsupported by toolchain so we can get those kernel to build with LLVM. Link: https://github.com/ClangBuiltLinux/linux/issues/1544 Reported-by: Nathan Chancellor Signed-off-by: Jiaxun Yang --- v0: https://lore.kernel.org/all/20230414080701.15503-7-jiaxun.yang@flygoat.com/ v1: Fix SB1 arch level to mips64 --- arch/mips/Makefile | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/arch/mips/Makefile b/arch/mips/Makefile index daa569ca4372..91470931a5b8 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -148,10 +148,10 @@ cflags-y += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,) # # CPU-dependent compiler/assembler options for optimization. # -cflags-$(CONFIG_CPU_R3000) += -march=r3000 -cflags-$(CONFIG_CPU_R4300) += -march=r4300 -Wa,--trap -cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap -cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap +cflags-$(CONFIG_CPU_R3000) += $(call cc-option,-march=r3000,-march=mips1) +cflags-$(CONFIG_CPU_R4300) += $(call cc-option,-march=r4300,-march=mips3) -Wa,--trap +cflags-$(CONFIG_CPU_R4X00) += $(call cc-option,-march=r4600,-march=mips3) -Wa,--trap +cflags-$(CONFIG_CPU_TX49XX) += $(call cc-option,-march=r4600,-march=mips3) -Wa,--trap cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,--trap cflags-$(CONFIG_CPU_MIPS32_R5) += -march=mips32r5 -Wa,--trap -modd-spreg @@ -160,26 +160,30 @@ cflags-$(CONFIG_CPU_MIPS64_R1) += -march=mips64 -Wa,--trap cflags-$(CONFIG_CPU_MIPS64_R2) += -march=mips64r2 -Wa,--trap cflags-$(CONFIG_CPU_MIPS64_R5) += -march=mips64r5 -Wa,--trap cflags-$(CONFIG_CPU_MIPS64_R6) += -march=mips64r6 -Wa,--trap -cflags-$(CONFIG_CPU_P5600) += -march=p5600 -Wa,--trap -modd-spreg -cflags-$(CONFIG_CPU_R5000) += -march=r5000 -Wa,--trap -cflags-$(CONFIG_CPU_R5500) += $(call cc-option,-march=r5500,-march=r5000) \ +cflags-$(CONFIG_CPU_P5600) += $(call cc-option,-march=p5600,-march=mips32r5) \ + -Wa,--trap -modd-spreg +cflags-$(CONFIG_CPU_R5000) += $(call cc-option,-march=r5000,-march=mips4) \ -Wa,--trap -cflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=r5000) \ +cflags-$(CONFIG_CPU_R5500) += $(call cc-option,-march=r5500,-march=mips4) \ -Wa,--trap -cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \ +cflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=mips4) \ -Wa,--trap -cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-march=sb1,-march=r5000) \ +cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=mips4) \ + -Wa,--trap +cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-march=sb1,-march=mips64) \ -Wa,--trap cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mdmx) cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mips3d) -cflags-$(CONFIG_CPU_R10000) += $(call cc-option,-march=r10000,-march=r8000) \ +cflags-$(CONFIG_CPU_R10000) += $(call cc-option,-march=r10000,-march=mips4) \ -Wa,--trap cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += -march=octeon -Wa,--trap cflags-$(CONFIG_CAVIUM_CN63XXP1) += -Wa,-mfix-cn63xxp1 cflags-$(CONFIG_CPU_BMIPS) += -march=mips32 -Wa,-mips32 -Wa,--trap -cflags-$(CONFIG_CPU_LOONGSON2E) += -march=loongson2e -Wa,--trap -cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f -Wa,--trap +cflags-$(CONFIG_CPU_LOONGSON2E) += \ + $(call cc-option,-march=loongson2e,-march=mips3) -Wa,--trap +cflags-$(CONFIG_CPU_LOONGSON2F) += \ + $(call cc-option,-march=loongson2f,-march=mips3) -Wa,--trap # Some -march= flags enable MMI instructions, and GCC complains about that # support being enabled alongside -msoft-float. Thus explicitly disable MMI. cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call cc-option,-mno-loongson-mmi) -- 2.43.0