diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/unexmacosx.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/unexmacosx.c b/src/unexmacosx.c index ff6ab016fd1..bb71d8fa76d 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c | |||
| @@ -582,6 +582,14 @@ print_load_command_name (int lc) | |||
| 582 | printf ("LC_UUID "); | 582 | printf ("LC_UUID "); |
| 583 | break; | 583 | break; |
| 584 | #endif | 584 | #endif |
| 585 | #ifdef LC_DYLD_INFO | ||
| 586 | case LC_DYLD_INFO: | ||
| 587 | printf ("LC_DYLD_INFO "); | ||
| 588 | break; | ||
| 589 | case LC_DYLD_INFO_ONLY: | ||
| 590 | printf ("LC_DYLD_INFO_ONLY"); | ||
| 591 | break; | ||
| 592 | #endif | ||
| 585 | default: | 593 | default: |
| 586 | printf ("unknown "); | 594 | printf ("unknown "); |
| 587 | } | 595 | } |
| @@ -819,6 +827,7 @@ copy_data_segment (struct load_command *lc) | |||
| 819 | || strncmp (sectp->sectname, "__const", 16) == 0 | 827 | || strncmp (sectp->sectname, "__const", 16) == 0 |
| 820 | || strncmp (sectp->sectname, "__cfstring", 16) == 0 | 828 | || strncmp (sectp->sectname, "__cfstring", 16) == 0 |
| 821 | || strncmp (sectp->sectname, "__gcc_except_tab", 16) == 0 | 829 | || strncmp (sectp->sectname, "__gcc_except_tab", 16) == 0 |
| 830 | || strncmp (sectp->sectname, "__program_vars", 16) == 0 | ||
| 822 | || strncmp (sectp->sectname, "__objc_", 7) == 0) | 831 | || strncmp (sectp->sectname, "__objc_", 7) == 0) |
| 823 | { | 832 | { |
| 824 | if (!unexec_copy (sectp->offset, old_file_offset, sectp->size)) | 833 | if (!unexec_copy (sectp->offset, old_file_offset, sectp->size)) |
| @@ -1086,6 +1095,36 @@ copy_twolevelhints (struct load_command *lc, long delta) | |||
| 1086 | curr_header_offset += lc->cmdsize; | 1095 | curr_header_offset += lc->cmdsize; |
| 1087 | } | 1096 | } |
| 1088 | 1097 | ||
| 1098 | #ifdef LC_DYLD_INFO | ||
| 1099 | /* Copy a LC_DYLD_INFO(_ONLY) load command from the input file to the output | ||
| 1100 | file, adjusting the file offset fields. */ | ||
| 1101 | static void | ||
| 1102 | copy_dyld_info (struct load_command *lc, long delta) | ||
| 1103 | { | ||
| 1104 | struct dyld_info_command *dip = (struct dyld_info_command *) lc; | ||
| 1105 | |||
| 1106 | if (dip->rebase_off > 0) | ||
| 1107 | dip->rebase_off += delta; | ||
| 1108 | if (dip->bind_off > 0) | ||
| 1109 | dip->bind_off += delta; | ||
| 1110 | if (dip->weak_bind_off > 0) | ||
| 1111 | dip->weak_bind_off += delta; | ||
| 1112 | if (dip->lazy_bind_off > 0) | ||
| 1113 | dip->lazy_bind_off += delta; | ||
| 1114 | if (dip->export_off > 0) | ||
| 1115 | dip->export_off += delta; | ||
| 1116 | |||
| 1117 | printf ("Writing "); | ||
| 1118 | print_load_command_name (lc->cmd); | ||
| 1119 | printf (" command\n"); | ||
| 1120 | |||
| 1121 | if (!unexec_write (curr_header_offset, lc, lc->cmdsize)) | ||
| 1122 | unexec_error ("cannot write dyld info command to header"); | ||
| 1123 | |||
| 1124 | curr_header_offset += lc->cmdsize; | ||
| 1125 | } | ||
| 1126 | #endif | ||
| 1127 | |||
| 1089 | /* Copy other kinds of load commands from the input file to the output | 1128 | /* Copy other kinds of load commands from the input file to the output |
| 1090 | file, ones that do not require adjustments of file offsets. */ | 1129 | file, ones that do not require adjustments of file offsets. */ |
| 1091 | static void | 1130 | static void |
| @@ -1152,6 +1191,12 @@ dump_it () | |||
| 1152 | case LC_TWOLEVEL_HINTS: | 1191 | case LC_TWOLEVEL_HINTS: |
| 1153 | copy_twolevelhints (lca[i], linkedit_delta); | 1192 | copy_twolevelhints (lca[i], linkedit_delta); |
| 1154 | break; | 1193 | break; |
| 1194 | #ifdef LC_DYLD_INFO | ||
| 1195 | case LC_DYLD_INFO: | ||
| 1196 | case LC_DYLD_INFO_ONLY: | ||
| 1197 | copy_dyld_info (lca[i], linkedit_delta); | ||
| 1198 | break; | ||
| 1199 | #endif | ||
| 1155 | default: | 1200 | default: |
| 1156 | copy_other (lca[i]); | 1201 | copy_other (lca[i]); |
| 1157 | break; | 1202 | break; |