/* Dump Emacs in Mach-O format for use on Mac OS X.
- Copyright (C) 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2001-2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
be changed accordingly.
*/
-#include <stdio.h>
+/* config.h #define:s malloc/realloc/free and then includes stdlib.h.
+ We want the undefined versions, but if config.h includes stdlib.h
+ with the #define:s in place, the prototypes will be wrong and we get
+ warnings. To prevent that, include stdlib.h before config.h. */
+
#include <stdlib.h>
+#include <config.h>
+#undef malloc
+#undef realloc
+#undef free
+
+#include "unexec.h"
+
+#include <stdio.h>
#include <fcntl.h>
#include <stdarg.h>
#include <sys/types.h>
#if defined (__ppc__)
#include <mach-o/ppc/reloc.h>
#endif
-#include <config.h>
-#undef malloc
-#undef realloc
-#undef free
#ifdef HAVE_MALLOC_MALLOC_H
#include <malloc/malloc.h>
#else
static struct segment_command *data_segment_scp;
+static void unexec_error (const char *format, ...) NO_RETURN;
+
/* Read N bytes from infd into memory starting at address DEST.
Return true if successful, false otherwise. */
static int
/* Debugging and informational messages routines. */
static void
-unexec_error (char *format, ...)
+unexec_error (const char *format, ...)
{
va_list ap;
}
static void
-print_region_list ()
+print_region_list (void)
{
struct region_t *r;
}
static void
-print_regions ()
+print_regions (void)
{
task_t target_task = mach_task_self ();
vm_address_t address = (vm_address_t) 0;
cannot be omitted because they some regions created at run time are
read-only. */
static void
-build_region_list ()
+build_region_list (void)
{
task_t target_task = mach_task_self ();
vm_address_t address = (vm_address_t) 0;
}
static void
-find_emacs_zone_regions ()
+find_emacs_zone_regions (void)
{
num_unexec_regions = 0;
}
static void
-unexec_regions_merge ()
+unexec_regions_merge (void)
{
int i, n;
unexec_region_info r;
the global array lca. Store the total number of load commands in
global variable nlc. */
static void
-read_load_commands ()
+read_load_commands (void)
{
int i;
}
}
- printf ("Highest address of load commands in input file: %#8x\n",
- infile_lc_highest_addr);
+ printf ("Highest address of load commands in input file: %#8lx\n",
+ (unsigned long)infile_lc_highest_addr);
printf ("Lowest offset of all sections in __TEXT segment: %#8lx\n",
text_seg_lowest_offset);
}
else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0
|| strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0
+ || strncmp (sectp->sectname, "__got", 16) == 0
|| strncmp (sectp->sectname, "__la_sym_ptr2", 16) == 0
|| strncmp (sectp->sectname, "__dyld", 16) == 0
|| strncmp (sectp->sectname, "__const", 16) == 0
/* Loop through all load commands and dump them. Then write the Mach
header. */
static void
-dump_it ()
+dump_it (void)
{
int i;
long linkedit_delta = 0;
and infile, respectively. The three other parameters are
ignored. */
void
-unexec (char *outfile, char *infile, void *start_data, void *start_bss,
- void *entry_address)
+unexec (const char *outfile, const char *infile)
{
if (in_dumped_exec)
unexec_error ("Unexec from a dumped executable is not supported.");
void
-unexec_init_emacs_zone ()
+unexec_init_emacs_zone (void)
{
emacs_zone = malloc_create_zone (0, 0);
malloc_set_zone_name (emacs_zone, "EmacsZone");
else
malloc_zone_free (emacs_zone, (unexec_malloc_header_t *) ptr - 1);
}
-
-/* arch-tag: 1a784f7b-a184-4c4f-9544-da8619593d72
- (do not change this comment) */