From e81d40a7c85f19ac767c347a326a316348b7144e Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 17 Aug 2014 20:23:24 +0200 Subject: [PATCH] Fix debug build. * Restore missing definitions of std::nothrow and mynothrow that are required for the debug build. * Additionally, cleanup function overrides provided by kernel_cpp, such that any exceptions in kernel, bootloader or runtime_loader will trigger a panic. --- src/system/kernel/util/Jamfile | 2 +- src/system/kernel/util/kernel_cpp.cpp | 30 ++++++++++++++++++++------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/system/kernel/util/Jamfile b/src/system/kernel/util/Jamfile index e7e7e407e7..42fa42e0fe 100644 --- a/src/system/kernel/util/Jamfile +++ b/src/system/kernel/util/Jamfile @@ -18,5 +18,5 @@ KernelMergeObject kernel_util.o : Random.cpp StringHash.cpp - : $(TARGET_KERNEL_PIC_CCFLAGS) + : $(TARGET_KERNEL_PIC_CCFLAGS) -DUSING_LIBGCC ; diff --git a/src/system/kernel/util/kernel_cpp.cpp b/src/system/kernel/util/kernel_cpp.cpp index a4ab706705..c569260a86 100644 --- a/src/system/kernel/util/kernel_cpp.cpp +++ b/src/system/kernel/util/kernel_cpp.cpp @@ -29,6 +29,17 @@ // Always define the symbols needed when not linking against libgcc.a -- // we simply override them. +// ... it doesn't seem to work with this symbol at least. +#ifndef USING_LIBGCC +# if __GNUC__ >= 3 +const std::nothrow_t std::nothrow = {}; +# else +const nothrow_t std::nothrow = {}; +# endif +#endif + +const mynothrow_t mynothrow = {}; + #if __GNUC__ == 2 extern "C" void @@ -62,7 +73,9 @@ __cxa_finalize(void* dsoHandle) #endif // full C++ support in the kernel -#if (defined(_KERNEL_MODE) || defined(_LOADER_MODE)) && !defined(_BOOT_MODE) +#if (defined(_KERNEL_MODE) || defined(_LOADER_MODE)) + +#ifndef _BOOT_MODE FILE *stderr = NULL; @@ -75,8 +88,6 @@ fprintf(FILE *f, const char *format, ...) return 0; } -#if __GNUC__ >= 3 - extern "C" size_t fwrite(const void *buffer, size_t size, size_t numItems, FILE *stream) @@ -110,7 +121,7 @@ printf(const char *format, ...) dprintf("printf(`%s',...)\n", format); return 0; } -#endif +#endif // #ifndef _LOADER_MODE extern "C" int @@ -119,10 +130,9 @@ puts(const char *string) return fputs(string, NULL); } +#endif // #ifndef _BOOT_MODE -#endif // __GNUC__ >= 3 - -#if __GNUC__ >= 4 && !defined(USING_LIBGCC) +#if __GNUC__ >= 4 extern "C" void @@ -248,6 +258,8 @@ abort() } +#ifndef _BOOT_MODE + extern "C" void debugger(const char *message) @@ -255,7 +267,9 @@ debugger(const char *message) kernel_debugger(message); } -#endif // _#if KERNEL_MODE +#endif // #ifndef _BOOT_MODE + +#endif // #if (defined(_KERNEL_MODE) || defined(_LOADER_MODE)) extern "C"