Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp514198imu; Thu, 20 Dec 2018 00:21:32 -0800 (PST) X-Google-Smtp-Source: AFSGD/XWZiGnpqbMXHduOk94391t8dfta/NNdk4YN3okPpKDvoFjSmnms+yUepfjpdJT9JoQmrK8 X-Received: by 2002:a17:902:9305:: with SMTP id bc5mr23024399plb.86.1545294092397; Thu, 20 Dec 2018 00:21:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545294092; cv=none; d=google.com; s=arc-20160816; b=Cn7+0Ij9E4fn+7HdWCMKOhpnUP+7V23e6g3oT7HQD3HRigUxgrfpQ6h2QSS7ocGsf9 fLXk+ssfMEy2CdsRA/Jua0n9t3N/f06wQf+Zoo0oRXelsA8+z9zyv31YtHxwWGwVMU7k PMIQvsTrpLFRtZ9g7DJ+WItn8kgR7SHqvTPWVrgfRLzSm3QM7ARlG6DFy39QwOu8RRGl RTRZrSRuGlyeKegKU5s8aGdvAiM2m3GD3c2REtHpkmDzGmEnPNvbIsLnoFVFUveCAEPA djMjttzrTarjpPHH/TXwyJWhYlnRa6HWjpFeHDkuD3oC3haEiumpn5mLiXgcTGIHwnHM sQOA== 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=uSH8Px44l+044lB7ulMznZksHkH6jpW/e6qzUQ/ZZ+A=; b=jsgWaMfkwSxlPOQ8PT42L8h07QHawRWL+S1HhNcmmO/n4mE/fwHZSdCBCMjVRJBLNA mDE6CyIgZqO0fADXqbjNG3uFfc1xEFEIvh+S2yrLIjrO7U/p8ccYelxc/cRha+sb2jR1 iTs0K5JTz4IeNkb6ejEh0ma7RCxZGB3El0eqf8xhLzE9Hvs62YXzGuE9R1j0J8DzXm8Z v1Zta2XuEJbNX0cVHkAzGqhQRSSQ171naFMfeRDbEFOGbDxZmz81fT8qNgHULHxHN/xM /F4cJ5TdjhDRQ0WvLV2Jcq8G9Z0F1ruivWndX0AiPD6CACZDm86QfPtDde7I/TYL0Sj3 cLpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Wiq26En0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si18934955pfe.74.2018.12.20.00.21.15; Thu, 20 Dec 2018 00:21:32 -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=@gmail.com header.s=20161025 header.b=Wiq26En0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730469AbeLTGRA (ORCPT + 99 others); Thu, 20 Dec 2018 01:17:00 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:33656 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728025AbeLTGRA (ORCPT ); Thu, 20 Dec 2018 01:17:00 -0500 Received: by mail-ed1-f67.google.com with SMTP id p6so752734eds.0 for ; Wed, 19 Dec 2018 22:16:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uSH8Px44l+044lB7ulMznZksHkH6jpW/e6qzUQ/ZZ+A=; b=Wiq26En0qPUdxtT1NfYNP47NrXDB628RGKZkVe0FLdHadP5Nrj8p20h9L/v0+VSePc CE0Kx2IM4OM/G00JzADi3pGm/c2OGFBcUt5iuoFxCLCtObjWQwIYnWhIks7n/lhmRDzJ /pUbbPDRwN6MNtRl3/Bl77KfBUduIEWB5/0ZQPQn//eCohX1ngrEouuFSkHK7ulufZ9V UoxXieVjjKIYBT6cI83ztBMpY89HXxSzkHS6DAJPFpSXuzmgAHnmIxPzpOCkxvnjSke9 YRzpg8breNAFUTUr98GrdThmklcufbdLZTHW37S1OfZdaIERyUQsghnYoRC3iloFmqjk /+pQ== 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=uSH8Px44l+044lB7ulMznZksHkH6jpW/e6qzUQ/ZZ+A=; b=ulwu391DsByRf9739iHY+UWjhHSgjIrufEr67qZ62HyjzuKo5Lj7xt2OI5w93jLkBg DR4rxpAvmygjaB7rI4HEtuzPAi3zS3X/BedqvXJQz0Ybmdw9oGcQjiAI2lckPwr5T8jG g7x8J+/k+Je3loGCjfMMaC1blxrTROA+6KOJ4gIF0g3ABUOsk/E5fYmg9ZuKAjiDuaEQ 4xXk95DK8ytK8YgvFeTcSDiJ0PvHCbzx99QUytPTFrs6fucn6pSsgDI86cu0VoPwpC2i TzFTNSAOyqkNPkTjOgR63x+B2SqwdYWsewuZdmfFPqHPfOWDr5Z7Cu45+ustZiseJhqS 2U/A== X-Gm-Message-State: AA+aEWbQhuIdZzbtxZlEBhNF5Z6QqFRgw8HC69/4sAWFUx3xt8vpkPe3 LxUQeHIO2VUMlOxrrUIoZ3Bfs+T+ATnLgUKImZg= X-Received: by 2002:a50:9291:: with SMTP id k17mr20863951eda.243.1545286618433; Wed, 19 Dec 2018 22:16:58 -0800 (PST) MIME-Version: 1.0 References: <20181219123657.61270-1-anup@brainfault.org> In-Reply-To: <20181219123657.61270-1-anup@brainfault.org> From: Bin Meng Date: Thu, 20 Dec 2018 14:16:47 +0800 Message-ID: Subject: Re: [PATCH v2] RISC-V: Make BSS section as the last section in vmlinux.lds.S To: Anup Patel Cc: Palmer Dabbelt , Albert Ou , Christoph Hellwig , Atish Patra , linux-riscv@lists.infradead.org, linux-kernel 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 Wed, Dec 19, 2018 at 8:37 PM 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. In summary, this patch reduces > Linux-4.20-rc4 flat kernel Image size by 809 KB. > > Signed-off-by: Anup Patel > --- > > Changes since v1: > - Introduce MAX_BYTES_PER_LONG define and use it in-place of > 0x10 magic value > > arch/riscv/kernel/vmlinux.lds.S | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > Reviewed-by: Bin Meng