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).

ok?


Index: gnu/llvm/lld/ELF/SyntheticSections.cpp
===================================================================
RCS file: /cvs/src/gnu/llvm/lld/ELF/SyntheticSections.cpp,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 SyntheticSections.cpp
--- gnu/llvm/lld/ELF/SyntheticSections.cpp      3 Aug 2020 14:32:29 -0000       
1.1.1.1
+++ gnu/llvm/lld/ELF/SyntheticSections.cpp      10 Oct 2020 21:13:59 -0000
@@ -604,6 +604,8 @@ GotSection::GotSection()
   // ElfSym::globalOffsetTable.
   if (ElfSym::globalOffsetTable && !target->gotBaseSymInGotPlt)
     numEntries += target->gotHeaderEntriesNum;
+  else if (config->emachine == EM_PPC)
+    numEntries += target->gotHeaderEntriesNum;
 }
 
 void GotSection::addEntry(Symbol &sym) {

Reply via email to