diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-23 21:56:39 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-23 21:56:39 +0000 |
commit | 83c3cb14a4a8629df75b509e926e3c06438391d1 (patch) | |
tree | 8426eadd3e93a53532fb54ccfb33d42c840377c1 /courgette/encoded_program.cc | |
parent | 968f98483f3b025fd56b31f5942c91271b464e03 (diff) | |
download | chromium_src-83c3cb14a4a8629df75b509e926e3c06438391d1.zip chromium_src-83c3cb14a4a8629df75b509e926e3c06438391d1.tar.gz chromium_src-83c3cb14a4a8629df75b509e926e3c06438391d1.tar.bz2 |
Revert 224789 "Add PE64 support to courgette"
Caused failures: http://build.chromium.org/p/chromium.win/builders/Win7%20Tests%20%28dbg%29%281%29/builds/23037/steps/courgette_unittests/logs/stdio
> Add PE64 support to courgette
>
> Add tests for PE64
>
> BUG=38784
>
> Review URL: https://chromiumcodereview.appspot.com/23600063
TBR=wfh@chromium.org
Review URL: https://codereview.chromium.org/23591065
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224806 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/encoded_program.cc')
-rw-r--r-- | courgette/encoded_program.cc | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/courgette/encoded_program.cc b/courgette/encoded_program.cc index 8d45d72..c619c6a 100644 --- a/courgette/encoded_program.cc +++ b/courgette/encoded_program.cc @@ -248,10 +248,8 @@ CheckBool EncodedProgram::AddRel32ARM(uint16 op, int label_index) { rel32_ix_.push_back(label_index); } -CheckBool EncodedProgram::AddPeMakeRelocs(ExecutableType kind) { - if (kind == EXE_WIN_32_X86) - return ops_.push_back(MAKE_PE_RELOCATION_TABLE); - return ops_.push_back(MAKE_PE64_RELOCATION_TABLE); +CheckBool EncodedProgram::AddPeMakeRelocs() { + return ops_.push_back(MAKE_PE_RELOCATION_TABLE); } CheckBool EncodedProgram::AddElfMakeRelocs() { @@ -530,7 +528,6 @@ CheckBool EncodedProgram::AssembleTo(SinkStream* final_buffer) { RVA current_rva = 0; bool pending_pe_relocation_table = false; - uint8 pending_pe_relocation_table_type = 0x03; // IMAGE_REL_BASED_HIGHLOW Elf32_Word pending_elf_relocation_table_type = 0; SinkStream bytes_following_relocation_table; @@ -616,8 +613,9 @@ CheckBool EncodedProgram::AssembleTo(SinkStream* final_buffer) { // We can see the base relocation anywhere, but we only have the // information to generate it at the very end. So we divert the bytes // we are generating to a temporary stream. - if (pending_pe_relocation_table) - return false; // Can't have two base relocation tables. + if (pending_pe_relocation_table) // Can't have two base relocation + // tables. + return false; pending_pe_relocation_table = true; output = &bytes_following_relocation_table; @@ -632,22 +630,13 @@ CheckBool EncodedProgram::AssembleTo(SinkStream* final_buffer) { // emitting an ORIGIN after the MAKE_BASE_RELOCATION_TABLE. } - case MAKE_PE64_RELOCATION_TABLE: { - if (pending_pe_relocation_table) - return false; // Can't have two base relocation tables. - - pending_pe_relocation_table = true; - pending_pe_relocation_table_type = 0x0A; // IMAGE_REL_BASED_DIR64 - output = &bytes_following_relocation_table; - break; - } - case MAKE_ELF_ARM_RELOCATION_TABLE: { // We can see the base relocation anywhere, but we only have the // information to generate it at the very end. So we divert the bytes // we are generating to a temporary stream. - if (pending_elf_relocation_table_type) - return false; // Can't have two base relocation tables. + if (pending_elf_relocation_table_type) // Can't have two relocation + // tables. + return false; pending_elf_relocation_table_type = R_ARM_RELATIVE; output = &bytes_following_relocation_table; @@ -658,8 +647,9 @@ CheckBool EncodedProgram::AssembleTo(SinkStream* final_buffer) { // We can see the base relocation anywhere, but we only have the // information to generate it at the very end. So we divert the bytes // we are generating to a temporary stream. - if (pending_elf_relocation_table_type) - return false; // Can't have two base relocation tables. + if (pending_elf_relocation_table_type) // Can't have two relocation + // tables. + return false; pending_elf_relocation_table_type = R_386_RELATIVE; output = &bytes_following_relocation_table; @@ -669,8 +659,7 @@ CheckBool EncodedProgram::AssembleTo(SinkStream* final_buffer) { } if (pending_pe_relocation_table) { - if (!GeneratePeRelocations(final_buffer, - pending_pe_relocation_table_type) || + if (!GeneratePeRelocations(final_buffer) || !final_buffer->Append(&bytes_following_relocation_table)) return false; } @@ -732,8 +721,7 @@ class RelocBlock { RelocBlockPOD pod; }; -CheckBool EncodedProgram::GeneratePeRelocations(SinkStream* buffer, - uint8 type) { +CheckBool EncodedProgram::GeneratePeRelocations(SinkStream* buffer) { std::sort(abs32_relocs_.begin(), abs32_relocs_.end()); RelocBlock block; @@ -747,7 +735,7 @@ CheckBool EncodedProgram::GeneratePeRelocations(SinkStream* buffer, block.pod.page_rva = page_rva; } if (ok) - block.Add(((static_cast<uint16>(type)) << 12 ) | (rva & 0xFFF)); + block.Add(0x3000 | (rva & 0xFFF)); } ok &= block.Flush(buffer); return ok; |