summaryrefslogtreecommitdiff
path: root/src/unexelf.c
diff options
context:
space:
mode:
authorDan Nicolaescu <dann@ics.uci.edu>2008-06-26 04:24:54 +0000
committerDan Nicolaescu <dann@ics.uci.edu>2008-06-26 04:24:54 +0000
commit4218a3c5d365c89f493cf41845bcab20dc18d3a7 (patch)
tree0964588a634febc5127595c7db6798451c412534 /src/unexelf.c
parentb6ab0b68078cbf72506a5818d7b154d7373de2e3 (diff)
downloademacs-4218a3c5d365c89f493cf41845bcab20dc18d3a7.tar.gz
* unexnext.c:
* m/ews4800.h: * m/hp9000s300.h: * m/ibm370aix.h: * m/mips-siemens.h: * m/ncr386.h: * m/next.h: * m/pmax.h: * m/powerpcle.h: * m/tandem-s2.h: * s/386bsd.h: * s/bsd386.h: * s/bsd4-1.h: * s/bsd4-2.h: * s/bsdos2-1.h: * s/bsdos2.h: * s/bsdos3.h: * s/bsdos4.h: * s/nextstep.h: * s/ultrix4-3.h: * s/usg5-0.h: * s/usg5-2-2.h: * s/usg5-2.h: * s/usg5-4-3.h: * s/ux4800.h: * s/uxpds.h: * s/uxpv.h: Remove support for obsolete systems. * s/hpux.h, s/hpux10.h, s/hpux8.h, s/hpux9.h, s/hpux9shr.h: Remove, insert contents in s/hpux-10.20.h * s/aix3-1.h, s/aix3-2-5.h, s/aix3-2.h, s/aix4-1.h, s/aix4.h: Remove, insert contents in s/aix-4.2.h * s/usg5-3.h: Remove, insert contents in s/usg5-4.h. * s/bsd4-3.h: Rename to .. * s/bsd-common.h: ... this. * src/data.c: * src/doc.c: * src/ecrt0.c: * src/emacs.c: * src/fileio.c: * src/floatfns.c: * src/keyboard.c: * src/mem-limits.h: * src/print.c: * src/process.c: * src/sysdep.c: * src/syssignal.h: * src/systty.h: * src/syswait.h: * src/term.c: * src/unexec.c: * src/unexelf.c: * src/unexhp9k800.c: * src/m/hp800.h: * src/m/ibmrs6000.h: * src/m/mips.h: * src/m/vax.h: * src/s/darwin.h: * src/s/freebsd.h: * src/s/gnu.h: * src/s/ms-w32.h: * src/s/msdos.h: * src/s/netbsd.h: * src/s/template.h: Remove references to obsolete variables. * Makefile.in: Add dependencies for all unexec files. (admindir): Remove unused variable. (UNEXEC_SRC): Remove references. * config.nt: Remove reference to UNEXEC_SRC. * lwlib.c: Remove references to obsolete variables. * fakemail.c: Remove references to obsolete variables. * os.texi: Remove references to obsolete systems. * configure.in: * configure: Remove references to obsolete systems.
Diffstat (limited to 'src/unexelf.c')
-rw-r--r--src/unexelf.c98
1 files changed, 2 insertions, 96 deletions
diff --git a/src/unexelf.c b/src/unexelf.c
index db05c55fb8d..199352d4e6e 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -433,9 +433,6 @@ extern void fatal (const char *msgid, ...);
#if __sgi
#include <syms.h> /* for HDRR declaration */
#endif /* __sgi */
-#ifdef BROKEN_NOCOMBRELOC
-#include <assert.h>
-#endif
#ifndef MAP_ANON
#ifdef MAP_ANONYMOUS
@@ -690,9 +687,6 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
int old_mdebug_index;
struct stat stat_buf;
int old_file_size;
-#ifdef BROKEN_NOCOMBRELOC
- int unreloc_sections[10], n_unreloc_sections;
-#endif
/* Open the old file, allocate a buffer of the right size, and read
in the file contents. */
@@ -982,23 +976,11 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
section just before .bss has less-strict alignment; this
was observed between .symtab and .bss on Solaris 2.5.1
(sparc) with GCC snapshot 960602. */
-#ifdef SOLARIS_POWERPC
- /* On PPC Reference Platform running Solaris 2.5.1
- the plt section is also of type NOBI like the bss section.
- (not really stored) and therefore sections after the bss
- section start at the plt offset. The plt section is always
- the one just before the bss section.
- It would be better to put the new data section before
- the .plt section, or use libelf instead.
- Erik Deumens, deumens@qtp.ufl.edu. */
- if (NEW_SECTION_H (nn).sh_offset
- >= OLD_SECTION_H (old_bss_index-1).sh_offset)
- NEW_SECTION_H (nn).sh_offset += new_data2_size;
-#else
+
if (NEW_SECTION_H (nn).sh_offset + NEW_SECTION_H (nn).sh_size
> new_data2_offset)
NEW_SECTION_H (nn).sh_offset += new_data2_size;
-#endif
+
/* Any section that was originally placed after the section
header table should now be off by the size of one section
header table entry. */
@@ -1224,7 +1206,6 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
/* This loop seeks out relocation sections for the data section, so
that it can undo relocations performed by the runtime linker. */
-#ifndef BROKEN_NOCOMBRELOC
for (n = new_file_h->e_shnum - 1; n; n--)
{
ElfW(Shdr) section = NEW_SECTION_H (n);
@@ -1279,81 +1260,6 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
break;
}
}
-#else /* BROKEN_NOCOMBRELOC */
- for (n = 1, n_unreloc_sections = 0; n < new_file_h->e_shnum; n++)
- if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data")
- || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".sdata")
- || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".lit4")
- || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".lit8")
-#ifdef IRIX6_5 /* see above */
- || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".got")
-#endif
- || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".sdata1")
- || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data1"))
- {
- assert (n_unreloc_sections
- < (sizeof (unreloc_sections) / sizeof (unreloc_sections[0])));
- unreloc_sections[n_unreloc_sections++] = n;
-#ifdef DEBUG
- fprintf (stderr, "section %d: %s\n", n,
- old_section_names + NEW_SECTION_H (n).sh_name);
-#endif
- }
-
- for (n = new_file_h->e_shnum - 1; n; n--)
- {
- ElfW(Shdr) section = NEW_SECTION_H (n);
- caddr_t reloc, end;
- ElfW(Addr) addr, offset;
- int target;
-
- switch (section.sh_type)
- {
- default:
- break;
- case SHT_REL:
- case SHT_RELA:
- /* This code handles two different size structs, but there should
- be no harm in that provided that r_offset is always the first
- member. */
- for (reloc = old_base + section.sh_offset,
- end = reloc + section.sh_size;
- reloc < end;
- reloc += section.sh_entsize)
- {
- addr = ((ElfW(Rel) *) reloc)->r_offset;
-#ifdef __alpha__
- /* The Alpha ELF binutils currently have a bug that
- sometimes results in relocs that contain all
- zeroes. Work around this for now... */
- if (addr == 0)
- continue;
-#endif
- for (nn = 0; nn < n_unreloc_sections; nn++)
- {
- target = unreloc_sections[nn];
- if (NEW_SECTION_H (target).sh_addr <= addr
- && addr < (NEW_SECTION_H (target).sh_addr +
- NEW_SECTION_H (target).sh_size))
- {
- offset = (NEW_SECTION_H (target).sh_addr -
- NEW_SECTION_H (target).sh_offset);
- memcpy (new_base + addr - offset,
- old_base + addr - offset,
- sizeof (ElfW(Addr)));
-#ifdef DEBUG
- fprintf (stderr, "unrelocate: [%08lx] <= %08lx\n",
- (long) addr,
- (long) *((long *) (new_base + addr - offset)));
-#endif
- break;
- }
- }
- }
- break;
- }
- }
-#endif /* BROKEN_NOCOMBRELOC */
/* Write out new_file, and free the buffers. */