Mercurial > hg > Members > tobaru > cbc > CbC_llvm
comparison 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 |
comparison
equal
deleted
inserted
replaced
101:34baf5011add | 120:1172e4bd9c6f |
---|---|
21 case NeverSeen: | 21 case NeverSeen: |
22 case Defined: | 22 case Defined: |
23 case Used: | 23 case Used: |
24 S = Defined; | 24 S = Defined; |
25 break; | 25 break; |
26 case DefinedWeak: | |
27 break; | |
28 case UndefinedWeak: | |
29 S = DefinedWeak; | |
26 } | 30 } |
27 } | 31 } |
28 | 32 |
29 void RecordStreamer::markGlobal(const MCSymbol &Symbol) { | 33 void RecordStreamer::markGlobal(const MCSymbol &Symbol, |
34 MCSymbolAttr Attribute) { | |
30 State &S = Symbols[Symbol.getName()]; | 35 State &S = Symbols[Symbol.getName()]; |
31 switch (S) { | 36 switch (S) { |
32 case DefinedGlobal: | 37 case DefinedGlobal: |
33 case Defined: | 38 case Defined: |
34 S = DefinedGlobal; | 39 S = (Attribute == MCSA_Weak) ? DefinedWeak : DefinedGlobal; |
35 break; | 40 break; |
36 | 41 |
37 case NeverSeen: | 42 case NeverSeen: |
38 case Global: | 43 case Global: |
39 case Used: | 44 case Used: |
40 S = Global; | 45 S = (Attribute == MCSA_Weak) ? UndefinedWeak : Global; |
46 break; | |
47 case UndefinedWeak: | |
48 case DefinedWeak: | |
41 break; | 49 break; |
42 } | 50 } |
43 } | 51 } |
44 | 52 |
45 void RecordStreamer::markUsed(const MCSymbol &Symbol) { | 53 void RecordStreamer::markUsed(const MCSymbol &Symbol) { |
46 State &S = Symbols[Symbol.getName()]; | 54 State &S = Symbols[Symbol.getName()]; |
47 switch (S) { | 55 switch (S) { |
48 case DefinedGlobal: | 56 case DefinedGlobal: |
49 case Defined: | 57 case Defined: |
50 case Global: | 58 case Global: |
59 case DefinedWeak: | |
60 case UndefinedWeak: | |
51 break; | 61 break; |
52 | 62 |
53 case NeverSeen: | 63 case NeverSeen: |
54 case Used: | 64 case Used: |
55 S = Used; | 65 S = Used; |
82 MCStreamer::EmitAssignment(Symbol, Value); | 92 MCStreamer::EmitAssignment(Symbol, Value); |
83 } | 93 } |
84 | 94 |
85 bool RecordStreamer::EmitSymbolAttribute(MCSymbol *Symbol, | 95 bool RecordStreamer::EmitSymbolAttribute(MCSymbol *Symbol, |
86 MCSymbolAttr Attribute) { | 96 MCSymbolAttr Attribute) { |
87 if (Attribute == MCSA_Global) | 97 if (Attribute == MCSA_Global || Attribute == MCSA_Weak) |
88 markGlobal(*Symbol); | 98 markGlobal(*Symbol, Attribute); |
99 if (Attribute == MCSA_LazyReference) | |
100 markUsed(*Symbol); | |
89 return true; | 101 return true; |
90 } | 102 } |
91 | 103 |
92 void RecordStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, | 104 void RecordStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, |
93 uint64_t Size, unsigned ByteAlignment) { | 105 uint64_t Size, unsigned ByteAlignment) { |