bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-mes] unexpected size:8, not a <type>: (tag "stat")


From: Jan Nieuwenhuizen
Subject: [bug-mes] unexpected size:8, not a <type>: (tag "stat")
Date: Sat, 23 Feb 2019 10:55:49 +0100

Hi Danny!

The unexpected size:8 is caused by the fact that mescc does not support
any 8 byte types in 32 bit mode.  That's a known limitation and needs
to be fixed some time.

You currently get it when using a long long or in this case a double of
size 8.  This may be the reason x86 uses a 4 byte double / long long:
to silence this message.

Maybe we should just disable any code that use doubles (abtod) in this
case when compiling with mescc; eg use something like

#if __MESC__
  float dbase = base;
#else
  double dbase = base;
#endif

In any case, this error is really a red herring...  Even for a full tcc
build this abtod function can be a stub, we introduce floats support
only much later in the bootstrap process.

Anyway, the real problem that causes the build to fail is that `struct
stat' is not defined.  This error can be avoided by using the __i386__
definitions for stat (and LONG_MIN) using the attached patch.

I didn't push to wip-arm, I have no idea if this is correct, I can
imagine we may need separate definitions for arm?

Greetings
janneke

>From d695cdb0a8ec78e2ed2976b7bf735d67acc73e9e Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <address@hidden>
Date: Sat, 23 Feb 2019 10:42:34 +0100
Subject: [PATCH] ARM: mescc: Mes C library: Support libc+tcc.

* include/stdint.h[__arm__]: Use __i386__ definitions.  FIXME?
* include/sys/stat.h (struct stat): Likewise.
* lib/stdio/remove.c: Include it.
---
 include/stdint.h   | 2 +-
 include/sys/stat.h | 2 +-
 lib/stdio/remove.c | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/stdint.h b/include/stdint.h
index 8b772350..1342c992 100644
--- a/include/stdint.h
+++ b/include/stdint.h
@@ -91,7 +91,7 @@ typedef unsigned uintmax_t;
 #define USHRT_MAX UINT16_MAX
 #define USHRT_MIN UINT16_MIN
 
-#if __i386__
+#if __i386__ || __arm__
 #define LONG_MIN INT_MIN
 #define LONG_MAX INT_MAX
 #define UINT_MAX UINT32_MAX
diff --git a/include/sys/stat.h b/include/sys/stat.h
index dcac07f5..c48dca42 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -35,7 +35,7 @@ typedef int mode_t;
 #endif
 
 // *INDENT-OFF*
-#if __i386__
+#if __i386__ || __arm__
 struct stat
 {
   unsigned long  st_dev;
diff --git a/lib/stdio/remove.c b/lib/stdio/remove.c
index f50b1d0a..c215e81f 100644
--- a/lib/stdio/remove.c
+++ b/lib/stdio/remove.c
@@ -19,6 +19,7 @@
  */
 
 #include <stdio.h>
+#include <sys/stat.h>
 
 int
 remove (char const *file_name)
-- 
2.20.1

-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]