Index: uspace/lib/cpp/include/cassert
===================================================================
--- uspace/lib/cpp/include/cassert	(revision b83ec692ece791c1367db526f77c9d28fd800692)
+++ uspace/lib/cpp/include/cassert	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -30,4 +30,6 @@
 #define LIBCPP_CASSERT
 
+#include "internal/common.hpp"
+
 namespace std
 {
Index: uspace/lib/cpp/include/cctype
===================================================================
--- uspace/lib/cpp/include/cctype	(revision b83ec692ece791c1367db526f77c9d28fd800692)
+++ uspace/lib/cpp/include/cctype	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -30,4 +30,6 @@
 #define LIBCPP_CCTYPE
 
+#include "internal/common.hpp"
+
 namespace std
 {
Index: uspace/lib/cpp/include/cerrno
===================================================================
--- uspace/lib/cpp/include/cerrno	(revision b83ec692ece791c1367db526f77c9d28fd800692)
+++ uspace/lib/cpp/include/cerrno	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -30,4 +30,6 @@
 #define LIBCPP_CERRNO
 
+#include "internal/common.hpp"
+
 namespace std
 {
Index: uspace/lib/cpp/include/cinttypes
===================================================================
--- uspace/lib/cpp/include/cinttypes	(revision b83ec692ece791c1367db526f77c9d28fd800692)
+++ uspace/lib/cpp/include/cinttypes	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -30,4 +30,6 @@
 #define LIBCPP_CINTTYPES
 
+#include "internal/common.hpp"
+
 namespace std
 {
Index: uspace/lib/cpp/include/climits
===================================================================
--- uspace/lib/cpp/include/climits	(revision b83ec692ece791c1367db526f77c9d28fd800692)
+++ uspace/lib/cpp/include/climits	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -30,4 +30,6 @@
 #define LIBCPP_CLIMITS
 
+#include "internal/common.hpp"
+
 namespace std
 {
Index: uspace/lib/cpp/include/csetjmp
===================================================================
--- uspace/lib/cpp/include/csetjmp	(revision b83ec692ece791c1367db526f77c9d28fd800692)
+++ uspace/lib/cpp/include/csetjmp	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -30,4 +30,6 @@
 #define LIBCPP_CSETJMP
 
+#include "internal/common.hpp"
+
 namespace std
 {
Index: uspace/lib/cpp/include/cstdarg
===================================================================
--- uspace/lib/cpp/include/cstdarg	(revision b83ec692ece791c1367db526f77c9d28fd800692)
+++ uspace/lib/cpp/include/cstdarg	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -30,4 +30,6 @@
 #define LIBCPP_CSTDARG
 
+#include "internal/common.hpp"
+
 namespace std
 {
Index: uspace/lib/cpp/include/cstddef
===================================================================
--- uspace/lib/cpp/include/cstddef	(revision b83ec692ece791c1367db526f77c9d28fd800692)
+++ uspace/lib/cpp/include/cstddef	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -30,4 +30,6 @@
 #define LIBCPP_CSTDDEF
 
+#include "internal/common.hpp"
+
 namespace std
 {
Index: uspace/lib/cpp/include/cstdint
===================================================================
--- uspace/lib/cpp/include/cstdint	(revision b83ec692ece791c1367db526f77c9d28fd800692)
+++ uspace/lib/cpp/include/cstdint	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -30,4 +30,6 @@
 #define LIBCPP_CSTDINT
 
+#include "internal/common.hpp"
+
 namespace std
 {
Index: uspace/lib/cpp/include/cstdio
===================================================================
--- uspace/lib/cpp/include/cstdio	(revision b83ec692ece791c1367db526f77c9d28fd800692)
+++ uspace/lib/cpp/include/cstdio	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -30,5 +30,5 @@
 #define LIBCPP_CSTDIO
 
-#define _Bool bool
+#include "internal/common.hpp"
 
 namespace std
Index: uspace/lib/cpp/include/cstdlib
===================================================================
--- uspace/lib/cpp/include/cstdlib	(revision b83ec692ece791c1367db526f77c9d28fd800692)
+++ uspace/lib/cpp/include/cstdlib	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -30,4 +30,6 @@
 #define LIBCPP_CSTDLIB
 
+#include "internal/common.hpp"
+
 namespace std
 {
Index: uspace/lib/cpp/include/cstring
===================================================================
--- uspace/lib/cpp/include/cstring	(revision b83ec692ece791c1367db526f77c9d28fd800692)
+++ uspace/lib/cpp/include/cstring	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -30,4 +30,6 @@
 #define LIBCPP_CSTRING
 
+#include "internal/common.hpp"
+
 namespace std
 {
Index: uspace/lib/cpp/include/ctime
===================================================================
--- uspace/lib/cpp/include/ctime	(revision b83ec692ece791c1367db526f77c9d28fd800692)
+++ uspace/lib/cpp/include/ctime	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -30,5 +30,5 @@
 #define LIBCPP_CTIME
 
-#define restrict __restrict__
+#include "internal/common.hpp"
 
 namespace std
Index: uspace/lib/cpp/include/exception
===================================================================
--- uspace/lib/cpp/include/exception	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
+++ uspace/lib/cpp/include/exception	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017 Jaroslav Jindrak
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LIBCPP_EXCEPTION
+#define LIBCPP_EXCEPTION
+
+namespace std
+{
+
+class exception
+{
+	public:
+		exception() = default;
+		exception(const exception&) = default;
+		exception& operator=(const exception&) noexcept;
+		virtual const char *what() const;
+		virtual ~exception() = default;
+};
+
+}
+
+#endif
Index: uspace/lib/cpp/include/internal/common.hpp
===================================================================
--- uspace/lib/cpp/include/internal/common.hpp	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
+++ uspace/lib/cpp/include/internal/common.hpp	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -0,0 +1,19 @@
+#ifndef LIBCPP_INTERNAL_COMMON
+#define LIBCPP_INTERNAL_COMMON
+
+/**
+ * G++ is will not properly include libc
+ * headers without this define.
+ */
+#define _Bool bool
+
+/**
+ * The restrict keyword is not part of the
+ * C++ standard, but g++ supports __restrict__,
+ * this might cause problems with other compilers
+ * like clang.
+ * TODO: Test this.
+ */
+#define restrict __restrict__
+
+#endif
Index: uspace/lib/cpp/include/new
===================================================================
--- uspace/lib/cpp/include/new	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
+++ uspace/lib/cpp/include/new	(revision a1aecb12e1acd6c228cecd2e91a411a9fb169a0c)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017 Jaroslav Jindrak
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LIBCPP_NEW
+#define LIBCPP_NEW
+
+#include <exception>
+
+namespace std
+{
+
+class bad_alloc: public std::exception
+{
+	public:
+		bad_alloc() = default;
+		bad_alloc(const bad_alloc&);
+		bad_alloc& operator=(const bad_alloc&) = default;
+		virtual const char *what() const override;
+		virtual ~bad_alloc() = default;
+};
+
+using new_handler = void (*)();
+
+struct nothrow_t {};
+extern const nothrow_t nothrow;
+
+}
+
+void *operator new(std::size_t);
+
+void operator delete(void *);
+
+#endif
