Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4172872rwb; Tue, 6 Sep 2022 03:50:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR4v5B+/rv9bwc2x5x5AyKmVgnltiihUIxIUWrM23DCMHyd3iF5Bsc5siLqlvKGz1Og3+EWK X-Received: by 2002:a63:4b5a:0:b0:434:a821:5ed7 with SMTP id k26-20020a634b5a000000b00434a8215ed7mr2415312pgl.474.1662461412168; Tue, 06 Sep 2022 03:50:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662461412; cv=none; d=google.com; s=arc-20160816; b=Y5SMmKRc+rl20ZM7UctsPu1uzI5rXOcMaOTATS+1fAc1wn2Bp8V5FO/cNzEQhX8bTV hceGN9/A3EfwTWVhStm9l4h5TzdRsY2C2x7kvbSh+IfGaYP2+ZJzRf0gvZ25czWJ1WoP wmqKRd1JkeJv+1TcwqiOR/ZfPnEVx02ONO9VGy/mnqJEO2dEt7b4iCTI+/TxD+YGhWjZ Ei7jEZ9Z7siDurHUSwIoSr2lCjKFeXf7SK8q71kDZGn+MLq0L7TbgZPmODLyJOKJe8O/ Wxji2qr6WsM3+1gbTpPZ57YC+tjCQ5OdT1+Q9sw/uOU8W/z6JBsTuK3yyErL9XN9jtzk Vmyw== 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=XIDhfOJQH/FKS7hkIamxWsKpP1PYYkKpqRCd+nyNttc=; b=wzc/QM3E5kBiaHTGe5I7ShvZNieybGTGviOGcKE2XnOKt4j3gyGUbRu4gp5F/6cK4S MwiUCSwM8EQxgJEydiADe6XJ1HqkS3cp/upSVMie13PatDqrsV8mXyIkh1J8FK1eGa6V JTrNyJPtrLvPSvHlr5Yt0u6YGIx1WmlMc+JPRUwuRcYc2oVf/lq0/9jD49IUodC6QDlF pDv+vKzk+jTBG8UzG2gpJrdc9zPFMAYfRYhtJjm7etfzcf6M7BN5OxL7/VFMltJd3iD0 ZkdiF3a7pfsRzJh1rgtDyoDhSrSJmpNUzddqcVcfyQFJZXzh38XROZf/z+AWfrppaX5G wTjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WymsisIa; 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 t33-20020a056a0013a100b00536d5b41c8bsi15065665pfg.165.2022.09.06.03.50.00; Tue, 06 Sep 2022 03:50:12 -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=WymsisIa; 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 S239014AbiIFKQq (ORCPT + 99 others); Tue, 6 Sep 2022 06:16:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238753AbiIFKQo (ORCPT ); Tue, 6 Sep 2022 06:16:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA35939B9D for ; Tue, 6 Sep 2022 03:16:43 -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 ams.source.kernel.org (Postfix) with ESMTPS id 32ADFB81729 for ; Tue, 6 Sep 2022 10:16:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0187C433B5 for ; Tue, 6 Sep 2022 10:16:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662459400; bh=9/OqEY1AdGlYqFrskuBnDyzAXAsqqGEVaUN/RRhe4Ck=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=WymsisIaz3vz6LLmtOOC+6uvrRVt/GXWVbZSpnpZSoDmvyfqWsVxCkdE31gaYzac9 o2EEnu+x5hVNwqHY1f6wcX80IUKdyDUYFZFnuH1dafiI2RkqRYLWsXlXiySwnErflw saNrVf+hNX6PoZFNlDw8+lpqVYr1S/S9XCf9k84sT7ya7GWmXH/kUynUiPdiewtQ1W biHvU9MKULbLxegUO22LJ1Y90ZJIxxLv4Mjev+7dEirObDHpyEBELbaqUBXNT/m2cH mnRp/BPuFoDFJzqSN8MqeChSdC+5ppDIAfTlZZOLtk/0tBDCQGttx8kqefBjg5n6Mr 9kPzLAsp5eBeg== Received: by mail-lj1-f170.google.com with SMTP id k18so11688671lji.13 for ; Tue, 06 Sep 2022 03:16:40 -0700 (PDT) X-Gm-Message-State: ACgBeo1EsiNXHgnm3ZBRTAFQDOWRfVHh3EOOGa3k5FQsls1waig45FVq ThyBCAdnESHbNhqdd71U84B3ebrGGo0bDJ0MmdE= X-Received: by 2002:a2e:9b0e:0:b0:268:cb68:575b with SMTP id u14-20020a2e9b0e000000b00268cb68575bmr7059563lji.152.1662459398847; Tue, 06 Sep 2022 03:16:38 -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: Ard Biesheuvel Date: Tue, 6 Sep 2022 12:16:27 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v7 0/5] LoongArch: Support toolchain with new relocation types To: Huacai Chen 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, 6 Sept 2022 at 10:59, Huacai Chen wrote: > > 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 > I have merged this into the patch, and updated the tag efi-loongarch-for-v6.1 ead384d956345681e1ddf97890d5e15ded015f07 It should be in linux-next tomorrow, you can merge the tag now from git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git