[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex
From: |
Danny Milosavljevic |
Subject: |
Re: [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello' |
Date: |
Fri, 8 Jan 2021 15:07:25 +0100 |
Hi Janneke,
I propose to, instead, change mes libc to align stuff malloc returns like this:
That should fix it.
diff --git a/include/stddef.h b/include/stddef.h
index a597c9bb..a682d726 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -37,6 +37,10 @@
#endif // !__MESC__
#endif // offsetof
+/* TODO: On armhf gcc, max_align_t is 16 Byte big instead. Use that? */
+
+typedef double max_align_t;
+
#endif // ! SYSTEM_LIBC
#endif // __MES_STDDEF_H
diff --git a/lib/stdlib/malloc.c b/lib/stdlib/malloc.c
index f4be4de1..aaf99886 100644
--- a/lib/stdlib/malloc.c
+++ b/lib/stdlib/malloc.c
@@ -20,6 +20,8 @@
#include <mes/lib.h>
#include <string.h>
+#include <stddef.h>
+#include <stdint.h>
/* FIXME: We want bin/mes-mescc's x86-linux sha256sum to stay the same.
Therfore we cannot remove stdlib/malloc from libc_SOURCES, which is
@@ -37,6 +39,8 @@ malloc (size_t size)
{
if (!__brk)
__brk = (char *) brk (0);
+ /* align what we give back. */
+ __brk = (char*) (((uintptr_t) __brk + sizeof(max_align_t) - 1) &
-sizeof(max_align_t));
if (brk (__brk + size) == -1)
return 0;
char *p = __brk;
pgppgSyZ1jgtD.pgp
Description: OpenPGP digital signature
- RE: [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', (continued)
- Re: [bootstrappable] wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Paul Sherwood, 2021/01/06
- Re: [bootstrappable] wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Jan Nieuwenhuizen, 2021/01/07
- Re: [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Danny Milosavljevic, 2021/01/07
- Re: [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Danny Milosavljevic, 2021/01/07
- Re: [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Danny Milosavljevic, 2021/01/07
- Re: [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Jan Nieuwenhuizen, 2021/01/08
- Re: [Tinycc-devel] [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', arnold, 2021/01/08
- Re: [Tinycc-devel] [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Jan Nieuwenhuizen, 2021/01/08
- Re: [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Danny Milosavljevic, 2021/01/08
- Re: [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello',
Danny Milosavljevic <=
- Re: [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Jan Nieuwenhuizen, 2021/01/08
- Re: [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Danny Milosavljevic, 2021/01/08
- Re: [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Danny Milosavljevic, 2021/01/08
- Re: [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Jan Nieuwenhuizen, 2021/01/08
- Re: [Tinycc-devel] [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', grischka, 2021/01/08
- Re: [Tinycc-devel] [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Danny Milosavljevic, 2021/01/08
- RE: [bootstrappable] Re: [Tinycc-devel] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Orians, Jeremiah (DTMB), 2021/01/08
- Re: [Tinycc-devel] [bootstrappable] Re: Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Vincent Lefevre, 2021/01/08
- Re: [Tinycc-devel] [bootstrappable] Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello', Jan Nieuwenhuizen, 2021/01/08
- ARM Unified Assembly Language - GNU as does some weird stuff, Danny Milosavljevic, 2021/01/25