__attribute__((section(".text._init_relro"))) int init_relro(int argc, char** argv, char** env) { do_relocations_with_relro(); original_init(argc, argv, env); return 0; }
__attribute__((section(".text._init"))) int init(int argc, char** argv, char** env) { do_relocations(); original_init(argc, argv, env); // Ensure there is no tail-call optimization, avoiding the use of the // B.W instruction in Thumb for the call above. return 0; }
int init_relro(int argc, char **argv, char **env) { relro_pre(); do_relocations(); relro_post(); original_init(argc, argv, env); return 0; }
void init(int argc, char **argv, char **env) { Elf32_Rel *rel; Elf_Addr *ptr, *start; for (rel = relhack; rel->r_offset; rel++) { start = (Elf_Addr *)((intptr_t)&elf_header + rel->r_offset); for (ptr = start; ptr < &start[rel->r_info]; ptr++) *ptr += (intptr_t)&elf_header; } #ifndef NOINIT original_init(argc, argv, env); #endif }