Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12805612rwd; Fri, 23 Jun 2023 10:53:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66pioYIRYkWf/pO6sWqY7Wx13F1l3wjvZnPpsys+4JL37VGadoJIvHut/DqoImAnOI8abo X-Received: by 2002:a05:6a21:6d86:b0:124:413a:56d2 with SMTP id wl6-20020a056a216d8600b00124413a56d2mr6840154pzb.43.1687542835594; Fri, 23 Jun 2023 10:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687542835; cv=none; d=google.com; s=arc-20160816; b=pCoMdg7izkUfxcGuHAJ+aMh4Vhn4XbrcscsBSsg1HypZbOFxy0nsDDEdzTyAgDFbWX fMPQZoqrgLPU3i7o/BP3bM3HcZMkdpGT/lVuZRPfaQIK5RJREttvm+7xTlO6TJPOUFmu /UZx+oWW75yQ8tI5S+RDQ8ZsleeRJpRqPH08d8M19NzvY+WOBRIuOUZcmIRTE5EvUJjF sa5Slbiky3G9kNOzY/vc+itnbUK54GBp3KQlMagzMXRmKj+AT1cu9s/Tp28yakgRU355 rHyNsn6ErTNbiTv5q6ciRZxFagUf7Rwg5F5xjEHwUtRJlck7uauOJ+C+SX0xsjTBKHxn hn5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=1+Q3s9+4hIOQJxus01vWM8frh+OlMBNzr2yk8GZvJP8=; b=hlmuLBsv2mUGI/iW23F4AO1pPfmmUfMf+U3yZ//0uP8a9P0m8buddn8BhMsHHvWDMq 7w9raMwZ17bRjESrDlh3IDlYrZISE3oJRQ3GoiyJi4w1fRWhJj4LKVHGJqraAHnZYXlQ IP2wThtYKmuKHuNmorVrpxDwyrkS2acyGYIP3AKPOU3biAZdZOi8QOM9aTteC9yh3IS2 otni0HPVK33fZvGnKP+dD0IecOC1UulBQiDa3Pe+vsnFIu5GpXx5hwzfMt+QyOgff389 F79A8JzEoXu5aDTleDECzOmAJgw907LtDDkYSy/vm7eGfIPFcA6/mTaEkJa6kpV9wXY4 GxUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b="m/qvk+H1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c1-20020a170903234100b001b674055d72si5270199plh.621.2023.06.23.10.53.42; Fri, 23 Jun 2023 10:53:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b="m/qvk+H1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232591AbjFWQyD (ORCPT + 99 others); Fri, 23 Jun 2023 12:54:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232560AbjFWQxx (ORCPT ); Fri, 23 Jun 2023 12:53:53 -0400 Received: from xry111.site (xry111.site [89.208.246.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34938270E; Fri, 23 Jun 2023 09:53:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1687539230; bh=1+Q3s9+4hIOQJxus01vWM8frh+OlMBNzr2yk8GZvJP8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=m/qvk+H1fM1W6DOe/lEURh0RkeDXaG+/ORWCTn/N1dgVW0f+7LlHYMHS11rWW4m6Q clyJpEfABALQMfuAws2j5YeGMw+Y8Zb+3t5FnIuqLPnHtvH2ASNTr9Bzy3X4w2VBpB uazawT9ZLZjRoouWe2YqSJDzakE8sTHMraXosIOw= Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) 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 38C3865A9C; Fri, 23 Jun 2023 12:53:49 -0400 (EDT) Message-ID: <7502003f530ca03548bad513b70401939eac7f6e.camel@xry111.site> Subject: Re: [PATCH 7/9] LoongArch: Tweak CFLAGS for Clang compatibility From: Xi Ruoyao To: Nick Desaulniers , WANG Xuerui Cc: Huacai Chen , WANG Rui , loongarch@lists.linux.dev, linux-kbuild@vger.kernel.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, WANG Xuerui Date: Sat, 24 Jun 2023 00:53:47 +0800 In-Reply-To: References: <20230623134351.1898379-1-kernel@xen0n.name> <20230623134351.1898379-8-kernel@xen0n.name> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.3 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2023-06-23 at 09:39 -0700, Nick Desaulniers wrote: > On Fri, Jun 23, 2023 at 6:44=E2=80=AFAM WANG Xuerui w= rote: > >=20 > > From: WANG Xuerui > >=20 > > Now the arch code is mostly ready for LLVM/Clang consumption, it is tim= e > > to re-organize the CFLAGS a little to actually enable the LLVM build. > >=20 > > A build with !RELOCATABLE && !MODULE is confirmed working within a QEMU > > environment; support for the two features are currently blocked by > > LLVM/Clang, and will come later. > >=20 > > Signed-off-by: WANG Xuerui > > --- > > =C2=A0arch/loongarch/Makefile=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 14 ++++++= +++++--- > > =C2=A0arch/loongarch/vdso/Makefile |=C2=A0 6 +++++- > > =C2=A02 files changed, 16 insertions(+), 4 deletions(-) > >=20 > > diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile > > index a27e264bdaa5..efe9b50bd829 100644 > > --- a/arch/loongarch/Makefile > > +++ b/arch/loongarch/Makefile > > @@ -46,12 +46,18 @@ ld-emul=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 =3D $(64bit-emul) > > =C2=A0cflags-y=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 +=3D -mabi=3Dlp64s > > =C2=A0endif > >=20 > > -cflags-y=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 += =3D -G0 -pipe -msoft-float >=20 > This seems to drop -msoft-float for GCC. Intentional? >=20 > > -LDFLAGS_vmlinux=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 +=3D -G0 -static -n -nostdlib > > +ifndef CONFIG_CC_IS_CLANG > > +cflags-y=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 += =3D -G0 > > +LDFLAGS_vmlinux=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 +=3D -G0 >=20 > Thanks for the patch! >=20 > I can understand not passing -G0 to clang if clang doesn't understand > it, but should you be using CONFIG_LD_IS_LLD for LDFLAGS? >=20 > What does -G0 do? -G0 is a no-op for now because there is no small bss/data optimization implemented for LoongArch yet. /* snip */ > Why would AS_HAS_EXPLICIT_RELOCS be set if -mexplicit-relocs isn't > supported? Is the kconfig for that broken? Using GCC 12 (w/o -mexplicit-relocs support) together with Binutils >=3D 2.39 (with explicit relocs support) will cause kernel modules fail to be loaded (because there will be R_LARCH_ABS_* relocations in the modules and the module loader does not support them), so we deliberately reject such a combination at compile time. I could add R_LARCH_ABS_* implementation into the module loader to make it work, but Huacai suggested to just declare the combination of GCC 12 and Binutils >=3D 2.39 unsupported. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University