Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4084557rwb; Tue, 6 Sep 2022 02:11:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR6KGqQ99Jah6KOTucVI/HzyZ5S9xPL2LqSXn7WI/HTUhqhPqJYXdELPfZDA3WZiF1cPVsxT X-Received: by 2002:a05:6a00:2446:b0:52b:e9a8:cb14 with SMTP id d6-20020a056a00244600b0052be9a8cb14mr2780119pfj.32.1662455479124; Tue, 06 Sep 2022 02:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662455479; cv=none; d=google.com; s=arc-20160816; b=VFS0GcmPjcZB4rnOfwqNmQwnjeJZALgvdQraZ+WW4glxbFCLXWxmgTcOwWnq0DxJ4n xPRyuCFHfTVQA/CSTFwuZCP3n3iXOwRhoF+UYIz8UmYLSMHbLmtS7gX9tUqjOxyULgtv v9geJc0Njq/Y2vwUtHsS/nISH9T3g8rlPePl+Y0laBlh6waaSDuxipcIiKzMA93dHDlm EmyMf1df1doQaQlvmeVz55A8zh/qmHvEL9sErfB3K0KGa31n+a2pui7mIondXeywCque Tv7UTA9ho1mo3avhRbhYc39O7KD/+PXMtnOAUwUjIT64qSSp8WxMbqz3fpJiiFr21Una dJbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=yld/UU813xqRfW3zayFP3lMdn0AnQlcu81v36eOaa9w=; b=v2Q6c6SZCFNUxb0/SWjTE++1rsmpuMxhjLpuTpYzv7KVAHEthY9nIy3HSLWbT73/Mu mt1+MDNaQdXNs2rlEoYzBVDjQuMc/ds9kTbadNIg+LsEOKkV/U3grJXCcZz1ceG+Z8GE heMlVUCVm7KyRSUoBYydD09epDYtIAOLoU23Q7F7DzPed/KH95GNAEmDdZvChKvJ6hkq U67CR2KTTeyFmIea+A5W+nKQu3/4Au577PW4ppjiUrBKk2k9dUWyQ+d/EuFEq4OO2nYP 2DIBpf+ZPF3flVl8bsSBBqq/VTC7o5AktAyElijBzvkoiX87bOsKMugCT8fpddocvGws pvlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sSxZSntK; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020a170902b19200b001769f4909b4si6836196plr.356.2022.09.06.02.11.07; Tue, 06 Sep 2022 02:11:19 -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=@kernel.org header.s=k20201202 header.b=sSxZSntK; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238076AbiIFI7j (ORCPT + 99 others); Tue, 6 Sep 2022 04:59:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233234AbiIFI7g (ORCPT ); Tue, 6 Sep 2022 04:59:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 999CCAE77 for ; Tue, 6 Sep 2022 01:59:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 34C5361449 for ; Tue, 6 Sep 2022 08:59:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C571C43140 for ; Tue, 6 Sep 2022 08:59:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662454773; bh=l5trKJkmzDajoRg9PtwszAwt9kN0Ee++TPrswep1gkc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=sSxZSntKcYF6ekVYCSWt8Y/ryhtl15qNiSW70+EKohTKUGxjYjSvGRuTdHHPqwAoZ 3okAfq+eKgMh0kQUStt9hezFQRYcnvaVPTLTzfV55w/Nwa6cko2s+++HT1rJAqm+v6 XAYr9Rh9VdTEF28SeDFwjECm/vIC+qHrz2UJWC9tnWzs/ngnk8dbcLtcAS2g/rs4Oo fKg4vdAttpWklnObUIhIbkIdpChlmE1CvyAFbh7ccCAwIC2PnQaPV1VEtQ/2D7pADZ n1s/FQvmc7i15m5w9ZtU9pSYwd69HG7B4NwoJwKU3WvXfYd9+bT2JZntY49Sc/35Mw uAga2a4vRsz8w== Received: by mail-vs1-f52.google.com with SMTP id k2so10959431vsk.8 for ; Tue, 06 Sep 2022 01:59:33 -0700 (PDT) X-Gm-Message-State: ACgBeo0rSHC4IarB3rwl0BR2/iqGjjjMwjwSLoLX2Cl/fdhYZXiXNRgz tU0IupYERJE0Cl0ZK/gVUEB2scohWf7xLIyxS+0= X-Received: by 2002:a67:d49e:0:b0:390:dccf:23c8 with SMTP id g30-20020a67d49e000000b00390dccf23c8mr13467486vsj.59.1662454772399; Tue, 06 Sep 2022 01:59:32 -0700 (PDT) MIME-Version: 1.0 References: <20220830104806.128365-1-xry111@xry111.site> <5b87173faeef587a2ffaaa6f58d34e0940231067.camel@xry111.site> <97291c0fe5a660c844475ff019c8db6af77ecf86.camel@xry111.site> <8d0f96e2977c5c78f17bb410087f2aad986ef5a4.camel@xry111.site> In-Reply-To: From: Huacai Chen Date: Tue, 6 Sep 2022 16:59:21 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v7 0/5] LoongArch: Support toolchain with new relocation types To: Ard Biesheuvel Cc: Xi Ruoyao , Jinyang He , WANG Xuerui , loongarch@lists.linux.dev, LKML , Youling Tang Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Tue, Sep 6, 2022 at 4:20 PM Huacai Chen wrote: > > On Tue, Sep 6, 2022 at 3:18 PM Ard Biesheuvel wrote: > > > > On Tue, 6 Sept 2022 at 06:43, Huacai Chen wrote: > > > > > > Hi, Ruoyao, > > > > > > On Tue, Sep 6, 2022 at 12:27 PM Xi Ruoyao wrote: > > > > > > > > On Tue, 2022-09-06 at 09:52 +0800, Huacai Chen wrote: > > > > > > cflags-$(CONFIG_LOONGARCH) := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \ > > > > > > - -fpic > > > > > > + -fpie > > > > > > > > > > > > cflags-$(CONFIG_EFI_GENERIC_STUB) += -I$(srctree)/scripts/dtc/libfdt > > > > > > > > > > > > (Some explanation: -fpic does not only mean "generate position- > > > > > > independent code", but "generate position-independent code *suitable for > > > > > > use in a shared library*". On LoongArch -mdirect-extern-access cannot > > > > > > work for a shared library so the "-fpic -mdirect-extern-access" > > > > > > combination is rejected deliberately.) > > > > > > > > > > > > Not sure how to submit these changes properly... Do you prefer me to > > > > > > send V8 of this series or a single patch on top of your tree on GitHub? > > > > > > > > > Don't need V8, I will squash it into the previous patch myself. But > > > > > can we keep efistub as is? > > > > > > > > No, we can't allow -mdirect-extern-access -fpic on LoongArch because > > > > without copy relocation such a combination just does not make sense (i. > > > > e. we cannot find a sensible way to handle such a combination in GCC). > > > > So such a combination will cause GCC refuse to run. > > > > > > > > Note that -fpic/-fPIC is "position-independent code *suitable for > > > > use in a shared library*", while -fpie/-fPIE is more like just > > > > "position-independent code". The names of those options are confusing. > > > > (When -fpic was invented first time, people mostly believed "PIC had > > > > been only for shared libraries", so it's named -fpic instead of -shlib > > > > or something.) IMO in the EFI stub for other ports, -fpie should be > > > > used instead of -fpic as well because the EFI stub is not similar to a > > > > shared library in any means. > > > You are right, but I guess that Ard doesn't want to squash the efistub > > > change into the LoongArch efistub support patch. :) > > > > > > > I don't mind changing the stable tag at this point - I don't have > > anything queued up on top of it at the moment. > > > > But I don't see the actual patch: please send me the delta patch that > > you want to apply, and I will update it. Then, you can rebase your > > v6.1 tree on top of it. > OK, Ruoyao, please send a patch to change the efistub cflags. Thank you. Oh, I think you needn't send, just showing the diff to Ard is OK. :) diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index 8931ed24379e..8c1225b92492 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -27,7 +27,7 @@ cflags-$(CONFIG_ARM) := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \ cflags-$(CONFIG_RISCV) := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \ -fpic cflags-$(CONFIG_LOONGARCH) := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \ - -fpic + -fpie cflags-$(CONFIG_EFI_GENERIC_STUB) += -I$(srctree)/scripts/dtc/libfdt Huacai > > Huacai