Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5351595imu; Sun, 25 Nov 2018 22:13:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/WXuNCGGz4IlY/kbO9tbwOyYW5/zY0rIOTcbGkXNwSCLLSvHi6bRb88+wPfd6Zyu5qAdpU0 X-Received: by 2002:a17:902:3181:: with SMTP id x1mr25958107plb.58.1543212796317; Sun, 25 Nov 2018 22:13:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543212796; cv=none; d=google.com; s=arc-20160816; b=vpN9fNSZc3+LEn1MMlKZ7ImuBd6cuPv40kiwc04G5+aaWSigLzqXgHwODaAzOhWVpn VUAOvB4OC8YRRKSeT4Jj90+TQXbQYKsiOYqzItiVDk89yXwgTX6jWP7uueeOCS65lu2r /0+ZpvFmxLOP4vNnTSw4k6oNMG60DlZMXvjRWrotYaeK5wUPM5t35YJ5XGmA5eaCt5kd NancEFg7mZg1z78oD/dNJbz2J387NBzy13MEdcRjd+AtuDku9l+270HgtOIAmZie3KhS 9UZPLWDLfIwC8cpwaA/HbTyFE0HhrHm9kWCjmGGqsVkpDoP+oO3eGsJs47BmyAThdU9G AooQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=ycwWr1lGERMQyqh6jY/uTIb5bXXqYhTnWn45u5xzpto=; b=OOYFBw8DL7th3CQn4d/rJCQZFhaUY2iyY9AzwzFMhy/R7GBM3rYs5uLdMkyQaj8/Nj TgXsvT1b3yjvRhPnuTevi/fGfJQrq6eBxwGJimZ1+efwIA51NgMRu4IqFTqA7LkymhuJ q6RrraVYAfLEnMMjEDQ+h5KO1l8C/hBsviuOsss/84j8a3FzUR2lwPgjqzvS8+Xqzmws U2m3r2snnL/RD/QyVKkJdCHJT1Uv9uYCBWUad2I6Od8J3sim6XmZbMumGHFgOCBmFMwE QVRqFrXZQTlHm6BodrN4gS5HMB7ppuXvZyFhcB7jW7SMIUe5SPVh8KaOeiOGRiZGcqE6 zBRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=gR1x7zwO; 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 35si33198858pgn.278.2018.11.25.22.13.00; Sun, 25 Nov 2018 22:13:16 -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=gR1x7zwO; 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 S1726174AbeKZRF1 (ORCPT + 99 others); Mon, 26 Nov 2018 12:05:27 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:43898 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbeKZRF1 (ORCPT ); Mon, 26 Nov 2018 12:05:27 -0500 Received: by mail-pl1-f196.google.com with SMTP id gn14so13352427plb.10 for ; Sun, 25 Nov 2018 22:12:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=ycwWr1lGERMQyqh6jY/uTIb5bXXqYhTnWn45u5xzpto=; b=gR1x7zwOUka48kMUoO0lfnRmyUbvphK9tetPQ+uxr7ajAcn46xrYZoHIR4gP7mau3x Aux78GvhwmG30DMxiRiRvvuk+HZVOKv+wv5Srw5YRtUawFBv1HhuQrrGHTynaw2Zy2rU x+oNnn3rZaOJwoG/EF3ZuF0ehUH7m3f4cwscrcMP8QU9MDOaoM4Qt5czmsNiqewLd2+k 7Gmm9COTzsMkgO4BMcuJsTDR6GtdnMixIsUSZTmLQRUKPqlnvzAgh39Zzt9lIqlfVo3l 7vAT/yQGk8F0ZOrDz2QYH2VdMt13VqjzZnXa/ySwYxxgGzQsiRvdc57H3USsmnL3Z4BE 1coQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ycwWr1lGERMQyqh6jY/uTIb5bXXqYhTnWn45u5xzpto=; b=dBOVqSFm+sF8C26cY0gbgoJMEgEMUjCemNacp1jjIyHa1vPHvlxA1/ARIRs+OygU8K fjRq9FRIh57ZpFHKoVkvAam9fkLUKHuLpPp8KaHB7Y8mF6+boDiOiQpDvZdii3b3y77t Tst3iRue2BBFiBY5C1x30heDai6pofrmEHgQ8BnGHK7z+HT92aqAYDP9+f9smblDK4hB hqsThhBnfIloUZHpDkt7TN4jnqtrpZJDztqfQ4HeyRI/wwLM2o3jyumwTgZ02+ocZmej cl1gqAQGgX/AYbb/h8aazMU3pwEBtT+M6+/RSHRwi8gy7bDaQvIZpWu7hoVaDEw1PfPy oEdA== X-Gm-Message-State: AA+aEWZU2Hm+7/1+LoUmUSuRLJTEALodcZ/RSlbcPJfIUlxRMJJjXPmL kN23oT5g+WDm0fgafEJL1SolTg== X-Received: by 2002:a17:902:b60a:: with SMTP id b10mr24826817pls.303.1543212743665; Sun, 25 Nov 2018 22:12:23 -0800 (PST) Received: from anup-ubuntu64.qualcomm.com ([106.51.18.229]) by smtp.googlemail.com with ESMTPSA id y6sm5966790pfd.104.2018.11.25.22.12.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Nov 2018 22:12:22 -0800 (PST) From: Anup Patel To: Palmer Dabbelt , Albert Ou Cc: Atish Patra , Christoph Hellwig , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel Subject: [PATCH] RISC-V: Make BSS section as the last section in vmlinux.lds.S Date: Mon, 26 Nov 2018 11:38:02 +0530 Message-Id: <20181126060802.19314-1-anup@brainfault.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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