The elf-edit library provides a datatype suitable for reading and writing Elf files.
It is a fork of the original elf package on Hackage, but enables modifying and serializing Elf files. These changes are not backwards compatible and hence we have a new name.
To build with Stack, first symlink to one of the provided YAML files. For example
ln -fs stack-8.6.yaml stack.yaml stack build