Using the _Atomic types is technically more accurate, but equivalent in
practice (glibc uses a normal int) and a bit of a headache for C++
targets since _Atomic is replaced with std::atomic.
GCC's default stdint.h only defaults to stdint-gcc.h, which we want to
use, when using -ffreestanding. Make our wishes explicit to avoid
needing that flag.
@update
> CMakeLists.txt
| remove the generation of the shared version of the fxlibc (deprecated, unused)
> include/errno
| add some error macros needed in vhex
> src/string/strerror
| add EINTR support
| add EAGAIN support
| add ENOMEDIUM support
| add EMEDIUMTYPE support
@fix
> include/target/vhex
| add missing headers
This version of signal (which does not rely on a notion of userland
processes and is thus excluded from Vhex) follows C99 semantics but does
not generate any signals by default.
Basically, the signal function sets up function pointers and the signal
function calls them. Termination signals call exit() while other signals
call _Exit(), which is a quicker program termination similar to abort().
C99 allows programs to long jump out of signal handlers (!) which is
unbelievably scary because it would bypass stack switching code in Vhex
as well as normal interrupt handler termination in gint.
This is implemented for gint only currently; on Vhex, _Exit() is likely
just going to be a syscall. For CASIOWIN, this is slightly more
difficult, as there is no native exit syscall.
On sh-generic targets, the headers <bits/cpucap.h> (in C) and
<bits/asm/cpucap.h> (in assembler) provide definitions to acces the
__cpucap symbol which provides information on the CPU.
Currently, a single capability __CPUCAP_SH4ALDSP is defined; it
represents the SH4 extended instructions together with the integrated
DSP instructions. The main uses of this capability are [movua.l]
(unaligned reads) and [ldrc] (built-in tight loops).
Capabilities are initialized to 0 (their safest default) and the runtime
can enable them based on what hardware is running.
This won't build on vhex-x86 but that can be left for another time. The
previous approach did not work because the __SUPPORT flags are not
defined when interfacing the library.