Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2902098rwd; Wed, 14 Jun 2023 08:40:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4yaGZar8AgFH/i9iJvn3waafQa3qfn+d5HxxDLPiNNS5PpJ8iCVBKJCAmxQMNcmn7h2zSa X-Received: by 2002:a17:906:ef0b:b0:965:ff38:2fbb with SMTP id f11-20020a170906ef0b00b00965ff382fbbmr16736802ejs.1.1686757259082; Wed, 14 Jun 2023 08:40:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686757259; cv=none; d=google.com; s=arc-20160816; b=YH7Wfn2GkPmMWehfcmr37oWTRifFs20xwjj0wiOSXlUMm3Xx3s6GbbukTsyjQkSxIP mR/dBuh3yeoSHI9SOFStsL1BkDBmfPs5VOAqmzzrD3K+IZxNB5ohH6TT6LNB0VRhCLME CF2jy2HEuVlv2nqOKyP81btF4ZeFAkwRrcychrFz9wPAnL8MWB3j1My9TLXR/hmwfdwc 2BZMm/qoWVW1ZSTkqU11Ze+YEfu92FTCHQyhjZuSijfUtKqhb8dIe4M6Wob1E/ihua7R ODpm7wC/MxapLHeb9yB0zBCNx6u60mK8ILVZg0ej6IPDAPGbK0I3BwZDyMMLaeARNiWw UKNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=GKRPE21e3VYfChpFhohDRbV1xWyVB/8sEvcGY/fQRtY=; b=FJCCagBDBdEkHKAwqVismle7Q3QseU4QB4yaFjrpJAf3ySb9gQnSjz3aQUff4IdRa3 SfQLOkzaSsj6scQiH0NcRbYUERJ2Wi2+H9cHTbl0Qnf2RgFycZZAEjzsxde8Fe4PkWWw PpREj/W1sGTzJKCF6kIwTg1jICY36yJO/KNwPj/3KKwWwmCF4004OE1vERbp3QyKWT+2 +JlF/yXD2Juw/yt8yrjblj3yx89gBHhnk1Fv84wkZeMNkUavKgK4044yNSW7x4nldFQT bQmUgHL6VX3FNLhu7iwxq8HISz0kp7RQYM4GCBGDk1uNbRWxFZy3S4VoYl/AM9KtHou4 Kbbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20221208.gappssmtp.com header.s=20221208 header.b=StLoc1kV; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lr11-20020a170906fb8b00b009828c28d052si256502ejb.823.2023.06.14.08.40.23; Wed, 14 Jun 2023 08:40:59 -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=@dabbelt-com.20221208.gappssmtp.com header.s=20221208 header.b=StLoc1kV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237071AbjFNOte (ORCPT + 99 others); Wed, 14 Jun 2023 10:49:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245402AbjFNOtU (ORCPT ); Wed, 14 Jun 2023 10:49:20 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2101B1BE8 for ; Wed, 14 Jun 2023 07:49:19 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1b3a82c8887so38301505ad.2 for ; Wed, 14 Jun 2023 07:49:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20221208.gappssmtp.com; s=20221208; t=1686754158; x=1689346158; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=GKRPE21e3VYfChpFhohDRbV1xWyVB/8sEvcGY/fQRtY=; b=StLoc1kVQd8T9vYMLq0d7MyCHvxTL+0SIFZNTaA2rIaV3Q3TxJP1T2XFTGwcKZ7Bso bjLkgFqON00qrD7vOcMG2nwP2tUTvOQC4Qz+ruaJSoRXbMJ8zekx905259Ej/nz/EsDh ppaseEAxZUyq3/AJ/WiMvkfPVXRbf8FWxpP33b0SXtob2sIropYCCwdhc+4pBSpIR7Hp do+JfGRUQu+3phZg888rY2sShfFKoC/S+D6mwXll2Km/ak94SKgD02sGR4eBQRi1q5eU 0uKI5zn0olHna/hKqL7AjcqQslXL5DgkUMsAAcmPmvkqOMBYQ3pjbXd60iDL6i/lfIfm xbxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686754158; x=1689346158; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GKRPE21e3VYfChpFhohDRbV1xWyVB/8sEvcGY/fQRtY=; b=LrBpUBd0xhKr/12rQe9OURRIf4UT68MUwWJuU4BIZLhdtC3Li5pfYvHN/eSw3xtAza FKuv1mRVUIBX5jMErNtuDrr0+sEIKxsH0HhmA1FYyhqPcduKz5fw2dcut3RU485HZ0ZV 9BC3MJYIU3Toei6cd0ANflhkcq/gQIjY5sNpuEzO0rxKidlSNBLFbGOge5CT7785QgR1 ZIGgbIDjyiT8NcoaRxCf998CM9BDoZAZIvx4/kptqazDI+Y67npyV5CEv+L3QwlnacRj BUyedjrKnk55OvWZXgWyjg5kdHbP/XiZf0fEoKzMJ3Vu4dwYh692nthDzcbWr8G+eHc/ I9ng== X-Gm-Message-State: AC+VfDx/58FmQpwkdBKlGWxcLGnoSS/wGW5clGGKxEflt/2MzjHfcn4a rq3spGLBbS2UrsMFcAZdYC+Y1w== X-Received: by 2002:a17:903:32d1:b0:1af:cbb1:845 with SMTP id i17-20020a17090332d100b001afcbb10845mr16027525plr.16.1686754158383; Wed, 14 Jun 2023 07:49:18 -0700 (PDT) Received: from localhost ([135.180.227.0]) by smtp.gmail.com with ESMTPSA id bi8-20020a170902bf0800b001b3d7205401sm5552790plb.303.2023.06.14.07.49.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jun 2023 07:49:17 -0700 (PDT) Date: Wed, 14 Jun 2023 07:49:17 -0700 (PDT) X-Google-Original-Date: Wed, 14 Jun 2023 07:49:15 PDT (-0700) Subject: Re: [PATCH v2 0/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION In-Reply-To: <20230523165502.2592-1-jszhang@kernel.org> CC: Paul Walmsley , aou@eecs.berkeley.edu, Arnd Bergmann , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org From: Palmer Dabbelt To: jszhang@kernel.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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, 23 May 2023 09:54:58 PDT (-0700), jszhang@kernel.org wrote: > When trying to run linux with various opensource riscv core on > resource limited FPGA platforms, for example, those FPGAs with less > than 16MB SDRAM, I want to save mem as much as possible. One of the > major technologies is kernel size optimizations, I found that riscv > does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, which > passes -fdata-sections, -ffunction-sections to CFLAGS and passes the > --gc-sections flag to the linker. > > This not only benefits my case on FPGA but also benefits defconfigs. > Here are some notable improvements from enabling this with defconfigs: > > nommu_k210_defconfig: > text data bss dec hex > 1112009 410288 59837 1582134 182436 before > 962838 376656 51285 1390779 1538bb after > > rv32_defconfig: > text data bss dec hex > 8804455 2816544 290577 11911576 b5c198 before > 8692295 2779872 288977 11761144 b375f8 after > > defconfig: > text data bss dec hex > 9438267 3391332 485333 13314932 cb2b74 before > 9285914 3350052 483349 13119315 c82f53 after > > patch1 and patch2 are clean ups. > patch3 fixes a typo. > patch4 finally enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION for riscv. > > NOTE: Zhangjin Wu firstly sent out a patch to enable dead code > elimination for riscv several months ago, I didn't notice it until > yesterday. Although it missed some preparations and some sections's > keeping, he is the first person to enable this feature for riscv. To > ease merging, this series take his patch into my entire series and > makes patch4 authored by him after getting his ack to reflect > the above fact. > > Since v1: > - collect Reviewed-by, Tested-by tag > - Make patch4 authored by Zhangjin Wu, add my co-developed-by tag > > Jisheng Zhang (3): > riscv: move options to keep entries sorted > riscv: vmlinux-xip.lds.S: remove .alternative section > vmlinux.lds.h: use correct .init.data.* section name > > Zhangjin Wu (1): > riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION > > arch/riscv/Kconfig | 13 +- > arch/riscv/kernel/vmlinux-xip.lds.S | 6 - > arch/riscv/kernel/vmlinux.lds.S | 6 +- > include/asm-generic/vmlinux.lds.h | 2 +- > 4 files changed, 11 insertions(+), 16 deletions(-) Do you have a base commit for this? It's not applying to 6.4-rc1 and the patchwork bot couldn't find one either.