aboutsummaryrefslogtreecommitdiffstats
path: root/unexalpha.c
diff options
context:
space:
mode:
Diffstat (limited to 'unexalpha.c')
-rw-r--r--unexalpha.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/unexalpha.c b/unexalpha.c
index 2adfd1f..69db5fd 100644
--- a/unexalpha.c
+++ b/unexalpha.c
@@ -20,7 +20,15 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <config.h>
+#ifndef emacs
+# ifndef __ELF__
+ /* Describe layout of the address space in an executing process. */
+# define TEXT_START 0x120000000
+# define DATA_START 0x140000000
+# endif
+#else
+# include <config.h>
+#endif
#include <sys/types.h>
#include <sys/file.h>
#include <sys/stat.h>
@@ -93,7 +101,7 @@ struct headers {
/* Define name of label for entry point for the dumped executable. */
#ifndef DEFAULT_ENTRY_ADDRESS
-#define DEFAULT_ENTRY_ADDRESS __start
+# define DEFAULT_ENTRY_ADDRESS __start
#endif
unexec (new_name, a_name, data_start, bss_start, entry_address)
@@ -194,10 +202,10 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
#endif
#ifdef _PDATA
CHECK_SCNHDR (pdata_section, _PDATA, STYP_PDATA);
-#endif _PDATA
+#endif /* _PDATA */
#ifdef _GOT
CHECK_SCNHDR (got_section, _GOT, STYP_GOT);
-#endif _GOT
+#endif /* _GOT */
CHECK_SCNHDR (data_section, _DATA, STYP_DATA);
#ifdef _XDATA
CHECK_SCNHDR (xdata_section, _XDATA, STYP_XDATA);
@@ -315,7 +323,7 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
"writing data section to %s", new_name);
#ifdef _GOT
-#define old_got_section ((struct scnhdr *)buffer)
+# define old_got_section ((struct scnhdr *)buffer)
if (got_section != NULL)
{
@@ -327,7 +335,7 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
"seeking to end of data section of %s", new_name);
}
-#undef old_got_section
+# undef old_got_section
#endif
/*
@@ -408,10 +416,10 @@ update_dynamic_symbols (old, new_name, new, aout)
x = ds_base[rd_base[i].index];
-#if 0
+# if 0
fprintf (stderr, "Object inspected: %s, addr = %lx, shndx = %x",
old + dynstr_section->s_scnptr + x.st_name, rd_base[i].addr, x.st_shndx);
-#endif
+# endif
if ((ELF32_ST_BIND (x.st_info) == STB_GLOBAL)
@@ -433,13 +441,13 @@ update_dynamic_symbols (old, new_name, new, aout)
unsigned long newref = aout.tsize + reladdr;
int len;
-#if 0
+# if 0
fprintf (stderr, "...relocated\n");
-#endif
+# endif
- if (rd_base[i].type == R_REFLONG)
+ if (rd_base[i].type == R_REFLONG)
len = 4;
- else if (rd_base[i].type == R_REFQUAD)
+ else if (rd_base[i].type == R_REFQUAD)
len = 8;
else
fatal_unexec ("unrecognized relocation type in .dyn.rel section (symbol #%d)", i);
@@ -448,10 +456,10 @@ update_dynamic_symbols (old, new_name, new, aout)
WRITE (new, oldref, len, "writing old dynrel info in %s", new_name);
}
-#if 0
+# if 0
else
fprintf (stderr, "...not relocated\n");
-#endif
+# endif
}