aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2017-10-24 12:54:28 -0700
committerPaul Eggert2017-10-24 12:55:15 -0700
commit1d83257a1db3a9b87675a0dfc68cb4964cecaa09 (patch)
treeca3d11bdb03cf1591004adecb6e3596e730a369d
parent19667f44efabda7d4e53e706c6cd8140145b2a1a (diff)
downloademacs-1d83257a1db3a9b87675a0dfc68cb4964cecaa09.tar.gz
emacs-1d83257a1db3a9b87675a0dfc68cb4964cecaa09.zip
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.
-rw-r--r--configure.ac15
-rw-r--r--src/unexelf.c15
2 files changed, 22 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 646a637cf34..ca75136474e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -699,6 +699,12 @@ case "${canonical}" in
699 esac 699 esac
700 ;; 700 ;;
701 701
702 ## QNX Neutrino
703 *-nto-qnx* )
704 opsys=qnxnto
705 CFLAGS="$CFLAGS -D__NO_EXT_QNX"
706 ;;
707
702 ## Intel 386 machines where we don't care about the manufacturer. 708 ## Intel 386 machines where we don't care about the manufacturer.
703 i[3456]86-*-* ) 709 i[3456]86-*-* )
704 case "${canonical}" in 710 case "${canonical}" in
@@ -1507,6 +1513,8 @@ case "$opsys" in
1507 1513
1508 hpux*) LIBS_SYSTEM="-l:libdld.sl" ;; 1514 hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
1509 1515
1516 qnxnto) LIBS_SYSTEM="-lsocket" ;;
1517
1510 sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;; 1518 sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
1511 1519
1512 ## Motif needs -lgen. 1520 ## Motif needs -lgen.
@@ -2210,7 +2218,8 @@ test "$CANNOT_DUMP" = yes ||
2210case "$opsys" in 2218case "$opsys" in
2211 ## darwin ld insists on the use of malloc routines in the System framework. 2219 ## darwin ld insists on the use of malloc routines in the System framework.
2212 darwin | mingw32 | nacl | sol2-10) ;; 2220 darwin | mingw32 | nacl | sol2-10) ;;
2213 cygwin) hybrid_malloc=yes 2221 cygwin | qnxto)
2222 hybrid_malloc=yes
2214 system_malloc= ;; 2223 system_malloc= ;;
2215 *) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;; 2224 *) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
2216esac 2225esac
@@ -4603,7 +4612,7 @@ case $opsys in
4603 AC_DEFINE(PTY_TTY_NAME_SPRINTF, []) 4612 AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
4604 ;; 4613 ;;
4605 4614
4606 gnu | openbsd ) 4615 gnu | openbsd | qnxnto )
4607 AC_DEFINE(FIRST_PTY_LETTER, ['p']) 4616 AC_DEFINE(FIRST_PTY_LETTER, ['p'])
4608 ;; 4617 ;;
4609 4618
@@ -5144,6 +5153,8 @@ elif test "$opsys" = "mingw32"; then
5144 CYGWIN_OBJ= 5153 CYGWIN_OBJ=
5145 PRE_ALLOC_OBJ= 5154 PRE_ALLOC_OBJ=
5146 POST_ALLOC_OBJ=lastfile.o 5155 POST_ALLOC_OBJ=lastfile.o
5156elif test "$opsys" = "qnxnto"; then
5157 CYGWIN_OBJ=sheap.o
5147else 5158else
5148 CYGWIN_OBJ= 5159 CYGWIN_OBJ=
5149 PRE_ALLOC_OBJ=lastfile.o 5160 PRE_ALLOC_OBJ=lastfile.o
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! */
58#include <sys/types.h> 58#include <sys/types.h>
59#include <unistd.h> 59#include <unistd.h>
60 60
61#if !defined (__NetBSD__) && !defined (__OpenBSD__) 61#ifdef __QNX__
62#include <elf.h> 62# include <sys/elf.h>
63#endif /* not __NetBSD__ and not __OpenBSD__ */ 63#elif !defined __NetBSD__ && !defined __OpenBSD__
64# include <elf.h>
65#endif
64#include <sys/mman.h> 66#include <sys/mman.h>
65#if defined (_SYSTYPE_SYSV) 67#if defined (_SYSTYPE_SYSV)
66#include <sys/elf_mips.h> 68#include <sys/elf_mips.h>
@@ -222,7 +224,6 @@ unexec (const char *new_name, const char *old_name)
222{ 224{
223 int new_file, old_file; 225 int new_file, old_file;
224 off_t new_file_size; 226 off_t new_file_size;
225 void *new_break;
226 227
227 /* Pointers to the base of the image of the two files. */ 228 /* Pointers to the base of the image of the two files. */
228 caddr_t old_base, new_base; 229 caddr_t old_base, new_base;
@@ -326,11 +327,13 @@ unexec (const char *new_name, const char *old_name)
326 if (old_bss_index == -1) 327 if (old_bss_index == -1)
327 fatal ("no bss section found"); 328 fatal ("no bss section found");
328 329
330 void *no_break = (void *) (intptr_t) -1;
331 void *new_break = no_break;
329#ifdef HAVE_SBRK 332#ifdef HAVE_SBRK
330 new_break = sbrk (0); 333 new_break = sbrk (0);
331#else
332 new_break = (byte *) old_bss_addr + old_bss_size;
333#endif 334#endif
335 if (new_break == no_break)
336 new_break = (byte *) old_bss_addr + old_bss_size;
334 new_bss_addr = (ElfW (Addr)) new_break; 337 new_bss_addr = (ElfW (Addr)) new_break;
335 bss_size_growth = new_bss_addr - old_bss_addr; 338 bss_size_growth = new_bss_addr - old_bss_addr;
336 new_data2_size = bss_size_growth; 339 new_data2_size = bss_size_growth;