[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210402123959.5143-1-alobakin@pm.me>
Date: Fri, 02 Apr 2021 12:40:08 +0000
From: Alexander Lobakin <alobakin@...me>
To: Kees Cook <keescook@...omium.org>
Cc: Jessica Yu <jeyu@...nel.org>, Miroslav Benes <mbenes@...e.cz>,
Emil Velikov <emil.l.velikov@...il.com>,
Sami Tolvanen <samitolvanen@...gle.com>,
Sean Christopherson <seanjc@...gle.com>,
Masahiro Yamada <masahiroy@...nel.org>,
Alexander Lobakin <alobakin@...me>,
linux-hardening@...r.kernel.org, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] kbuild: merge module sections under CONFIG_LD_DEAD_CODE_DATA_ELIMINATION too
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@...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
Powered by blists - more mailing lists