IRC channel logs
2021-11-23.log
back to list of logs
<oriansj>Program received signal SIGSEGV, Segmentation fault <oriansj>gdb just shows Program received signal SIGSEGV, Segmentation fault when I try to step into it <oriansj>I made a seperate branch for anyone else to look at <oriansj>I have a return 42 example program that I named foo.c with I hit the bug just doing ./bin/M2-Mesoplanet -f foo.c <stikonas>it creates /tmp/M2-Mesoplanet-... file and exits <stikonas>hmm, so I don't think I can reproduce it <oriansj>it crashes before making the file for me <stikonas>I am on glibc 2.33, although it's probably something simpler <gbrlwck>i'm having trouble compiling lib/linux/<arch>-mes-mescc/crt1.c (strictly following live-bootstrap). is one of you able to compile that with mescc? <gbrlwck>i get expr->register: not supported: #f (for both: riscv64 and x86) <stikonas>gbrlwck: are you sure you set all variables? <stikonas>including MES_PREFIX and GUILE_LOAD_PATH <stikonas>missing/incorrectly set up env variables were the most common cause of problems with mescc for me <gbrlwck>i add the lib paths via -L option, mescc compiles fine. i am able to run it on a simple "return 42" c program (which obviously won't work) <gbrlwck>if you have a working mes/mescc setup it would be great if you could check whether you are able to compile crt1.c (x86) <stikonas>(I might not have time today, but I can try tomorrow) <gbrlwck>can be your last: c07111ff876882591bc0077b32b7303d3bf2b99e <gbrlwck>i started building on top of that (but that's just RISC-V emission, i did not change anything within mes) <gbrlwck>if you could paste the results in here, that'd be great :) i'll read the logs for the time i'm not online <stikonas>so after uname call I have openat(AT_FDCWD, "/tmp/M2-Mesoplanet-FU8dtE", O_RDWR|O_CREAT|O_EXCL, 0600) = 5 <oriansj>ok, it appears to be something with my debian gcc install <oriansj>ok, its making the tempfile and "writing to it"; however nothing is showing up in the file <oriansj>I guess I'm going to have to do w+ and r+ modes in M2libc for fopen <oriansj>so --debug flag or --no-debug flag for M2-Mesoplanet? <oriansj>now to add in the logic for using the M2libc definition files and elf-headers <oriansj>and spawing is entirely isolated into cc_spawn.c so it can be easily removed from cc-minimal.c's dependency chain <stikonas[m]>by default stage0-posix builds everything with debug info <stikonas[m]>and those binaries are small enough anyway, so debug info is not a big problem <oriansj>as of right now ./bin/M2-Mesoplanet -f foo.c -o foo will preprocess, compile, assemble and link without issue basics correctly <oriansj>however it just needs a little logic when dealing with #include to set a flag if stdio is used <oriansj>the big next step is the actual importing of code with #include with <file> using the M2LIBC_PATH <stikonas>yes, that will make building more similar to usual compiler... <stikonas>oriansj: maybe with spawning and no -E it shouldn't output to stdout? <stikonas>as it will print lots of binary garbage to terminal <oriansj>stikonas: well it was a rough solution <stikonas>but it does work much nicer now than before <gbrlwck>did you compile by `make`? any other prerequesites necessary? <stikonas>gbrlwck: right now by make, but I guess once oriansj gets #include working, we can pull it into stage0-posix <stikonas>in principle you can compile it with M2-Planet <stikonas>just slightly different set of files (e.g. no cc_core.c but there is now cc_env.c and cc_spawn.c) <gbrlwck>i tried: `/root/M2-Planet/bin/M2-Planet --architecture riscv64 -f M2libc/bootstrappable.c -f cc_reader.c -f cc_core.c -f cc_macro.c -f cc_env.c -f cc_spawn.c -f cc.c -f cc.h -f cc_globals.c -f gcc_req.h --debug -o bin/M2-Mesoplanet` but this gives "Unterminated string" <gbrlwck>weird. `make` did not work before (not sure why) but typing make now did the trick <gbrlwck>not sure what happened, but it seems to work now :) <gbrlwck>i did a small PR for updating the README and --help (listing all possible options) <gbrlwck>"doesn't" in the // comment in gcc_req.h on line 18 triggers the unterminated string.. <gbrlwck>now i get "unknown type FILE".. is it possible this is not defined in M2libc/bootstrappable.c but only M2libc/stdio.c ? <stikonas>remove gcc_req.h from your M2-Planet command line <stikonas>well, that too but in any case your shouldn't include that file <stikonas>it's because // comments are stripped later (after tokenizer runs) <stikonas>and the reason for removing // comments later is that in bootstrap mode they are not comments <stikonas>cc_* compilers use // CONSTANT instead of #define <stikonas>and other headers like ../M2libc/amd64/Linux/unistd.h <stikonas>it's possible to build it in M2-Planet --bootstrap-mode too (test1000 does that to check some of the cc_* compatibility) but we can just do proper build <stikonas>gbrlwck: what command line are you running? <stikonas>I think it doesn't enforce it but should compile <stikonas>I get ./M2libc/stddef.h:18:newline expected at end of macro directive <stikonas>Mesoplanet does not assume cc_* compatibility <stikonas>and we started using some of the new features like i += 1; <stikonas>const looks like new addition by oriansj <stikonas>we have to add it to unlink because that's what POSIX requires <stikonas>so perhaps that's what we need to do with unlink too <stikonas>that's because you need char const* filename <stikonas>M2-Planet --architecture $ARCH -f ./M2libc/sys/types.h -f ./M2libc/stddef.h -f ./M2libc/$ARCH/Linux/unistd.h -f ./M2libc/$ARCH/Linux/fcntl.h -f M2libc/stdlib.c -f ./M2libc/stdio.c -f ./M2libc/bootstrappable.c -f M2libc/bootstrappable.c -f M2libc/string.c -f cc.h -f cc_globals.c -f cc_reader.c -f cc_core.c -f cc_macro.c -f cc_env.c -f cc_spawn.c -f cc.c --debug -o M2-Mesoplanet.M1 <stikonas>you also had order of some files in -f wrong <stikonas>header files with declarations should come first <stikonas>so we need to add fdopen to M2libc before we can compile it <gbrlwck>does this do more than converting the file descriptor to a FILE * (and check the mode)?