On Sun, 19 Jan 2020 11:32:26 +0900 rgc <rgci...@disroot.org> wrote: > ... > > On Sun, Jan 19, 2020 at 11:12:15AM +0900, rgc wrote: > > ppc@ > > > > as title ... i've been playing around since i got 6.6-current installed. > > > > first build a gcc4 kernel and test if it boots properly. OK > > > > modified share/mk/bsd.own.mk; modified links to cc, c++, cpp; kernel > > build without errors; these steps are from a 2018 mail on how to > > "switch armv7 to clang" > > > > ... but does not boot > > > > ----- > > [ using 1135748 bytes of bsd ELF symbol table ] > > console out [ATY,Jasper_A] console in [keyboard], using USB > > using parent ATY,JasperParent:[]-2147483648/0 sp=6db6db6d inside > > 80210194-38214000: not MAP_STACK > > ----- > > > > ...
clang still has bugs and can emit wrong assembly code. MAP_STACK is documented in mmap(2). The kernel sometimes checks that the cpu's stack pointer (register %r1 on PowerPC) points to MAP_STACK memory. The check would fail if something corrupted the stack pointer; "sp=6db6db6d" might be a corrupt value. You might get more info by adding printf() calls and rebuilding the kernel. I reported https://bugs.llvm.org/show_bug.cgi?id=40736 where clang and gcc use incompatible assembly code to return small structs, and am working on a possible fix. Without a fix, user commands built by clang might have trouble calling libraries built by gcc. If we fix enough compatibility bugs, we might try building user commands with clang. This might be easier than building the kernel. --George