OLD | NEW |
1 //===- subzero/src/IceELFSection.cpp - Representation of ELF sections -----===// | 1 //===- subzero/src/IceELFSection.cpp - Representation of ELF sections -----===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 (void)Unique; | 109 (void)Unique; |
110 } | 110 } |
111 | 111 |
112 void ELFSymbolTableSection::noteUndefinedSym(const IceString &Name, | 112 void ELFSymbolTableSection::noteUndefinedSym(const IceString &Name, |
113 ELFSection *NullSection) { | 113 ELFSection *NullSection) { |
114 ELFSym NewSymbol = ELFSym(); | 114 ELFSym NewSymbol = ELFSym(); |
115 NewSymbol.Sym.setBindingAndType(STB_GLOBAL, STT_NOTYPE); | 115 NewSymbol.Sym.setBindingAndType(STB_GLOBAL, STT_NOTYPE); |
116 NewSymbol.Section = NullSection; | 116 NewSymbol.Section = NullSection; |
117 NewSymbol.Number = ELFSym::UnknownNumber; | 117 NewSymbol.Number = ELFSym::UnknownNumber; |
118 bool Unique = GlobalSymbols.insert(std::make_pair(Name, NewSymbol)).second; | 118 bool Unique = GlobalSymbols.insert(std::make_pair(Name, NewSymbol)).second; |
119 assert(Unique); | 119 if (!Unique) { |
| 120 std::string Buffer; |
| 121 llvm::raw_string_ostream StrBuf(Buffer); |
| 122 StrBuf << "Symbol external and defined: " << Name; |
| 123 llvm::report_fatal_error(StrBuf.str()); |
| 124 } |
120 (void)Unique; | 125 (void)Unique; |
121 } | 126 } |
122 | 127 |
123 const ELFSym *ELFSymbolTableSection::findSymbol(const IceString &Name) const { | 128 const ELFSym *ELFSymbolTableSection::findSymbol(const IceString &Name) const { |
124 auto I = LocalSymbols.find(Name); | 129 auto I = LocalSymbols.find(Name); |
125 if (I != LocalSymbols.end()) | 130 if (I != LocalSymbols.end()) |
126 return &I->second; | 131 return &I->second; |
127 I = GlobalSymbols.find(Name); | 132 I = GlobalSymbols.find(Name); |
128 if (I != GlobalSymbols.end()) | 133 if (I != GlobalSymbols.end()) |
129 return &I->second; | 134 return &I->second; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 continue; | 219 continue; |
215 } | 220 } |
216 StringIndex.second = StringData.size(); | 221 StringIndex.second = StringData.size(); |
217 std::copy(Cur.begin(), Cur.end(), back_inserter(StringData)); | 222 std::copy(Cur.begin(), Cur.end(), back_inserter(StringData)); |
218 StringData.push_back(0); | 223 StringData.push_back(0); |
219 Prev = Cur; | 224 Prev = Cur; |
220 } | 225 } |
221 } | 226 } |
222 | 227 |
223 } // end of namespace Ice | 228 } // end of namespace Ice |
OLD | NEW |