I have static linked binary (ELF file) it doesn't have dynamic segment, .dymsym sections and it doesn't perform LD_PRELOAD command and etc. How could i create fake dummy dynamic segment to activate dynamic loader and perform LD_PRELOAD command?
Asked
Active
Viewed 2,866 times
7
-
1Possible duplicate of [Convert a statically linked elf binary to dynamically linked](http://stackoverflow.com/questions/13976680/convert-a-statically-linked-elf-binary-to-dynamically-linked) – pah Aug 03 '16 at 15:54
-
Uhh I've read this question and your previous question, could you please post some code of yours and explain to me what are you trying to do? – DrPrItay Aug 04 '16 at 18:43
1 Answers
7
How could i create fake dummy dynamic segment to activate dynamic loader and perform LD_PRELOAD command?
You can't.
Even if you could, getting LD_PRELOAD
to preload something would still be useless: usually you want to interpose some symbols in your LD_PRELOAD
ed library, but that requires these symbols to be unresolved in the main binary, or at least exported in its dynamic symbol table. A statically linked executable doesn't have any unresolved symbols, nor a dynamic symbol table by definition.

Employed Russian
- 199,314
- 34
- 295
- 362
-
1Interposition is not the only reason to use LD_PRELOAD - the preloaded dll can create threads that perform various tasks (monitoring, profiling or others). I was unpleasantly surprised to discover this isn't possible for statically linked elfs. – Ofek Shilon Aug 24 '23 at 13:11