Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/rp2040/boot_stage2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function(pico_define_boot_stage2 NAME SOURCES)
if (PICO_C_COMPILER_IS_CLANG)
target_link_options(${NAME} PRIVATE "-nostdlib")
elseif (PICO_C_COMPILER_IS_GNU)
# this disables newlib's implementation of syscalls such as _read
target_link_options(${NAME} PRIVATE "--specs=nosys.specs")
target_link_options(${NAME} PRIVATE "-nostartfiles")
endif ()
Expand Down
1 change: 1 addition & 0 deletions src/rp2350/boot_stage2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function(pico_define_boot_stage2 NAME SOURCES)
if (PICO_C_COMPILER_IS_CLANG)
target_link_options(${NAME} PRIVATE "-nostdlib")
elseif (PICO_C_COMPILER_IS_GNU)
# this disables newlib's implementation of syscalls such as _read
target_link_options(${NAME} PRIVATE "--specs=nosys.specs")
target_link_options(${NAME} PRIVATE "-nostartfiles")
endif ()
Expand Down
6 changes: 6 additions & 0 deletions src/rp2_common/pico_clib_interface/picolibc_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ static FILE __stdio = FDEV_SETUP_STREAM(picolibc_putc,
picolibc_flush,
_FDEV_SETUP_RW);

#ifdef __GNUCLIKE_PRAGMA_DIAGNOSTIC
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wunknown-warning-option"
#pragma GCC diagnostic ignored "-Wredundant-decls"
#endif

FILE *const stdin = &__stdio; __strong_reference(stdin, stdout); __strong_reference(stdin, stderr);

void __weak __assert_func(const char *file, int line, const char *func, const char *failedexpr) {
Expand Down
1 change: 1 addition & 0 deletions src/rp2_common/pico_cxx_options/new_delete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// Override the standard allocators to use regular malloc/free

#if !PICO_CXX_DISABLE_ALLOCATION_OVERRIDES // Let user override
#include <stdlib.h> // weird looking but it is required if dropping picolibc on top of GCC+newlib (reent issue)
#include <cstdlib>
#include "pico.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

#if defined __GNUC__
#include <sys/cdefs.h>
#if !defined(__printflike) && defined(__picolibc_format)
#define __printflike(a,b) __picolibc_format(printf,a,b)
#endif
// note LLVM defines __GNUC__
#ifdef __clang__
#define PICO_C_COMPILER_IS_CLANG 1
Expand Down
5 changes: 4 additions & 1 deletion src/rp2_common/pico_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ endforeach()

# todo is this correct/needed?
if (PICO_C_COMPILER_IS_GNU)
target_link_options(pico_runtime INTERFACE "--specs=nosys.specs")
if (PICO_LIBC STREQUAL "newlib")
# this disables newlib's implementation of syscalls such as _read
target_link_options(pico_runtime INTERFACE "--specs=nosys.specs")
endif()
elseif (PICO_C_COMPILER_IS_CLANG)
# target_link_options(pico_runtime INTERFACE "-nostdlib")
endif()
Expand Down
3 changes: 2 additions & 1 deletion src/rp2_common/pico_standard_link/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ if (NOT TARGET pico_standard_link)
# if PICO_TARGET_BINARY_TYPE is set to foo on the target, otherwise ${CMAKE_CURRENT_LIST_DIR}/memmap_${PICO_DEFAULT_BINARY_TYPE).ld
set(_LINKER_SCRIPT_EXPRESSION "$<IF:$<BOOL:$<TARGET_PROPERTY:PICO_TARGET_LINKER_SCRIPT>>,$<TARGET_PROPERTY:PICO_TARGET_LINKER_SCRIPT>,${PICO_LINKER_SCRIPT_PATH}/memmap_$<IF:$<STREQUAL:$<TARGET_PROPERTY:PICO_TARGET_BINARY_TYPE>,>,${PICO_DEFAULT_BINARY_TYPE},$<TARGET_PROPERTY:PICO_TARGET_BINARY_TYPE>>.ld>")
target_link_options(pico_standard_link INTERFACE
"LINKER:--script=${_LINKER_SCRIPT_EXPRESSION}"
# use T instead of --script here,as picolibc.specs looks for -T not --linker
"-T${_LINKER_SCRIPT_EXPRESSION}"
)
pico_add_link_depend(pico_standard_link ${_LINKER_SCRIPT_EXPRESSION})
unset(_LINKER_SCRIPT_EXPRESSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SECTIONS

. = ALIGN(4);
/* preinit data */
PROVIDE_HIDDEN (__bothinit_array_start = .);
Comment thread
kilograham marked this conversation as resolved.
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP(*(SORT(.preinit_array.*)))
KEEP(*(.preinit_array))
Expand All @@ -46,6 +47,7 @@ SECTIONS
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
PROVIDE_HIDDEN (__bothinit_array_end = .);

. = ALIGN(4);
/* finit data */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ SECTIONS

. = ALIGN(4);
/* preinit data */
PROVIDE_HIDDEN (__bothinit_array_start = .);
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP(*(SORT(.preinit_array.*)))
KEEP(*(.preinit_array))
Expand All @@ -62,6 +63,7 @@ SECTIONS
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
PROVIDE_HIDDEN (__bothinit_array_end = .);

. = ALIGN(4);
/* finit data */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ SECTIONS

. = ALIGN(4);
/* preinit data */
PROVIDE_HIDDEN (__bothinit_array_start = .);
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP(*(SORT(.preinit_array.*)))
KEEP(*(.preinit_array))
Expand All @@ -41,6 +42,7 @@ SECTIONS
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
PROVIDE_HIDDEN (__bothinit_array_end = .);

. = ALIGN(4);
/* finit data */
Expand Down
Loading