From ae4ca7a09bb6715a0f3533fa6e499ce40b5d7ac1 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 6 Jan 2023 05:07:20 +0000 Subject: [PATCH] ANDROID: fips140: allow building without LTO Following "ANDROID: fips140: eliminate crypto-fips.a build step", the only remaining dependency on LTO is the fact that the part of the module linker script that merges the text and rodata sections and adds some symbols is guarded by '#ifdef CONFIG_LTO_CLANG'. This doesn't actually need to be the case, though. So guard it by alternatively IS_ENABLED(CONFIG_CRYPTO_FIPS140_MOD). Then, remove the dependency of CRYPTO_FIPS140_MOD on LTO_CLANG. (Note: the android14-6.1 kernel currently has LTO disabled, which is part of the motivation for this change. I don't know whether it will stay that way, though.) Bug: 188620248 Change-Id: I1aa7b293ac7a793721275e06e3ae40628e26bbc4 Signed-off-by: Eric Biggers --- crypto/Kconfig | 2 +- scripts/module.lds.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/Kconfig b/crypto/Kconfig index c5256e32f713..f41ddc91b7b2 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -35,7 +35,7 @@ config CRYPTO_FIPS config CRYPTO_FIPS140_MOD tristate "Enable FIPS 140 cryptographic module" - depends on ARM64 && ARM64_MODULE_PLTS && LTO_CLANG + depends on ARM64 && ARM64_MODULE_PLTS depends on m help This option enables building a loadable module fips140.ko, which diff --git a/scripts/module.lds.S b/scripts/module.lds.S index 0cef6b43a908..0dabe5b43cc0 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -62,7 +62,7 @@ SECTIONS { } #endif -#ifdef CONFIG_LTO_CLANG +#if defined(CONFIG_LTO_CLANG) || IS_ENABLED(CONFIG_CRYPTO_FIPS140_MOD) /* * With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and * -ffunction-sections, which increases the size of the final module.