diff --git a/configure b/configure index 8783b80..1e77e47 100755 --- a/configure +++ b/configure @@ -5358,6 +5358,12 @@ case "${canonical}" in esac ;; + ## QNX Neutrino + *-nto-qnx* ) + opsys=qnxnto + CFLAGS="$CFLAGS -D__NO_EXT_QNX" + ;; + ## Intel 386 machines where we don't care about the manufacturer. i[3456]86-*-* ) case "${canonical}" in @@ -9607,6 +9613,8 @@ case "$opsys" in hpux*) LIBS_SYSTEM="-l:libdld.sl" ;; + qnxnto) LIBS_SYSTEM="-lsocket" ;; + sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;; ## Motif needs -lgen. @@ -11475,7 +11483,7 @@ hybrid_malloc= case "$opsys" in ## darwin ld insists on the use of malloc routines in the System framework. darwin | mingw32 | nacl | sol2-10) system_malloc=yes ;; - cygwin) hybrid_malloc=yes;; + cygwin | qnxnto ) hybrid_malloc=yes;; esac GMALLOC_OBJ= @@ -18475,7 +18483,7 @@ case $opsys in ;; - gnu | openbsd ) + gnu | openbsd | qnxnto ) $as_echo "#define FIRST_PTY_LETTER 'p'" >>confdefs.h ;; @@ -19254,6 +19262,8 @@ elif test "$opsys" = "mingw32"; then CYGWIN_OBJ= PRE_ALLOC_OBJ= POST_ALLOC_OBJ=lastfile.o +elif test "$opsys" = "qnxnto"; then + CYGWIN_OBJ=sheap.o else CYGWIN_OBJ= PRE_ALLOC_OBJ=lastfile.o diff --git a/configure.ac b/configure.ac index 2a4e0c1..6ba7db6 100644 --- a/configure.ac +++ b/configure.ac @@ -697,6 +697,12 @@ case "${canonical}" in *) ;; esac ;; + + ## QNX Neutrino + *-nto-qnx* ) + opsys=qnxnto + CFLAGS="$CFLAGS -D__NO_EXT_QNX" + ;; ## Intel 386 machines where we don't care about the manufacturer. i[3456]86-*-* ) @@ -1440,6 +1446,8 @@ case "$opsys" in hpux*) LIBS_SYSTEM="-l:libdld.sl" ;; + qnxnto) LIBS_SYSTEM="-lsocket" ;; + sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;; ## Motif needs -lgen. @@ -2137,7 +2145,7 @@ hybrid_malloc= case "$opsys" in ## darwin ld insists on the use of malloc routines in the System framework. darwin | mingw32 | nacl | sol2-10) system_malloc=yes ;; - cygwin) hybrid_malloc=yes;; + cygwin | qnxnto ) hybrid_malloc=yes;; esac GMALLOC_OBJ= @@ -4465,7 +4473,7 @@ case $opsys in AC_DEFINE(PTY_TTY_NAME_SPRINTF, []) ;; - gnu | openbsd ) + gnu | openbsd | qnxnto ) AC_DEFINE(FIRST_PTY_LETTER, ['p']) ;; @@ -5045,6 +5053,8 @@ elif test "$opsys" = "mingw32"; then CYGWIN_OBJ= PRE_ALLOC_OBJ= POST_ALLOC_OBJ=lastfile.o +elif test "$opsys" = "qnxnto"; then + CYGWIN_OBJ=sheap.o else CYGWIN_OBJ= PRE_ALLOC_OBJ=lastfile.o diff --git a/src/gmalloc.c b/src/gmalloc.c index a63927e..3489277 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c @@ -67,7 +67,7 @@ extern _Noreturn void emacs_abort (void) NO_INLINE; #define aligned_alloc galigned_alloc #define free gfree -#ifdef CYGWIN +#ifdef HYBRID_MALLOC extern void *bss_sbrk (ptrdiff_t size); extern int bss_sbrk_did_unexec; extern char bss_sbrk_buffer[]; @@ -1516,7 +1516,7 @@ void * __default_morecore (ptrdiff_t increment) { void *result; -#if defined (CYGWIN) +#if defined (HYBRID_MALLOC) if (!DUMPED) { return bss_sbrk (increment); diff --git a/src/unexelf.c b/src/unexelf.c index 5a56cbd..bf05e29 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -58,9 +58,11 @@ what you give them. Help stamp out software-hoarding! */ #include #include -#if !defined (__NetBSD__) && !defined (__OpenBSD__) +#ifdef __QNX__ +#include +#elif !defined __NetBSD__ && !defined __OpenBSD__ #include -#endif /* not __NetBSD__ and not __OpenBSD__ */ +#endif #include #if defined (_SYSTYPE_SYSV) #include @@ -191,6 +193,10 @@ verify ((! TYPE_SIGNED (ElfW (Half)) # define DEBUG_LOG(expr) fprintf (stderr, #expr " 0x%jx\n", (uintmax_t) (expr)) #endif +#ifdef HYBRID_MALLOC +extern int bss_sbrk_did_unexec; +#endif + /* Get the address of a particular section or program header entry, * accounting for the size of the entries. */ @@ -329,8 +335,15 @@ unexec (const char *new_name, const char *old_name) if (old_bss_index == -1) fatal ("no bss section found"); +#ifdef HYBRID_MALLOC + /* The pre-dump hybrid malloc uses an area in the BSS as a heap, + which means that allocations have no impact on the final size. */ + new_bss_addr = old_bss_addr + old_bss_size; + bss_sbrk_did_unexec = 1; +#else new_break = sbrk (0); new_bss_addr = (ElfW (Addr)) new_break; +#endif bss_size_growth = new_bss_addr - old_bss_addr; new_data2_size = bss_size_growth; new_data2_size += alignof (ElfW (Shdr)) - 1;