Abstract:

J. Marino's notes

See http://www.dragonlace.net/wiki/xcompile/index.html

  1. Install NetBSD-current-aarch64.
  2. Copy /usr/lib and /usr/include out of the system.
  3. Take binutils from NetBSD's source code. It is located under src/external/gpl3/binutils/dist. The reason for using the integrated binutils and not upstream is that NetBSD's binutils are heavily patched. Allow configure to be executable.
    1. Make sure isl, gmp, mpfr and mpc (mpcomplex) are installed under /usr/pkg, since binutils will make use of them.
    2. Build binutils
  4. Copy gcc10-aux's patched source code from pkgsrc (work/gcc-10.3.0).
    1. REVIEW: The gmp, mpfr and mpcomplex directories are prefixed with .devel.. Move them so that they do not have such prefix.
    2. Create a new folder to build gcc. In this case build-gcc.

Notes

Once gcc10-aux builds successfully in NetBSD x8664, it is time to make it work in other platforms! Steps:

  1. Make sure that the Makefile.rtl in gcc/ada contains an entry for the OS/arch pair that you are cross-compiling to. For the time being, arm and arm64 have been added.
  2. Clone the NetBSD src into /usr/src (canonical place).
  3. NetBSD has stripped everything-ada from its source code and entries, so we need to re-enable it.
    1. Enable the compilation of Ada as part of GCC. Add ada to the entry GCC_LANGUAGES=c c++ objc in /src/tools/gcc/Makefile.
    2. Add configure-target-libada to MKNATIVE_CONFIG_TARGET_LIBS+ in the same file as above.
    3. Add --enable-languages="${GCC_LANGUAGES}" in NATIVE_CONFIGURE_ARGS+= before the .native/.configure_done target.
    4. TODO CLEAN: change these two lines ALL_TARGET= all-gcc all-target-libgcc INSTALL_TARGET= install-gcc install-target-libgcc
    5. Enable ada/gcc-interface in /src/external/gpl3/gcc/usr.bin/frontend/Makefile at the bottom loop. This will fix an include error that would happen if not added to the "#include \"$$f/lang-specs.h\"" line.
    6. Copy the gcc/ada folder from the patched pkgsrc "work" directory from gcc10-aux into /src/external/gpl3/gcc/dist/gcc.
    7. Copy the libada and gnattools folders from the patched sources into /src/external/gpl3/gcc/dist.
    8. TODO See https://github.com/NetBSD/src/tree/trunk/external/gpl3/gcc/lib
    9. TODO See https://github.com/NetBSD/src/tree/trunk/external/gpl3/gcc/usr.bin (gnattools?)
    10. TODO See https://github.com/NetBSD/src/blob/a56a355f5aa95b831d219d32d678431153490f6e/tools/gcc/mknative-gcc and enable ada.
  4. Compile a release of NetBSD. For 32-bit systems run: ./build.sh -m evbarm -a earmv7hf -j6 -u release. For 64-bit systems (RPi 3 and above) run ./build.sh -m evbarm -a aarch64 -j6 -u release
specs.h: Makefile
	for f in cp lto objc objcp ada/gcc-interface; do \
		echo "#include \"$$f/lang-specs.h\""; \
	done > specs.h

Table of Contents

Author: Fernando Oleo Blanco

Email: irvise _at_ irvise.xyz

Created: 2022-01-27 Do 16:11

Emacs 27.1 (Org mode 9.4.4)

Validate