$OpenBSD: patch-tools_lld_ELF_InputSection_cpp,v 1.5 2021/03/15 21:02:10 sthen Exp $

[ELF][PPC32] Don't report "relocation refers to a discarded section" for .got2.

Index: tools/lld/ELF/InputSection.cpp
--- tools/lld/ELF/InputSection.cpp.orig
+++ tools/lld/ELF/InputSection.cpp
@@ -438,11 +438,12 @@ void InputSection::copyRelocations(uint8_t *buf, Array
       // hopefully creates a frame that is ignored at runtime. Also, don't warn
       // on .gcc_except_table and debug sections.
       //
-      // See the comment in maybeReportUndefined for PPC64 .toc .
+      // See the comment in maybeReportUndefined for PPC32 .got2 and PPC64 .toc
       auto *d = dyn_cast<Defined>(&sym);
       if (!d) {
         if (!isDebugSection(*sec) && sec->name != ".eh_frame" &&
-            sec->name != ".gcc_except_table" && sec->name != ".toc") {
+            sec->name != ".gcc_except_table" && sec->name != ".got2" &&
+            sec->name != ".toc") {
           uint32_t secIdx = cast<Undefined>(sym).discardedSecIdx;
           Elf_Shdr_Impl<ELFT> sec =
               CHECK(file->getObj().sections(), file)[secIdx];
