With significant assistance from Steve McIntyre and some judicious delving into the
ARM Information Centre, I've now got the assembly portions of klibc sorted (but untested) for AArch64 (arm64).
Andy & I started by copying the old ARM support as a new directory and one of
the final steps was to remove a whole bunch of legacy code from the days before Thumb and all the #ifdef lines which went with it. Some files disappeared entirely. setjmp.S was the largest amount of work as the load&store multiple support of ARMv7 has gone in ARMv8, so the stmia mnemonic had to be
expanded to multiple stp calls but that makes it more explicit, so it's not a bad thing.
Steve & I borrowed from the glibc AArch64 code from
upstream by Marcus Shawcroft, simplifying the glibc macros for klibc and also got clues about what extra registers needed handling compared to ARMv7.
I've now got to look at some traditional cross-compilation issues because the Linaro AArch64 toolchain doesn't install to typical Debian cross-building paths and the build now moves past the AArch64-specific assembly and fails later when the C code gets the wrong include path and ends up including /usr/include/i386-linux-gnu/asm/byteorder.h with predictable results.
If someone has an AArch64 toolchain already set up, feel free to
clone my modified klibc tree and let me know if there are subsequent build errors. Of course, if you fancy testing a build in the Foundation Model for ARMv8, that would be good too! (Report issues via github.)
Whilst I'm sorting out the toolchain, I've also been updating
perl-cross-debian (which has also seen
some more upstream testing and improvement).