Blob Blame Raw
diff --git a/device/include/aligned_alloc.h b/device/include/aligned_alloc.h
new file mode 100644
index 0000000..2cd5e3a
--- /dev/null
+++ b/device/include/aligned_alloc.h
@@ -0,0 +1,11 @@
+#ifndef __SDCC_ALIGNED_ALLOC_H
+#define __SDCC_ALIGNED_ALLOC_H 1
+
+#if __STDC_VERSION__ >= 201112L
+inline void *aligned_alloc(size_t alignment, size_t size)
+{
+  (void)alignment;
+  return malloc(size);
+}
+#endif
+#endif
diff --git a/device/include/stdlib.h b/device/include/stdlib.h
index 5abede0..cce0686 100644
--- a/device/include/stdlib.h
+++ b/device/include/stdlib.h
@@ -82,6 +82,7 @@ void *calloc (size_t nmemb, size_t size);
 void *malloc (size_t size);
 void *realloc (void *ptr, size_t size);
 #endif
+#ifdef RRR
 #if __STDC_VERSION__ >= 201112L
 inline void *aligned_alloc(size_t alignment, size_t size)
 {
@@ -89,6 +90,7 @@ inline void *aligned_alloc(size_t alignment, size_t size)
   return malloc(size);
 }
 #endif
+#endif
 extern void free (void * ptr);
 
 /* Searching and sorting utilities (ISO C11 7.22.5) */
diff --git a/device/lib/aligned_alloc.c b/device/lib/aligned_alloc.c
index 92f3259..552459b 100644
--- a/device/lib/aligned_alloc.c
+++ b/device/lib/aligned_alloc.c
@@ -37,5 +37,5 @@
 
 extern void *aligned_alloc(size_t alignment, size_t size);
 
-#include <stdlib.h>
+#include <aligned_alloc.h>