> Date: Sat, 10 Oct 2020 23:19:19 +0200 (CEST) > From: Mark Kettenis <mark.kette...@xs4all.nl> > > On powerpc with the secure-plt ABI we need a .got section, even if the > _GLOBAL_OFFSET_TABLE_ symbol isn't referenced. This is needed because > the first three entries of the GOT are used by the dynamic linker. > > With this fix I can build executables of all flavours (including > -static/-nopie).
Turns out that adding these GOT entries when using "ld -r" is a bad idea. Dif below fixes that. ok? Index: gnu/llvm/lld/ELF/SyntheticSections.cpp =================================================================== RCS file: /cvs/src/gnu/llvm/lld/ELF/SyntheticSections.cpp,v retrieving revision 1.2 diff -u -p -r1.2 SyntheticSections.cpp --- gnu/llvm/lld/ELF/SyntheticSections.cpp 11 Oct 2020 13:10:13 -0000 1.2 +++ gnu/llvm/lld/ELF/SyntheticSections.cpp 31 Oct 2020 23:37:11 -0000 @@ -604,7 +604,7 @@ GotSection::GotSection() // ElfSym::globalOffsetTable. if (ElfSym::globalOffsetTable && !target->gotBaseSymInGotPlt) numEntries += target->gotHeaderEntriesNum; - else if (config->emachine == EM_PPC) + else if (config->emachine == EM_PPC && !config->relocatable) numEntries += target->gotHeaderEntriesNum; }