Skip to content
Snippets Groups Projects
Commit fd0451c7 authored by Jason Hiser's avatar Jason Hiser :tractor:
Browse files

updated to elide setting address to 0 when applying pcrel reloc. pcrel reloc...

updated to elide setting address to 0 when applying pcrel reloc.  pcrel reloc now ignores virtualOffset field
parent 32f19902
No related branches found
No related tags found
No related merge requests found
......@@ -782,6 +782,9 @@ class FixCalls_t : public TransformStep_t
if(virt_offset == 0 || virt_offset == (uintptr_t)-1)
return;
// do verbosity output
const auto verbose_fix_calls = getenv("VERBOSE_FIX_CALLS") != nullptr;
const auto cur_relocs = insn->getRelocations();
const auto pcrel_reloc_it = find_if(ALLOF(cur_relocs), [](const Relocation_t* r) { return r->getType()=="pcrel"; });
if(pcrel_reloc_it != end(cur_relocs)) return; // already exists.
......@@ -806,7 +809,7 @@ class FixCalls_t : public TransformStep_t
// figure out how to rewrite pcrel arm insns, then change the virt addr
// insn->getAddress()->setVirtualOffset(0);
// for now, we aren't doing this... we may need to for doing xforms.
if(getenv("VERBOSE_FIX_CALLS"))
if(verbose_fix_calls)
cout << "Detected arm32/64 pc-rel operand in " << disasm->getDisassembly() << endl;
}
else if(mt==admtX86_64 || mt==admtI386)
......@@ -861,13 +864,19 @@ class FixCalls_t : public TransformStep_t
data.replace(0, data.length(), cstr, data.length());
insn->setDataBits(data);
other_fixes++;
#if 0
// and it's important to set the VO to 0, so that the pcrel-ness is calculated correctly.
insn->getAddress()->setVirtualOffset(0);
#endif
if(getenv("VERBOSE_FIX_CALLS"))
// log
if(verbose_fix_calls)
cout << " Converted to: " << insn->getDisassembly() << endl;
// and it's important to set the VO to 0, so that the pcrel-ness is calculated correctly.
insn->getAddress()->setVirtualOffset(0);
// keep up with stats.
other_fixes++;
}
else
throw std::invalid_argument("Unknown architecture in fix_other_pcrel");
......
......@@ -76,7 +76,7 @@ DominatorGraph_t::DominatorGraph_t(const ControlFlowGraph_t* p_cfg, bool needs_p
/*
algorithm from advanced compiler design & impelmentation, Mucnick, 2nd edition page 18
algorithm from advanced compiler design & impelmentation, Mucnick, 2nd edition page 186
procedure Dom_Comp(N,Pred,r) returns Node-> set of Node
N: in set of Node
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment