question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Alternate implementation of R_PPC_JMP_SLOT for older ABI

See original GitHub issue

Older PPC ABIs need their relocations, specifically R_PPC_JMP_SLOT implemented differently. The change to the current ABI, which we support well, is described here. You can detect the presence of the new ABI by the presence of the DT_PPC_GOT dynamic section tag, as indicated here. We can detect this right now (commit incoming), but the affect we need to implement based on this relocation in the old case is highly nontrivial, you can find a reference implementation in the ppc_fixup_plt function in the last link. It involves actually writing code into the PLT.

One cookie will be awarded to whoever implements this in CLE.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
fmagincommented, Jul 21, 2019

To celebrate the one year anniversary of this issue, here is the expression to hook when using ghidra for symbols:

[ proj.hook(f.symbol.address.unsignedOffset, angr.SIM_PROCEDURES['libc'][f.name]()) for f in currentProgram.functionManager.getFunctions(True) if f.thunk and not f.name.startswith("__")]

The lingering thought that I could at least do this with CLE instead of some external tool will now distract me from what I actually want to do.

1reaction
fmagincommented, Jul 21, 2018

Super dumb workaround if you just want to get SimProcs working is to just hook the symbol address directly instead of inserting the code that would jump the address that is already hooked by CLE. Ugly code I used with binary ninja:

for sym in [ sym[1] for sym in bv.symbols.iteritems() if 'GOT' in sym[0] and "__" not in sym[0]]:
    simproc = angr.SIM_PROCEDURES['libc'][sym.name[:-4]]
    proj.hook(sym.address, hook=simproc())
Read more comments on GitHub >

github_iconTop Results From Across the Web

Dual ABI - GCC, the GNU Compiler Collection
Using the default configuration options for GCC the default value of the macro is 1 which causes the new ABI to be active,...
Read more >
c++ - What is a good way of handling ABI-differences between ...
The problem: Many c++11 features require the new libc++ implementation of the C++ standard library. But libc++ is not ABI-compatible with the old...
Read more >
GCC5 and the C++11 ABI - Red Hat Developer
So to allow the new ABI to coexist with the old ABI, a library such as libstdc++ needs to ensure that all the...
Read more >
“libc++” C++ Standard Library - LLVM releases
libc++ is a new implementation of the C++ standard library, targeting C++11 and above. ... Breaking ABI compatibility with old versions of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found