From 6a7db34ff63345a7badec79ebea3aaef1712f374 Mon Sep 17 00:00:00 2001 From: graham sanderson Date: Tue, 13 Jun 2023 17:25:13 -0500 Subject: [PATCH] revert changes to when -nostartfiles is specified in link for 1.5.1 as it can cause link errors with C++; see #1368 --- src/rp2_common/pico_standard_link/CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/rp2_common/pico_standard_link/CMakeLists.txt b/src/rp2_common/pico_standard_link/CMakeLists.txt index b9282e2d..432ae356 100644 --- a/src/rp2_common/pico_standard_link/CMakeLists.txt +++ b/src/rp2_common/pico_standard_link/CMakeLists.txt @@ -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 $<$,no_flash>,1,$,$>>>:-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 $<$,no_flash>,1,$,$>>>:-nostartfiles>) # boot_stage2 will be linked if PICO_NO_FLASH would be defined to 0 target_link_libraries(pico_standard_link INTERFACE $<$,no_flash>,1,$,$>>>>:$>,$,bs2_default>_library>)