Skip to content

Commit 464c213

Browse files
facchinmsoburi
authored andcommitted
linker: forcefully remove exceptions and pack sections
There's no way to convince the compiler to consider the provided flags when linking modern c++ code (std::). Get rid of the useless symbols in the linker and add the (then) missing implementations in abi.cpp
1 parent b7480d3 commit 464c213

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

cores/arduino/abi.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@
66

77
#include <stdlib.h>
88

9-
extern "C" void __cxa_pure_virtual(void) __attribute__ ((__noreturn__));
10-
extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__));
11-
12-
namespace std {
13-
[[gnu::weak, noreturn]] void terminate() {
14-
abort();
15-
}
9+
extern "C" void __cxa_pure_virtual(void) {}
10+
extern "C" void __cxa_deleted_virtual(void) {}
11+
extern "C" int __cxa_atexit(void (*func) (void *), void * arg, void * dso_handle) {
12+
return 0;
1613
}
1714

18-
void __cxa_pure_virtual(void) {
19-
std::terminate();
20-
}
15+
namespace std {
16+
void __throw_length_error(const char* __s __attribute__((unused))) {}
17+
};
2118

22-
void __cxa_deleted_virtual(void) {
23-
std::terminate();
19+
extern "C" int strcmp(const char* s1, const char* s2) {
20+
while(*s1 && (*s1 == *s2))
21+
{
22+
s1++;
23+
s2++;
24+
}
25+
return *(const unsigned char*)s1 - *(const unsigned char*)s2;
2426
}

0 commit comments

Comments
 (0)