[uClibc] patches for uClibc++

Peter S. Mazinger ps.m at gmx.net
Mon Jan 24 17:48:44 UTC 2005


Hello!

The attached patch:
- splits up new.cpp into subfiles (as libsupc++.a uses it)
- tries to solve the problems building libuClibc++.a all the time
(it should be buildable all the time)
- does not install include/Makefile
- corrects docs

Peter

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2
-------------- next part --------------
--- uClibc++/bin/Makefile.new~	2005-01-18 18:22:26.000000000 +0100
+++ uClibc++/bin/Makefile	2005-01-24 15:14:38.000000000 +0100
@@ -41,7 +41,7 @@
 	echo 'done' >> $(WRAPPER)
 	echo 'if [ "$$INCLIB" == "Y" ]' >> $(WRAPPER)
 	echo 'then' >> $(WRAPPER)
-	echo '	OPTIONS="$$OPTIONS -luClibc++ -lc $(EXTRALIBS)"' >> $(WRAPPER)
+	echo '	OPTIONS="$$OPTIONS -luClibc++ $(EXTRALIBS) -lc"' >> $(WRAPPER)
 	echo 'fi' >> $(WRAPPER)
 	echo -n "exec $(CXX) " >> $(WRAPPER)
 	echo -n ' -fno-builtin -nostdinc++ -nodefaultlibs' >> $(WRAPPER)
--- uClibc++/extra/Configs/Config.in.new~	2005-01-14 22:47:46.000000000 +0100
+++ uClibc++/extra/Configs/Config.in	2005-01-24 15:14:38.000000000 +0100
@@ -139,7 +139,7 @@
 	  iostream subsystem as the default buffer size for a file, and
 	  affects cin, cout, fstream, etc.  This is independent of the 
 	  buffering provided by the underlying C library.  This must be a
-	  multiple of 2
+	  multiple of 2.
 
 	  NOTE: Setting this to '0' will disable buffering completely.
 	  This may break applications which extend the I/O stream
@@ -287,9 +287,9 @@
 	 UCLIBCXX_ RUNTIME_PREFIX is the directory into which the uClibc++
 	  runtime libraries will be installed.
 
-	  For a typical target system this should be set to "/usr", such
-	  that'make install' will install
-	  /usr/lib/libuClibc++.so
+	  For a typical target system this should be set to "/usr", so
+	  that 'make install' will install libuClibc++.so into
+	  /usr/lib.
 
 config UCLIBCXX_RUNTIME_INCLUDE_SUBDIR
 	string "uClibc++ header file subdirectory"
@@ -331,8 +331,8 @@
 	  the library.
 
 	  RTTI support is used for exceptions as well as operators such
-	  as dynamic_cast<>() and others.  This must be disabled to support
-	  static linking.  Using this increases the size of the library.
+	  as dynamic_cast<>() and others.
+	  Using this increases the size of the library.
 
 	  Most people will answer Y.
 
@@ -347,8 +347,8 @@
 	  the C++ ABI.  This is largely compiler dependent.
 
 	  Since the library is statically compiled, this code would normally
-	  need to be compiled into each executible.  However, it can also be
-	  imported into this library and shared. GNU libc++ imports this code.
+	  need to be compiled into each executable.  However, it can also be
+	  imported into this library and shared. uClibc++ imports this code.
 
 	  There is no point in importing this if you disable exception and rtti
 	  support above.
@@ -357,12 +357,11 @@
 
 config BUILD_STATIC_LIB
 	bool "Build static library"
-	depends on !UCLIBCXX_EXCEPTION_SUPPORT
 	default y
 	help
 	  By default, libuClibc++ is built only as a shared library.  Choosing
 	  'y' here will also build a static library which can be used to build
-	  statically linked executibles.
+	  statically linked executables.
 
 	  There is little reason to say 'no' here.
 
@@ -373,10 +372,10 @@
 	depends on BUILD_STATIC_LIB
 	default n
 	help
-	  By default, libuClibc++ is builds a shared library.  Choosing
-	  'y' here will disable the building of the shared library.  You
-	  should only choose 'y' here if you are on a system which does
-	  not support shared libraries
+	  By default, libuClibc++ is built as a shared library.  Choosing
+	  'y' here will disable building the shared library.  You should
+	  only choose 'y' here if you are on a system which does not
+	  support shared libraries.
 
 	  You should say no.
 
--- uClibc++/src/Makefile.new~	2005-01-24 15:14:38.000000000 +0100
+++ uClibc++/src/Makefile	2005-01-24 15:30:21.000000000 +0100
@@ -3,10 +3,19 @@
 TOPDIR=../
 include $(TOPDIR)Rules.mak
 
+LIBSUPC_SRCS	=\
+		new_op.cpp \
+		new_opv.cpp \
+		new_opnt.cpp \
+		new_opvnt.cpp \
+		del_op.cpp \
+		del_opv.cpp \
+		del_opnt.cpp \
+		del_opvnt.cpp \
+		abi/abi.cpp
+
 SRCS	=\
-	new.cpp \
 	exception.cpp \
-	abi/abi.cpp \
 	char_traits.cpp \
 	string.cpp \
 	iostream.cpp \
@@ -35,38 +44,10 @@
 	valarray.cpp
 
 
-EXOBJS	=\
-	new.o \
-	exception.o \
-	abi/abi.o \
-	char_traits.o \
-	string.o \
-	iostream.o \
-	ios.o \
-	utility.o \
-	stdexcept.o \
-	func_exception.o \
-	locale.o \
-	streambuf.o \
-	istream.o \
-	ostream.o \
-	iterator.o \
-	fstream.o \
-	iomanip.o \
-	vector.o \
-	deque.o \
-	list.o \
-	map.o \
-	set.o \
-	stack.o \
-	queue.o \
-	algorithm.o \
-	numeric.o \
-	sstream.o \
-	bitset.o \
-	valarray.o
+EXOBJS		=$(patsubst %.cpp,%.o, $(SRCS))
+LIBSUPC_OBJS	=$(patsubst %.cpp,%.o, $(LIBSUPC_SRCS))
 
-ALLOBJS	=	$(EXOBJS)
+ALLOBJS	=	$(EXOBJS) $(LIBSUPC_OBJS)
 ALLBIN	=	
 ifeq ($(BUILD_STATIC_LIB),y)
 ALLBIN	+=	libuClibc++.a
@@ -78,23 +59,42 @@
 SONAME  =	libuClibc++
 #SONAME  =	libstdc++
 
-ifeq ($(IMPORT_LIBSUP),y)
-SUPOBJS	=	$(shell $(CXX) -print-file-name=libsupc++.a)
-else
-SUPOBJS =
-endif
-
 # User defines:
 
-all:	$(ALLOBJS) $(ALLBIN)
+all:	libgcc_eh libsupc $(ALLOBJS) $(ALLBIN)
 
 objs:	$(ALLOBJS)
 
-libuClibc++.a:
-	$(AR) rcs libuClibc++.a $(EXOBJS) $(SUPOBJS)
+libsupc:
+	rm -rf libsupc libsupc_new
+	mkdir libsupc libsupc_new
+	rm -f *.o
+	$(AR) x $(shell $(CXX) -print-file-name=libsupc++.a)
+ifeq ($(IMPORT_LIBSUP),y)
+	mv new_op*.o del_op*.o pure.o libsupc_new/
+endif
+	mv *.o libsupc/
+ifeq ($(IMPORT_LIBSUP),y)
+SUPOBJS = $(wildcard libsupc/*.o)
+SUPOBJS_NEW = $(wildcard libsupc_new/*.o)
+else
+SUPOBJS =
+SUPOBJS_NEW =
+endif
 
-libuClibc++.so:
-	$(CC) -shared $(CFLAGS) $(LIBS) $(EXOBJS) $(SUPOBJS) \
+libgcc_eh:
+	rm -rf libgcc_eh
+	mkdir libgcc_eh
+	rm -f *.o
+	$(AR) x $(shell $(CC) -print-file-name=libgcc_eh.a)
+	mv *.o libgcc_eh/
+GCCOBJS = $(wildcard libgcc_eh/*.o)
+
+libuClibc++.a: libgcc_eh libsupc
+	$(AR) rcs libuClibc++.a $(EXOBJS) $(GCCOBJS) $(SUPOBJS_NEW) $(SUPOBJS)
+
+libuClibc++.so: libsupc
+	$(CC) -shared $(CFLAGS) $(LIBS) $(LIBSUPC_OBJS) $(EXOBJS) $(SUPOBJS) \
 		-o libuClibc++.so.$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL) \
 		-Wl,-soname,$(SONAME).so.$(MAJOR_VERSION)
 	ln -s -f libuClibc++.so.$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL) libuClibc++.so.$(MAJOR_VERSION).$(MINOR_VERSION)
@@ -109,20 +109,10 @@
 
 clean:	cleanobjs cleanbin
 	rm -f libuClibc++*
+	rm -rf libsupc libsupc_new libgcc_eh
+	
 
 cleanall:	cleanobjs cleanbin
 
 .cpp.o:
 	$(CXX) -c $(CXXFLAGS) -o $@ $<
-
-.cc.o:
-	$(CXX) -c $(CXXFLAGS) -o $@ $<
-
-.cxx.o:
-	$(CXX) -c $(CXXFLAGS) -o $@ $<
-
-.C.o:
-	$(CXX) -c $(CXXFLAGS) -o $@ $<
-
-.c.o:
-	$(CC) -c $(CFLAGS) -o $@ $<
--- uClibc++/src/del_op.cpp.new~	2005-01-24 15:14:38.000000000 +0100
+++ uClibc++/src/del_op.cpp	2005-01-24 15:14:38.000000000 +0100
@@ -0,0 +1,26 @@
+/*	Copyright (C) 2004 Garrett A. Kajmowicz
+
+	This file is part of the uClibc++ Library.
+
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+
+	This library 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
+	Lesser General Public License for more details.
+
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <new>
+#include <cstdlib>
+#include <func_exception>
+
+void operator delete(void* ptr) throw(){
+	free(ptr);
+}
--- uClibc++/src/del_opnt.cpp.new~	2005-01-24 15:14:38.000000000 +0100
+++ uClibc++/src/del_opnt.cpp	2005-01-24 15:14:38.000000000 +0100
@@ -0,0 +1,28 @@
+/*	Copyright (C) 2004 Garrett A. Kajmowicz
+
+	This file is part of the uClibc++ Library.
+
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+
+	This library 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
+	Lesser General Public License for more details.
+
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <new>
+#include <cstdlib>
+#include <func_exception>
+
+#ifndef NO_NOTHROW
+void operator delete(void* ptr, const std::nothrow_t& ) throw() {
+	free(ptr);
+}
+#endif
--- uClibc++/src/del_opv.cpp.new~	2005-01-24 15:14:38.000000000 +0100
+++ uClibc++/src/del_opv.cpp	2005-01-24 15:14:38.000000000 +0100
@@ -0,0 +1,26 @@
+/*	Copyright (C) 2004 Garrett A. Kajmowicz
+
+	This file is part of the uClibc++ Library.
+
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+
+	This library 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
+	Lesser General Public License for more details.
+
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <new>
+#include <cstdlib>
+#include <func_exception>
+
+void operator delete[](void * ptr) throw(){
+	free(ptr);
+}
--- uClibc++/src/del_opvnt.cpp.new~	2005-01-24 15:14:38.000000000 +0100
+++ uClibc++/src/del_opvnt.cpp	2005-01-24 15:14:38.000000000 +0100
@@ -0,0 +1,28 @@
+/*	Copyright (C) 2004 Garrett A. Kajmowicz
+
+	This file is part of the uClibc++ Library.
+
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+
+	This library 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
+	Lesser General Public License for more details.
+
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <new>
+#include <cstdlib>
+#include <func_exception>
+
+#ifndef NO_NOTHROW
+void operator delete[](void* ptr, const std::nothrow_t& ) throw(){
+	free(ptr);
+}
+#endif
--- uClibc++/src/new.cpp.new~	2004-09-08 05:28:46.000000000 +0200
+++ uClibc++/src/new.cpp	2005-01-24 15:14:38.000000000 +0100
@@ -1,67 +0,0 @@
-/*	Copyright (C) 2004 Garrett A. Kajmowicz
-
-	This file is part of the uClibc++ Library.
-
-	This library is free software; you can redistribute it and/or
-	modify it under the terms of the GNU Lesser General Public
-	License as published by the Free Software Foundation; either
-	version 2.1 of the License, or (at your option) any later version.
-
-	This library 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
-	Lesser General Public License for more details.
-
-	You should have received a copy of the GNU Lesser General Public
-	License along with this library; if not, write to the Free Software
-	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-#include <new>
-#include <cstdlib>
-#include <func_exception>
-
-#ifndef _HEADER_STD_NEW
-#define _HEADER_STD_NEW 1
-
-	void* operator new(std::size_t numBytes) throw(std::bad_alloc){
-		void * p = malloc(numBytes);
-		if(p == 0){
-			std::__throw_bad_alloc();
-		}
-		return p;
-	}
-
-        void operator delete(void* ptr) throw(){
-		free(ptr);
-	}
-
-        void* operator new[](std::size_t numBytes) throw(std::bad_alloc){
-		void * p = malloc(numBytes);
-		if(p == 0){
-			std::__throw_bad_alloc();
-		}
-		return p;
-	}
-
-        void operator delete[](void * ptr) throw(){
-		free(ptr);
-	}
-
-	void* operator new(std::size_t numBytes, const std::nothrow_t& ) throw(){
-		return malloc(numBytes);
-	}
-
-        void operator delete(void* ptr, const std::nothrow_t& ) throw() {
-		free(ptr);
-	}
-
-        void* operator new[](std::size_t numBytes, const std::nothrow_t& ) throw(){
-		return malloc(numBytes);
-
-	}
-        void operator delete[](void* ptr, const std::nothrow_t& ) throw(){
-		free(ptr);
-	}
-
-#endif
--- uClibc++/src/new_op.cpp.new~	2005-01-24 15:14:38.000000000 +0100
+++ uClibc++/src/new_op.cpp	2005-01-24 15:14:38.000000000 +0100
@@ -0,0 +1,30 @@
+/*	Copyright (C) 2004 Garrett A. Kajmowicz
+
+	This file is part of the uClibc++ Library.
+
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+
+	This library 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
+	Lesser General Public License for more details.
+
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <new>
+#include <cstdlib>
+#include <func_exception>
+
+void* operator new(std::size_t numBytes) throw(std::bad_alloc){
+	void * p = malloc(numBytes);
+	if(p == 0){
+		std::__throw_bad_alloc();
+	}
+	return p;
+}
--- uClibc++/src/new_opnt.cpp.new~	2005-01-24 15:14:38.000000000 +0100
+++ uClibc++/src/new_opnt.cpp	2005-01-24 15:14:38.000000000 +0100
@@ -0,0 +1,28 @@
+/*	Copyright (C) 2004 Garrett A. Kajmowicz
+
+	This file is part of the uClibc++ Library.
+
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+
+	This library 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
+	Lesser General Public License for more details.
+
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <new>
+#include <cstdlib>
+#include <func_exception>
+
+#ifndef NO_NOTHROW
+void* operator new(std::size_t numBytes, const std::nothrow_t& ) throw(){
+	return malloc(numBytes);
+}
+#endif
--- uClibc++/src/new_opv.cpp.new~	2005-01-24 15:14:38.000000000 +0100
+++ uClibc++/src/new_opv.cpp	2005-01-24 15:14:38.000000000 +0100
@@ -0,0 +1,30 @@
+/*	Copyright (C) 2004 Garrett A. Kajmowicz
+
+	This file is part of the uClibc++ Library.
+
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+
+	This library 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
+	Lesser General Public License for more details.
+
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <new>
+#include <cstdlib>
+#include <func_exception>
+
+void* operator new[](std::size_t numBytes) throw(std::bad_alloc){
+	void * p = malloc(numBytes);
+	if(p == 0){
+		std::__throw_bad_alloc();
+	}
+	return p;
+}
--- uClibc++/src/new_opvnt.cpp.new~	2005-01-24 15:14:38.000000000 +0100
+++ uClibc++/src/new_opvnt.cpp	2005-01-24 15:14:38.000000000 +0100
@@ -0,0 +1,28 @@
+/*	Copyright (C) 2004 Garrett A. Kajmowicz
+
+	This file is part of the uClibc++ Library.
+
+	This library is free software; you can redistribute it and/or
+	modify it under the terms of the GNU Lesser General Public
+	License as published by the Free Software Foundation; either
+	version 2.1 of the License, or (at your option) any later version.
+
+	This library 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
+	Lesser General Public License for more details.
+
+	You should have received a copy of the GNU Lesser General Public
+	License along with this library; if not, write to the Free Software
+	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <new>
+#include <cstdlib>
+#include <func_exception>
+
+#ifndef NO_NOTHROW
+void* operator new[](std::size_t numBytes, const std::nothrow_t& ) throw(){
+	return malloc(numBytes);
+}
+#endif
--- uClibc++/include/Makefile.new~	2005-01-14 22:50:02.000000000 +0100
+++ uClibc++/include/Makefile	2005-01-24 15:14:38.000000000 +0100
@@ -9,7 +9,7 @@
 
 install:
 	$(INSTALL) -d $(PREFIX)$(UCLIBCXX_RUNTIME_PREFIX)$(UCLIBCXX_RUNTIME_INCLUDE_SUBDIR)
-	$(INSTALL) -m 644 `ls --color=never --ignore="CVS"` \
+	$(INSTALL) -m 644 `ls --color=never --ignore="CVS" --ignore="Makefile"` \
 		$(PREFIX)$(UCLIBCXX_RUNTIME_PREFIX)$(UCLIBCXX_RUNTIME_INCLUDE_SUBDIR)
 
 .cpp.o:


More information about the uClibc mailing list