cmake: only allow gold linker for posix builds

- the gold linker doesn't currently work for NuttX builds
 - NuttX skip --print-memory-usage if using the GOLD linker
 - fixes #15400
This commit is contained in:
Daniel Agar
2020-07-22 10:23:37 -04:00
parent 7ac66bae4f
commit 9426c68a13
2 changed files with 19 additions and 14 deletions
+3 -1
View File
@@ -221,7 +221,8 @@ endif()
#============================================================================= #=============================================================================
# gold linker - use if available # gold linker - use if available (posix only for now)
if(${PX4_PLATFORM} STREQUAL "posix")
include(CMakeDependentOption) include(CMakeDependentOption)
CMAKE_DEPENDENT_OPTION(USE_LD_GOLD CMAKE_DEPENDENT_OPTION(USE_LD_GOLD
"Use GNU gold linker" ON "Use GNU gold linker" ON
@@ -237,6 +238,7 @@ if(USE_LD_GOLD)
set(USE_LD_GOLD OFF) set(USE_LD_GOLD OFF)
endif() endif()
endif() endif()
endif()
#============================================================================= #=============================================================================
+4 -1
View File
@@ -124,7 +124,6 @@ target_link_libraries(px4 PRIVATE
-Wl,-Map=${PX4_CONFIG}.map -Wl,-Map=${PX4_CONFIG}.map
-Wl,--warn-common -Wl,--warn-common
-Wl,--gc-sections -Wl,--gc-sections
-Wl,--print-memory-usage
-Wl,--start-group -Wl,--start-group
${nuttx_libs} ${nuttx_libs}
@@ -134,6 +133,10 @@ target_link_libraries(px4 PRIVATE
gcc gcc
) )
if(NOT USE_LD_GOLD)
target_link_libraries(px4 PRIVATE -Wl,--print-memory-usage)
endif()
target_link_libraries(px4 PRIVATE ${module_libraries}) target_link_libraries(px4 PRIVATE ${module_libraries})
if (config_romfs_root) if (config_romfs_root)