Displaying 2 results from an estimated 2 matches for "layoutsections".
2020 Aug 13
2
Adding sections in a binary
...ting address ranges: this is very difficult
due to many implicit inter-section references. If you have an advanced
binary rewriting tool, this is still doable, but definitely brittle.
File offsets (p_offset,sh_offset) can be reconstructed from addresses.
llvm-objcopy/ELF/Object.cpp layoutSections has some code.
A more sophisticated implementation is in the linker: lld/ELF/Writer.cpp assignFileOffsets
2020 Aug 13
2
Adding sections in a binary
Hey,
LLVM has logic to parse ELF and PE binaries using
`llvm::object::createBinary`. I tried to search in the codebase to see if
there's a possibility to add/remove sections after parsing a binary and
re-write the binary to another location. Basically, like what llvm-objcopy
does. Can you point me to the right classes to look into, if this is
something that LLVM has?
Many thanks
Joseph