Store whether a symbol is a comdat signature in MCSymbolELF.

With this getBinging can now return the correct answer for all cases not
involving a .symver and the elf writer doesn't need to patch it last minute.

llvm-svn: 238980
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index 6165533..bf9a29a 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -74,7 +74,6 @@
     static uint64_t SymbolValue(const MCSymbol &Sym, const MCAsmLayout &Layout);
     static bool isInSymtab(const MCAsmLayout &Layout, const MCSymbolELF &Symbol,
                            bool Used, bool Renamed);
-    static bool isLocal(const MCSymbolELF &Symbol, bool IsSignature);
 
     /// Helper struct for containing some precomputed information on symbols.
     struct ELFSymbolData {
@@ -755,19 +754,6 @@
   return true;
 }
 
-bool ELFObjectWriter::isLocal(const MCSymbolELF &Symbol, bool IsSignature) {
-  if (Symbol.isExternal())
-    return false;
-
-  if (Symbol.isDefined())
-    return true;
-
-  if (Symbol.isUsedInReloc())
-    return false;
-
-  return IsSignature;
-}
-
 void ELFObjectWriter::computeSymbolTable(
     MCAssembler &Asm, const MCAsmLayout &Layout,
     const SectionIndexMapTy &SectionIndexMap, const RevGroupMapTy &RevGroupMap,
@@ -800,7 +786,7 @@
     const auto &Symbol = cast<MCSymbolELF>(S);
     bool Used = Symbol.isUsedInReloc();
     bool WeakrefUsed = WeakrefUsedInReloc.count(&Symbol);
-    bool isSignature = RevGroupMap.count(&Symbol);
+    bool isSignature = Symbol.isSignature();
 
     if (!isInSymtab(Layout, Symbol, Used || WeakrefUsed || isSignature,
                     Renames.count(&Symbol)))
@@ -809,12 +795,7 @@
     ELFSymbolData MSD;
     MSD.Symbol = cast<MCSymbolELF>(&Symbol);
 
-    // Undefined symbols are global, but this is the first place we
-    // are able to set it.
-    bool Local = isLocal(Symbol, isSignature);
-    if (!Local && Symbol.getBinding() == ELF::STB_LOCAL)
-      Symbol.setBinding(ELF::STB_GLOBAL);
-
+    bool Local = Symbol.getBinding() == ELF::STB_LOCAL;
     if (Symbol.isAbsolute()) {
       MSD.SectionIndex = ELF::SHN_ABS;
     } else if (Symbol.isCommon()) {