IRC channel logs
2025-01-10.log
back to list of logs
<stikonas>rkeene: have you tested your untar changes with M2-Planet? <stikonas>since you defined variables inside blocks <rkeene>Ah, I assumed that because the Makefile specified C99 that it would be okay <stikonas>but definitely can't do it inside for loop <stikonas>(M2-Planet would just keep trying to create a new variable on each invocation then) <stikonas>anyway, try running it inside stage0-posix... <stikonas>mescc-tools-extra is a submodule of stage0-posix <rkeene>Well, creating a new variable is fine since, unlike within a loop where it should be created as part of the preamble <stikonas>in fact we'll need to fix your M2libc PR too <stikonas> +> ./x86/artifact/M2 --architecture x86 -f ./M2libc/sys/types.h -f ./M2libc/stddef.h -f ./M2libc/sys/utsname.h -f ./M2libc/x86/linux/unistd.c -f ./M2libc/x86/linux/fcntl.c -f ./M2libc/fcntl.c -f ./M2libc/x86/linux/sys/stat.c -f ./M2libc/stdlib.c -f ./M2libc/stdio.h -f ./M2libc/stdio.c -f ./M2libc/bootstrappable.c -f ./mescc-tools/hex2.h -f ./mescc-tools/hex2_linker.c -f ./mescc-tools/hex2_word.c -f ./mescc-tools/hex2.c -- <stikonas>debug -o ./x86/artifact/hex2_linker-0.M1 <stikonas>remove those const statements from signature <rkeene>commit a8f46dfc9d8b63277028c17076ae73703c7206e7 Update to define variables at top of function scope <stikonas>we'll still need a new PR to M2libc though... <stikonas>just change function to "int symlink(char *path1, char *path2)" <rkeene>Yeah, I was trying to get stage0-posix to work to validate it <rkeene>Other functions within `stdint.h` use `const` FWIW, which is why I used it: int chroot(char const *path); <stikonas>rkeene: but in the top level unistd.h symlink is the only one with consts... <stikonas>I'm a bit puzzled when const works and when it doesn't... <rkeene>I guess that it doesn't work on declaration, but is ignored on definition... for some reason. <stikonas>well, let's wait for oriansj to merge this fixup... <rkeene>I haven't got stage0-posix doing anything useful yet <stikonas>anyway, you need to update top level M2libc submodule there with your change (that's the one that is used in stage0-posix, not the ones inside other submodules) <stikonas>and update mescc-tools-extra to your changes <stikonas>(or some other arch, e.g. make test-amd64) <rkeene>untar.c:195:ERROR in collect_local Missing ; <rkeene>FWIW, the C specification says that sizeof(char) is always exactly 1 -- any reason to use sizeof(char) ? <rkeene>Okay, this is fixed by not using an array but switching to calloc() -- now I get a checksum error <rkeene>Afterwards: rm -f foo; ln -s /dev/null foo; rm -f foo.tar; tar -cf foo.tar foo; rm -f foo; ./untar --file foo.tar; ls -l foo => The extraction of foo.tar was successful lrwxrwxrwx 1 rkeene rkeene 9 Jan 9 18:27 foo -> /dev/null <rkeene>stikonas, commit 1bbd83341c904e40373a0cb6f0244146ac9c4c1b Switch to allocating from heap rather than stack confirmed to work with stage0-posix <stikonas>checksum error is fine, we need to update checksums <stikonas>make Generate-x86-answers would update them <stikonas>though I'll have to update other arches too <rkeene>All the binary hashes changed, I guess because of the addition of symlink <oriansj>and M2libc changes often impact *EVERY* program built. <oriansj>and yeah sizeof(char) isn't 1 for all architectures <rkeene>oriansj, If a C compiler produces something other than 1 for sizeof(char) it's broken <rkeene>oriansj, Thanks for merging my PRs ! <stikonas>./AArch64/artifact/hex2_linker-1.M1:154 :Received invalid other; SET_X1_TO_FCNTL_H_AT_FDCWD <stikonas>i.e. what is the hex value of it on aarch64 <stikonas>I'm not very familiar with arm64 machine encoding myself though... <stikonas>other than that I think rest of the arches work <rkeene>stikonas, Hmm... easy enough to add <rkeene>FWIW, I just use an assembler to get the correct instructions <rkeene>#define SET_X1_TO_FCNTL_H_AT_FDCWD 610c8092 -> which is 92800c61 mov x1, #0xffffffffffffff9c // #-100 <stikonas>aarch64 in principle would benefit from riscv style rewrite but nobody has volunteered <stikonas>you probably saw how in riscv64 we have individual opcode and register macros <rkeene>Yeah, it's certainly more convienent not to have to pass things back and forth between an assembler <stikonas>well, for riscv we didn't have much choice anyway <stikonas>riscv machine encoding is quite complicated, with various bits of immediate constents scattered around.. <rkeene>I don't have a RISC-V assembler or disassembler so I just had to guess at it... hopefully it works out <stikonas>but riscv doesn't need assembler there... <stikonas>with risc-v all the basic RV32I, RV64I and I guess RV64M opcodes are all already there <stikonas>basically written down directly from ISA documentation <stikonas>(perhaps after conversion from binary to hex...) <stikonas>rkeene: while you are at it with M2libc, could you perhaps remove UNTESTED comment from riscv symlink functions?