OLD | NEW |
1 //===- subzero/src/IceELFObjectWriter.cpp - ELF object file writer --------===// | 1 //===- subzero/src/IceELFObjectWriter.cpp - ELF object file writer --------===// |
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 // This file defines the writer for ELF relocatable object files. | 10 // This file defines the writer for ELF relocatable object files. |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // The symbol table entry doesn't need to know the defined symbol's | 318 // The symbol table entry doesn't need to know the defined symbol's |
319 // size since this is in a section with a fixed Entry Size. | 319 // size since this is in a section with a fixed Entry Size. |
320 const SizeT SymbolSize = 0; | 320 const SizeT SymbolSize = 0; |
321 Section->setFileOffset(alignFileOffset(Align)); | 321 Section->setFileOffset(alignFileOffset(Align)); |
322 | 322 |
323 // Write the data. | 323 // Write the data. |
324 for (Constant *C : Pool) { | 324 for (Constant *C : Pool) { |
325 auto Const = llvm::cast<ConstType>(C); | 325 auto Const = llvm::cast<ConstType>(C); |
326 std::string SymBuffer; | 326 std::string SymBuffer; |
327 llvm::raw_string_ostream SymStrBuf(SymBuffer); | 327 llvm::raw_string_ostream SymStrBuf(SymBuffer); |
328 SymStrBuf << ".L$" << Ty << "$" << Const->getPoolEntryID(); | 328 Const->emitPoolLabel(SymStrBuf); |
329 std::string &SymName = SymStrBuf.str(); | 329 std::string &SymName = SymStrBuf.str(); |
330 SymTab->createDefinedSym(SymName, STT_NOTYPE, STB_LOCAL, Section, | 330 SymTab->createDefinedSym(SymName, STT_NOTYPE, STB_LOCAL, Section, |
331 OffsetInSection, SymbolSize); | 331 OffsetInSection, SymbolSize); |
332 StrTab->add(SymName); | 332 StrTab->add(SymName); |
333 typename ConstType::PrimType Value = Const->getValue(); | 333 typename ConstType::PrimType Value = Const->getValue(); |
334 memcpy(Buf, &Value, WriteAmt); | 334 memcpy(Buf, &Value, WriteAmt); |
335 Str.writeBytes(llvm::StringRef(Buf, WriteAmt)); | 335 Str.writeBytes(llvm::StringRef(Buf, WriteAmt)); |
336 OffsetInSection += WriteAmt; | 336 OffsetInSection += WriteAmt; |
337 } | 337 } |
338 Section->setSize(OffsetInSection); | 338 Section->setSize(OffsetInSection); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 if (IsELF64) { | 394 if (IsELF64) { |
395 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), | 395 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), |
396 AllSections.size()); | 396 AllSections.size()); |
397 } else { | 397 } else { |
398 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), | 398 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), |
399 AllSections.size()); | 399 AllSections.size()); |
400 } | 400 } |
401 } | 401 } |
402 | 402 |
403 } // end of namespace Ice | 403 } // end of namespace Ice |
OLD | NEW |