llvm-mc/Mach-O: Preliminary support for indirect symbols.
 - The indirect table itself isn't being filled in yet.

 - This isn't factored properly and is rather FIXMEd, but at the moment I'm more
   focused on figuring out what it needs to do.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79910 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp
index 9d60e3e..f49f6e0 100644
--- a/lib/MC/MCMachOStreamer.cpp
+++ b/lib/MC/MCMachOStreamer.cpp
@@ -165,6 +165,16 @@
 
 void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
                                           SymbolAttr Attribute) {
+  // Indirect symbols are handled differently, to match how 'as' handles
+  // them. This makes writing matching .o files easier.
+  if (Attribute == MCStreamer::IndirectSymbol) {
+    IndirectSymbolData ISD;
+    ISD.Symbol = Symbol;
+    ISD.SectionData = CurSectionData;
+    Assembler.getIndirectSymbols().push_back(ISD);
+    return;
+  }
+
   // Adding a symbol attribute always introduces the symbol, note that an
   // important side effect of calling getSymbolData here is to register the
   // symbol with the assembler.
@@ -177,6 +187,7 @@
   // In the future it might be worth trying to make these operations more well
   // defined.
   switch (Attribute) {
+  case MCStreamer::IndirectSymbol:
   case MCStreamer::Hidden:
   case MCStreamer::Internal:
   case MCStreamer::Protected:
@@ -195,10 +206,6 @@
       SD.setFlags(SD.getFlags() | SF_ReferenceTypeUndefinedLazy);
     break;
 
-  case MCStreamer::IndirectSymbol:
-    llvm_unreachable("FIXME: Not yet implemented!");
-    break;
-
     // Since .reference sets the no dead strip bit, it is equivalent to
     // .no_dead_strip in practice.
   case MCStreamer::Reference: