[ELF] - Do not crash when object has multiple SHT_MIPS_OPTIONS
Issue was revealed by AFl and I was able to generate such object using yaml2obj.
When object has more than one SHT_MIPS_OPTIONS, 
each except the last one is destroyed after placing into Sections array.
Sections array contains dead pointers finally. LLD may crash then.
Differential revision: https://reviews.llvm.org/D25555
llvm-svn: 284227
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 269d060..3aafdbb 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -324,6 +324,9 @@
     MipsReginfo.reset(new MipsReginfoInputSection<ELFT>(this, &Sec, Name));
     return MipsReginfo.get();
   case SHT_MIPS_OPTIONS:
+    if (MipsOptions)
+      fatal(getFilename(this) +
+            ": multiple SHT_MIPS_OPTIONS sections are not allowed");
     MipsOptions.reset(new MipsOptionsInputSection<ELFT>(this, &Sec, Name));
     return MipsOptions.get();
   case SHT_MIPS_ABIFLAGS: