From 3ad39e9878310e5317ee73c9b353c1e2c1c5c4ee Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Sat, 11 Jul 2026 22:48:30 +0800 Subject: lib: establish Zircon libc++ and KTL foundation --- lib/ktl/include/cstdlib | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 lib/ktl/include/cstdlib (limited to 'lib/ktl/include/cstdlib') diff --git a/lib/ktl/include/cstdlib b/lib/ktl/include/cstdlib new file mode 100644 index 0000000..25ad762 --- /dev/null +++ b/lib/ktl/include/cstdlib @@ -0,0 +1,30 @@ +// Copyright 2018 The Fuchsia Authors +// +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file or at +// https://opensource.org/licenses/MIT + +#pragma once + +// This is used by libc++'s just for std::abort, ::posix_memalign, and +// ::free. + +#include + +#include <__config> + +#define _LIBCPP_UNREACHABLE() __builtin_unreachable() + +// This is used by the __libcpp_aligned_alloc inline. Since it always fails +// that inline will trivially always return nullptr. +inline int posix_memalign(void** ptr, size_t align, size_t size) { return 1; } + +// This is used by the __libcpp_aligned_free inline, which won't really ever be +// called. The kernel does have a real free declared elsewhere. +void free(void* ptr); + +_LIBCPP_BEGIN_NAMESPACE_STD + +using ::abort; + +_LIBCPP_END_NAMESPACE_STD -- cgit v1.2.3