Add a stub C++ standard library.
authorwhitequark <whitequark@whitequark.org>
Sun, 26 Jul 2015 09:49:02 +0000 (12:49 +0300)
committerwhitequark <whitequark@whitequark.org>
Sun, 26 Jul 2015 09:49:21 +0000 (12:49 +0300)
This is necessary to build libunwind.

software/common.mak
software/include/basec++/algorithm [new file with mode: 0644]
software/include/basec++/cstddef [new file with mode: 0644]
software/include/basec++/cstdlib [new file with mode: 0644]
software/include/basec++/memory [new file with mode: 0644]
software/include/basec++/new [new file with mode: 0644]
software/include/basec++/tuple [new file with mode: 0644]
software/include/basec++/vector [new file with mode: 0644]

index 925fafe3b7441db568367ff1070349f0ee3dddda..b345bee3f04789860dd3d18f0fd667f79ae55f4b 100644 (file)
@@ -42,7 +42,7 @@ endif
 INCLUDES = -I$(MSCDIR)/software/include/base -I$(MSCDIR)/software/include -I$(MSCDIR)/common
 COMMONFLAGS = -Os $(CPUFLAGS) -Wall -fno-builtin -nostdinc -DMSC_GIT_ID=$(MSC_GIT_ID) $(INCLUDES)
 CFLAGS = $(COMMONFLAGS) -fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
-CXXFLAGS = $(COMMONFLAGS) -fexceptions -fno-rtti -ffreestanding
+CXXFLAGS = $(COMMONFLAGS) -std=c++11 -I$(MSCDIR)/software/include/basec++ -fexceptions -fno-rtti -ffreestanding
 LDFLAGS = -nostdlib -nodefaultlibs -L$(MSCDIR)/software/include
 
 # compile and generate dependencies, based on
diff --git a/software/include/basec++/algorithm b/software/include/basec++/algorithm
new file mode 100644 (file)
index 0000000..cb9b614
--- /dev/null
@@ -0,0 +1,4 @@
+#ifndef __CXX_ALGORITHM
+#define __CXX_ALGORITHM
+
+#endif /* __CXX_ALGORITHM */
diff --git a/software/include/basec++/cstddef b/software/include/basec++/cstddef
new file mode 100644 (file)
index 0000000..5291f1b
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef __CXX_CSTDDEF
+#define __CXX_CSTDDEF
+
+#include <stddef.h>
+
+namespace std {
+  using ::size_t;
+  using ::ptrdiff_t;
+}
+
+#endif /* __CXX_CSTDDEF */
diff --git a/software/include/basec++/cstdlib b/software/include/basec++/cstdlib
new file mode 100644 (file)
index 0000000..6501ea9
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef __CXX_CSTDLIB
+#define __CXX_CSTDLIB
+
+#include <stdlib.h>
+
+#endif /* __CXX_CSTDLIB */
diff --git a/software/include/basec++/memory b/software/include/basec++/memory
new file mode 100644 (file)
index 0000000..899bb3d
--- /dev/null
@@ -0,0 +1,4 @@
+#ifndef __CXX_MEMORY
+#define __CXX_MEMORY
+
+#endif /* __CXX_MEMORY */
diff --git a/software/include/basec++/new b/software/include/basec++/new
new file mode 100644 (file)
index 0000000..aa2f1a8
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __CXX_NEW
+#define __CXX_NEW
+
+#include <cstddef>
+
+inline void* operator new (std::size_t size, void* ptr) noexcept
+  { return ptr; }
+
+#endif /* __CXX_NEW */
diff --git a/software/include/basec++/tuple b/software/include/basec++/tuple
new file mode 100644 (file)
index 0000000..c97a8a1
--- /dev/null
@@ -0,0 +1,4 @@
+#ifndef __CXX_TUPLE
+#define __CXX_TUPLE
+
+#endif /* __CXX_TUPLE */
diff --git a/software/include/basec++/vector b/software/include/basec++/vector
new file mode 100644 (file)
index 0000000..ec28441
--- /dev/null
@@ -0,0 +1,4 @@
+#ifndef __CXX_VECTOR
+#define __CXX_VECTOR
+
+#endif /* __CXX_VECTOR */