diff --git a/src/ox/std/CMakeLists.txt b/src/ox/std/CMakeLists.txt index e83e2ca2d..ed77a94d1 100644 --- a/src/ox/std/CMakeLists.txt +++ b/src/ox/std/CMakeLists.txt @@ -6,6 +6,7 @@ add_library( memops.cpp new.cpp random.cpp + substitutes.cpp stacktrace.cpp strops.cpp trace.cpp diff --git a/src/ox/std/substitutes.cpp b/src/ox/std/substitutes.cpp new file mode 100644 index 000000000..59a7a3003 --- /dev/null +++ b/src/ox/std/substitutes.cpp @@ -0,0 +1,29 @@ +/* + * Copyright 2015 - 2018 gtalent2@gmail.com + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef OX_USE_STDLIB + +#include +#include + +// weak link panic to ensure that it exists, but allow it to be overriden by +// platform specific code +void __attribute__((weak)) panic(const char *msg) { + printf("Unexpected state:\n%s", msg); + std::abort(); +} + +extern "C" { + +void __cxa_pure_virtual() { + panic("Missing virtual function"); +} + +} + +#endif