[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108094: * unexmacosx.c (copy_data
From: |
YAMAMOTO Mitsuharu |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108094: * unexmacosx.c (copy_data_segment): Copy initialized data in statically linked libraries from input file rather than memory. |
Date: |
Wed, 08 Aug 2012 14:44:53 +0900 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 108094
committer: YAMAMOTO Mitsuharu <address@hidden>
branch nick: emacs-24
timestamp: Wed 2012-08-08 14:44:53 +0900
message:
* unexmacosx.c (copy_data_segment): Copy initialized data in statically
linked libraries from input file rather than memory.
modified:
src/ChangeLog
src/unexmacosx.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-08-07 03:47:26 +0000
+++ b/src/ChangeLog 2012-08-08 05:44:53 +0000
@@ -1,3 +1,8 @@
+2012-08-08 YAMAMOTO Mitsuharu <address@hidden>
+
+ * unexmacosx.c (copy_data_segment): Copy initialized data in
+ statically linked libraries from input file rather than memory.
+
2012-08-07 YAMAMOTO Mitsuharu <address@hidden>
* unexmacosx.c (print_load_command_name): Add cases LC_MAIN,
=== modified file 'src/unexmacosx.c'
--- a/src/unexmacosx.c 2012-08-07 03:47:26 +0000
+++ b/src/unexmacosx.c 2012-08-08 05:44:53 +0000
@@ -815,8 +815,24 @@
file. */
if (strncmp (sectp->sectname, SECT_DATA, 16) == 0)
{
- if (!unexec_write (sectp->offset, (void *) sectp->addr, sectp->size))
+ extern char my_edata[];
+ unsigned long my_size;
+
+ /* The __data section is basically dumped from memory. But
+ initialized data in statically linked libraries are
+ copied from the input file. In particular,
+ add_image_hook.names and add_image_hook.pointers stored
+ by libarclite_macosx.a, are restored so that they will be
+ reinitialized when the dumped binary is executed. */
+ my_size = (unsigned long)my_edata - sectp->addr;
+ if (!(sectp->addr <= (unsigned long)my_edata
+ && my_size <= sectp->size))
+ unexec_error ("my_edata is not in section %s", SECT_DATA);
+ if (!unexec_write (sectp->offset, (void *) sectp->addr, my_size))
unexec_error ("cannot write section %s", SECT_DATA);
+ if (!unexec_copy (sectp->offset + my_size, old_file_offset + my_size,
+ sectp->size - my_size))
+ unexec_error ("cannot copy section %s", SECT_DATA);
if (!unexec_write (header_offset, sectp, sizeof (struct section)))
unexec_error ("cannot write section %s's header", SECT_DATA);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-24 r108094: * unexmacosx.c (copy_data_segment): Copy initialized data in statically linked libraries from input file rather than memory.,
YAMAMOTO Mitsuharu <=