summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2013-06-24Remove assertion that breaks with Red Hat's libelfmorephdrnorly
2013-06-24PHDR addition. Should make x86-64 work in many cases.norly
2013-06-24mLayoutAuto: Do not move LOAD segments, and update PHDR PHDRnorly
2013-06-24Reorder PHDRs according to ELF specnorly
2013-06-24mLayoutGetSpaceInPhdr: Use mPhdrLoadLowestHighestnorly
2013-06-24PHDR: Find lowest/highest addr/offsnorly
2013-06-22reladd: Work more with sh_addr instead of sh_offsetnorly
2013-06-22Minor fixes to PHDR expansion to lower addressesnorly
2013-06-22PHDR: find by addr/offsetnorly
2013-06-21Use .rela.plt too - need this for x86-64c90norly
2013-06-21mFromFile: Initialize *menorly
2013-06-21Minor cleanup in reladd, 2nd passnorly
2013-06-21Merge cloneScn() into reladd.cnorly
It's the only place where we use it, and it's case-specific
2013-06-21LOAD PHDRs at top level, others as children. mPhdrForall().norly
The reference binaries had to be updated as PHDRs are now reordered.
2013-06-20Add Elf/Phdr/Scn alloc/destroynorly
2013-06-20Extend relocation parser to full 32/64 bitsnorly
2013-06-20Cleaner ElfuPhdr allocnorly
2013-06-20Clean up code using ElfuScnnorly
2013-06-20Separate library code, build .a/.sonorly
2013-06-18Basic detour supportnorly
2013-06-17C90 compliance, except variadic macros and TODOsnorly
Also removed a lot of dead code from the early days.
2013-06-16mv main.c -> elfucli.c, make it scriptable via argssymrelnorly
2013-06-16Clean up main.c a bitnorly
2013-06-15Factor out symbol table handlingnorly
2013-06-15Rename mRelocatenorly
2013-06-15Basic x86-64 support, not very usable in practicenorly
Turns out that x86-64 aligns LOAD segments to 0x200000 bytes. Given that the mapping starts at 0x400000, there is not much room to expand... so there will be a need to add additional LOAD headers.
2013-06-15Merge symbol tables. (Not fully ELF conformant)norly
Also, remove that nameptr member from symbols. It just *had* to cause trouble. Symbols are simply appended to the target's symbol table, which means that LOCAL symbols are not inserted at the beginning and we are thus ignoring an ELF spec. Might change that in the future, it's good enough for now and it's sure not to break anything with the old symbols. The code currently assumes that the target *has* a symbol table. We'll have to fix that, and also remove undefined and duplicate symbols.
2013-06-15Flatten symtab to file - gdb works, check breaks.norly
2013-06-15Make symtab and reltab resident in ElfuScnnorly
2013-06-12Rename elfedit to centaur, model to modelopsnorly
2013-06-03Do not insert STRTAB sections explicitlynorly
2013-06-03Insert NOBITS sections (.bss), ignore empty sectionsnorly
2013-06-03Guess where unknown functions are in .rel.pltnorly
2013-06-03Disable memory dump to screennorly
2013-06-03Basic 32-bit SYMTAB and REL (not RELA) supportnorly
2013-06-03Simplify includesnorly
2013-06-01Insert section names (with fixed prefix)norly
Ideally, the filename of the original .o file being inserted would be used as a prefix for the sections copied over. However for now that prefix is simply "reladd".
2013-05-31Auto-layout file after --reladdnorly
2013-05-31Pull out existing re-layouting codenorly
2013-05-30More rigorous sh_addr and sh_offset checkingnorly
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