1141 |
static void GC_dyld_image_add(struct mach_header* hdr, unsigned long slide) { |
static void GC_dyld_image_add(struct mach_header* hdr, unsigned long slide) { |
1142 |
unsigned long start,end,i; |
unsigned long start,end,i; |
1143 |
const struct section *sec; |
const struct section *sec; |
1144 |
|
if (GC_no_dls) return; |
1145 |
for(i=0;i<sizeof(GC_dyld_sections)/sizeof(GC_dyld_sections[0]);i++) { |
for(i=0;i<sizeof(GC_dyld_sections)/sizeof(GC_dyld_sections[0]);i++) { |
1146 |
sec = getsectbynamefromheader( |
sec = getsectbynamefromheader( |
1147 |
hdr,GC_dyld_sections[i].seg,GC_dyld_sections[i].sect); |
hdr,GC_dyld_sections[i].seg,GC_dyld_sections[i].sect); |
1148 |
if(sec == NULL || sec->size == 0) continue; |
if(sec == NULL || sec->size == 0) continue; |
1149 |
start = slide + sec->addr; |
start = slide + sec->addr; |
1150 |
end = start + sec->size; |
end = start + sec->size; |
1151 |
# ifdef DARWIN_DEBUG |
# ifdef DARWIN_DEBUG |
1152 |
GC_printf4("Adding section at %p-%p (%lu bytes) from image %s\n", |
GC_printf4("Adding section at %p-%p (%lu bytes) from image %s\n", |
1153 |
start,end,sec->size,GC_dyld_name_for_hdr(hdr)); |
start,end,sec->size,GC_dyld_name_for_hdr(hdr)); |
1154 |
# endif |
# endif |
1155 |
GC_add_roots((char*)start,(char*)end); |
GC_add_roots((char*)start,(char*)end); |
1156 |
} |
} |
1157 |
# ifdef DARWIN_DEBUG |
# ifdef DARWIN_DEBUG |
1158 |
GC_print_static_roots(); |
GC_print_static_roots(); |
1159 |
# endif |
# endif |
1160 |
} |
} |
1161 |
|
|
1162 |
/* This should never be called by a thread holding the lock */ |
/* This should never be called by a thread holding the lock */ |
1169 |
if(sec == NULL || sec->size == 0) continue; |
if(sec == NULL || sec->size == 0) continue; |
1170 |
start = slide + sec->addr; |
start = slide + sec->addr; |
1171 |
end = start + sec->size; |
end = start + sec->size; |
1172 |
# ifdef DARWIN_DEBUG |
# ifdef DARWIN_DEBUG |
1173 |
GC_printf4("Removing section at %p-%p (%lu bytes) from image %s\n", |
GC_printf4("Removing section at %p-%p (%lu bytes) from image %s\n", |
1174 |
start,end,sec->size,GC_dyld_name_for_hdr(hdr)); |
start,end,sec->size,GC_dyld_name_for_hdr(hdr)); |
1175 |
# endif |
# endif |
1176 |
GC_remove_roots((char*)start,(char*)end); |
GC_remove_roots((char*)start,(char*)end); |
1177 |
} |
} |
1178 |
# ifdef DARWIN_DEBUG |
# ifdef DARWIN_DEBUG |
1179 |
GC_print_static_roots(); |
GC_print_static_roots(); |
1180 |
# endif |
# endif |
1181 |
} |
} |
1182 |
|
|
1183 |
void GC_register_dynamic_libraries() { |
void GC_register_dynamic_libraries() { |