Skip to content

Commit

Permalink
Merge pull request facebook#12 from mringwal/master
Browse files Browse the repository at this point in the history
Also rebind symbols in __DATA_CONST segment
  • Loading branch information
grp committed Jul 30, 2015
2 parents ae2bc09 + 8327b28 commit 9086d2f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fishhook.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ typedef struct nlist nlist_t;
#define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT
#endif

#ifndef SEG_DATA_CONST
#define SEG_DATA_CONST "__DATA_CONST"
#endif

struct rebindings_entry {
struct rebinding *rebindings;
size_t rebindings_nel;
Expand Down Expand Up @@ -147,7 +151,8 @@ static void rebind_symbols_for_image(struct rebindings_entry *rebindings,
for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) {
cur_seg_cmd = (segment_command_t *)cur;
if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {
if (strcmp(cur_seg_cmd->segname, SEG_DATA) != 0) {
if (strcmp(cur_seg_cmd->segname, SEG_DATA) != 0 &&
strcmp(cur_seg_cmd->segname, SEG_DATA_CONST) != 0) {
continue;
}
for (uint j = 0; j < cur_seg_cmd->nsects; j++) {
Expand Down

0 comments on commit 9086d2f

Please sign in to comment.