Quelles sections sont requises pour un exécutable ELF utilisable?
-
26-09-2019 - |
Question
Je crée un fichier exécutable ELF et j'ai besoin de savoir quelles sections sont requises par le système d'exploitation afin de le charger et de l'exécuter.
Détails:
OS: Ubuntu 10.04 (64-bit) Kernel version: 2.6.32-24 Architecture: i386
Je me rends compte que ce qui suit serait probablement nécessaire:
- .texte
- .Symtab
- .rel.Text
Y en a-t-il d'autres?
La solution
"A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux " has information on how to (ab)use the various ELF sections to make an executable as small as possible. It also contains a link to the ELF specification if you need more information. (It's also a fairly entertaining read.) Maybe it will tell you what you need to know?
Autres conseils
I decided to try systematically stripping sections from an ELF file generated by GCC.
I was able to remove many of the sections, but these could not be removed and have the executable still execute without a segmentation fault:
.dynsym .dynstr .gnu.version_r .rel.plt .init .plt .text .fini .ctors .dtors .dynamic .got.plt .data .strtab