IRC channel logs

2025-03-10.log

back to list of logs

<matrix_bridge><gtker> stikonas: Because of the prefixes?
<fossy>evrial: GCC, and clang, and that's all.
<fossy>Firefox is an *incredibly* complex beast
<fossy>i don't know that firefox even builds without rust these days
<fossy>tl;dr you cannot get Firefox with anything that is reasonably auditable by an individual, or even a small team of people
<lanodan>Yeah would probably make more sense to grab a *much* smaller browser for auditing concerns, like netsurf/dillo or even elinks/lynx/w3m/…
<janus>fossy: is rust hard to audit? why?
<matrix_bridge><Andrius Štikonas> gtker: yes, prefixes work i n a different way there
<matrix_bridge><Andrius Štikonas> janus: cause you need to audit rust source for 10 versions of rust
<matrix_bridge><Andrius Štikonas> Or over 20 at some times
<matrix_bridge><Andrius Štikonas> Depending on mrustc release schedule
<matrix_bridge><Andrius Štikonas> Well, that's if our hard to audit metric is source size
<lanodan>And having stared in the code of rust stdlib few times… good luck auditing it.
<matrix_bridge><gtker> Stikonas: OK, I changed it in a later commit to the single byte prefix, does that also work differently?
<fossy>as stikonas said, and rust is at least as complicated as c/c++ backends of gcc, janus
<matrix_bridge><Andrius Štikonas> gtker: all of them work differently
<matrix_bridge><Andrius Štikonas> In risc-v prefix specifies riscv instruction encoding
<matrix_bridge><Andrius Štikonas> So it is tied to opcode and not size
<matrix_bridge><Andrius Štikonas> E.g. addi is I type instruction and uses !
<matrix_bridge><gtker> Ah. So I'll need to convert them all to 32bit % prefixes?
<matrix_bridge><Andrius Štikonas> Let me double check
<matrix_bridge><gtker> So a raw !1 !2 !3 !4 wouldn't be the same as %0x01020304?
<matrix_bridge><Andrius Štikonas> Remind me are these seen by M1 or hex2?
<matrix_bridge><gtker> M1, I think
<matrix_bridge><Andrius Štikonas> Yeah, on RISC it is competely different
<matrix_bridge><Andrius Štikonas> Bits are shuffled all over the place
<matrix_bridge><Andrius Štikonas> Let me find you a table
<matrix_bridge><Andrius Štikonas> https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fi.stack.imgur.com%2FMUKIE.png&f=1&nofb=1&ipt=28c06360b81f4df8ec8852cf14c38de41cf041c869064afbc3ff499b5bff3698&ipo=images
<matrix_bridge><Andrius Štikonas> So I type (!) means take 11 bits and shift to the appropriate location
<matrix_bridge><Andrius Štikonas> See also https://github.com/oriansj/mescc-tools/blob/98d391202736d1b766aa50e779c61b2cac731ee0/M1-macro.c#L615
<matrix_bridge><Andrius Štikonas> OK % seems to be the same
<matrix_bridge><Andrius Štikonas> Or almost the same, I this on x86 they are little endian
<matrix_bridge><Andrius Štikonas> s/this/think/
<matrix_bridge><gtker> % is the same as 4 literal bytes on all platforms? Otherwise what is the recommended way of inserting literal bytes
<janus>what's the most bootstrappable of the typed languages? would it be some typing system for guile?
<janus>or would it be c++ or java?
<matrix_bridge><Andrius Štikonas> gtker: I'll check in the evening % might be fine
<matrix_bridge><Andrius Štikonas> If not, it might be why we were doing byte by byte...
<lanodan>Go is probably the easiest strongly typed language in wide use today to bootstrap & audit, less stages to get a modern compiler and much smaller compiler/stdlib
<lanodan>And personally I found trying to bootstrap Java to be a pain, way too many enterprise software nobody touched in the last 10~15 years.
<matrix_bridge><Andrius Štikonas> Well, C++ I'd not hard to bootstrap
<matrix_bridge><Andrius Štikonas> s/I'd/is/
<matrix_bridge><Andrius Štikonas> Just need to use C only GCC 4 and rebuild itself with C++
<matrix_bridge><Andrius Štikonas> I guess C itself too. It is even easier to bootstrap
<lanodan>C++ isn't really hard to bootstrap but I wouldn't really say GCC (or $DEITY forbid, LLVM/Clang) is auditable
<matrix_bridge><Andrius Štikonas> But that needs to be audited for any other language anyway
<matrix_bridge><Andrius Štikonas> Almost no other language is bootstrappable without GCC
<matrix_bridge><Andrius Štikonas> Maybe some can be done with tcc but tcc is not any easier to audit
<lanodan>Well it's a bootstrap chain, gcc is effectively extra to tcc or any other c compiler since you can't directly bootstrap gcc.
<janus>It sounds like there are no good options, so if the easy bootstrapping/auditing is a requirement, I suppose optionally type checked langauges are options too
<janus>Now that Python and TypeScript have a blessed syntax for type annotations, it becomes a better option
<lanodan>Can proper TypeScript even bootstrap? I noted it as problematic on my side: https://hacktivis.me/notes/bootstrapping#typescript
<janus>Right, what I mean is that since there is now a blessed syntax, there is a subset of TypeScript that involves no code-generation, only correctness checks
<janus>So one could imagine a type-stripper, written in an arbitrary language, which would emit a JavaScript program to be evaluated
<janus>I know it sounds a bit handwavy ;) I think Python should be easier since it seems like Mypy/Pyright programs always execute with the vanilla interpreter
<matrix_bridge><Andrius Štikonas> janus but for bootstrapping Python you still need C
<matrix_bridge><Andrius Štikonas> most of the bootstrapping relies having C (or more languages) first
<matrix_bridge><Andrius Štikonas> there are very few compilers/interpreters written in assembly
<matrix_bridge><Andrius Štikonas> at least not many that can go all the way to usable system rather than some toy ones that can't be used to go all the way
<mihi>gtker: The preferred way (for me) to output literal bytes in M1 is to put hex bytes in single quotes, e.g. 'CA FE BA BE'
<mihi>everything in single quotes is passed as-is to hex2
<mihi>(or whatever you are using for processing the output of M1)
<stikonas>mihi: this is basically about his PR https://github.com/oriansj/M2-Planet/pull/97
<stikonas>feel free to help me review it...
<stikonas>gtker is doing a very nice job at tremendous speed but so far it's just me reviewing the changes
<mihi>when looking at that PR, I have to admit I am unsure whether M2-Planet supports any big endian architectures - the shuffling of ints into initializer_list_values and later back out will not work like this...
<mihi>in general, I think M2-Planet tries to keep bytes as bytes and ints as ints and lets hex2 take care of endianness.
<mihi>(in other words, "literal bytes" built from ints are not literal bytes in my opinion :D)
<mihi>s/hex2 take/M1 and &/