The guest's file namespace works like QEMU's -L. A guest path names the file at that
path under the sysroot when the sysroot has one, and the host's file at that path
otherwise. The program's own path, its working folder (the host's) and files named on
its command line therefore work as they do natively, while /lib/ld-linux-aarch64.so.1,
/usr/include and /usr/lib/libc.a come from the sysroot. A file the guest creates is
made in the tree its folder is in.
Unlike QEMU, a path is resolved one component at a time, so a symlink in the sysroot
whose target is absolute (lib64 -> /lib, the linker scripts' neighbors) leads to the
sysroot's /lib rather than the host's, as under chroot. /proc and /dev are the
runtime's own (/proc/self/exe and /proc/self/fd/N lead to the host files they name),
as are the resolver files the network layer provides under /etc.
Without -L, the sysroot is linux/ of the data folder games/ and work/ are in
(Usage): the portable folder beside a portable copy, the user's data
folder otherwise (~/.local/share/scarletnx on Linux), from a build tree too. The guest
path /usr/lib/libc.a is then linux/usr/lib/libc.a. Nothing in linux/ is ever committed: it holds whatever
sysroot and guest toolchains are put there (.gitignore). A glibc sysroot such as
gnu-cross's
aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot, copied to linux/, is
enough to run dynamically linked programs and an AArch64-hosted GCC:
cp -a aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot ~/.local/share/scarletnx/linux
build/scarletnx-gnuabi ~/.local/share/scarletnx/linux/opt/gcc/bin/aarch64-linux-gcc --sysroot=/ hello.c -o hello
build/scarletnx-gnuabi ./hello
The guest compiler's --sysroot=/ points it at the guest's root, which is linux/.
Made from docs/platforms/gnuabi/README.md at 69237645142c. GPL-3.0-or-later.