From 673a7c789ca1b4dc8d2a1714020d18947de31097 Mon Sep 17 00:00:00 2001 From: YB-cydz <3347963340@qq.com> Date: Sat, 29 Aug 2026 11:44:38 +0800 Subject: [PATCH] powerfin: statically link musl target Signed-off-by: YB-cydz <3347963340@qq.com> --- platforms/posix/cmake/Toolchain-arm-linux-musleabihf.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platforms/posix/cmake/Toolchain-arm-linux-musleabihf.cmake b/platforms/posix/cmake/Toolchain-arm-linux-musleabihf.cmake index 2baf00d6a1d5..62e4fd880591 100644 --- a/platforms/posix/cmake/Toolchain-arm-linux-musleabihf.cmake +++ b/platforms/posix/cmake/Toolchain-arm-linux-musleabihf.cmake @@ -3,6 +3,12 @@ set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_VERSION 1) +# PowerFin deploys PX4 as a self-contained binary on an OpenHarmony musl +# userspace. GNU gold 2.37 cannot link this static PIE because it does not +# support --no-dynamic-linker, so use ld.bfd and link the runtime statically. +set(USE_LD_GOLD OFF CACHE BOOL "Use GNU gold linker" FORCE) +set(CMAKE_EXE_LINKER_FLAGS "-static" CACHE STRING "Executable linker flags" FORCE) + if(NOT CMAKE_SYSTEM_PROCESSOR) set(CMAKE_SYSTEM_PROCESSOR arm) endif()