From: Mark Kettenis Subject: Re: macppc ld.so: move check for unsupported PLT To: George Koehler Cc: tech@openbsd.org Date: Sat, 22 Aug 2026 12:55:08 +0200 > Date: Fri, 21 Aug 2026 18:00:55 -0400 > From: George Koehler > > Pike from https://pike.lysator.liu.se gave a strange error on macppc, > > $ pike --features > ld.so: pike: unsupported insecure BSS PLT object > Killed > > The PLT is for relocating function calls. The old BSS PLT for powerpc > is extinct. Pike used ld -nostartmodules to link a module with no > function calls. This module has no PLT, and ld.so confused the > absence of a PLT with the presence of a BSS PLT. This diff fixes it > by moving the check for the secure PLT (if PPC_GOT is nonzero) after > the check for any kind of PLT (if PLTREL is RELA). Now pike doesn't > die, but if I make a BSS PLT, it still dies: > > $ cc -fuse-ld=bfd -Wl,--bss-plt -o here here.c > $ ./here > ld.so: here: unsupported insecure BSS PLT object > Killed > > ok to commit? ok kettenis@ > Index: powerpc/rtld_machine.c > =================================================================== > RCS file: /cvs/src/libexec/ld.so/powerpc/rtld_machine.c,v > diff -u -p -r1.73 rtld_machine.c > --- powerpc/rtld_machine.c 16 Jul 2026 11:21:37 -0000 1.73 > +++ powerpc/rtld_machine.c 21 Aug 2026 01:59:18 -0000 > @@ -74,9 +74,6 @@ _dl_md_reloc(elf_object_t *object, int r > if (relrel > numrela) > _dl_die("relcount > numrel: %ld > %d", relrel, numrela); > > - if (object->Dyn.info[DT_PROC(DT_PPC_GOT)] == 0) > - _dl_die("unsupported insecure BSS PLT object"); > - > /* tight loop for leading RELATIVE relocs */ > for (i = 0; i < relrel; i++, relas++) { > Elf_Addr *r_addr; > @@ -273,6 +270,9 @@ _dl_md_reloc_got(elf_object_t *object, i > > if (object->Dyn.info[DT_PLTREL] != DT_RELA) > return 0; > + > + if (object->Dyn.info[DT_PROC(DT_PPC_GOT)] == 0) > + _dl_die("unsupported insecure BSS PLT object"); > > if (!lazy) { > fails = _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ); > >