diff --git a/libc/Makefile b/libc/Makefile
index ea9f43d3..53ce1d93 100644
--- a/libc/Makefile
+++ b/libc/Makefile
@@ -522,7 +522,7 @@ ifeq ($(HOST),x86_64-sortix)
SORTIXFLAGS:=$(SORTIXFLAGS) -mno-red-zone
endif
-BINS=libc.a libg.a libpthread.a libstdc++.a $(CRTOBJ)
+BINS=libc.a libg.a libpthread.a $(CRTOBJ)
BINSKERNEL=libc-sortix.a
INSTALLLIBS:=$(addprefix $(DESTDIR)$(LIBDIR)/,$(BINS))
INSTALLLIBSKERNEL:=$(addprefix $(DESTDIR)$(LIBDIR)/,$(BINSKERNEL))
@@ -550,9 +550,6 @@ libg.a:
libpthread.a:
$(HOSTAR) rcs $@
-libstdc++.a:
- $(HOSTAR) rcs $@
-
crt1.o: $(CPUDIR)/crt1.o
ln -f $< $@
diff --git a/libc/aux/op-new.cpp b/libc/aux/op-new.cpp
index 2174c9de..511768ca 100644
--- a/libc/aux/op-new.cpp
+++ b/libc/aux/op-new.cpp
@@ -1,6 +1,6 @@
/*******************************************************************************
- Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
+ Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
This file is part of the Sortix C Library.
@@ -18,14 +18,38 @@
along with the Sortix C Library. If not, see .
aux/op-new.cpp
- C++ allocation operators.
+ C++ allocation operators. This is a hack to work around that libstdc++ is
+ yet to be integrated into Sortix.
*******************************************************************************/
#include
#include
-void* operator new(size_t size) { return malloc(size); }
-void* operator new[](size_t size) { return malloc(size); }
-void operator delete (void* addr) { return free(addr); }
-void operator delete[](void* addr) { return free(addr); }
+#if __STDC_HOSTED__
+
+__attribute__((weak))
+void* operator new(size_t size)
+{
+ return malloc(size);
+}
+
+__attribute__((weak))
+void* operator new[](size_t size)
+{
+ return malloc(size);
+}
+
+__attribute__((weak))
+void operator delete(void* addr)
+{
+ return free(addr);
+}
+
+__attribute__((weak))
+void operator delete[](void* addr)
+{
+ return free(addr);
+}
+
+#endif
diff --git a/sortix/Makefile b/sortix/Makefile
index 05cb18cb..cf313a79 100644
--- a/sortix/Makefile
+++ b/sortix/Makefile
@@ -114,6 +114,7 @@ logterminal.o \
memorymanagement.o \
mtable.o \
net/fs.o \
+op-new.o \
panic.o \
partition.o \
pci.o \
diff --git a/sortix/op-new.cpp b/sortix/op-new.cpp
new file mode 100644
index 00000000..e041ab8e
--- /dev/null
+++ b/sortix/op-new.cpp
@@ -0,0 +1,46 @@
+/*******************************************************************************
+
+ Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
+
+ This file is part of Sortix.
+
+ Sortix is free software: you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation, either version 3 of the License, or (at your option) any later
+ version.
+
+ Sortix is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along with
+ Sortix. If not, see .
+
+ op-new.cpp
+ C++ allocation operators.
+
+*******************************************************************************/
+
+#include
+#include
+
+void* operator new(size_t size)
+{
+ return malloc(size);
+}
+
+void* operator new[](size_t size)
+{
+ return malloc(size);
+}
+
+void operator delete(void* addr)
+{
+ return free(addr);
+}
+
+void operator delete[](void* addr)
+{
+ return free(addr);
+}