This adds support for building nanos on an M1 or M2 based Mac. Several rules
have been rewritten to be more friendly for cross compiling or for determining
CFLAGS based on compiler type and not just platform.
Aarch64 apple clang has several warnings and errors when processing nanos
code and some of them did not have a reasonable solution for making the compiler
happy. Most of these problems were related to the inline assembly. Since homebrew
provides an up-to-date aarch64-elf-gcc, this change uses that instead of clang to
compile the kernel.
While aarch64-elf-binutils works fine for working with the kernel, the linker
appears to have a problem compiling the static runtime tests where the
automatic symbol __ehdr_start is not found. For this reason, a custom
aarch64-linux-binutils formula is provided which allows proper linking of
those static user programs.
The OBJS_CRT definitions that were removed in a previous change have
been restored as they are required for linking user programs on either
architecture of Macs, but they have been relocated to the runtime
Makefile as that is the only place they are used.
A handful of small changes were necessary to silence new compiler warnings.
This adds support for building nanos on an M1 or M2 based Mac. Several rules have been rewritten to be more friendly for cross compiling or for determining CFLAGS based on compiler type and not just platform.
Aarch64 apple clang has several warnings and errors when processing nanos code and some of them did not have a reasonable solution for making the compiler happy. Most of these problems were related to the inline assembly. Since homebrew provides an up-to-date aarch64-elf-gcc, this change uses that instead of clang to compile the kernel.
While aarch64-elf-binutils works fine for working with the kernel, the linker appears to have a problem compiling the static runtime tests where the automatic symbol __ehdr_start is not found. For this reason, a custom aarch64-linux-binutils formula is provided which allows proper linking of those static user programs.
The OBJS_CRT definitions that were removed in a previous change have been restored as they are required for linking user programs on either architecture of Macs, but they have been relocated to the runtime Makefile as that is the only place they are used.
A handful of small changes were necessary to silence new compiler warnings.