This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] glibc 64-bit obstack support


And >2G on 32-bit.

	* include/gnu-versions.h (_GNU_OBSTACK_INTERFACE_VERSION): Bump.
	* include/obstack.h: Add _obstack2_newchunk hidden proto.
	* malloc/obstack.h: Import from gnulib.
	* malloc/obstack.c: Likewise.
	* malloc/obstackv1.c: New file.
	* malloc/Makefile (routines): Add obstackv1.
	(CFLAGS-obstackv1.c): Define.
	(malloc/Versions): Add _obstack2 functions.
	* config.h.in (SIZEOF_INT, SIZEOF_SIZE_T): Add.
	* configure.in: AC_CHECK_SIZEOF int and size_t.
	* configure: Regenerate.

diff --git a/config.h.in b/config.h.in
index 2dcd135..0996130 100644
--- a/config.h.in
+++ b/config.h.in
@@ -200,6 +200,12 @@
 /* Define if the linker defines __ehdr_start.  */
 #undef HAVE_EHDR_START
 
+/* The size of "int", as computed by sizeof.  */
+#undef SIZEOF_INT
+
+/* The size of "size_t", as computed by sizeof.  */
+#undef SIZEOF_SIZE_T
+
 /*
  */
 
diff --git a/configure.ac b/configure.ac
index 566ecb2..53ee319 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1824,6 +1824,10 @@ AC_CHECK_SIZEOF(long double, 0)
 sizeof_long_double=$ac_cv_sizeof_long_double
 AC_SUBST(sizeof_long_double)
 
+dnl Determine the size of int and size_t for obstack.h.
+AC_CHECK_SIZEOF([int])
+AC_CHECK_SIZEOF([size_t],,[#include <stddef.h>])
+
 CPPUNDEFS=
 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
 dnl Since we are building the implementations of the fortified functions here,
diff --git a/include/gnu-versions.h b/include/gnu-versions.h
index 6ffbd47..99caf5b 100644
--- a/include/gnu-versions.h
+++ b/include/gnu-versions.h
@@ -43,7 +43,7 @@
    remember, if any of these versions change, the libc.so major version
    number must change too (so avoid it)!  */
 
-#define _GNU_OBSTACK_INTERFACE_VERSION	1 /* vs malloc/obstack.c */
+#define _GNU_OBSTACK_INTERFACE_VERSION	2 /* vs malloc/obstack.c */
 #define _GNU_REGEX_INTERFACE_VERSION	1 /* vs posix/regex.c */
 #define _GNU_GLOB_INTERFACE_VERSION	1 /* vs posix/glob.c */
 #define _GNU_GETOPT_INTERFACE_VERSION	2 /* vs posix/getopt.c and
diff --git a/include/obstack.h b/include/obstack.h
index 349d59b..655a853 100644
--- a/include/obstack.h
+++ b/include/obstack.h
@@ -1,3 +1,6 @@
 #include <malloc/obstack.h>
 
 libc_hidden_proto (_obstack_newchunk)
+#ifdef __OBSTACK_ALIAS_VER2
+libc_hidden_proto (_obstack2_newchunk)
+#endif
diff --git a/malloc/Makefile b/malloc/Makefile
index 9e93523..accc584 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -30,7 +30,7 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
 	 tst-pvalloc tst-memalign tst-mallopt
 test-srcs = tst-mtrace
 
-routines = malloc morecore mcheck mtrace obstack
+routines = malloc morecore mcheck mtrace obstack obstackv1
 
 install-lib := libmcheck.a
 non-lib.a := libmcheck.a
@@ -104,6 +104,7 @@ include ../Rules
 
 CFLAGS-mcheck-init.c = $(PIC-ccflag)
 CFLAGS-obstack.c = $(uses-callbacks)
+CFLAGS-obstackv1.c = $(uses-callbacks)
 
 $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
 	-rm -f $@
diff --git a/malloc/Versions b/malloc/Versions
index 7ca9bdf..09fb9dd 100644
--- a/malloc/Versions
+++ b/malloc/Versions
@@ -61,6 +61,10 @@ libc {
   GLIBC_2.16 {
     aligned_alloc;
   }
+  GLIBC_2.20 {
+    _obstack2_allocated_p; _obstack2_begin; _obstack2_begin_1;
+    _obstack2_free; _obstack2_memory_used; _obstack2_newchunk;
+  }
   GLIBC_PRIVATE {
     # Internal startup hook for libpthread.
     __libc_malloc_pthread_startup;
diff --git a/malloc/obstackv1.c b/malloc/obstackv1.c
new file mode 100644
index 0000000..65e82b5
--- /dev/null
+++ b/malloc/obstackv1.c
@@ -0,0 +1,2 @@
+#define __OBSTACK_INTERFACE_VERSION 1
+#include "obstack.c"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]