From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (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 ECB9B39A81E for ; Fri, 24 Apr 2026 11:06:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777028797; cv=none; b=UseGAywotUOxaWCL/gta8usJLQ7Tgwt3sy3PJau/b70INvao/AXHneLk/SGJMqHLwmlSNR21Pr4bZFKQ5gcp5hcWqnhQTa0Pvu7Tjr0tRDIArA8RswsoDDtSmevyvvVrPGFI1NycRO9ucCQkIjyVieYc6zOo5BU5FsTtvNRNAZo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777028797; c=relaxed/simple; bh=N4Z9CTh5ZlzdtCFtBp8F5n/nUs8lkwIgEc7rauaLOBo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RpPPk+5p+aLAyD1h/G1j2ENdmY1+ylYtXrKqtMr0P9Jp9rzCd/WnderwEuFpRJ/HwEKDpxlW0epj7PzqeRRz6z4OdjAgFsQ1W8xqUAGWa8jcw7+EFkggTiZikvF+GtZ8ABo/4oESWx1i71h1B0CueGiTWm9yK1i68ldpRF/QDGc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hev.cc; spf=pass smtp.mailfrom=hev.cc; dkim=pass (2048-bit key) header.d=hev-cc.20251104.gappssmtp.com header.i=@hev-cc.20251104.gappssmtp.com header.b=xND02KTT; arc=none smtp.client-ip=209.85.215.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hev.cc Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hev.cc Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=hev-cc.20251104.gappssmtp.com header.i=@hev-cc.20251104.gappssmtp.com header.b="xND02KTT" Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-c795f096fa5so3089870a12.3 for ; Fri, 24 Apr 2026 04:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hev-cc.20251104.gappssmtp.com; s=20251104; t=1777028794; x=1777633594; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LDIZFW/CQm971bNIO9ritpIw0PqXgfmFxiIFHhRqUmo=; b=xND02KTT4GL6OUYB0ikcN6HpEXjO/ZrR2bEkMSmQaU4UatEc353sd3K/3Z7ZQGLx0r xkZ2yd57+22/448m/3xsuMzZ52xZpHJv1+S9UPVf+BUqJNyJiE6a1yFVgi8LNxnuHNF7 lE4OEM8qtA88IE6rPc6ufXY7NvRx6vNjNnTyQ9g7GzLsIAGy9Wub6eZ4Z8270S1rJ4ip BwHjh5uwBDvsgGz8XZDQrh+zaB2sPNx1lGLa0XMuigIRYomeYXspEOtoiIzgJEAMzAKo s9k3P+aUknwVRdGMwggq5yjdvtCcFB1MsIvlCK2+vARJSVgArECIf0nW3I2ss+mwrrkn 7ZjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777028794; x=1777633594; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=LDIZFW/CQm971bNIO9ritpIw0PqXgfmFxiIFHhRqUmo=; b=AKp41rVXz7KvVgWr7NGEHarskXnWPwSVZDDhKwihUh1+g7YSYV6O+52aDcTMqjy+Jf qBXbXibRU2i1lDERd+98Dxi73jv2RwSqrGmkexN+M3AKAzroid0BrhvzDyTIzFZ/ZmfC o6vLDF6D2YBFD0iS04k23/9yZd7vwlI49HkX+eFL+9pp0dk9U3TfoQ5sBo14Cc/5ngVq 7jHQ2L+0heVkA6MbIcOIVVIFfz9XETQISh2cUfHaOXS1wbG7sCGBwBrIJUK88C9lxeKp J+7Fmt0INvCvoyL017ewhwUHZolgy+h9xXjd4V1w2cNXk9CuxPGp06+zU3yrKzumH9eX HAMA== X-Forwarded-Encrypted: i=1; AFNElJ/Ejaw3NlCAuPXoA2o/03nzdAJwnYrES0U+XOnNSkkBKJ7v8kuPEHYLsh0KaKRxOrn4PY4urDGc42bntRc=@vger.kernel.org X-Gm-Message-State: AOJu0Yy297e/hT9B5WqX13sf9HE8x817u5QZaY/bdglXGRW8++UVpjXq KzBmUzMa3pO9etlSI2ZRFYJOtSqijhyO+O7z1z6dR+nTCym5NKtteIn/zFTLBOYboc0= X-Gm-Gg: AeBDieuNVs7LrCNgAk+uYJo2wRJ2QZxP4RlBehKgdUBBB106Nki3GVXgeWiKLNHGU++ nNKVor7dwC+wZEzBzwf3QIelH+rN6J7JvGXfsqhaxJW8JGPbI4P+8OQhclP7HSbcG0WXB6H3+xK 6ayW9ubgH+hcwrmO4EwOT3jAnx+L5A0DPLtGIUoXXOUb/LSlwBrJFiTBNL+9SsccqoUQZIKlcvg tCVWydghQpXA69/rPzz8345kUNmci9YNSAZ0wCE99bgal+upTrvlv99CM9Lc6bnVH4PwIRiMZvz RSewBc5obTiQMMr0i+wbiQC9RLdbf9Qoe8zcHE+JBDFIisd7hypMskStecun9wDOwGEr1ICaA7x VA8EPApJTeE/5tPWrOw5clwxSsAAktrtvmq2EST77IPemxhASmp0uz1h/au3Mx6XTkvUYhviuZs YDkk2Bqx5BzlY= X-Received: by 2002:a17:902:8211:b0:2b2:ed0d:3f47 with SMTP id d9443c01a7336-2b5f9fd5bf9mr231926145ad.39.1777028794151; Fri, 24 Apr 2026 04:06:34 -0700 (PDT) Received: from xpc ([2400:8902:e002:de3c:3085:4d80:3614:2212]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5fab20ae4sm276880115ad.61.2026.04.24.04.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2026 04:06:33 -0700 (PDT) From: WANG Rui To: nathan@kernel.org Cc: arnd@arndb.de, chenhuacai@kernel.org, chenhuacai@loongson.cn, guoren@kernel.org, jiaxun.yang@flygoat.com, kernel@xen0n.name, linux-kernel@vger.kernel.org, lixuefeng@loongson.cn, loongarch@lists.linux.dev, WANG Rui Subject: Re: [PATCH V4 14/14] LoongArch: Adjust build infrastructure for 32BIT/64BIT Date: Fri, 24 Apr 2026 19:06:23 +0800 Message-ID: <20260424110624.48510-1-r@hev.cc> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260423220647.GA3447678@ax162> References: <20260423220647.GA3447678@ax162> 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: 8bit Hi Nathan, >> diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile >> index 8d45b860fe56..47516aeea9d2 100644 >> --- a/arch/loongarch/Makefile >> +++ b/arch/loongarch/Makefile >... >> @@ -62,9 +66,19 @@ ifneq ($(SUBARCH),$(ARCH)) >> endif >> endif >> >> +ifdef CONFIG_32BIT >> +ifdef CONFIG_32BIT_STANDARD >> +ld-emul = $(32bit-emul) >> +cflags-y += -march=la32v1.0 -mabi=ilp32s -mcmodel=normal >> +else # CONFIG_32BIT_REDUCED >> +ld-emul = $(32bit-emul) >> +cflags-y += -march=la32rv1.0 -mabi=ilp32s -mcmodel=normal >> +endif >> +endif > > As a result of the above problem, I see > > clang: error: ignoring '-mabi=ilp32s' as it conflicts with that implied by '-msoft-float' (lp64s) [-Werror,-Woption-ignored] > clang: error: ignoring '-mabi=ilp32s' as it conflicts with that implied by '-msoft-float' (lp64s) [-Werror,-Woption-ignored] > clang: error: ignoring '-mabi=ilp32s' as it conflicts with that implied by '-msoft-float' (lp64s) [-Werror,-Woption-ignored] > > when building configurations that I expected to be 64-bit but had been > turned into 32-bit ones with LLVM. This was also reported by the test > robot with allnoconfig. > > https://lore.kernel.org/202604232041.ESJDwVG4-lkp@intel.com/ > > Maybe some change is needed on the LLVM side? The root cause is that scripts/Makefile.clang unconditionally sets CLANG_TARGET_FLAGS_loongarch to loongarch64-linux-gnusf. However, Clang with --target=loongarch64 does not support a 32-bit ABI. LLVM clearly separates loongarch32 and loongarch64 targets. Since CLANG_TARGET_FLAGS gets initialized before CONFIG is available, the current setup effectively assumes that a 64-bit target must also handle a 32-bit ABI. That assumption may not hold for LLVM, which models 32-bit and 64-bit LoongArch as separate targets. I have a workaround patch for now, though I’d appreciate suggestions if there’s a cleaner fix. diff --git a/Makefile b/Makefile index 54e1ae602000..f03ff854014a 100644 --- a/Makefile +++ b/Makefile @@ -725,6 +725,10 @@ CC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(CC) --version 2>/dev/null RUSTC_VERSION_TEXT = $(subst $(pound),,$(shell $(RUSTC) --version 2>/dev/null)) PAHOLE_VERSION = $(shell $(srctree)/scripts/pahole-version.sh $(PAHOLE)) +ifdef need-config +-include $(objtree)/include/config/auto.conf +endif + ifneq ($(findstring clang,$(CC_VERSION_TEXT)),) include $(srctree)/scripts/Makefile.clang endif diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang index b67636b28c35..1c4db2f6543e 100644 --- a/scripts/Makefile.clang +++ b/scripts/Makefile.clang @@ -4,7 +4,11 @@ CLANG_TARGET_FLAGS_arm := arm-linux-gnueabi CLANG_TARGET_FLAGS_arm64 := aarch64-linux-gnu CLANG_TARGET_FLAGS_hexagon := hexagon-linux-musl +ifdef CONFIG_32BIT +CLANG_TARGET_FLAGS_loongarch := loongarch32-linux-gnusf +else CLANG_TARGET_FLAGS_loongarch := loongarch64-linux-gnusf +endif CLANG_TARGET_FLAGS_m68k := m68k-linux-gnu CLANG_TARGET_FLAGS_mips := mipsel-linux-gnu CLANG_TARGET_FLAGS_powerpc := powerpc64le-linux-gnu -- Thanks, Rui