I need to perform objdump
on an ELF to get address and/or sizes of specific functions and variables as well objcopy
to convert it to a different format for operations performed later. Especially with the first part, some of the operations done on the result of objdump
are a bit complex, so I went with creating a small C++ application to perform that. It works, however it currently calls the gcc's objdump
and objdopy
directly including its parameters with a system
call.
There are multiple reasons why I don't like this approach, main one of which being that I either need to rely on user having them on the PC or distribute them with my own executable and treat it as a kind of dynamic library, but in form of executables, which I don't like either.
My question is, is there some form of (gcc?) library that I could (preferably statically) link to perform same operations that way? I'd really rather use something as close do gcc, especially when it comes to compatibility with gcc produced files as input and giving same output, as I already have that kind of version of my own executable working.