Since the kernel links against libgcc.a and we use some C++ features that cause functions of libgcc.a to be included that use a couple of formerly undefined symbols (stderr, fprintf, abort, debugger) those had to be added to kernel_cpp.cpp. We don't build the kernel utils as static library anymore, since libgcc.a is listed at the end of the link command line and trying to change that would be a bit ugly. For C++ in the boot loader nothing changes.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9554 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2004-10-27 22:07:00 +00:00
parent 2cee54a863
commit 5de8542789
4 changed files with 50 additions and 9 deletions

View File

@ -71,10 +71,15 @@ operator delete[](void *ptr) throw ()
free(ptr);
}
// we're using virtuals
// only needed in the boot loader
#ifndef _BOOT_MODE
extern "C" void __pure_virtual();
#endif // #if _BOOT_MODE
#endif // #if _KERNEL_MODE
#endif // __cplusplus
#endif /* KERNEL_CPP_H */

View File

@ -54,11 +54,11 @@ KernelLd kernel :
kernel_cache.o
kernel_device_manager.o
kernel_disk_device_manager.o
kernel_util.o
libbus.a
lib$(OBOS_ARCH).a
libdrivers.a
libkernel_util.a
linkhack.so
@ -83,11 +83,11 @@ KernelLd kernel.so :
kernel_cache.o
kernel_device_manager.o
kernel_disk_device_manager.o
kernel_util.o
libbus.a
lib$(OBOS_ARCH).a
libdrivers.a
libkernel_util.a
linkhack.so

View File

@ -1,8 +1,8 @@
SubDir OBOS_TOP src kernel core util ;
KernelStaticLibrary libkernel_util :
<$(SOURCE_GRIST)>list.c
<$(SOURCE_GRIST)>kernel_cpp.cpp
:
-fno-pic -Wno-unused -D_KERNEL_MODE
KernelMergeObject kernel_util.o :
list.c
kernel_cpp.cpp
: -fno-pic -Wno-unused -D_KERNEL_MODE
;

View File

@ -4,7 +4,8 @@
** This file may be used under the terms of the OpenBeOS License.
*/
#if _KERNEL_MODE
// stripped down C++ support for the boot loader
#ifdef _BOOT_MODE
#include "util/kernel_cpp.h"
@ -27,4 +28,39 @@ __cxa_pure_virtual()
#endif
// full C++ support in the kernel
#elif _KERNEL_MODE // #endif _BOOT_MODE
#include <stdio.h>
#include <KernelExport.h>
#include "util/kernel_cpp.h"
FILE *stderr = NULL;
extern "C"
int
fprintf(FILE *f, const char *format, ...)
{
// TODO: Introduce a vdprintf()...
dprintf("fprintf(`%s',...)\n", format);
return 0;
}
extern "C"
void
abort()
{
panic("abort() called!");
}
extern "C"
void
debugger(const char *message)
{
kernel_debugger(message);
}
#endif // _#if KERNEL_MODE