[llvm-dev] Modifying objects with MC

Simon Cook via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 25 02:30:26 PDT 2015


Hi,

I've been trying to write a tool that reads in an ELF file and modifies
one section within that ELF file based on the data contained within
another section. Using llvm-objdump as a template of how to read an
object file, I've been able to read the latter section that tells me
what to edit, but I haven't found a way to edit the former, as
everything in the MCSection/ELFObjectFile/SectionRef classes seem to be
read-only as far as section contents are concerned.

The changes I would want to make don't change the size of any section,
all I need to do is for example zero the first n bytes of .text whilst
keeping the rest of the object the same. What would be the recommended
approach to achieving this goal?

Thanks,
Simon


More information about the llvm-dev mailing list