summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2013-05-30Redesign data structures, make basic reladd work.newparsernorly
The memory ELF model is now a tree structure: ELF +--> PHDRs +--> PHDR +--> Section | | +--> Section | | ... | | \--> Section | | | +--> PHDR +--> Section | | ... | ... | \--> Orphaned sections +--> Section ... \--> Section This effectively introduces semantics into the binary blob we are editing, and allows us to re-layout its contents much more easily while keeping as close as possible to what is assumed to be the original semantics. As a side-effect, a first meta-function had to be introduced (elfu_mScnForall) in order to traverse all leaves of the tree. Much old code has been removed given the leaner environment available now, and automated insertion of .text and .data sections from object files into executables now works. However nothing else is inserted (such as string tables or .bss) and no relocation takes place yet.
2013-05-28Implement orphaned sectionsnorly
Orphaned sections are not (fully) included in any LOAD PHDR and can thus be moved and stripped at will without changing the memory image of the program.
2013-05-28Remove old and ugly printing functionsnorly
2013-05-28Add printing functions for models to ease debuggingnorly
2013-05-27Find PHDR -> PHDR dependenciesnorly
2013-05-27Only establish PHDR->Scn relationship for PT_LOADnorly
2013-05-27Restrict sh_link/sh_info evaluation where possiblenorly
2013-05-27Abstract model more - break 'make check'norly
Sections are now sorted by file offset and sh_link dependencies between them as well as PHDR-SHDR dependencies are deduced as much as possible. The downside is that while the output should still work just fine, 'make check' fails to establish binary equivalence of input and output if the section table is reordered. Thankfully, in normal GCC binaries it is already ordered so we don't have to worry about this. Unfortunately the ELF spec is very lax in this regard so we have to draw a line ourselves.
2013-05-27Turn elfu_gPhdrContainsScn into a macronorly
2013-05-27Turn elfu_gScnSizeFile into a macronorly
2013-05-27Clean up loader codenorly
2013-05-27Validate input at libelf levelnorly
This way we can just assume that stuff works later on and keep the code clean and simple. It especially establishes that the file has a sane format and is thus understandable and editable.
2013-05-25Be more verbosenorly
2013-05-25Fix alignment error in mInsertSpaceBeforenorly
2013-05-24Object file injection, first partnorly
2013-05-24Move section-in-segment.c to generic/norly
2013-05-24Cleaner error handling with ELFU_WARN and ELFU_WARNELFnorly
2013-05-24Use explicit libelf/* path in includesnorly
2013-03-24Typosnorly
2013-03-22Clean up file handling in main.c a bitnorly
2013-03-21NOBITS expansion, for .bss etcnorly
GNU binutils' readelf gets confused with symbol versions. More analysis needed on that.
2013-03-21Copy section contents into newly allocated buffersnorly
2013-03-20Typonorly
2013-03-01Implement mInsertAfter, for post-.data injectionnorly
2013-02-27Implement mInsertBefore, for pre-.interp injectionnorly
2013-02-24Add simple 'make check'norly
Uses elfedit to copy itself and ensure both versions are identical.
2013-02-23Refactor mdoel-related codenorly
2013-02-23Clean up ELF-related files and functionsnorly
2013-02-23Merge {first,last}-section-in-segment.cnorly
2013-02-23Move headers for ELF-based operations togethernorly
2013-02-23Move ELF-related files togethernorly
2013-02-23Remove ELFU_BOOLnorly
2013-02-23Add run-time sanity checksnorly
2013-02-22Use CIRCLEQ_FOREACH throughoutnorly
2013-02-22Add elfu_count{Section,PHDR}snorly
2013-02-22Remove --copy, do it whenever we have -onorly
2013-02-21Fix build on Ubuntu 12.04norly
Thanks to Cristian Cadar.
2013-02-11PHDR self-reference fixup functionmodel-cleanupnorly
2013-02-11Makefile: debug option - attach to running instancenorly
2013-02-11Model to ELF (writing) support, copy functionalitynorly
2013-02-11First memory model of an ELF filenorly
2013-02-11Print ELF header/segments/sectionsnorly
2013-01-25Add .gitignorenorly
2013-01-25Initial commitnorly