fosslinux / live-bootstrap

Use of a Linux initramfs to fully automate the bootstrapping process
291 stars 26 forks source link

Potential bug in tcc-0.9.26 pass1.kaem #411

Closed cosinusoidally closed 6 months ago

cosinusoidally commented 6 months ago

Just happened to notice this https://github.com/fosslinux/live-bootstrap/blob/6ed2e09f3a533a1efdd807a77a7c00a07bf984f1/steps/tcc-0.9.26/pass1.kaem#L235C1-L240C3

tcc-boot1 -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -D HAVE_FLOAT=1 -I include -I include/linux/${MES_ARCH} -o libtcc1.o lib/libtcc1.c
if match ${ARCH} riscv64; then
    tcc-boot1 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o lib-arm64.o ../${TCC_PKG}/lib/lib-arm64.c
    tcc-boot1 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o lib-arm64.o
else
    tcc-boot1 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o
fi

When refactoring pass1.kaem for #355 . It seems to be building some arm64 support code for the riscv target? Or is that just a quirk of the riscv target (it maybe reuses some arm64 support code)? I don't have any riscv hardware so I can't check myself.

stikonas commented 6 months ago

No, that's intentional, it has to be lib-arm64.c It uses the same functions as arm64 support code.

stikonas commented 6 months ago

(by the way, you could run it in qemu too on riscv, though that requires passing through qemu into bwrap/chroot environment.)