Added exit() function and renamed stdlib file to libc.a so GCC is happy.
This commit is contained in:
@@ -28,7 +28,7 @@ if env['BUILD_TARGET'] == 'stdlib':
|
||||
stdlib_env.Append(CPPPATH = ['#targets/_any/bastl/include', '#targets/_any/stdlib/include', '#targets/_any/kernel/include'])
|
||||
|
||||
lib_stdlib = stdlib_env.StaticLibrary(
|
||||
target = stdlib_env.File('#stdlib/stdlib.a'),
|
||||
target = stdlib_env.File('#stdlib/libc.a'),
|
||||
source = stdlib_sources
|
||||
)
|
||||
crti_o = stdlib_env.Object(target = '#stdlib/crti.o', source = stdlib_env['CRTI_PATH'])
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include "os/memory.hpp"
|
||||
#include "os/syscall.hpp"
|
||||
#include "os/tty.hpp"
|
||||
|
||||
namespace
|
||||
@@ -44,6 +45,15 @@ void abort()
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void exit(int exitCode) noexcept
|
||||
{
|
||||
#if !defined(__baos_kernel_source__)
|
||||
baos::doSyscall(baos::Syscall::EXIT, exitCode);
|
||||
#else
|
||||
abort(); // no exit in kernel!
|
||||
#endif
|
||||
}
|
||||
|
||||
void* malloc(size_t size) noexcept
|
||||
{
|
||||
if (size == 0)
|
||||
|
||||
Reference in New Issue
Block a user