Skip to content

Commit

Permalink
revert changes to when -nostartfiles is specified in link for 1.5.1 a…
Browse files Browse the repository at this point in the history
…s it can cause link errors with C++; see #1368
  • Loading branch information
kilograham committed Jun 13, 2023
1 parent 8ecc5ab commit 6a7db34
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/rp2_common/pico_standard_link/CMakeLists.txt
Expand Up @@ -74,11 +74,9 @@ if (NOT TARGET pico_standard_link)
target_compile_definitions(pico_standard_link INTERFACE PICO_DEOPTIMIZED_DEBUG=1)
endif()

# -nostartfiles will be added if not using C++ exceptions (which is the only thing that seems to need it)
if (PICO_C_COMPILER_IS_GNU AND NOT PICO_CXX_ENABLE_EXCEPTIONS)
# target_link_options(pico_standard_link INTERFACE $<$<IF:$<STREQUAL:$<TARGET_PROPERTY:PICO_TARGET_BINARY_TYPE>,no_flash>,1,$<AND:$<BOOL:${PICO_NO_FLASH}>,$<STREQUAL:,$<TARGET_PROPERTY:PICO_TARGET_BINARY_TYPE>>>>:-nostartfiles>)
target_link_options(pico_standard_link INTERFACE -nostartfiles)
endif()
# this (arguably wrong) code is restored for 1.5.1 as setting -nostartfiles on many C++ binaries causes link errors. see issue #1368
# -nostartfiles will be added if PICO_NO_FLASH would be defined to 1
target_link_options(pico_standard_link INTERFACE $<$<IF:$<STREQUAL:$<TARGET_PROPERTY:PICO_TARGET_BINARY_TYPE>,no_flash>,1,$<AND:$<BOOL:${PICO_NO_FLASH}>,$<STREQUAL:,$<TARGET_PROPERTY:PICO_TARGET_BINARY_TYPE>>>>:-nostartfiles>)
# boot_stage2 will be linked if PICO_NO_FLASH would be defined to 0
target_link_libraries(pico_standard_link INTERFACE $<$<NOT:$<IF:$<STREQUAL:$<TARGET_PROPERTY:PICO_TARGET_BINARY_TYPE>,no_flash>,1,$<AND:$<BOOL:${PICO_NO_FLASH}>,$<STREQUAL:,$<TARGET_PROPERTY:PICO_TARGET_BINARY_TYPE>>>>>:$<IF:$<BOOL:$<TARGET_PROPERTY:PICO_TARGET_BOOT_STAGE2>>,$<TARGET_PROPERTY:PICO_TARGET_BOOT_STAGE2>,bs2_default>_library>)

Expand Down

0 comments on commit 6a7db34

Please sign in to comment.