IRC channel logs
2023-12-05.log
back to list of logs
<oriansj>janneke: or it is so fun people don't even think to ask anyone for help <Googulator1>...who knew bootstrapping inside a VM can somehow crash the host OS... <Googulator1>fossy: a little snippet useful for debugging live-bootstrap: trap 'bash -c '"'"'while true; do printf "# "; $(cat); done'"'"'' ERR <Googulator1>works in the very first bash build to get an interactive shell if something goes wrong <Googulator1>replace "set -e" with this in the script you want to debug <janneke>on #gnu, someone just asked "can gcc be compiled without gcc" <Googulator>the only downside to this Bash snippet is that it requires an Enter followed by a Ctrl+D before it accepts a command <Googulator>fossy: caught a bug in script-generator: in interpreter(), last may be used uninitialized <Googulator>causing weird behavior if the first directive is a define <matrix_bridge><cosinusoidally> I've managed to get my alternative bootstrap path up to tcc 0.9.27. I can generate a copy of tcc.o that is bit identical to that of my in tree tcc 0.9.27 rebuilding itself. <matrix_bridge><cosinusoidally> Only thing that is not quite right atm is libtcc1.o . I think there's a bug in my polyfill libc that is causing the assembler to select slightly differrent instructions: 2b 8d dc ff ff ff (sub -0x24(%ebp),%ecx) vs 2b 4d dc (sub -0x24(%ebp),%ecx) . If I link the same tcc.o against glibc then the bug goes away. <janus>cosinusoidally: you wrote sub (-0x24(%ebp),%ecx) twice? <matrix_bridge><cosinusoidally> In the "incorrect" libtcc1.o sub -0x24(%ebp),%ecx is encoded as 2b 8d dc ff ff ff , in the correct one it is 2b 4d dc <matrix_bridge><cosinusoidally> It is encoding a 32 bit immediate rather than a 8 bit one <matrix_bridge><cosinusoidally> There's probably some bug in my libc. For example I got a long way with a broken strcmp (until I replaced my buggy version with a good one from meslibc) <matrix_bridge><cosinusoidally> Googulator: at the moment I'm loading/running the elf files with a custom loader (from tcc_27 I run ./x86/bin/elf_loader_cc_x86.exe -l libtcc1.o -l ../tcc_26/libc_boot3.o -l tcc.o ...) but in theory if I figure out the correct tcc comand I could get it to generate a linked binary version of itself. tcc.o will currently be looking in the wrong place for crt files etc. <Googulator>If you managed to do that, we could remove mes/mescc from the bootstrap path in live-bootstrap, at least on x86 <Googulator>building mes, and then building tcc with mescc is currently the slowest step on the way to getting a Linux kernel <Googulator>& it gets exponentially slower on older hardware <Googulator>on a Core 2 Duo, just compiling tcc to assembly with mes takes longer than the entire Linux kernel build <Googulator>on modern hardware, Linux is slower to build than mes-tcc, but mes-tcc is still a really slow step, especially compared to how fast tcc then rebuilds itself <Googulator>I actually tested some commands to have tcc_27 loaded by elf_loader generate a fully linked version of itself, but it breaks due to lseek not being implemented <Googulator>yeah, that tcc-mes is a pain in the ass to get built <Googulator>also, building meslibc with tcc would be the dream too <Googulator>btw, has anyone figured out a way to run mescc using guile instead of mes, just to compare the speed? <Googulator>(of course guile is not gonna be available in early bootstrap where mescc is needed, but I'm trying to figure out if the slowness comes from mes or mescc) <Googulator>hmm, "if match ${ARCH} riscv64; then tcc-mes -c [...] ../${TCC_PKG}/lib/lib-arm64.c" <Googulator>lib-arm64.c for riscv64, and only for riscv64, not even for arm64? <stikonas>Googulator: yes, you can run mes with guile <stikonas>at leasta few times if I remember correctly <Googulator>if it's "a few times", that's not a big enough improvement, given how slow it is right now <stikonas>probably one can get some speed from mes back if we replace if's with switch statements throught mes <stikonas>well, on riscv64 getting to tcc takes a week <stikonas>visionfive2 machine, let me checck the core <stikonas>but that machine doesn't feel that slow with GCC <stikonas>mes and M2-Planet and kind of based on x86 <stikonas>so codegen does a lot of stack pushes/pops <stikonas>but I'm not sure if that's the cause of slowness <stikonas>probably not having huge cache also slows it down <Googulator>I'm testing on Core 2 Duo/Quad and Ryzen 7840HS - the Ryzen is about 2x faster building the Linux kernel (on 1 core, since no SMP in Fiwix), but over 10x faster for building tcc with mes <Googulator>Clock & IPC difference explains the difference in Linux <stikonas>Ryzen's have far bigger Cache or am I misremembering? <stikonas>hmm, I wonder what is RAM speed in visionfive2 <stikonas>but that might explain why visionfive2 is so slow...