Gnuk 1.2.19 fails to build with gcc-11.2.1
NIIBE Yutaka
gniibe at fsij.org
Tue Mar 22 07:38:59 CET 2022
Hello,
Thank you for your report.
Bertrand Jacquin wrote:
> In file included from regnual.c:31:
> types.h:1:23: error: conflicting types for ‘size_t’; have ‘long unsigned int’
> 1 | typedef unsigned long size_t;
> | ^~~~~~
> In file included from /usr/arm-none-eabi/include/sys/reent.h:14,
> from /usr/arm-none-eabi/include/string.h:11,
> from regnual.c:29:
> /usr/lib/gcc/arm-none-eabi/11.2.1/include/stddef.h:209:23: note: previous declaration of ‘size_t’ with type ‘size_t’ {aka ‘unsigned int’}
> 209 | typedef __SIZE_TYPE__ size_t;
> | ^~~~~~
>
> It it safe to assume that type used by gnuk should be redefined to avoid
> conflict with compiler provided types ?
ABI wise, it is same; Both are 32-bit unsigned integer.
You can just remove the definition of size_t in regnual/types.h.
I'll fix.
Initially, when Gnuk started, I assumed freestanding environment. That
is, an environment with no C library. That's why we have the header
file regnual/types.h and declaration of memset in regnural.c.
It worked, for a while, in the past.
But GCC changed (or clarified its requirement for freestanding
environment). GCC requires the freestanding environment to provide
memcpy/memmove/memset/memcmp functions.
Instead of providing the required functions, I moved to use newlib for
that.
Note that most parts of Gnuk (for MCU) never depends on C library,
still.
Now, Gnuk supports emulation, in this case, it uses GNU C library.
(regnual only runs on MCU, not emulation.)
--
More information about the Gnuk-users
mailing list