IRC channel logs

2025-01-10.log

back to list of logs

<stikonas>rkeene: have you tested your untar changes with M2-Planet?
<rkeene>No, only natively
<stikonas>I suspect it might fail
<rkeene>Why is that ?
<stikonas>since you defined variables inside blocks
<stikonas>and M2-Planet is not smart enough
<stikonas>to deal with that
<rkeene>Ah, I assumed that because the Makefile specified C99 that it would be okay
<stikonas>well, I'm not 100% sure for if's
<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>well, C99 is for GCC build
<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>rkeene: I'm also trying it now
<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>Unknown type const
<stikonas>./M2libc/x86/linux/unistd.c:139:
<stikonas>remove those const statements from signature
<stikonas>and for untar build I've got this: https://paste.debian.net/1344658/
<rkeene>Hmm, 262 is `if(VERBOSE)`
<rkeene>commit a8f46dfc9d8b63277028c17076ae73703c7206e7 Update to define variables at top of function scope
<stikonas>we'll still need a new PR to M2libc though...
<stikonas>can you create it?
<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>hmm, I wonder why it failed then...
<stikonas>rkeene: but in the top level unistd.h symlink is the only one with consts...
<stikonas>oh ok, chroot and mount are not...
<rkeene> https://github.com/oriansj/M2libc/pull/63
<stikonas>ok, thanks
<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>oh, that might be it
<stikonas>well, let's wait for oriansj to merge this fixup...
<stikonas>so rest is now working?
<stikonas>(in stage0-posix)
<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>and then run "make test-x86"
<stikonas>(or some other arch, e.g. make test-amd64)
<rkeene>Hmm
<rkeene>untar.c:195:ERROR in collect_local Missing ;
<rkeene>But https://github.com/oriansj/mescc-tools-extra/pull/25/files#diff-335bb9dace26b3eabf6f2278b2028c2e73083d18e6b0d1e5f916d6130d3ec8d0R195 looks to be correct...
<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
<rkeene>(well, modulo the changes in https://github.com/oriansj/M2libc/pull/63 -- which need to be incorporated to the submodule)
<stikonas>I guess to make it more readable...
<stikonas>checksum error is fine, we need to update checksums
<stikonas>it's the last part of stage0-posix
<rkeene>Left a comment here: https://github.com/oriansj/mescc-tools-extra/pull/25#issuecomment-2581505741
<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
<stikonas>yeah, that's expected
<stikonas>M2libc changed
<oriansj>and M2libc changes often impact *EVERY* program built.
<oriansj>M2libc changes merged
<oriansj>and yeah sizeof(char) isn't 1 for all architectures
<lanodan>n
<lanodan>woups ssh escape fail
<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>rkeene: one more problem...
<stikonas>./AArch64/artifact/hex2_linker-1.M1:154 :Received invalid other; SET_X1_TO_FCNTL_H_AT_FDCWD
<stikonas>you didn't add aarch64 define...
<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
<stikonas>yeah, shouldn't be too bad
<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>yeah, should be good enough for now
<rkeene> https://github.com/oriansj/M2libc/pull/64
<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
<stikonas>not the whole thing as in arm64...
<rkeene>Yeah, it's certainly more convienent not to have to pass things back and forth between an assembler
<stikonas>it makes early riscv steps harder...
<stikonas>but later steps nicer...
<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>risc-v works
<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?
<stikonas>I've just tested it on riscv64