summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2011-07-23 13:04:58 +0900
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2011-07-23 13:04:58 +0900
commit7963fa061a06d3d3c3bd396246fbb17e6aad9f67 (patch)
tree771d9a7bbe4637ee90710211d665fac2eb572559 /src
parentf7912160c498869e56edc5472b94106fd772fb8d (diff)
downloademacs-7963fa061a06d3d3c3bd396246fbb17e6aad9f67.tar.gz
Support LC_FUNCTION_STARTS load command on Darwin.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/unexmacosx.c37
2 files changed, 44 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 09a6180e79d..62424f794cf 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2011-07-23 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * unexmacosx.c (print_load_command_name): Add cases LC_FUNCTION_STARTS
+ and LC_VERSION_MIN_MACOSX.
+ (copy_linkedit_data) [LC_FUNCTION_STARTS]: New function.
+ (dump_it) [LC_FUNCTION_STARTS]: Use it.
+
2011-07-22 Chong Yidong <cyd@stupidchicken.com>
* frame.c (Fmodify_frame_parameters): In tty case, update the
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index d6f170c9127..e4d0314ce8c 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -590,6 +590,16 @@ print_load_command_name (int lc)
printf ("LC_DYLD_INFO_ONLY");
break;
#endif
+#ifdef LC_VERSION_MIN_MACOSX
+ case LC_VERSION_MIN_MACOSX:
+ printf ("LC_VERSION_MIN_MACOSX");
+ break;
+#endif
+#ifdef LC_FUNCTION_STARTS
+ case LC_FUNCTION_STARTS:
+ printf ("LC_FUNCTION_STARTS");
+ break;
+#endif
default:
printf ("unknown ");
}
@@ -1126,6 +1136,28 @@ copy_dyld_info (struct load_command *lc, long delta)
}
#endif
+#ifdef LC_FUNCTION_STARTS
+/* Copy a LC_FUNCTION_STARTS load command from the input file to the
+ output file, adjusting the data offset field. */
+static void
+copy_linkedit_data (struct load_command *lc, long delta)
+{
+ struct linkedit_data_command *ldp = (struct linkedit_data_command *) lc;
+
+ if (ldp->dataoff > 0)
+ ldp->dataoff += delta;
+
+ printf ("Writing ");
+ print_load_command_name (lc->cmd);
+ printf (" command\n");
+
+ if (!unexec_write (curr_header_offset, lc, lc->cmdsize))
+ unexec_error ("cannot write linkedit data command to header");
+
+ curr_header_offset += lc->cmdsize;
+}
+#endif
+
/* Copy other kinds of load commands from the input file to the output
file, ones that do not require adjustments of file offsets. */
static void
@@ -1198,6 +1230,11 @@ dump_it ()
copy_dyld_info (lca[i], linkedit_delta);
break;
#endif
+#ifdef LC_FUNCTION_STARTS
+ case LC_FUNCTION_STARTS:
+ copy_linkedit_data (lca[i], linkedit_delta);
+ break;
+#endif
default:
copy_other (lca[i]);
break;