Permalink
Browse files

get rid of hacky conditional in mach find_stub_addr

  • Loading branch information...
1 parent f889218 commit e25e2ad7972643585a8b016bfe6fcb8191edbee3 @tmm1 tmm1 committed Apr 24, 2010
Showing with 4 additions and 4 deletions.
  1. +4 −4 ext/mach.c
View
@@ -112,7 +112,7 @@ find_stub_addr(const char *symname, struct mach_config *img_cfg)
for (; i < nsyms; i ++) {
uint32_t currsym = sect->reserved1 + i;
- uint64_t stubaddr = sect->addr + (i * sect->reserved2);
+ uint64_t stubaddr = sect->offset + (i * sect->reserved2);
uint32_t symoff = 0;
assert(currsym <= img_cfg->nindirectsyms);
@@ -129,9 +129,9 @@ find_stub_addr(const char *symname, struct mach_config *img_cfg)
if (strcmp(symname, string+1) == 0) {
if (stubaddr) {
- if (img_cfg->index != 0) // don't add load_addr for main exe
- stubaddr = (uint64_t)img_cfg->load_addr + stubaddr;
- dbg_printf("address of stub in %s for %s is %" PRId64 "\n", img_cfg->filename, string, stubaddr);
+ dbg_printf("address of stub in %s for %s is %" PRId64 " + %" PRId64 " = ", img_cfg->filename, string, stubaddr, img_cfg->load_addr);
+ stubaddr = (uint64_t)img_cfg->load_addr + stubaddr;
+ dbg_printf("%" PRId64 "\n", stubaddr);
return (void *)stubaddr;
}
}

0 comments on commit e25e2ad

Please sign in to comment.