On Mon, 16 Mar 2020 19:13:13 -0600 "Theo de Raadt" <dera...@openbsd.org> wrote:
> How are the bootblocks faring? > > And userland? ofwboot with clang works for me. I failed to make bsd.rd (in src/distrib/macppc/ramdisk) with clang, but I don't remember exactly what I did, so I might have been making it the wrong way. My build failed at clang -static -L. -nopie -o instbin instbin.o dd.lo ... /usr/bin/ld: dd.lo(.text+0x14): R_PPC_PLTREL24 reloc against local symbol I was able to make bsd.rd with gcc. "$CC -fno-pie -c something.c; objdump -dlr something.o" shows that gcc -fno-pie uses R_PPC_REL24, but clang -fno-pie uses R_PPC_PLTREL24, for calls to external functions. The symbols would be global until crunchgen(8) hides them by marking them local. R_PPC_REL24 would branch directly to a function, and R_PPC_PLTREL24 would go through the PLT (for a function in a shared library). The compiler can't know whether the function is in a shared lib; the linker must decide. clang -fno-pie on amd64 uses R_X86_64_PLT32, so I guess that clang -fno-pie on powerpc isn't wrong to use R_PPC_PLTREL24. Passing -M to crunchgen(8), as we do on {longsoon,octeon,sgi}, might work around the problem, but I haven't tried it, and I don't know whether this is the only problem. --George