Load binaries with a custom function ordering
See original GitHub issueI have compiled a binary with relocation flag enabled ld --emit-relocs
. Now I want to load the binary with a specific function ordering. I mean I want to give the function order as argument to CLE and CLE should load the binary in that order. Does CLE support this functionality? If doesn’t can you give me some pointers which source files should I look up first to implement this feature for X86_64 ELF binaries.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How can I force the order of functions in a binary with the gcc ...
The background is, I have external code which is linked against offsets in this binary. Now if I change the source, all the...
Read more >How do I add functionality to an existing binary executable?
Whenever an application uses a DLL, and you can tell the load order with Dependency Walker or under a debugger, you can pick...
Read more >Loading Binary Files in Python that Were Written Using C ...
With the first character of the format string we specify the byte ordering: we're using < to tell the unpack function that the...
Read more >Azure Functions custom handlers | Microsoft Learn
Custom handlers are lightweight web servers that receive events from the Functions host. Any language that supports HTTP primitives can ...
Read more >Loading binary data to NumPy/Pandas | by Chris Maierle
In this article, I'll show you how to use a combination of built-in functions, the C-API, and Cython to quickly and easily put...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t understand this quesiton. What does it mean for a binary to have its functions in a certain order? Do you mean CLE re-linking the binary with the functions arranged in that order in the address space? From what I can tell that’s the point of the
--emit-relocs
function, but I don’t understand what the use case for this would be.The most serious roadblock to this would be that CLE absolutely does not have the relocations implemented to do anything other than the stuff that usually shows up in dynamically linked executables. You’ll have to implement all the code relocations yourself (cle/backends/elf/relocation). Then you’ll probably want to build a custom backend which subclasses backends.ELF and after super-init returns, chops up and reorders the text section. I don’t know if the relocations from
--emit-relocs
will be automatically processed by CLE’s linking step, so if they aren’t you’ll need to inject those somehow as well.This issue has been closed due to inactivity.