@@ -60,10 +60,10 @@ struct rebindings_entry {
6060 struct rebindings_entry * next ;
6161};
6262
63- static struct rebindings_entry * _rebindings_head ;
63+ static struct rebindings_entry * _flex_rebindings_head ;
6464
6565/// @return 0 on success
66- static int prepend_rebindings (struct rebindings_entry * * rebindings_head ,
66+ static int flex_prepend_rebindings (struct rebindings_entry * * rebindings_head ,
6767 struct rebinding rebindings [],
6868 size_t nel ) {
6969 struct rebindings_entry * new_entry = (struct rebindings_entry * ) malloc (sizeof (struct rebindings_entry ));
@@ -85,7 +85,7 @@ static int prepend_rebindings(struct rebindings_entry **rebindings_head,
8585 return 0 ;
8686}
8787
88- static vm_prot_t get_protection (void * sectionStart ) {
88+ static vm_prot_t flex_get_protection (void * sectionStart ) {
8989 mach_port_t task = mach_task_self ();
9090 vm_size_t size = 0 ;
9191 vm_address_t address = (vm_address_t )sectionStart ;
@@ -110,19 +110,19 @@ static vm_prot_t get_protection(void *sectionStart) {
110110 return VM_PROT_READ ;
111111 }
112112}
113- static void perform_rebinding_with_section (struct rebindings_entry * rebindings ,
114- section_t * section ,
115- intptr_t slide ,
116- nlist_t * symtab ,
117- char * strtab ,
118- uint32_t * indirect_symtab ) {
113+ static void flex_perform_rebinding_with_section (struct rebindings_entry * rebindings ,
114+ section_t * section ,
115+ intptr_t slide ,
116+ nlist_t * symtab ,
117+ char * strtab ,
118+ uint32_t * indirect_symtab ) {
119119 const bool isDataConst = strcmp (section -> segname , "__DATA_CONST" ) == 0 ;
120120 uint32_t * indirect_symbol_indices = indirect_symtab + section -> reserved1 ;
121121 void * * indirect_symbol_bindings = (void * * )((uintptr_t )slide + section -> addr );
122122 vm_prot_t oldProtection = VM_PROT_READ ;
123123
124124 if (isDataConst ) {
125- oldProtection = get_protection (rebindings );
125+ oldProtection = flex_get_protection (rebindings );
126126 mprotect (indirect_symbol_bindings , section -> size , PROT_READ | PROT_WRITE );
127127 }
128128
@@ -177,9 +177,9 @@ static void perform_rebinding_with_section(struct rebindings_entry *rebindings,
177177 }
178178}
179179
180- static void rebind_symbols_for_image (struct rebindings_entry * rebindings ,
181- const struct mach_header * header ,
182- intptr_t slide ) {
180+ static void flex_rebind_symbols_for_image (struct rebindings_entry * rebindings ,
181+ const struct mach_header * header ,
182+ intptr_t slide ) {
183183 Dl_info info ;
184184 if (dladdr (header , & info ) == 0 ) {
185185 return ;
@@ -232,12 +232,12 @@ static void rebind_symbols_for_image(struct rebindings_entry *rebindings,
232232 section_t * sect = (section_t * )(cur + sizeof (segment_command_t )) + j ;
233233
234234 if ((sect -> flags & SECTION_TYPE ) == S_LAZY_SYMBOL_POINTERS ) {
235- perform_rebinding_with_section (
235+ flex_perform_rebinding_with_section (
236236 rebindings , sect , slide , symtab , strtab , indirect_symtab
237237 );
238238 }
239239 if ((sect -> flags & SECTION_TYPE ) == S_NON_LAZY_SYMBOL_POINTERS ) {
240- perform_rebinding_with_section (
240+ flex_perform_rebinding_with_section (
241241 rebindings , sect , slide , symtab , strtab , indirect_symtab
242242 );
243243 }
@@ -246,19 +246,19 @@ static void rebind_symbols_for_image(struct rebindings_entry *rebindings,
246246 }
247247}
248248
249- static void _rebind_symbols_for_image (const struct mach_header * header ,
250- intptr_t slide ) {
251- rebind_symbols_for_image ( _rebindings_head , header , slide );
249+ static void _flex_rebind_symbols_for_image (const struct mach_header * header ,
250+ intptr_t slide ) {
251+ flex_rebind_symbols_for_image ( _flex_rebindings_head , header , slide );
252252}
253253
254- int rebind_symbols_image (void * header ,
255- intptr_t slide ,
256- struct rebinding rebindings [],
257- size_t rebindings_nel ) {
254+ int flex_rebind_symbols_image (void * header ,
255+ intptr_t slide ,
256+ struct rebinding rebindings [],
257+ size_t rebindings_nel ) {
258258 struct rebindings_entry * rebindings_head = NULL ;
259259
260- int retval = prepend_rebindings (& rebindings_head , rebindings , rebindings_nel );
261- rebind_symbols_for_image (rebindings_head , (const struct mach_header * ) header , slide );
260+ int retval = flex_prepend_rebindings (& rebindings_head , rebindings , rebindings_nel );
261+ flex_rebind_symbols_for_image (rebindings_head , (const struct mach_header * ) header , slide );
262262
263263 if (rebindings_head ) {
264264 free (rebindings_head -> rebindings );
@@ -269,20 +269,20 @@ int rebind_symbols_image(void *header,
269269}
270270
271271/// @return 0 on success
272- int rebind_symbols (struct rebinding rebindings [], size_t rebindings_nel ) {
273- int retval = prepend_rebindings ( & _rebindings_head , rebindings , rebindings_nel );
272+ int flex_rebind_symbols (struct rebinding rebindings [], size_t rebindings_nel ) {
273+ int retval = flex_prepend_rebindings ( & _flex_rebindings_head , rebindings , rebindings_nel );
274274 if (retval < 0 ) {
275275 return retval ;
276276 }
277277
278278 // If this was the first call, register callback for image additions (which is also invoked for
279279 // existing images, otherwise, just run on existing images
280- if (!_rebindings_head -> next ) {
281- _dyld_register_func_for_add_image (_rebind_symbols_for_image );
280+ if (!_flex_rebindings_head -> next ) {
281+ _dyld_register_func_for_add_image (_flex_rebind_symbols_for_image );
282282 } else {
283283 uint32_t c = _dyld_image_count ();
284284 for (uint32_t i = 0 ; i < c ; i ++ ) {
285- _rebind_symbols_for_image (_dyld_get_image_header (i ), _dyld_get_image_vmaddr_slide (i ));
285+ _flex_rebind_symbols_for_image (_dyld_get_image_header (i ), _dyld_get_image_vmaddr_slide (i ));
286286 }
287287 }
288288
0 commit comments