From 3a659b4b54f9e3be253a2e9d082361704203c9dd Mon Sep 17 00:00:00 2001 From: Nicholas Guriev Date: Tue, 9 Feb 2021 08:55:41 +0300 Subject: [PATCH] Add -mxgot flag to td_scheme on MIPS64 This fixes "relocation truncated to fit ..." error on final linking. It should not introduce a lot of overhead since the code is used only in network communications. This errors appears sometimes and I do not know exact conditions, I think it is related to large size of an object file with the schema. More docs see at https://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html#index-mxgot-1 --- Telegram/cmake/td_scheme.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Telegram/cmake/td_scheme.cmake b/Telegram/cmake/td_scheme.cmake index 81778c27f..e4c68a602 100644 --- a/Telegram/cmake/td_scheme.cmake +++ b/Telegram/cmake/td_scheme.cmake @@ -33,3 +33,12 @@ PUBLIC desktop-app::lib_base desktop-app::lib_tl ) + +if (CMAKE_SYSTEM_PROCESSOR STREQUAL "mips64") + # Sometimes final linking may fail with error "relocation truncated to fit" + # due to large scheme size. + target_compile_options(td_scheme + PRIVATE + -mxgot + ) +endif()