public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] elf: dl-minimal malloc needs to respect fundamental alignment
@ 2016-06-21 11:17 Florian Weimer
  2016-06-21 12:54 ` H.J. Lu
  2016-07-11  2:35 ` Carlos O'Donell
  0 siblings, 2 replies; 15+ messages in thread
From: Florian Weimer @ 2016-06-21 11:17 UTC (permalink / raw)
  To: libc-alpha

If malloc is used instead of memalign for small alignments,
malloc needs to provide the ABI-required alignment.

2016-06-21  Florian Weimer  <fweimer@redhat.com>

	* elf/dl-minimal.c (malloc): Allocate with fundamental alignment.

diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c
index c8a8f8d..2d7d139 100644
--- a/elf/dl-minimal.c
+++ b/elf/dl-minimal.c
@@ -27,6 +27,7 @@
 #include <sys/types.h>
 #include <ldsodefs.h>
 #include <_itoa.h>
+#include <stdalign.h>
 
 #include <assert.h>
 
@@ -90,7 +91,7 @@ __libc_memalign (size_t align, size_t n)
 void * weak_function
 malloc (size_t n)
 {
-  return __libc_memalign (sizeof (double), n);
+  return __libc_memalign (_Alignof (max_align_t), n);
 }
 
 /* We use this function occasionally since the real implementation may

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-08-03 13:51 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-21 11:17 [PATCH] elf: dl-minimal malloc needs to respect fundamental alignment Florian Weimer
2016-06-21 12:54 ` H.J. Lu
2016-06-21 12:57   ` Florian Weimer
2016-06-21 13:00     ` H.J. Lu
2016-06-21 13:06       ` Florian Weimer
2016-06-21 13:20         ` H.J. Lu
2016-06-23 15:01           ` Florian Weimer
2016-06-23 16:15             ` H.J. Lu
2016-06-23 16:25               ` Florian Weimer
2016-06-23 17:02                 ` Joseph Myers
2016-06-23 17:54                   ` Florian Weimer
2016-07-11  2:35 ` Carlos O'Donell
2016-07-11  8:55   ` Florian Weimer
2016-08-03 10:04     ` Florian Weimer
2016-08-03 13:51       ` Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).