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

Unified Diff: src/IceELFObjectWriter.cpp

Issue 1185703004: Add constant blinding/pooling option for X8632 code translation (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Avoid calling randomizationOrPoolImmediate() multiple times on a same operand" Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: src/IceELFObjectWriter.cpp
diff --git a/src/IceELFObjectWriter.cpp b/src/IceELFObjectWriter.cpp
index 9c75482def48ede32edf4d4d097cd5b04e14e768..2f86c8dffe1234d7ca93299bb14a14baa22f1397 100644
--- a/src/IceELFObjectWriter.cpp
+++ b/src/IceELFObjectWriter.cpp
@@ -383,8 +383,9 @@ void ELFObjectWriter::writeDataOfType(SectionType ST,
for (VariableDeclaration::Initializer *Init : Var->getInitializers()) {
switch (Init->getKind()) {
case VariableDeclaration::Initializer::DataInitializerKind: {
- const auto Data = llvm::cast<VariableDeclaration::DataInitializer>(
- Init)->getContents();
+ const auto Data =
+ llvm::cast<VariableDeclaration::DataInitializer>(Init)
+ ->getContents();
Section->appendData(Str, llvm::StringRef(Data.data(), Data.size()));
break;
}
@@ -487,7 +488,8 @@ template <typename ConstType> void ELFObjectWriter::writeConstantPool(Type Ty) {
// between entries.
assert(WriteAmt % Align == 0);
// Check that we write the full PrimType.
- assert(WriteAmt == sizeof(typename ConstType::PrimType));
+ assert(WriteAmt == sizeof(typename ConstType::PrimType) ||
Jim Stichnoth 2015/06/19 16:51:02 I think this assert should be removed. The commen
qining 2015/06/19 20:22:25 Done.
+ WriteAmt == sizeof(short) || WriteAmt == sizeof(char));
const Elf64_Xword ShFlags = SHF_ALLOC | SHF_MERGE;
std::string SecBuffer;
llvm::raw_string_ostream SecStrBuf(SecBuffer);
@@ -503,6 +505,8 @@ template <typename ConstType> void ELFObjectWriter::writeConstantPool(Type Ty) {
// Write the data.
for (Constant *C : Pool) {
+ if (!C->shouldBePooled)
+ continue;
auto Const = llvm::cast<ConstType>(C);
std::string SymBuffer;
llvm::raw_string_ostream SymStrBuf(SymBuffer);
@@ -528,6 +532,8 @@ template void ELFObjectWriter::writeConstantPool<ConstantFloat>(Type Ty);
template void ELFObjectWriter::writeConstantPool<ConstantDouble>(Type Ty);
+template void ELFObjectWriter::writeConstantPool<ConstantInteger32>(Type Ty);
+
void ELFObjectWriter::writeAllRelocationSections() {
writeRelocationSections(RelTextSections);
writeRelocationSections(RelDataSections);

Powered by Google App Engine
This is Rietveld 408576698