about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-12-23 23:49:48 -0500
committerUlrich Drepper <drepper@gmail.com>2012-01-01 07:17:21 -0500
commit380d7e87dc80978581e73063dff0e264283c0306 (patch)
tree7d7bf0ae5f0ad112100bc49a2e90bcb94f9345ec
parentc0e87cc01807aee964014bb6518694e7f42b71a7 (diff)
downloadglibc-380d7e87dc80978581e73063dff0e264283c0306.tar.gz
glibc-380d7e87dc80978581e73063dff0e264283c0306.tar.xz
glibc-380d7e87dc80978581e73063dff0e264283c0306.zip
Implement aligned_alloc
-rw-r--r--ChangeLog8
-rw-r--r--NEWS15
-rw-r--r--Versions.def1
-rw-r--r--malloc/Versions3
-rw-r--r--malloc/malloc.c2
-rw-r--r--stdlib/stdlib.h5
6 files changed, 32 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 02d8a2b502..c75d829875 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,11 +28,17 @@
 
 2011-12-23  Ulrich Drepper  <drepper@gmail.com>
 
+	[BZ #13531]
+	* malloc/malloc.c: Define alias aligned_alloc for public_mEMALIGn.
+	* stdlib/stdlib.h: Declare aligned_alloc.
+	* Versions.def: Add GLIBC_2.16 for libc.
+	* malloc/Versions: Export aligned_alloc from libc for GLIBC_2.16.
+
 	[BZ 13527]
 	* stdlib/stdlib.h: Make at_quick_exit and quick_exit available for
 	ISO C11.
 
-	* include/features.h: Define __USE_ISOCXX11 when compiling ISo C++11
+	* include/features.h: Define __USE_ISOCXX11 when compiling ISO C++11
 	code.
 
 	[BZ #13528]
diff --git a/NEWS b/NEWS
index 241f4b79f5..43f02d9fd4 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,20 @@ Version 2.16
 
 * The following bugs are resolved with this release:
 
-  13526, 13527, 13528, 13529
+  13526, 13527, 13528, 13529, 13531
+
+* ISO C11 support:
+
+  + define static_assert
+
+  + do not declare gets
+
+  + declare at_quick_exit and quick_exit also for ISO C11
+
+  + aligned_alloc.  NB: The code is deliberately allows the size parameter
+    to not be a multiple of the alignment.  This is a moronic requirement
+    in the standard but it is only a requirement on the caller, not the
+    implementation.
 
 
 Version 2.15
diff --git a/Versions.def b/Versions.def
index 6b05e5ba5d..2b44f5e0bb 100644
--- a/Versions.def
+++ b/Versions.def
@@ -32,6 +32,7 @@ libc {
   GLIBC_2.13
   GLIBC_2.14
   GLIBC_2.15
+  GLIBC_2.16
   HURD_CTHREADS_0.3
 %ifdef EXPORT_UNWIND_FIND_FDE
   GCC_3.0
diff --git a/malloc/Versions b/malloc/Versions
index cf0b1e559a..7ca9bdf25f 100644
--- a/malloc/Versions
+++ b/malloc/Versions
@@ -58,6 +58,9 @@ libc {
   GLIBC_2.10 {
     malloc_info;
   }
+  GLIBC_2.16 {
+    aligned_alloc;
+  }
   GLIBC_PRIVATE {
     # Internal startup hook for libpthread.
     __libc_malloc_pthread_startup;
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 8608083adb..300e879b8c 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3124,6 +3124,8 @@ public_mEMALIGn(size_t alignment, size_t bytes)
 	 ar_ptr == arena_for_chunk(mem2chunk(p)));
   return p;
 }
+/* For ISO C11.  */
+weak_alias (public_mEMALIGn, aligned_alloc)
 libc_hidden_def (public_mEMALIGn)
 
 void*
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 754743f767..55886662bc 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -509,6 +509,11 @@ extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
      __THROW __nonnull ((1)) __wur;
 #endif
 
+#ifdef __USE_ISOC11
+/* ISO C variant of aligned allocation.  */
+extern int aligned_alloc (size_t __alignment, size_t __size) __THROW __wur;
+#endif
+
 __BEGIN_NAMESPACE_STD
 /* Abort execution and generate a core-dump.  */
 extern void abort (void) __THROW __attribute__ ((__noreturn__));