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.
This commit is contained in:
parent
19667f44ef
commit
1d83257a1d
2 changed files with 22 additions and 8 deletions
15
configure.ac
15
configure.ac
|
@ -699,6 +699,12 @@ case "${canonical}" in
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
## QNX Neutrino
|
||||||
|
*-nto-qnx* )
|
||||||
|
opsys=qnxnto
|
||||||
|
CFLAGS="$CFLAGS -D__NO_EXT_QNX"
|
||||||
|
;;
|
||||||
|
|
||||||
## Intel 386 machines where we don't care about the manufacturer.
|
## Intel 386 machines where we don't care about the manufacturer.
|
||||||
i[3456]86-*-* )
|
i[3456]86-*-* )
|
||||||
case "${canonical}" in
|
case "${canonical}" in
|
||||||
|
@ -1507,6 +1513,8 @@ case "$opsys" in
|
||||||
|
|
||||||
hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
|
hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
|
||||||
|
|
||||||
|
qnxnto) LIBS_SYSTEM="-lsocket" ;;
|
||||||
|
|
||||||
sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
|
sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
|
||||||
|
|
||||||
## Motif needs -lgen.
|
## Motif needs -lgen.
|
||||||
|
@ -2210,7 +2218,8 @@ test "$CANNOT_DUMP" = yes ||
|
||||||
case "$opsys" in
|
case "$opsys" in
|
||||||
## darwin ld insists on the use of malloc routines in the System framework.
|
## darwin ld insists on the use of malloc routines in the System framework.
|
||||||
darwin | mingw32 | nacl | sol2-10) ;;
|
darwin | mingw32 | nacl | sol2-10) ;;
|
||||||
cygwin) hybrid_malloc=yes
|
cygwin | qnxto)
|
||||||
|
hybrid_malloc=yes
|
||||||
system_malloc= ;;
|
system_malloc= ;;
|
||||||
*) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
|
*) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
|
||||||
esac
|
esac
|
||||||
|
@ -4603,7 +4612,7 @@ case $opsys in
|
||||||
AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
|
AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
|
||||||
;;
|
;;
|
||||||
|
|
||||||
gnu | openbsd )
|
gnu | openbsd | qnxnto )
|
||||||
AC_DEFINE(FIRST_PTY_LETTER, ['p'])
|
AC_DEFINE(FIRST_PTY_LETTER, ['p'])
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -5144,6 +5153,8 @@ elif test "$opsys" = "mingw32"; then
|
||||||
CYGWIN_OBJ=
|
CYGWIN_OBJ=
|
||||||
PRE_ALLOC_OBJ=
|
PRE_ALLOC_OBJ=
|
||||||
POST_ALLOC_OBJ=lastfile.o
|
POST_ALLOC_OBJ=lastfile.o
|
||||||
|
elif test "$opsys" = "qnxnto"; then
|
||||||
|
CYGWIN_OBJ=sheap.o
|
||||||
else
|
else
|
||||||
CYGWIN_OBJ=
|
CYGWIN_OBJ=
|
||||||
PRE_ALLOC_OBJ=lastfile.o
|
PRE_ALLOC_OBJ=lastfile.o
|
||||||
|
|
|
@ -58,9 +58,11 @@ what you give them. Help stamp out software-hoarding! */
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#if !defined (__NetBSD__) && !defined (__OpenBSD__)
|
#ifdef __QNX__
|
||||||
#include <elf.h>
|
# include <sys/elf.h>
|
||||||
#endif /* not __NetBSD__ and not __OpenBSD__ */
|
#elif !defined __NetBSD__ && !defined __OpenBSD__
|
||||||
|
# include <elf.h>
|
||||||
|
#endif
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#if defined (_SYSTYPE_SYSV)
|
#if defined (_SYSTYPE_SYSV)
|
||||||
#include <sys/elf_mips.h>
|
#include <sys/elf_mips.h>
|
||||||
|
@ -222,7 +224,6 @@ unexec (const char *new_name, const char *old_name)
|
||||||
{
|
{
|
||||||
int new_file, old_file;
|
int new_file, old_file;
|
||||||
off_t new_file_size;
|
off_t new_file_size;
|
||||||
void *new_break;
|
|
||||||
|
|
||||||
/* Pointers to the base of the image of the two files. */
|
/* Pointers to the base of the image of the two files. */
|
||||||
caddr_t old_base, new_base;
|
caddr_t old_base, new_base;
|
||||||
|
@ -326,11 +327,13 @@ unexec (const char *new_name, const char *old_name)
|
||||||
if (old_bss_index == -1)
|
if (old_bss_index == -1)
|
||||||
fatal ("no bss section found");
|
fatal ("no bss section found");
|
||||||
|
|
||||||
|
void *no_break = (void *) (intptr_t) -1;
|
||||||
|
void *new_break = no_break;
|
||||||
#ifdef HAVE_SBRK
|
#ifdef HAVE_SBRK
|
||||||
new_break = sbrk (0);
|
new_break = sbrk (0);
|
||||||
#else
|
|
||||||
new_break = (byte *) old_bss_addr + old_bss_size;
|
|
||||||
#endif
|
#endif
|
||||||
|
if (new_break == no_break)
|
||||||
|
new_break = (byte *) old_bss_addr + old_bss_size;
|
||||||
new_bss_addr = (ElfW (Addr)) new_break;
|
new_bss_addr = (ElfW (Addr)) new_break;
|
||||||
bss_size_growth = new_bss_addr - old_bss_addr;
|
bss_size_growth = new_bss_addr - old_bss_addr;
|
||||||
new_data2_size = bss_size_growth;
|
new_data2_size = bss_size_growth;
|
||||||
|
|
Loading…
Add table
Reference in a new issue