On Fri, Oct 2, 2026 at 12:54 PM Hakan Candar <[email protected]> wrote: > > While testing pmap_bootstrap locally the kernel never reached > > c_boot_entry: _start faults in its .bss clear (QEMU -d int shows > > fault_store at _start+0x2c, tval = higher-half address of _edata). > > > > Cause: the Debian cross toolchain defaults to PIC/PIE, so 'la' in > > boothdr.S assembles to GOT loads (R_RISCV_GOT_HI20) and the GOT holds > > VMAs, which do not exist in Bare mode. > > > Oh... I had not predicted different toolchains would be built > with -fPIE enabled by default. That sounds about right, and it > is indeed a gap in our build configuration. > > > I would fix this by building with -fno-pie -fno-PIE -fno-pic, as i386 > > and x86_64 already do (also in AM_CCASFLAGS; that is how boothdr.o got > > the GOT relocations). Does that look right to you? If so I will send > > the patch. > > Yes, please. This should be the right approach. Thanks for your > report!
Hello, this sounds like throwing out the baby with the bathwater :| PIC is an *essential* security feature, cannot we fix the underlying issue instead of disabling it? We did manage PIC on AArch64, I'm sure RISC-V can do it too. In particular, for boothdr.S, cannot you just spell the intended relocation more explicitly? Why is there a GOT in the first place, Mach is a single image/DSO with no ifuncs? 'la' is a pseudo-instruction that it sounds like should be best avoided, you likely want 'lla' (aka 'auipc' + 'addi') instead. Sergey P.S. Sorry for my ignorance, where is the repo I should be looking at to check out the current state of your RISC_V work?
