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:
@@ -71,10 +71,15 @@ operator delete[](void *ptr) throw ()
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we're using virtuals
|
// only needed in the boot loader
|
||||||
|
#ifndef _BOOT_MODE
|
||||||
|
|
||||||
extern "C" void __pure_virtual();
|
extern "C" void __pure_virtual();
|
||||||
|
|
||||||
|
#endif // #if _BOOT_MODE
|
||||||
|
|
||||||
#endif // #if _KERNEL_MODE
|
#endif // #if _KERNEL_MODE
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif /* KERNEL_CPP_H */
|
#endif /* KERNEL_CPP_H */
|
||||||
|
|||||||
+2
-2
@@ -54,11 +54,11 @@ KernelLd kernel :
|
|||||||
kernel_cache.o
|
kernel_cache.o
|
||||||
kernel_device_manager.o
|
kernel_device_manager.o
|
||||||
kernel_disk_device_manager.o
|
kernel_disk_device_manager.o
|
||||||
|
kernel_util.o
|
||||||
|
|
||||||
libbus.a
|
libbus.a
|
||||||
lib$(OBOS_ARCH).a
|
lib$(OBOS_ARCH).a
|
||||||
libdrivers.a
|
libdrivers.a
|
||||||
libkernel_util.a
|
|
||||||
|
|
||||||
linkhack.so
|
linkhack.so
|
||||||
|
|
||||||
@@ -83,11 +83,11 @@ KernelLd kernel.so :
|
|||||||
kernel_cache.o
|
kernel_cache.o
|
||||||
kernel_device_manager.o
|
kernel_device_manager.o
|
||||||
kernel_disk_device_manager.o
|
kernel_disk_device_manager.o
|
||||||
|
kernel_util.o
|
||||||
|
|
||||||
libbus.a
|
libbus.a
|
||||||
lib$(OBOS_ARCH).a
|
lib$(OBOS_ARCH).a
|
||||||
libdrivers.a
|
libdrivers.a
|
||||||
libkernel_util.a
|
|
||||||
|
|
||||||
linkhack.so
|
linkhack.so
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
SubDir OBOS_TOP src kernel core util ;
|
SubDir OBOS_TOP src kernel core util ;
|
||||||
|
|
||||||
KernelStaticLibrary libkernel_util :
|
KernelMergeObject kernel_util.o :
|
||||||
<$(SOURCE_GRIST)>list.c
|
list.c
|
||||||
<$(SOURCE_GRIST)>kernel_cpp.cpp
|
kernel_cpp.cpp
|
||||||
:
|
|
||||||
-fno-pic -Wno-unused -D_KERNEL_MODE
|
: -fno-pic -Wno-unused -D_KERNEL_MODE
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
** This file may be used under the terms of the OpenBeOS License.
|
** 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"
|
#include "util/kernel_cpp.h"
|
||||||
|
|
||||||
@@ -27,4 +28,39 @@ __cxa_pure_virtual()
|
|||||||
|
|
||||||
#endif
|
#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
|
#endif // _#if KERNEL_MODE
|
||||||
|
|||||||
Reference in New Issue
Block a user