Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2429426imu; Mon, 17 Dec 2018 01:39:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wmra2zp1p1r2vemUdFJrsd9p2qn2GvxcjYQkcmHZcDOOwZPDs4GPdHMlzkKsjC0Xt/IAts X-Received: by 2002:a17:902:7e0d:: with SMTP id b13mr12286599plm.154.1545039577447; Mon, 17 Dec 2018 01:39:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545039577; cv=none; d=google.com; s=arc-20160816; b=O90/c5fV1tcox888tak+DhflZFFz8Csr/k5ygBCFRLMWNvHJHOT7lVSkDdr+kKxm6/ vC0QNiZI/JJw2VGhjGAwDZzX9bMtGu3SIYthUAhJ7sXfKW2elF9X7SGzgywcxNf3t/M6 IBjtFNfCWnNp3whKQHWFafAlDMvbnEl3kv6Rms1y7aO8PjVHOEI9n2o95NftiFx/UKRh f5qDOHUYXliGvWp4pNXa9kImxVfK8RJtwYf6wZyTlVkwxUOTYCy8//BJVUxmG3+XoM4Q 7wlo82Vcz6QRjrFmQuk1bp1+qcybgHV2bUUp09ZtV7a1XoTd+cQBbg8lawf4BliLoMDJ lQvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=s8zZYYBpwYWn5hfJjNp5dCjaWNFjJl27s9MRtcqUbWw=; b=GWTtWJaIsEk4C4SeOadIAWjMbZft+zvVrXAv0TuagXWhzbS7cj6udwN31r5ICCdqQe CvSOYtG7kT1T5GG4KfBY3Vyn+g3edKiaVF/Kia8h4J9bneddpZUoY8jC4TF6H14Tz6Xh y3aoVEc3FwcKd6h8Qv6fSLqPQPgnhnJajGxAqtVzHEpKhcaLqILnHDM7FMjmUzuZYuZ9 MVDJ+A7w86J87OUirIKm79KyCNoCHGxsEX8XqB38woMXODi1oWmLSG0piyyYpQpKWnG5 P6kYqS2blkiyKfK//GxWAAWgCk74DkBMuKt7INQFa0a77T8co/CQ+Rida0C+VZWMAn3r AvrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=ukDxC+hS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g71si10500964pgc.419.2018.12.17.01.39.21; Mon, 17 Dec 2018 01:39:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=ukDxC+hS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732051AbeLQJg7 (ORCPT + 99 others); Mon, 17 Dec 2018 04:36:59 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:51787 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726622AbeLQJg7 (ORCPT ); Mon, 17 Dec 2018 04:36:59 -0500 Received: by mail-wm1-f67.google.com with SMTP id s14so11623934wmh.1 for ; Mon, 17 Dec 2018 01:36:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=s8zZYYBpwYWn5hfJjNp5dCjaWNFjJl27s9MRtcqUbWw=; b=ukDxC+hScIdsBXLuSXzJ3JfvXOcaezdp/yDTHJpnEgX+qge6+JhxctNWpT40cT53Mk VdJT0EENh+hK8eWwtOvO5kiK5jUQ91AR8LiXtzsxM6nuyps404Dd0ncILrZNS9g4y3hJ KENf0dlKfpfU5KjIoli5IJPPRX6UL2wwYxopvKjcYmiCUD7OlAp/kk0fHOSuJ++vQ0M6 /FUFDU8rGmyt08o9w1GGH/E9QoFdabrtLB/FYGFtVhAcIgSQa1+uBPiShUDHblpgWkFU 2L1y4GQiRfmU/FH8QHKGByHGCxv+ZYElVGCKuesPi+wX49pUJ4z3NyHt5Lvc1cMjmSZU k+Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=s8zZYYBpwYWn5hfJjNp5dCjaWNFjJl27s9MRtcqUbWw=; b=eBXO5cCyAGoAeLQKq9c8ar67kdVZp/iPRySX8YEMPYCWRoYB/x8187KouMk01jMmyQ sbRMzyPv6ukn3da6S9ID0ZK2/zhtAAlVgj+KjIg2nUu+jkW/pcyIhvf1Z+YBEQ3lRdwA zZGsO3ZuT8EsmzD4/SPampJMdaCKGeu7taP/UcmAyyt/iJc+02iq9s5mxZSaW0BfDTM5 v5U7EddEmXebpgAQSiZPGQxNqu8p3xHxlVOd8695cyplq1sie4KvhJte9crzPdzcN1Sx kOrbTJbu6PpnUsev8jUAVktrmesnmMWNSaShdwhVhCqiPV5BaqDo5/nynTsOOTm05+Wv qXTg== X-Gm-Message-State: AA+aEWYVoTcxbAIiHsne/1SHdxymX23hOt45JTsn1XY8k3NYoQtW5ZAO G2jnOJz1lseIiNSxYyCQvySRCjQSJ/Kg02rqGwFokw== X-Received: by 2002:a1c:1801:: with SMTP id 1mr11634200wmy.153.1545039416992; Mon, 17 Dec 2018 01:36:56 -0800 (PST) MIME-Version: 1.0 References: <20181126060802.19314-1-anup@brainfault.org> In-Reply-To: <20181126060802.19314-1-anup@brainfault.org> From: Anup Patel Date: Mon, 17 Dec 2018 15:06:45 +0530 Message-ID: Subject: Re: [PATCH] RISC-V: Make BSS section as the last section in vmlinux.lds.S To: Palmer Dabbelt , Albert Ou Cc: Atish Patra , Christoph Hellwig , linux-riscv@lists.infradead.org, "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 26, 2018 at 11:42 AM Anup Patel wrote: > > The objcopy only emits loadable sections when creating flat kernel > Image. To have minimal possible size of flat kernel Image, we should > have all non-loadable sections after loadable sections. > > Currently, execption table section (loadable section) is after BSS > section (non-loadable section) in the RISC-V vmlinux.lds.S. This > is not optimal for having minimal flat kernel Image size hence this > patch makes BSS section as the last section in RISC-V vmlinux.lds.S. > > In addition, we make BSS section aligned to 16byte instead of PAGE > aligned which further reduces flat kernel Image size by few KBs. > > The flat kernel Image size of Linux-4.20-rc4 using GCC 8.2.0 is > 8819980 bytes with current RISC-V vmlinux.lds.S and it reduces to > 7991740 bytes with this patch applied using GCC 8.2.0. In summary, > this patch reduces Linux-4.20-rc4 flat kernel Image size by 809 KB. > > Signed-off-by: Anup Patel > --- > arch/riscv/kernel/vmlinux.lds.S | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S > index 65df1dfdc303..cc99eed44931 100644 > --- a/arch/riscv/kernel/vmlinux.lds.S > +++ b/arch/riscv/kernel/vmlinux.lds.S > @@ -74,8 +74,6 @@ SECTIONS > *(.sbss*) > } > > - BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0) > - > EXCEPTION_TABLE(0x10) > NOTES > > @@ -83,6 +81,8 @@ SECTIONS > *(.rel.dyn*) > } > > + BSS_SECTION(0x10, 0x10, 0x10) > + > _end = .; > > STABS_DEBUG > -- > 2.17.1 > Hi All, Any comment on this patch? Regards, Anup