diff options
Diffstat (limited to 'src/unexelf.c')
-rw-r--r-- | src/unexelf.c | 80 |
1 files changed, 4 insertions, 76 deletions
diff --git a/src/unexelf.c b/src/unexelf.c index 068d268808a..58c9244c3a5 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -66,9 +66,6 @@ what you give them. Help stamp out software-hoarding! */ #include <sys/elf_mips.h> #include <sym.h> #endif /* _SYSTYPE_SYSV */ -#if __sgi -#include <syms.h> /* for HDRR declaration */ -#endif /* __sgi */ #ifndef MAP_ANON #ifdef MAP_ANONYMOUS @@ -329,7 +326,11 @@ unexec (const char *new_name, const char *old_name) if (old_bss_index == -1) fatal ("no bss section found"); +#ifdef HAVE_SBRK new_break = sbrk (0); +#else + new_break = (byte *) old_bss_addr + old_bss_size; +#endif new_bss_addr = (ElfW (Addr)) new_break; bss_size_growth = new_bss_addr - old_bss_addr; new_data2_size = bss_size_growth; @@ -461,29 +462,6 @@ unexec (const char *new_name, const char *old_name) || !strcmp (old_section_names + new_shdr->sh_name, ".sdata") || !strcmp (old_section_names + new_shdr->sh_name, ".lit4") || !strcmp (old_section_names + new_shdr->sh_name, ".lit8") - /* The conditional bit below was in Oliva's original code - (1999-08-25) and seems to have been dropped by mistake - subsequently. It prevents a crash at startup under X in - `IRIX64 6.5 6.5.17m', whether compiled on that release or - an earlier one. It causes no trouble on the other ELF - platforms I could test (Irix 6.5.15m, Solaris 8, Debian - Potato x86, Debian Woody SPARC); however, it's reported - to cause crashes under some version of GNU/Linux. It's - not yet clear what's changed in that Irix version to - cause the problem, or why the fix sometimes fails under - GNU/Linux. There's probably no good reason to have - something Irix-specific here, but this will have to do - for now. IRIX6_5 is the most specific macro we have to - test. -- fx 2002-10-01 - - The issue _looks_ as though it's gone away on 6.5.18m, - but maybe it's still lurking, to be triggered by some - change in the binary. It appears to concern the dynamic - loader, but I never got anywhere with an SGI support call - seeking clues. -- fx 2002-11-29. */ -#ifdef IRIX6_5 - || !strcmp (old_section_names + new_shdr->sh_name, ".got") -#endif || !strcmp (old_section_names + new_shdr->sh_name, ".sdata1") || !strcmp (old_section_names + new_shdr->sh_name, ".data1")) src = (caddr_t) old_shdr->sh_addr; @@ -517,53 +495,6 @@ unexec (const char *new_name, const char *old_name) phdr->cbExtOffset += diff; } #endif /* __alpha__ || _SYSTYPE_SYSV */ - -#if __sgi - /* Adjust the HDRR offsets in .mdebug and copy the - line data if it's in its usual 'hole' in the object. - Makes the new file debuggable with dbx. - patches up two problems: the absolute file offsets - in the HDRR record of .mdebug (see /usr/include/syms.h), and - the ld bug that gets the line table in a hole in the - elf file rather than in the .mdebug section proper. - David Anderson. davea@sgi.com Jan 16,1994. */ - if (strcmp (old_section_names + new_shdr->sh_name, ".mdebug") == 0 - && new_shdr->sh_offset - old_shdr->sh_offset != 0) - { -#define MDEBUGADJUST(__ct,__fileaddr) \ - if (n_phdrr->__ct > 0) \ - { \ - n_phdrr->__fileaddr += movement; \ - } - - HDRR *o_phdrr = (HDRR *) ((byte *) old_base + old_shdr->sh_offset); - HDRR *n_phdrr = (HDRR *) ((byte *) new_base + new_shdr->sh_offset); - ptrdiff_t movement = new_shdr->sh_offset - old_shdr->sh_offset; - - MDEBUGADJUST (idnMax, cbDnOffset); - MDEBUGADJUST (ipdMax, cbPdOffset); - MDEBUGADJUST (isymMax, cbSymOffset); - MDEBUGADJUST (ioptMax, cbOptOffset); - MDEBUGADJUST (iauxMax, cbAuxOffset); - MDEBUGADJUST (issMax, cbSsOffset); - MDEBUGADJUST (issExtMax, cbSsExtOffset); - MDEBUGADJUST (ifdMax, cbFdOffset); - MDEBUGADJUST (crfd, cbRfdOffset); - MDEBUGADJUST (iextMax, cbExtOffset); - /* The Line Section, being possible off in a hole of the object, - requires special handling. */ - if (n_phdrr->cbLine > 0) - { - n_phdrr->cbLineOffset += movement; - - if (o_phdrr->cbLineOffset > (old_shdr->sh_offset - + old_shdr->sh_size)) - /* If not covered by section, it hasn't yet been copied. */ - memcpy (n_phdrr->cbLineOffset + new_base, - o_phdrr->cbLineOffset + old_base, n_phdrr->cbLine); - } - } -#endif /* __sgi */ } /* Update the symbol values of _edata and _end. */ @@ -665,9 +596,6 @@ unexec (const char *new_name, const char *old_name) || !strcmp (old_section_names + shdr->sh_name, ".sdata") || !strcmp (old_section_names + shdr->sh_name, ".lit4") || !strcmp (old_section_names + shdr->sh_name, ".lit8") -#ifdef IRIX6_5 /* see above */ - || !strcmp (old_section_names + shdr->sh_name, ".got") -#endif || !strcmp (old_section_names + shdr->sh_name, ".sdata1") || !strcmp (old_section_names + shdr->sh_name, ".data1")) { |