[ELF] Don't add input sections twice when linker script is used

llvm-svn: 279036
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 922c7da..35a1a61 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -284,7 +284,8 @@
       if (IsNew)
         OutputSections->push_back(OutSec);
       for (InputSectionBase<ELFT> *Sec : V)
-        OutSec->addSection(Sec);
+        if (!Sec->OutSec)
+          OutSec->addSection(Sec);
     }
   }