this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add __TEXT,__elfname section into wrapgen-generated Mach-O files

+6 -2
+6 -2
src/startup/wrapgen/wrapgen.cpp
··· 239 239 void generate_wrapper(std::ofstream& output, const char* soname, const std::set<std::string>& symbols) 240 240 { 241 241 output << "#include <elfcalls.h>\n" 242 - "extern struct elf_calls* _elfcalls;\n\n"; 242 + "extern struct elf_calls* _elfcalls;\n\n" 243 + "extern const char __elfname[];\n\n"; 243 244 244 245 output << "static void* lib_handle;\n" 245 246 "__attribute__((constructor)) static void initializer() {\n" 246 - "\tlib_handle = _elfcalls->dlopen_fatal(\"" << soname << "\");\n" 247 + "\tlib_handle = _elfcalls->dlopen_fatal(__elfname);\n" 247 248 "}\n\n"; 248 249 249 250 output << "__attribute__((destructor)) static void destructor() {\n" ··· 257 258 "\treturn _elfcalls->dlsym_fatal(lib_handle, \"" << sym << "\");\n" 258 259 "}\n\n"; 259 260 } 261 + output << "asm(\".section __TEXT,__elfname\\n" 262 + ".private_extern ___elfname\\n" 263 + "___elfname: .asciz \\\"" << soname << "\\\"\");\n"; 260 264 } 261 265