News for hackers. Stuff that matters.
Re:On self-modifying executables in Rust by aaaaaaaaaaab on Friday January 28, 2022 @06:14PM (#30121805)
E.g. generating performance-critical DSP code at runtime, depending on the execution environment, e.g. cache-line width. Of course you can pre-generate common variants, but code size will be exponential in the number of parameters.
Re:On self-modifying executables in Rust by ktpsns on Friday January 28, 2022 @06:23PM (#30121882)
Compiling code at runtime is not self-modifying. For instance, in GPGPU programming, the kernels (=code running on GPUs) are usually compiled at runtime. And of course any time of JITs in scripting languages do the same.
Re:On self-modifying executables in Rust by smasher164 on Friday January 28, 2022 @07:04PM (#30122250)
What about rewriting CPU feature-detection code to remove branching?
Re:On self-modifying executables in Rust by dataflow on Friday January 28, 2022 @08:46PM (#30122921)
Yeah, I think this is the answer to OP's question.
Re:On self-modifying executables in Rust by aaaaaaaaaaab on Friday January 28, 2022 @06:29PM (#30121945)
Ok, then consider a lazy-loading dynamic linker that rewrites the thunks when the library is loaded.
Re:On self-modifying executables in Rust by immibis on Friday January 28, 2022 @09:00PM (#30123013)
The linked article is not about self-modifying code, but self-modifying executable files on disk.