From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 139CCC433E7 for ; Wed, 14 Oct 2020 22:50:34 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 972042223F for ; Wed, 14 Oct 2020 22:50:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pvTVAl4e"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Xiw0SX12" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 972042223F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0Tta71j56zTkJhU0inVw4TN7FppQEleaKfPBXHkrG1Y=; b=pvTVAl4e93MmOukxH1c2zSIWS 7/VTkd+l/i7rSv/Wu3ycGJHadffIhmrCdUJkC15Pm0DMxjsx4SxhoUP0avbSazYVyzhKDVOFnEanU SesXJD77DsE3RpuuPZnWkIKT8mfysS5aUFiVEAePvtDg/wblfCjOG763XMIyTvjuTGLUnAEQ67RrP 2LbPzFGTiK9ue7sqMfJ+LDwMc0GaxQRdV7bQ7zYIxRkTttc8FayEHokNf3wVbUYT2JfwAEWldTZHp 4vubyJh3D3ifsWGYxbv3747BkIs8x0DiDluy0zh8Gn5AQz/wQ2umsMFnAlyFUZ7Cg6yoNFD/o++pR Naj8KQqmg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSpa8-0004dR-Dx; Wed, 14 Oct 2020 22:49:16 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSpa6-0004cW-4z for linux-arm-kernel@lists.infradead.org; Wed, 14 Oct 2020 22:49:15 +0000 Received: by mail-pj1-x1041.google.com with SMTP id u3so631481pjr.3 for ; Wed, 14 Oct 2020 15:49:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=73JDK6v9QIywlQAL1ojHAWu8vRvKniVaMQhT9AVQkgM=; b=Xiw0SX12te2H7unG0PW7k/KDxUZJqZb5kGC4j352+pdUtyhY3eZe/RclVKos04VObp mf+x2YyvDzI5Ik3UZzDFmDrX7FcS/7sA3PxWZ6U5hpwDTt9i4/2blfvsBVY9nqQH/5rp HouHNDN1JpRuMXtKKKFag3SRoJuNJQv3vA0zs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=73JDK6v9QIywlQAL1ojHAWu8vRvKniVaMQhT9AVQkgM=; b=F5SloIIXELqQQ5EsnpMl1sb/zB7JXeVg7W7mg+zo8gyGRnboXocQOFaQnip7HzDrO1 X2FWiHPCqM7EaOI+7fMXST9/U8Zg+VUEWav4zJyr8vuieAjBOgtHSZqavfiDPsNVeQVF RFOe/qsfSMcqYUx59c+tX+B1OHKcQwgbyhXTWo41HDedEMqVm+MT3D82pqo2Lu4Ld2qA clLy14uw8zA9vD4lRMAISNta9/81tCVTColdXPAkAonlz7lUnsRG5WSs2m/rt0jrFVrT oBQw8M1VEpHU5y7PW48wOmjXhxQDXPOPIz7tT4EPizukAeWC8l3KSkO4/e8kNKyI68r2 nwiQ== X-Gm-Message-State: AOAM533Nfkc64z4oLoa+0Ppe0d5cU6WIyhUievowpL2ad7IapKO1aTwO jjQo9WfQulnuadQrTDJv4tf8Bw== X-Google-Smtp-Source: ABdhPJxSM90nZhUVG0O6sO50Xgaa+D7fRK95gdDff9gylp7HlrlNT4+Iuxg9mylfSVrF1VzMLrV6Tg== X-Received: by 2002:a17:90a:f685:: with SMTP id cl5mr1325486pjb.210.1602715751992; Wed, 14 Oct 2020 15:49:11 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e16sm675880pjr.36.2020.10.14.15.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 15:49:11 -0700 (PDT) Date: Wed, 14 Oct 2020 15:49:10 -0700 From: Kees Cook To: Sami Tolvanen Subject: Re: [PATCH v6 13/25] kbuild: lto: merge module sections Message-ID: <202010141548.47CB1BC@keescook> References: <20201013003203.4168817-1-samitolvanen@google.com> <20201013003203.4168817-14-samitolvanen@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201013003203.4168817-14-samitolvanen@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201014_184914_246658_9EC7AC66 X-CRM114-Status: GOOD ( 20.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, x86@kernel.org, "Paul E. McKenney" , kernel-hardening@lists.openwall.com, Peter Zijlstra , Greg Kroah-Hartman , Masahiro Yamada , linux-kbuild@vger.kernel.org, Nick Desaulniers , linux-kernel@vger.kernel.org, Steven Rostedt , clang-built-linux@googlegroups.com, linux-pci@vger.kernel.org, Will Deacon , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Oct 12, 2020 at 05:31:51PM -0700, Sami Tolvanen wrote: > LLD always splits sections with LTO, which increases module sizes. This > change adds linker script rules to merge the split sections in the final > module. > > Suggested-by: Nick Desaulniers > Signed-off-by: Sami Tolvanen > Reviewed-by: Kees Cook > --- > scripts/module.lds.S | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/scripts/module.lds.S b/scripts/module.lds.S > index 69b9b71a6a47..037120173a22 100644 > --- a/scripts/module.lds.S > +++ b/scripts/module.lds.S > @@ -25,5 +25,33 @@ SECTIONS { > __jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) } > } > > +#ifdef CONFIG_LTO_CLANG In looking at this again -- is this ifdef needed? Couldn't this be done unconditionally? (Which would make it an independent change...) -Kees > +/* > + * With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and > + * -ffunction-sections, which increases the size of the final module. > + * Merge the split sections in the final binary. > + */ > +SECTIONS { > + __patchable_function_entries : { *(__patchable_function_entries) } > + > + .bss : { > + *(.bss .bss.[0-9a-zA-Z_]*) > + *(.bss..L*) > + } > + > + .data : { > + *(.data .data.[0-9a-zA-Z_]*) > + *(.data..L*) > + } > + > + .rodata : { > + *(.rodata .rodata.[0-9a-zA-Z_]*) > + *(.rodata..L*) > + } > + > + .text : { *(.text .text.[0-9a-zA-Z_]*) } > +} > +#endif > + > /* bring in arch-specific sections */ > #include > -- > 2.28.0.1011.ga647a8990f-goog > -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel