summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-11-25 23:04:25 +0100
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-11-27 16:35:31 +0100
commitcee0b058fa0b4501b289a2da365182d60314d746 (patch)
tree423cf0b65ec2d1f9500b00d09f25952c7aa315d2
parent031d4eef8d055fbdae8d2fe4f59047e83601a15d (diff)
add aligned_alloc required for latest gcc libstdc++
-rw-r--r--include/stdlib.h6
-rw-r--r--libc/stdlib/malloc-standard/memalign.c1
-rw-r--r--libc/stdlib/malloc/memalign.c1
3 files changed, 8 insertions, 0 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index ba8849ed0..a108c84a9 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -529,6 +529,12 @@ 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 void *aligned_alloc (size_t __alignment, size_t __size)
+ __THROW __attribute_malloc__ __attribute_alloc_size__ ((2)) __wur;
+#endif
+
__BEGIN_NAMESPACE_STD
/* Abort execution and generate a core-dump. */
extern void abort (void) __THROW __attribute__ ((__noreturn__));
diff --git a/libc/stdlib/malloc-standard/memalign.c b/libc/stdlib/malloc-standard/memalign.c
index e9ae5a7b9..8cd6f582c 100644
--- a/libc/stdlib/malloc-standard/memalign.c
+++ b/libc/stdlib/malloc-standard/memalign.c
@@ -127,4 +127,5 @@ void* memalign(size_t alignment, size_t bytes)
__MALLOC_UNLOCK;
return retval;
}
+weak_alias(memalign, aligned_alloc)
libc_hidden_def(memalign)
diff --git a/libc/stdlib/malloc/memalign.c b/libc/stdlib/malloc/memalign.c
index 74d5dbd2d..6943279ac 100644
--- a/libc/stdlib/malloc/memalign.c
+++ b/libc/stdlib/malloc/memalign.c
@@ -93,4 +93,5 @@ memalign (size_t alignment, size_t size)
return MALLOC_SETUP (base, end_addr - (unsigned long)base);
}
+weak_alias(memalign, aligned_alloc)
libc_hidden_def(memalign)