/* Dump Emacs in Mach-O format for use on Mac OS X.
- Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005,
+ 2006 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#if defined (__ppc__)
#include <mach-o/ppc/reloc.h>
#endif
-#if defined (HAVE_MALLOC_MALLOC_H)
+#include <config.h>
+#undef malloc
+#undef realloc
+#undef free
+#ifdef HAVE_MALLOC_MALLOC_H
#include <malloc/malloc.h>
#else
#include <objc/malloc.h>
static void
read_load_commands ()
{
- int n, i, j;
+ int i;
if (!unexec_read (&mh, sizeof (struct mach_header)))
unexec_error ("cannot read mach-o header");
struct section *sectp;
int j;
unsigned long header_offset, file_offset, old_file_offset;
- struct region_t *r;
printf ("Writing segment %-16.16s at %#8x - %#8x (sz: %#8x)\n",
scp->segname, scp->fileoff, scp->fileoff + scp->filesize,
unexec (char *outfile, char *infile, void *start_data, void *start_bss,
void *entry_address)
{
+ if (in_dumped_exec)
+ unexec_error ("Unexec from a dumped executable is not supported.");
+
infd = open (infile, O_RDONLY, 0);
if (infd < 0)
{