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=-7.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 35776C43461 for ; Tue, 8 Sep 2020 21:09:12 +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 AD23820659 for ; Tue, 8 Sep 2020 21:09:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uX0UN4Rd"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="a7GjBHoh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD23820659 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com 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=vzCbU+lnYAnFQDzTCJIQ2uuMIvqubvAYejJNe8h7cig=; b=uX0UN4RdgzBQIbPAbpsKlnsgR 4sBrMCUx5IDDhkePloqngFkmowqZ48xYDIuWL2yH2pe8Fa/1c9yT/Robc0OcByOOQY0Q6pvsQzG4U cjS6PTT7iCP5Sg0So+zF19Fel6FOjDLM4nCxsTCvypppGRZJnbjvR0Y/u/clcnNONK15vbXLseLj6 M2RNAoY6gsZw5M27SaohhQShCc5asKjQFUEXBCgh24kdAxew2Qpiv2wKqxkuAWeTV1GdsCthv0RGL gokhX2ruuPZQFeHsADKLz1QL2P2/rdZ+/3GC8ultRWJfIny+i2Yx9rAxfCI29CiSUiEEQTYetQGCg 58i91je7A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFkqP-00072f-5H; Tue, 08 Sep 2020 21:08:01 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFkqM-00071g-A7 for linux-arm-kernel@lists.infradead.org; Tue, 08 Sep 2020 21:07:59 +0000 Received: by mail-pg1-x541.google.com with SMTP id j34so428907pgi.7 for ; Tue, 08 Sep 2020 14:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Wm1YZJP5IHcZuymW2XEKoD0pUveQe7CoNm7r9bi/W1k=; b=a7GjBHohAGSJ4PnMwooOuv5ACDnGE0C26cMuDHZo5+wvUiXv0xO8J2AUkV5JHb2FOP ldjjgjbqwFWCWq9Zw5W0LDK9PPh+xyYdY8hA2Wm743DJYsOoYFFThh9hJZBSdXRUCfFd cvOqVo7OMhMtAPX/2sp6Mz72uNjnDoYA9p//eZpjffoGYl/RG2xg8YzDi7C2OcRP5Eml H1IcomixFJ6jH0HEQSWDpcx4jVmZUZKnlbr7q8YvW0FORqPMCHn3losN4VKggIRBYbX6 PtF8QxirnS7Espc0n9SSG2KH2rmz6/CIoNi2jCnfqCKNNgM5GJGJNXvMfd4DY5Oii+fR uTRw== 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=Wm1YZJP5IHcZuymW2XEKoD0pUveQe7CoNm7r9bi/W1k=; b=HGD4EHxd4C62RDRqrRjqf8Ln30XUdn/VRFhpEEbZTBAa+73e9c5nH0OrUJSl/N/LHO 5IMhraAgFeZTazLc8xzVUFDH+mS/auT4qkpfK2mGCxIqpke+UGNUSzPCH4ua/wVNI30m N41yIgrh68yz8sCfVMsrwWACUcb+9vHcsB+SkOm/Xwfsn/uh3pHKc+KrV6e1bcGOhTuK tzIo+noUV0fTmruL2yPcm+vXnS7UqUu6LIMez4jx/JVxyAQYq/5oqQxhdhQk03JtveBo 9NdaKYN4JTH5ULDjbvwrKTUh9YkeyZS/VMsgiJrY0q9x8UQzm3347q8UParumo84MRXn X0Eg== X-Gm-Message-State: AOAM531c268hPD1OaAlTkYx6girIzmBQT+EBi+FXYip4SE5O/jkqavv1 AUBTa+te8yXVyQGXZygO1LKuBA== X-Google-Smtp-Source: ABdhPJz6/bLvTnKJTjhD++qFUgr8FkqyQitq4tmijOh19Mp/UXDDqyF/xILPr1db4moWKg5d5d7hXA== X-Received: by 2002:a17:902:c38a:: with SMTP id g10mr511116plg.23.1599599275319; Tue, 08 Sep 2020 14:07:55 -0700 (PDT) Received: from google.com ([2620:15c:201:2:f693:9fff:fef4:1b6d]) by smtp.gmail.com with ESMTPSA id m188sm323916pfd.56.2020.09.08.14.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 14:07:54 -0700 (PDT) Date: Tue, 8 Sep 2020 14:07:48 -0700 From: Sami Tolvanen To: Masahiro Yamada Subject: Re: [PATCH v2 13/28] kbuild: lto: merge module sections Message-ID: <20200908210748.GB1060586@google.com> References: <20200624203200.78870-1-samitolvanen@google.com> <20200903203053.3411268-1-samitolvanen@google.com> <20200903203053.3411268-14-samitolvanen@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200908_170758_356106_9234540B X-CRM114-Status: GOOD ( 28.04 ) 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 , X86 ML , Kees Cook , "Paul E. McKenney" , Kernel Hardening , Peter Zijlstra , Greg Kroah-Hartman , Linux Kbuild mailing list , Nick Desaulniers , Linux Kernel Mailing List , Steven Rostedt , clang-built-linux , linux-pci@vger.kernel.org, Will Deacon , linux-arm-kernel 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 Tue, Sep 08, 2020 at 12:25:54AM +0900, Masahiro Yamada wrote: > On Fri, Sep 4, 2020 at 5:31 AM Sami Tolvanen wrote: > > > > LLD always splits sections with LTO, which increases module sizes. This > > change adds a linker script that merges the split sections in the final > > module. > > > > Suggested-by: Nick Desaulniers > > Signed-off-by: Sami Tolvanen > > --- > > Makefile | 2 ++ > > scripts/module-lto.lds | 26 ++++++++++++++++++++++++++ > > 2 files changed, 28 insertions(+) > > create mode 100644 scripts/module-lto.lds > > > > diff --git a/Makefile b/Makefile > > index c69e07bd506a..bb82a4323f1d 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -921,6 +921,8 @@ CC_FLAGS_LTO_CLANG += -fvisibility=default > > # Limit inlining across translation units to reduce binary size > > LD_FLAGS_LTO_CLANG := -mllvm -import-instr-limit=5 > > KBUILD_LDFLAGS += $(LD_FLAGS_LTO_CLANG) > > + > > +KBUILD_LDS_MODULE += $(srctree)/scripts/module-lto.lds > > endif > > > > ifdef CONFIG_LTO > > diff --git a/scripts/module-lto.lds b/scripts/module-lto.lds > > new file mode 100644 > > index 000000000000..cbb11dc3639a > > --- /dev/null > > +++ b/scripts/module-lto.lds > > @@ -0,0 +1,26 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +/* > > + * 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_]*) } > > +} > > -- > > 2.28.0.402.g5ffc5be6b7-goog > > > > > After I apply https://patchwork.kernel.org/patch/11757323/, > is it possible to do like this ? > > > #ifdef CONFIG_LTO > SECTIONS { > ... > }; > #endif > > in scripts/module.lds.S Yes, that should work. I'll change this in v3 after your change is applied. Sami _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel