Skip to content

Commit 0547c7f

Browse files
committed
build: Fix linker errors when using CPP features.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
1 parent dd1bf3c commit 0547c7f

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

cores/arduino/abi.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,6 @@
66

77
#include <stdlib.h>
88

9-
namespace std {
10-
void __throw_length_error(const char *__s __attribute__((unused))) {
11-
}
12-
13-
void __throw_bad_alloc() {
14-
}
15-
16-
void __throw_bad_function_call() {
17-
}
18-
}; // namespace std
19-
209
extern "C" {
2110

2211
void *__dso_handle = (void *)&__dso_handle;

platform.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ compiler.zephyr.includes_file={build.variant.path}/includes.txt
4040
compiler.zephyr.cflags_file={build.variant.path}/cflags.txt
4141
compiler.zephyr.cxxflags_file={build.variant.path}/cxxflags.txt
4242
compiler.zephyr.macros="-imacros{build.variant.path}/llext-edk/include/zephyr/include/generated/zephyr/autoconf.h" "-imacros{build.variant.path}/llext-edk/include/zephyr/include/zephyr/toolchain/zephyr_stdint.h"
43-
compiler.zephyr.common_cxxflags=-fdata-sections -ffunction-sections -fno-unwind-tables
43+
compiler.zephyr.common_cxxflags=-fno-exceptions -fno-rtti -fdata-sections -ffunction-sections -fno-unwind-tables
4444
compiler.zephyr.common_ldflags=-fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-unwind-tables -fno-use-cxa-atexit -lstdc++ -lsupc++ -lnosys -nostdlib
4545

4646
compiler.zephyr.extra_cxxflags=
@@ -54,7 +54,7 @@ build.boot_mode=wait
5454
upload.extension=elf-zsk.bin
5555

5656
build.ldscript.path={runtime.platform.path}/variants/_ldscripts
57-
build.link_command="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" "-L{build.variant.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {build.extra_flags} {build.extra_ldflags} {compiler.zephyr.common_ldflags} --specs=picolibc.specs --specs=nosys.specs {compiler.ldflags} {object_files} -Wl,--start-group "{build.path}/{archive_file}" {compiler.zephyr.extra_ldflags} {compiler.libraries.ldflags} -Wl,--end-group {build.link_args.{build.link_mode}}
57+
build.link_command="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" "-L{build.variant.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {build.extra_flags} {build.extra_ldflags} {compiler.zephyr.common_ldflags} --specs=nano.specs --specs=nosys.specs {compiler.ldflags} {object_files} -Wl,--start-group "{build.path}/{archive_file}" {compiler.zephyr.extra_ldflags} {compiler.libraries.ldflags} -Wl,--end-group {build.link_args.{build.link_mode}}
5858

5959
build.check_command-dynamic={build.link_command} {build.link_args.check-dynamic} -o "{build.path}/{build.project_name}_check.tmp"
6060
build.check_command-static=/bin/true
@@ -63,7 +63,7 @@ build.combine_command={build.link_command} {build.link_args.build-{build.link_mo
6363

6464
# link_args.* are included by any link_command depending on the link_mode
6565
build.link_args.dynamic=-e main
66-
build.link_args.static=-lc -lm -lgcc -Wl,--wrap=random -Wl,--wrap=calloc -Wl,--wrap=free -Wl,--wrap=malloc -Wl,--wrap=realloc
66+
build.link_args.static=-lm -Wl,--wrap=random -Wl,--wrap=calloc -Wl,--wrap=free -Wl,--wrap=malloc -Wl,--wrap=realloc
6767

6868
# link_args.check-* are used to check the build. Only LLEXT needs these to emulate a static build (no -r!).
6969
build.link_args.check-dynamic="-T{build.variant.path}/syms-dynamic.ld" "-T{build.ldscript.path}/memory-check.ld" "-T{build.ldscript.path}/build-static.ld"

variants/_ldscripts/build-dynamic.ld

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ SECTIONS {
1919
*stdexcept.o
2020
*eh_*.o
2121
*cow-stdexcept.o
22-
*functexcept.o
2322
*cow-string-inst.o
2423
}
2524

0 commit comments

Comments
 (0)