Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2830944imu; Sun, 23 Dec 2018 08:45:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/UJMuBtmMDQI8du1n49fyAjBIl6mvsxMn0360V2rLRbP0uqjFnoGqi8y0JWEj4V46JGOJje X-Received: by 2002:a62:1212:: with SMTP id a18mr10538226pfj.217.1545583544311; Sun, 23 Dec 2018 08:45:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545583544; cv=none; d=google.com; s=arc-20160816; b=tvRj/aOZ/jxX15zHMFwbQByS+EniNaxzSAi/qUjtdIAqaJmqcrCQ16YiKwHDSq5rYL MrgX5UMT6bZPprHgZyOI3qhm9RCKuW3fyoOP81klMrBAQNO1s8+8KDwkUU0n4Aiv5GwH QBmz3/BVp/riL9sBktCseRmmTn9zY15OtxyECPge0O3k5CdPH3sZFbGkL7hXjF85o94v FicilFAbgSQreK8k7GhqhttDzP/sL9TOmD6cHxcaK+RPj15XqaIEosbpUr3+1/a/pEp5 anrF7W1sXBmF9FakcbAAmQ0Iy9Rnq4bg0iF3vr53eiQm4Gk9GabpUK/dXdNuMORFU3Tw 5kPg== 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=Y6scqON9KStlQnmh87N7ktbYjs+ArQwzAXpCvM+jErY=; b=Wn7PAlf6lCaaxnqh+DzSxynzSc5IG+ErrCLg1NMeEoP3hCt7nfnGM5s3H+fIN46TPP NQTlQORSoaLiOzKFR3P2wc7vUaL0JptE0QDHstiV44/L0TWkxgy0fTaeL41vmZIpnswa f+7Sfi/biohXIct5PpMuW3K+T2TYZLXDZcwKEjVx8J27XmT7Jbat+4mlBwuvYeP7fVss Bl+LKyBAubUNiRy5OMvEW+sqmAvcl4sHdchWneDhuzKZGn5uUpFWLJwHyrzAQuXRtS49 a2NSsuV96dIhPWFhLxZN4O5UtqAwEZfSaopK9p9Oy6hV9HJVXBXUEzABFS9u2WR5GlmN S0aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=UZQd+vr+; 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 j13si9387231pgi.227.2018.12.23.08.45.29; Sun, 23 Dec 2018 08:45:44 -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=UZQd+vr+; 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 S1729023AbeLWO6f (ORCPT + 99 others); Sun, 23 Dec 2018 09:58:35 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:44773 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728997AbeLWO6e (ORCPT ); Sun, 23 Dec 2018 09:58:34 -0500 Received: by mail-wr1-f68.google.com with SMTP id z5so9609349wrt.11 for ; Sun, 23 Dec 2018 06:58:33 -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=Y6scqON9KStlQnmh87N7ktbYjs+ArQwzAXpCvM+jErY=; b=UZQd+vr+FHB8k2FxAxU+hW45BJ+WlM/q4C4cjfMELqPM2rk6Jfj9TEeJpc7NoT/bIC 5eX0e2/9SxxgujScDFExdJvouaZY7RBwLf+IZvWSaSyaIo/8lXtbdtc4sRCvsdXyXH11 xLisGm/7BQ9gS97ezApPwEuDAkOjqTkL3JrURFn64l32Brs4KUPai90TCTjC81R6XGVZ P4R0QgtY6vL1TOPXsJbYnjZddKf8hACmAwuVUl58QMrfgM0EtkwQfOSHd7s22EvEoUqq WMYnLQju0JGfYpIsuLaTE6UlWE7VO+2LlvDDTXlp84ZgonWGsDl7JDBkq/phndsl8vSk YM2Q== 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=Y6scqON9KStlQnmh87N7ktbYjs+ArQwzAXpCvM+jErY=; b=Iv5fo83HlJTUT5niiErwqxe9cpRXDe4gt7c5GagiWrX1hrVMC729pRzol2wM8xU+N9 fUwssDzrueKEJK10iEXrnb57HM5Js+LKaukDVNkD6lFbaBHYkExqOUjZdOiQn2NYz3pD KtaQaZOQQyi/hWXIHzSRW9oZP83P0xaAv+f49Yny9ykgfsOlPLCtY7uEnW0Rzti1DYvN bvrbEqDyYM37IXMQlh6y8Ba7/6ZKXs69IpcXZwl3/xPqSoS3HrR5C/Y0uQ5dcOoZVaWx hFqmGysi7Y9l8MS5S5aijCR+2yusSYmnJPRyDAjCa3SkkmO/dOgMlW3d64qcvEzbXhqc 4TcQ== X-Gm-Message-State: AJcUukfVEGTaHJuX7+uYHFsAcGkO51qpRa3j7OAqPLFJgkpP+I6fs22J xYkU0PsVEFq38d1iIiYKTQl3+X2uQHUE/StZIK8dWQ== X-Received: by 2002:adf:f785:: with SMTP id q5mr9494358wrp.9.1545577112835; Sun, 23 Dec 2018 06:58:32 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Anup Patel Date: Sun, 23 Dec 2018 20:28:21 +0530 Message-ID: Subject: Re: [PATCH] RISC-V: Make BSS section as the last section in vmlinux.lds.S To: Palmer Dabbelt Cc: Albert Ou , 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 Fri, Dec 21, 2018 at 2:10 AM Palmer Dabbelt wrote: > > On Mon, 17 Dec 2018 01:36:45 PST (-0800), anup@brainfault.org wrote: > > 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? > > Sorry, I haven't had a chance to look at it yet. Aside from the macro issue > mentioned by Nick it seems OK. I have send v2 to address Nick's comment. Regards, Anup