Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d8fc94e authored by Sami Tolvanen's avatar Sami Tolvanen
Browse files

ANDROID: kbuild: don't select LD_DEAD_CODE_DATA_ELIMINATION with LTO



Instead of enabling -gc-sections, which can break the kernel by dropping
sections that are actually needed, just merge the sections also when LTO
is enabled.

Bug: 145297900
Change-Id: I86aecd543d303eea4d30e7ce49cf5fcb3ed24307
Signed-off-by: default avatarSami Tolvanen <samitolvanen@google.com>
parent 194910dc
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -650,7 +650,6 @@ config LTO_CLANG
	depends on !KASAN
	select LTO
	select THIN_ARCHIVES
	select LD_DEAD_CODE_DATA_ELIMINATION
	help
          This option enables clang's Link Time Optimization (LTO), which allows
          the compiler to optimize the kernel globally at link time. If you
+3 −3
Original line number Diff line number Diff line
@@ -65,11 +65,11 @@
 * .data. We don't want to pull in .data..other sections, which Linux
 * has defined. Same for text and bss.
 */
#ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
#if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO_CLANG)
#define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
#define TEXT_CFI_MAIN .text.cfi .text.[0-9a-zA-Z_]*.cfi
#define DATA_MAIN .data .data.[0-9a-zA-Z_]*
#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]*
#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..compoundliteral* .data..L*
#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* .bss..compoundliteral* .bss..L*
#else
#define TEXT_MAIN .text
#define TEXT_CFI_MAIN .text.cfi