diff lib/Object/RecordStreamer.cpp @ 120:1172e4bd9c6f

update 4.0.0
author mir3636
date Fri, 25 Nov 2016 19:14:25 +0900
parents afa8332a0e37
children 803732b1fca8
line wrap: on
line diff
--- a/lib/Object/RecordStreamer.cpp	Tue Jan 26 22:56:36 2016 +0900
+++ b/lib/Object/RecordStreamer.cpp	Fri Nov 25 19:14:25 2016 +0900
@@ -23,21 +23,29 @@
   case Used:
     S = Defined;
     break;
+  case DefinedWeak:
+    break;
+  case UndefinedWeak:
+    S = DefinedWeak;
   }
 }
 
-void RecordStreamer::markGlobal(const MCSymbol &Symbol) {
+void RecordStreamer::markGlobal(const MCSymbol &Symbol,
+                                MCSymbolAttr Attribute) {
   State &S = Symbols[Symbol.getName()];
   switch (S) {
   case DefinedGlobal:
   case Defined:
-    S = DefinedGlobal;
+    S = (Attribute == MCSA_Weak) ? DefinedWeak : DefinedGlobal;
     break;
 
   case NeverSeen:
   case Global:
   case Used:
-    S = Global;
+    S = (Attribute == MCSA_Weak) ? UndefinedWeak : Global;
+    break;
+  case UndefinedWeak:
+  case DefinedWeak:
     break;
   }
 }
@@ -48,6 +56,8 @@
   case DefinedGlobal:
   case Defined:
   case Global:
+  case DefinedWeak:
+  case UndefinedWeak:
     break;
 
   case NeverSeen:
@@ -84,8 +94,10 @@
 
 bool RecordStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
                                          MCSymbolAttr Attribute) {
-  if (Attribute == MCSA_Global)
-    markGlobal(*Symbol);
+  if (Attribute == MCSA_Global || Attribute == MCSA_Weak)
+    markGlobal(*Symbol, Attribute);
+  if (Attribute == MCSA_LazyReference)
+    markUsed(*Symbol);
   return true;
 }