From 1d398cd0653e6eae53538c42acd21b06c70afaf2 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Sun, 21 Jan 2024 01:22:38 +0800 Subject: [PATCH] mipsel: build: Work around MIPS floating point ABI passing in LTO Clang reports: floating point ABI '-mdouble-float' is incompatible with target floating point ABI '-msoft-float' when -msoft-float is enabled for the architecture. --- src/build/config/compiler/BUILD.gn | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/build/config/compiler/BUILD.gn b/src/build/config/compiler/BUILD.gn index 61091453c4..e3cb506b25 100644 --- a/src/build/config/compiler/BUILD.gn +++ b/src/build/config/compiler/BUILD.gn @@ -1357,6 +1357,13 @@ config("compiler_codegen") { } } + # Fix float ABI information not being passed in LLVM bitcode for LTO + # and link failure with -mdouble-float being incorrectly used by default + # while the bitcode was compiled with -msoft-float. + # See https://discourse.llvm.org/t/myterious-soft-float-output-in-lto-cache/70753 + if (current_cpu == "mipsel" && !is_debug && use_thin_lto && is_a_target_toolchain && mips_float_abi == "soft") { + ldflags += [ "-Wl,-mllvm,-mattr=+soft-float" ] + } asmflags = cflags }