From e1042b8504e277820f14cb884bd6ee5578ef8cb6 Mon Sep 17 00:00:00 2001 From: Yavor Georgiev Date: Fri, 1 Mar 2024 14:13:36 +0100 Subject: [PATCH] Use the bfd linker in the armv7 toolchain (#7406) --- CHANGELOG.md | 2 +- tools/cmake/armv7-linux-gnueabihf.toolchain.cmake | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 499435e8548..d363fce3387 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ ----------- ### Internals -* None. +* The Linux-armv7 cross-compiling toolchain file prefers the bfd linker over gold because of issues linking against OpenSSL 3.2.0. ---------------------------------------------- diff --git a/tools/cmake/armv7-linux-gnueabihf.toolchain.cmake b/tools/cmake/armv7-linux-gnueabihf.toolchain.cmake index 423c44fdcd5..296986fc5bc 100644 --- a/tools/cmake/armv7-linux-gnueabihf.toolchain.cmake +++ b/tools/cmake/armv7-linux-gnueabihf.toolchain.cmake @@ -1,3 +1,8 @@ set(_TRIPLET "armv7-unknown-linux-gnueabihf") set(_TOOLCHAIN_MD5 fbf817b1428bb35c93be8e6c15f73d7d) include("${CMAKE_CURRENT_LIST_DIR}/linux.toolchain.base.cmake") + +# Explicitly opt-in to the slower bfd linker over gold, because gold in GCC 11.2 doesn't play nice with R_ARM_REL32 relocations +set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=bfd ${CMAKE_EXE_LINKER_FLAGS_INIT}") +set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=bfd ${CMAKE_SHARED_LINKER_FLAGS_INIT}") +set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=bfd ${CMAKE_MODULE_LINKER_FLAGS_INIT}")