Canonicalize the type of .eh_frame.
GNU as can give it type SHT_PROGBITS or SHT_X86_64_UNWIND depending on
teh construct.
MC gives it type SHT_X86_64_UNWIND.
The linker has to canonicalize to one or the other so that there is only
one .eh_frame in the end.
llvm-svn: 252757
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index e01174e..f5f888c 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -489,8 +489,12 @@
       // mapping from input to output.
       auto *IS = dyn_cast<InputSection<ELFT>>(C);
       uintX_t EntSize = IS ? 0 : H->sh_entsize;
+      uint32_t OutType = H->sh_type;
+      if (OutType == SHT_PROGBITS && C->getSectionName() == ".eh_frame" &&
+          Config->EMachine == EM_X86_64)
+        OutType = SHT_X86_64_UNWIND;
       SectionKey<ELFT::Is64Bits> Key{getOutputName(C->getSectionName()),
-                                     H->sh_type, OutFlags, EntSize};
+                                     OutType, OutFlags, EntSize};
       OutputSectionBase<ELFT> *&Sec = Map[Key];
       if (!Sec) {
         if (IS)