From 82284f10ebc1f6829d8d86c07c3ed10eb35c30b5 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 15 Jun 2019 12:47:11 -0500 Subject: [PATCH] [ox/std] Add substitutes file with missing __cxa_pure_virtual handler (synced from 47ce0408d5761543a925084f9fa24552868fa332) --- src/ox/std/CMakeLists.txt | 1 + src/ox/std/substitutes.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/ox/std/substitutes.cpp 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