Re: [scc-dev] aarch64 support

From: Roberto E. Vargas Caballero <k0ga_at_shike2.com>
Date: Tue, 12 Mar 2024 20:02:21 +0100

Hi,

On Sat, Mar 09, 2024 at 05:14:46PM -0300, Brian Mayer wrote:
> I ran make after cleaning it up and getting your commit. This time the
> compilation goes further until this happens:

Yeah, as I commented many bugs were expected to happen ^^!!!!

> This was the Makefile in the root folder not having the aarch64
> target, so I added it to the scripts/arm64.mk file which gets included
> in the Makefile. Like this:
>
> diff --git a/scripts/arm64.mk b/scripts/arm64.mk
> index 949eb49b..f6ae8961 100644
> --- a/scripts/arm64.mk
> +++ b/scripts/arm64.mk
> _at_@ -1,6 +1,9 @@
> arm64:
> +_at_$(MAKE) `$(SCRIPTDIR)/config` CONF=arm64-linux libc libcrt
>
> +aarch64:
> + +_at_$(MAKE) `$(SCRIPTDIR)/config` CONF=arm64-linux libc libcrt
> +
> install-arm64: arm64
> $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.arm64 $(ROOT)

Good change, I am going to push it (also with the addition of the required
install-aarch64 and install-aarch64).

> Not sure if this is the right choice. So running make again takes it
> further but there comes a new error:
>
> make[4]: Entering directory '/home/blmayer/git/distro/scc/src/libc/inttypes'
> gcc -I../../../include -I../../../include/bits/linux
> -I../../../include/bits/arm64 -I../../../include/bits/linux/arm64
> -ffreestanding -fno-pie -std=c99 -fno-stack-protector -static -O1
> -o imaxabs.o -c imaxabs.c
> In file included from ../../../include/stdint.h:8,
> from ../../../include/inttypes.h:4,
> from imaxabs.c:1:
> ../../../include/bits/linux/arm64/arch/stdint.h:103:23: error: two or
> more data types in declaration specifiers
> 103 | typedef unsigned char int uint_fast8_t;
> | ^~~

There was a stupid type and that int had to be removed. I have pushed the fix.


> ../../../include/inttypes.h:5:10: fatal error: arch/inttypes.h: No
> such file or directory
> 5 | #include <arch/inttypes.h>
> | ^~~~~~~~~~~~~~~~~
> compilation terminated.

The file include/bits/linux/arm64/arch/inttypes.h was missed. I have pushed
it (It is basically the same than amd64, I have reviewed it, but it would
be nice if someone else does it).


> Note that only sigaction.s has 2 "_" before it. So I removed it, by
> editing the file src/libc/arch/arm64/linux/syscall.lst. This may be
> some Makefile with a typo. I'm not sure if that's correct, but
> compilation ran further:

The typo was in the Makefile, where it listed _sigaction.o instead of
__sigaction.o. I have pushed the fix it.


> After taking a look at:
> https://pubs.opengroup.org/onlinepubs/7908799/xsh/signal.h.html. I
> edited that file and changed the following:
>
> diff --git a/src/libc/arch/posix/signal.c b/src/libc/arch/posix/signal.c
> index 7bff34b0..3f04e164 100644
> --- a/src/libc/arch/posix/signal.c
> +++ b/src/libc/arch/posix/signal.c
> _at_@ -1,8 +1,7 @@
> #include <signal.h>
> #include <stddef.h>
>
> -#include <arch/sigaction.h>
> -#include <sys.h>
> +#include <signal.h>
>
> #undef signal
>
> _at_@ -13,7 +12,7 @@ void
> .sa_handler = func,
> };
>
> - if (_sigaction(signum, &sa, &osa) < 0)
> + if (sigaction(signum, &sa, &osa) < 0)
> return SIG_ERR;
>
> return osa.sa_handler;

In this case the solution that you applied was not good, because the issue
here was that include/bits/linux/arm64/arch/sigaction.h was missed. I think
the definition of struct sigaction is the same in both cases is the same,
but I am not so sure about the definition of SA_RESTORER. Can you try a small
program with glibc and print the value of SA_RESTORER?


Please, can you check the new master and see how much the build progress now?

Regards,
--
To unsubscribe send a mail to scc-dev+unsubscribe_at_simple-cc.org
Received on Tue 12 Mar 2024 - 20:02:21 CET

This archive was generated by hypermail 2.3.0 : Tue 12 Mar 2024 - 20:10:47 CET