All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <alobakin@pm.me>
To: Kees Cook <keescook@chromium.org>
Cc: Jessica Yu <jeyu@kernel.org>, Miroslav Benes <mbenes@suse.cz>,
	Emil Velikov <emil.l.velikov@gmail.com>,
	Sami Tolvanen <samitolvanen@google.com>,
	Sean Christopherson <seanjc@google.com>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Alexander Lobakin <alobakin@pm.me>,
	linux-hardening@vger.kernel.org, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] kbuild: merge module sections under CONFIG_LD_DEAD_CODE_DATA_ELIMINATION too
Date: Fri, 02 Apr 2021 12:40:08 +0000	[thread overview]
Message-ID: <20210402123959.5143-1-alobakin@pm.me> (raw)

When building with CONFIG_LD_DEAD_CODE_DATA_ELIMINATION,
-fdata-sections and -ffunction-sections are being enabled by the
top-level Makefile, and module section merging is also needed.
Expand the ifdef (and the comment block) to cover that case too.

Fixes: 6a3193cdd5e5 ("kbuild: lto: Merge module sections if and only if CONFIG_LTO_CLANG is enabled")
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
 scripts/module.lds.S | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/module.lds.S b/scripts/module.lds.S
index 2c52535f9b56..d6bbdfc55e08 100644
--- a/scripts/module.lds.S
+++ b/scripts/module.lds.S
@@ -20,11 +20,14 @@ SECTIONS {

 	__patchable_function_entries : { *(__patchable_function_entries) }

-#ifdef CONFIG_LTO_CLANG
+#if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO_CLANG)
 	/*
 	 * 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.
+	 * -ffunction-sections. With CONFIG_LD_DEAD_CODE_DATA_ELIMINATION,
+	 * -fdata-sections and -ffunction-sections are being enabled by
+	 * the top-level Makefile.
+	 * This increases the size of the final module. Merge the split
+	 * sections in the final binary.
 	 */
 	.bss : {
 		*(.bss .bss.[0-9a-zA-Z_]*)
--
2.31.1



             reply	other threads:[~2021-04-02 12:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02 12:40 Alexander Lobakin [this message]
2021-04-02 15:09 ` Sami Tolvanen
2021-04-06 14:42   ` Alexander Lobakin
2021-04-07 14:24     ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210402123959.5143-1-alobakin@pm.me \
    --to=alobakin@pm.me \
    --cc=emil.l.velikov@gmail.com \
    --cc=jeyu@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mbenes@suse.cz \
    --cc=samitolvanen@google.com \
    --cc=seanjc@google.com \
    --subject='Re: [PATCH] kbuild: merge module sections under CONFIG_LD_DEAD_CODE_DATA_ELIMINATION too' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.