⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme

📁 ELFkickers是一组elf工具
💻
字号:
elftoc reads an ELF file and outputs the file as C code. That is, theprogram generates the C source for an initialization of a structurethat should have the same memory image as the original ELF file.The various parts of the file are mapped to fields of a structurewhich is defined at the top of the output. The contents of the programproper, namely the text and data segments, translate into mere arraysof bytes (elftoc is not a disassembler), but the ELF-specificstructures are decoded as much as possible. The program tries toreplace hardcoded numbers with preprocessor symbols and compile-timecalculations based on sizeof and offsetof(). Section indices andmemory addresses are identified and given symbolic names.If the program is successful, one should be able to append thefollowing to the output:  #include <unistd.h>  int main(void) { return write(1, &foo, sizeof foo); }to produce a valid C program that will output a copy of the originalfile.If the output is not identical to the original, it is typically due toproblems with structure padding and alignment. The most common causeis when the file as a whole is not an even multiple of 4 bytes insize. The C structure, using gcc with the 32-bit Intel architecture,will have one to three bytes of padding at the end to align its size.In this situation, elftoc inserts an extra field, called _end, to makethis padding explicitly visible. Thus one could append the followingcode instead:  #include <unistd.h>  int main(void) { return write(1, &foo, offsetof(elf, _out)); }and still get an exact replica (although the presence of padding atthe end of a file should not cause an ELF file to work any differentlythan before).A more problematic situation is when a field that is itself an arrayof structures is not aligned on a 4-byte boundary. The varioussubstructures of an ELF file are supposed to be aligned within thefile. But if any such structures aren't, then the C code will not bean exact replica of the original file, and the output of such code mayor may not operate correctly. elftoc will issue a warning in thissituation. (The program could still produce valid output in this caseby representing the misaligned section in the structure as a simplebyte array. However, the whole purpose of elftoc is to expose the ELFstructures within it, so it seems better to proceed and hope for thebest.)elftoc will also issue warnings if the file appears to be corrupt, orappears to be created for a completely different architecture.However, unless the file lacks the ELF magic-number signature, orcontains seriously pathological information, elftoc will alwaysattempt to produce valid output.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -