[PATCH v2 16/30] Makefile: Disable LTO when not building with gcc
Simon Glass
sjg at chromium.org
Sun Apr 30 03:29:49 CEST 2023
For MSYS2 this creates a lot of errors of the form:
`__stack_chk_fail' referenced in section `.text' of ...ltrans.o: defined
in discarded section `.text' of common/stackprot.o (symbol from plugin)
For clang it doesn't work, except with sandbox.
Update the dependency to (hopefully) deal with all of that.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v2:
- Make LTO depend on !MSYS2 rather than adding another check
- Also disable LTO for clang, except with sandbox
Kconfig | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Kconfig b/Kconfig
index 888b9984ac3b..9ac816abef1c 100644
--- a/Kconfig
+++ b/Kconfig
@@ -72,6 +72,9 @@ config CLANG_VERSION
int
default $(shell,$(srctree)/scripts/clang-version.sh $(CC))
+config CC_IS_MSYS
+ def_bool $(success,uname -o | grep -q Msys)
+
choice
prompt "Optimization level"
default CC_OPTIMIZE_FOR_SIZE
@@ -121,6 +124,8 @@ config ARCH_SUPPORTS_LTO
config LTO
bool "Enable Link Time Optimizations"
depends on ARCH_SUPPORTS_LTO
+ depends on CC_IS_GCC || (CC_IS_CLANG && SANDBOX)
+ depends on !CC_IS_MSYS
help
This option enables Link Time Optimization (LTO), a mechanism which
allows the compiler to optimize between different compilation units.
--
2.40.1.495.gc816e09b53d-goog
More information about the U-Boot
mailing list