Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: src/IceELFObjectWriter.cpp

Issue 1386593004: Subzero: Fix nondeterministic behavior in constant pool creation. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Update comment Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/IceFixups.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// \file 10 /// \file
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 RandomShuffle(Pool.begin(), Pool.end(), 519 RandomShuffle(Pool.begin(), Pool.end(),
520 [&RNG](uint64_t N) { return (uint32_t)RNG.next(N); }); 520 [&RNG](uint64_t N) { return (uint32_t)RNG.next(N); });
521 } 521 }
522 // Write the data. 522 // Write the data.
523 for (Constant *C : Pool) { 523 for (Constant *C : Pool) {
524 if (!C->getShouldBePooled()) 524 if (!C->getShouldBePooled())
525 continue; 525 continue;
526 auto Const = llvm::cast<ConstType>(C); 526 auto Const = llvm::cast<ConstType>(C);
527 std::string SymBuffer; 527 std::string SymBuffer;
528 llvm::raw_string_ostream SymStrBuf(SymBuffer); 528 llvm::raw_string_ostream SymStrBuf(SymBuffer);
529 Const->emitPoolLabel(SymStrBuf); 529 Const->emitPoolLabel(SymStrBuf, &Ctx);
530 std::string &SymName = SymStrBuf.str(); 530 std::string &SymName = SymStrBuf.str();
531 SymTab->createDefinedSym(SymName, STT_NOTYPE, STB_LOCAL, Section, 531 SymTab->createDefinedSym(SymName, STT_NOTYPE, STB_LOCAL, Section,
532 OffsetInSection, SymbolSize); 532 OffsetInSection, SymbolSize);
533 StrTab->add(SymName); 533 StrTab->add(SymName);
534 typename ConstType::PrimType Value = Const->getValue(); 534 typename ConstType::PrimType Value = Const->getValue();
535 memcpy(Buf, &Value, WriteAmt); 535 memcpy(Buf, &Value, WriteAmt);
536 Str.writeBytes(llvm::StringRef(Buf, WriteAmt)); 536 Str.writeBytes(llvm::StringRef(Buf, WriteAmt));
537 OffsetInSection += WriteAmt; 537 OffsetInSection += WriteAmt;
538 } 538 }
539 Section->setSize(OffsetInSection); 539 Section->setSize(OffsetInSection);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 if (ELF64) { 669 if (ELF64) {
670 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), 670 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(),
671 AllSections.size()); 671 AllSections.size());
672 } else { 672 } else {
673 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), 673 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(),
674 AllSections.size()); 674 AllSections.size());
675 } 675 }
676 } 676 }
677 677
678 } // end of namespace Ice 678 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | src/IceFixups.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698