aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2012-08-11 10:13:55 +0800
committerChong Yidong2012-08-11 10:13:55 +0800
commit5725bd2cc0e691dadc31bd958f210b1bbcf17c49 (patch)
treea8faec22f21eff83d918076adcc9c8c49c4cc820 /src
parent5723992258a8025e29ba9fcae923182fb5456426 (diff)
parent711f4590cddbc83c509c1c5e852ef4e528a39780 (diff)
downloademacs-5725bd2cc0e691dadc31bd958f210b1bbcf17c49.tar.gz
emacs-5725bd2cc0e691dadc31bd958f210b1bbcf17c49.zip
Merge from emacs-24; up to 2012-05-02T11:38:01Z!lekktu@gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/unexmacosx.c41
2 files changed, 49 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3b88f5c94e9..2bdf4bce0fb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12012-08-08 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2
3 * unexmacosx.c (copy_data_segment): Copy initialized data in
4 statically linked libraries from input file rather than memory.
5
62012-08-07 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
7
8 * unexmacosx.c (print_load_command_name): Add cases LC_MAIN,
9 LC_SOURCE_VERSION, and LC_DYLIB_CODE_SIGN_DRS.
10 (dump_it) [LC_DYLIB_CODE_SIGN_DRS]: Call copy_linkedit_data.
11
12012-08-10 Glenn Morris <rgm@gnu.org> 122012-08-10 Glenn Morris <rgm@gnu.org>
2 13
3 * conf_post.h (IF_LINT, lint_assume): Move here from lisp.h. 14 * conf_post.h (IF_LINT, lint_assume): Move here from lisp.h.
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 0f5ad5498b0..05a16466dfb 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -607,6 +607,21 @@ print_load_command_name (int lc)
607 printf ("LC_FUNCTION_STARTS"); 607 printf ("LC_FUNCTION_STARTS");
608 break; 608 break;
609#endif 609#endif
610#ifdef LC_MAIN
611 case LC_MAIN:
612 printf ("LC_MAIN ");
613 break;
614#endif
615#ifdef LC_SOURCE_VERSION
616 case LC_SOURCE_VERSION:
617 printf ("LC_SOURCE_VERSION");
618 break;
619#endif
620#ifdef LC_DYLIB_CODE_SIGN_DRS
621 case LC_DYLIB_CODE_SIGN_DRS:
622 printf ("LC_DYLIB_CODE_SIGN_DRS");
623 break;
624#endif
610 default: 625 default:
611 printf ("unknown "); 626 printf ("unknown ");
612 } 627 }
@@ -798,8 +813,24 @@ copy_data_segment (struct load_command *lc)
798 file. */ 813 file. */
799 if (strncmp (sectp->sectname, SECT_DATA, 16) == 0) 814 if (strncmp (sectp->sectname, SECT_DATA, 16) == 0)
800 { 815 {
801 if (!unexec_write (sectp->offset, (void *) sectp->addr, sectp->size)) 816 extern char my_edata[];
817 unsigned long my_size;
818
819 /* The __data section is basically dumped from memory. But
820 initialized data in statically linked libraries are
821 copied from the input file. In particular,
822 add_image_hook.names and add_image_hook.pointers stored
823 by libarclite_macosx.a, are restored so that they will be
824 reinitialized when the dumped binary is executed. */
825 my_size = (unsigned long)my_edata - sectp->addr;
826 if (!(sectp->addr <= (unsigned long)my_edata
827 && my_size <= sectp->size))
828 unexec_error ("my_edata is not in section %s", SECT_DATA);
829 if (!unexec_write (sectp->offset, (void *) sectp->addr, my_size))
802 unexec_error ("cannot write section %s", SECT_DATA); 830 unexec_error ("cannot write section %s", SECT_DATA);
831 if (!unexec_copy (sectp->offset + my_size, old_file_offset + my_size,
832 sectp->size - my_size))
833 unexec_error ("cannot copy section %s", SECT_DATA);
803 if (!unexec_write (header_offset, sectp, sizeof (struct section))) 834 if (!unexec_write (header_offset, sectp, sizeof (struct section)))
804 unexec_error ("cannot write section %s's header", SECT_DATA); 835 unexec_error ("cannot write section %s's header", SECT_DATA);
805 } 836 }
@@ -1147,8 +1178,9 @@ copy_dyld_info (struct load_command *lc, long delta)
1147#endif 1178#endif
1148 1179
1149#ifdef LC_FUNCTION_STARTS 1180#ifdef LC_FUNCTION_STARTS
1150/* Copy a LC_FUNCTION_STARTS load command from the input file to the 1181/* Copy a LC_FUNCTION_STARTS/LC_DYLIB_CODE_SIGN_DRS load command from
1151 output file, adjusting the data offset field. */ 1182 the input file to the output file, adjusting the data offset
1183 field. */
1152static void 1184static void
1153copy_linkedit_data (struct load_command *lc, long delta) 1185copy_linkedit_data (struct load_command *lc, long delta)
1154{ 1186{
@@ -1242,6 +1274,9 @@ dump_it (void)
1242#endif 1274#endif
1243#ifdef LC_FUNCTION_STARTS 1275#ifdef LC_FUNCTION_STARTS
1244 case LC_FUNCTION_STARTS: 1276 case LC_FUNCTION_STARTS:
1277#ifdef LC_DYLIB_CODE_SIGN_DRS
1278 case LC_DYLIB_CODE_SIGN_DRS:
1279#endif
1245 copy_linkedit_data (lca[i], linkedit_delta); 1280 copy_linkedit_data (lca[i], linkedit_delta);
1246 break; 1281 break;
1247#endif 1282#endif