diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2017-10-24 12:54:28 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-10-24 12:55:15 -0700 |
commit | 1d83257a1db3a9b87675a0dfc68cb4964cecaa09 (patch) | |
tree | ca3d11bdb03cf1591004adecb6e3596e730a369d /src/unexelf.c | |
parent | 19667f44efabda7d4e53e706c6cd8140145b2a1a (diff) | |
download | emacs-1d83257a1db3a9b87675a0dfc68cb4964cecaa09.tar.gz |
Port to QNX
Simplified version of a patch proposed by Elad Lahav in:
https://lists.gnu.org/archive/html/emacs-devel/2017-10/msg00716.html
which is based on a previous patch I proposed in:
https://lists.gnu.org/archive/html/emacs-devel/2017-10/msg00707.html
* configure.ac (opsys, CFLAGS, LIBS_SYSTEM, hybrid_malloc)
(system_alloc, FIRST_PTY_LETTER, CYGWIN_OBJ):
Set appropriately for QNX.
* src/unexelf.c [__QNX__]: Include <sys/elf.h> instead of <elf.h>.
(unexec): Check for sbrk failure, and fall back on old BSS end.
Diffstat (limited to 'src/unexelf.c')
-rw-r--r-- | src/unexelf.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/unexelf.c b/src/unexelf.c index 1cdcfeb44e4..756de5835ce 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -58,9 +58,11 @@ what you give them. Help stamp out software-hoarding! */ #include <sys/types.h> #include <unistd.h> -#if !defined (__NetBSD__) && !defined (__OpenBSD__) -#include <elf.h> -#endif /* not __NetBSD__ and not __OpenBSD__ */ +#ifdef __QNX__ +# include <sys/elf.h> +#elif !defined __NetBSD__ && !defined __OpenBSD__ +# include <elf.h> +#endif #include <sys/mman.h> #if defined (_SYSTYPE_SYSV) #include <sys/elf_mips.h> @@ -222,7 +224,6 @@ unexec (const char *new_name, const char *old_name) { int new_file, old_file; off_t new_file_size; - void *new_break; /* Pointers to the base of the image of the two files. */ caddr_t old_base, new_base; @@ -326,11 +327,13 @@ unexec (const char *new_name, const char *old_name) if (old_bss_index == -1) fatal ("no bss section found"); + void *no_break = (void *) (intptr_t) -1; + void *new_break = no_break; #ifdef HAVE_SBRK new_break = sbrk (0); -#else - new_break = (byte *) old_bss_addr + old_bss_size; #endif + if (new_break == no_break) + new_break = (byte *) old_bss_addr + old_bss_size; new_bss_addr = (ElfW (Addr)) new_break; bss_size_growth = new_bss_addr - old_bss_addr; new_data2_size = bss_size_growth; |