Browse Source

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
sbg
Daniel Agar 5 years ago
parent
commit
9426c68a13
  1. 4
      CMakeLists.txt
  2. 5
      platforms/nuttx/CMakeLists.txt

4
CMakeLists.txt

@ -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()
#============================================================================= #=============================================================================

5
platforms/nuttx/CMakeLists.txt

@ -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)

Loading…
Cancel
Save