Mercurial > emacs
comparison src/unexmacosx.c @ 104686:7ac0a5c9da70
(print_load_command_name) [LC_DYLD_INFO]: Add cases
LC_DYLD_INFO and LC_DYLD_INFO_ONLY.
(copy_data_segment): Also copy __program_vars section.
(copy_dyld_info) [LC_DYLD_INFO]: New function.
(dump_it) [LC_DYLD_INFO]: Use it.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Fri, 28 Aug 2009 22:49:46 +0000 |
parents | e038c1a8307c |
children | 1d1d5d9bd884 |
comparison
equal
deleted
inserted
replaced
104685:46d3afb288bc | 104686:7ac0a5c9da70 |
---|---|
580 #ifdef LC_UUID | 580 #ifdef LC_UUID |
581 case LC_UUID: | 581 case LC_UUID: |
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 } |
588 } | 596 } |
589 | 597 |
817 || strncmp (sectp->sectname, "__la_sym_ptr2", 16) == 0 | 825 || strncmp (sectp->sectname, "__la_sym_ptr2", 16) == 0 |
818 || strncmp (sectp->sectname, "__dyld", 16) == 0 | 826 || strncmp (sectp->sectname, "__dyld", 16) == 0 |
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)) |
825 unexec_error ("cannot copy section %s", sectp->sectname); | 834 unexec_error ("cannot copy section %s", sectp->sectname); |
826 if (!unexec_write (header_offset, sectp, sizeof (struct section))) | 835 if (!unexec_write (header_offset, sectp, sizeof (struct section))) |
1084 unexec_error ("cannot write two level hint command to header"); | 1093 unexec_error ("cannot write two level hint command to header"); |
1085 | 1094 |
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 |
1092 copy_other (struct load_command *lc) | 1131 copy_other (struct load_command *lc) |
1093 { | 1132 { |
1150 copy_dysymtab (lca[i], linkedit_delta); | 1189 copy_dysymtab (lca[i], linkedit_delta); |
1151 break; | 1190 break; |
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; |
1158 } | 1203 } |
1159 | 1204 |