Skip to content

Commit c171724

Browse files
committed
[qnx] Add all modified files missed in previous commit.
1 parent 1bd21fd commit c171724

27 files changed

+163
-12
lines changed

configure.in

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,19 @@ case "$host" in
175175
with_sigaltstack=no
176176
use_sigposix=yes
177177
;;
178+
*-*-qnx*)
179+
CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -D_QNX_SOURCE -D_REENTRANT -DUSE_MMAP"
180+
libmono_cflags="-D_THREAD_SAFE -D_REENTRANT"
181+
platform_win32=no
182+
use_sigposix=yes
183+
with_tls=pthread
184+
libgc_threads=pthreads
185+
with_sigaltstack=no
186+
with_glib=embedded
187+
disable_nls=yes
188+
parallel_mark=no
189+
mono_cv_uscore=yes
190+
;;
178191
*-*-linux*)
179192
platform_win32=no
180193
CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
@@ -2203,6 +2216,15 @@ case "$host" in
22032216
jit_wanted=true
22042217
CPPFLAGS="$CPPFLAGS -DARM_FPU_VFP=1 -D__ARM_EABI__"
22052218
;;
2219+
arm*-*-qnx*)
2220+
TARGET=ARM;
2221+
arch_target=arm;
2222+
ACCESS_UNALIGNED="no"
2223+
JIT_SUPPORTED=yes
2224+
jit_wanted=true
2225+
CPPFLAGS="$CPPFLAGS -O2 -marm -Wa,-march=armv7-a -march=armv7-a -Wa,-mfpu=neon -mfpu=neon -mfloat-abi=softfp -mtune=cortex-a9 -ffunction-sections -fdata-sections -fno-strict-aliasing -DARM_FPU_VFP=1 -D__ARM_EABI__ -DHAVE_ARMV6"
2226+
LDFLAGS="$LDFLAGS -Wl,--rpath,app/native/Data/Managed -L${QNX_TARGET}/armle-v7/lib/gcc/4.6.3"
2227+
;;
22062228
arm*-linux*)
22072229
TARGET=ARM;
22082230
arch_target=arm;
@@ -2352,6 +2374,11 @@ case "$host" in
23522374
LIBC="libc.so"
23532375
INTL="libintl.so"
23542376
;;
2377+
*-*-*qnx*)
2378+
LIBC="libc.so"
2379+
INTL="libintl.so"
2380+
soname_spec='${libname}${shared_ext}'
2381+
;;
23552382
*-*-*linux*)
23562383
AC_PATH_X
23572384
AC_MSG_CHECKING(for the soname of libX11.so)

eglib/configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ AM_CONDITIONAL(NEEDS_LIBGCC, test x$needs_libgcc = xyes)
7979
AC_CHECK_SIZEOF(int)
8080
AC_CHECK_SIZEOF(void *)
8181
AC_CHECK_FUNCS(strndup strlcpy getpwent_r strtok_r rewinddir)
82+
AM_CONDITIONAL(NEED_VASPRINTF, test x$have_vasprintf = x )
8283
if test "x$WANT_ICONV" = "x1"; then
8384
AC_CHECK_LIB(iconv, libiconv_open, LIBS="$LIBS -liconv")
8485
fi

eglib/src/Makefile.am

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ unix_files = \
88
gdate-unix.c gdir-unix.c gfile-unix.c gmisc-unix.c \
99
gmodule-unix.c gtimer-unix.c
1010

11+
# some unices and windows do not have an implementation of vasprintf
12+
# used by eglib, use provided implementation instead
13+
if NEED_VASPRINTF
14+
vasprintf_files = vasprintf.c
15+
else
16+
vaprinttf_files = foo.c
17+
endif
18+
1119
if PLATFORM_WIN32
1220
os_files = $(win_files)
1321
else
@@ -40,7 +48,8 @@ libeglib_la_SOURCES = \
4048
gutf8.c \
4149
gunicode.c \
4250
unicode-data.h \
43-
$(os_files)
51+
$(os_files) \
52+
$(vasprintf_files)
4453

4554
libeglib_la_CFLAGS = -Wall -D_FORTIFY_SOURCE=2
4655

libgc/configure.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ case "$THREADS" in
164164
INCLUDES="$INCLUDES -pthread"
165165
THREADDLLIBS="-lpthread -lrt"
166166
;;
167+
*-*-qnx*)
168+
AC_DEFINE(GC_QNX_THREADS)
169+
if test "${enable_parallel_mark}" = yes; then
170+
AC_DEFINE(PARALLEL_MARK)
171+
fi
172+
AC_DEFINE(THREAD_LOCAL_ALLOC)
173+
;;
167174
*)
168175
AC_MSG_ERROR("Pthreads not supported by the GC on this platform.")
169176
;;

libgc/include/gc_config_macros.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
|| defined(GC_SOLARIS_PTHREADS) \
4343
|| defined(GC_HPUX_THREADS) \
4444
|| defined(GC_AIX_THREADS) \
45-
|| defined(GC_LINUX_THREADS))
45+
|| defined(GC_LINUX_THREADS) \
46+
|| defined(GC_QNX_THREADS))
4647
# define _REENTRANT
4748
/* Better late than never. This fails if system headers that */
4849
/* depend on this were previously included. */
@@ -57,7 +58,8 @@
5758
defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) || \
5859
defined(GC_DGUX386_THREADS) || defined(GC_DARWIN_THREADS) || \
5960
defined(GC_AIX_THREADS) || defined(GC_NETBSD_THREADS) || \
60-
(defined(GC_WIN32_THREADS) && defined(__CYGWIN32__))
61+
(defined(GC_WIN32_THREADS) && defined(__CYGWIN32__)) || \
62+
defined(GC_QNX_THREADS)
6163
# define GC_PTHREADS
6264
# endif
6365

@@ -99,6 +101,10 @@
99101
# define GC_AIX_THREADS
100102
# define GC_PTHREADS
101103
# endif
104+
# if defined(__QNXNTO__)
105+
# define GC_QNX_THREADS
106+
# define GC_PTHREADS
107+
# endif
102108
#endif /* GC_THREADS */
103109

104110
#if defined(GC_THREADS) && !defined(GC_PTHREADS) && \

libgc/include/private/gcconfig.h

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,15 @@
6464
# define DARWIN
6565
# endif
6666

67+
/* And one for QNX: */
68+
# if defined(__QNXNTO__)
69+
# define QNX
70+
# endif
71+
6772
/* Determine the machine type: */
6873
# if defined(__arm__) || defined(__thumb__)
6974
# define ARM32
70-
# if !defined(LINUX) && !defined(NETBSD) && !defined(DARWIN)
75+
# if !defined(LINUX) && !defined(NETBSD) && !defined(DARWIN) && !defined(QNX)
7176
# define NOSYS
7277
# define mach_type_known
7378
# endif
@@ -370,6 +375,14 @@
370375
# define OPENBSD
371376
# define mach_type_known
372377
# endif
378+
# if defined(QNX) && (defined(i386) || defined(__i386__))
379+
# define I386
380+
# define mach_type_known
381+
# endif
382+
# if defined(QNX) && defined(__arm__)
383+
# define ARM32
384+
# define mach_type_known
385+
# endif
373386
# if defined(FREEBSD) && (defined(i386) || defined(__i386__))
374387
# define I386
375388
# define mach_type_known
@@ -1329,6 +1342,11 @@
13291342
# define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
13301343
/* This may not be right. */
13311344
# endif
1345+
# ifdef QNX
1346+
# define OS_TYPE "QNX"
1347+
extern int etext[];
1348+
# define DATASTART ((ptr_t)((((word) (etext)) + 0x1ff) & ~0x1ff))
1349+
# endif
13321350
# ifdef OPENBSD
13331351
# define OS_TYPE "OPENBSD"
13341352
# endif
@@ -1955,6 +1973,11 @@
19551973
# define USE_MUNMAP
19561974
# endif
19571975
# endif
1976+
# ifdef QNX
1977+
# define OS_TYPE "QNX"
1978+
extern int etext[];
1979+
# define DATASTART ((ptr_t)((((word) (etext)) + 0x1ff) & ~0x1ff))
1980+
# endif
19581981
# ifdef NOSYS
19591982
/* __data_start is usually defined in the target linker script. */
19601983
extern int __data_start[];

libgc/os_dep.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@
6464
# include <ctype.h>
6565
#endif
6666

67+
#if defined(__QNXNTO__)
68+
#include <fcntl.h>
69+
#endif
70+
6771
/* Blatantly OS dependent routines, except for those that are related */
6872
/* to dynamic loading. */
6973

@@ -1028,7 +1032,8 @@ void *GC_set_stackbottom = NULL;
10281032
ptr_t GC_get_stack_base()
10291033
{
10301034
# if defined(HEURISTIC1) || defined(HEURISTIC2) || \
1031-
defined(LINUX_STACKBOTTOM) || defined(FREEBSD_STACKBOTTOM)
1035+
defined(LINUX_STACKBOTTOM) || defined(FREEBSD_STACKBOTTOM) || \
1036+
defined(QNX)
10321037
word dummy;
10331038
ptr_t result;
10341039
# endif

libgc/pthread_stop_world.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
#include "include/libgc-mono-debugger.h"
2222
#endif
2323

24+
#ifdef __QNXNTO__
25+
#define SA_RESTART 0
26+
#endif
27+
2428
#if DEBUG_THREADS
2529

2630
#ifndef NSIG

libgc/pthread_support.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868

6969
# if (defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) || \
7070
defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS)) || \
71-
defined(GC_NETBSD_THREADS) && !defined(USE_PTHREAD_SPECIFIC)
71+
defined(GC_NETBSD_THREADS) && !defined(USE_PTHREAD_SPECIFIC) || \
72+
defined(GC_QNX_THREADS)
7273
# define USE_PTHREAD_SPECIFIC
7374
# endif
7475

@@ -1037,7 +1038,7 @@ void GC_thr_init()
10371038
# if defined(GC_HPUX_THREADS)
10381039
GC_nprocs = pthread_num_processors_np();
10391040
# endif
1040-
# if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS)
1041+
# if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) || defined(GC_QNX_THREADS)
10411042
GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN);
10421043
if (GC_nprocs <= 0) GC_nprocs = 1;
10431044
# endif

mono/dis/dis-cil.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#ifdef HAVE_IEEEFP_H
2727
#include <ieeefp.h>
28+
#ifndef __QNXNTO__
2829
int isinf (double);
2930
int
3031
isinf (double num)
@@ -40,6 +41,7 @@ isinf (double num)
4041

4142
return 0;
4243
}
44+
#endif
4345
#else
4446
#error "Don't know how to implement isinf for this platform."
4547
#endif

mono/dis/dump.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
#ifndef HAVE_ISINF
2525

2626
#ifdef HAVE_IEEEFP_H
27+
#ifndef __QNXNTO__
2728
extern int isinf (double);
2829
#endif
30+
#endif
2931

3032
#endif
3133

mono/io-layer/misc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#include <sys/time.h>
1313
#include <stdlib.h>
1414
#include <string.h>
15+
#ifdef __QNXNTO__
16+
#include <time.h>
17+
#endif
1518

1619
#include "misc-private.h"
1720

mono/io-layer/processes.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
#include <sys/resource.h>
3636
#endif
3737

38+
#ifdef __QNXNTO__
39+
#include <sys/netmgr.h>
40+
#endif
41+
3842
#if defined(PLATFORM_MACOSX) || defined(__OpenBSD__)
3943
#include <sys/proc.h>
4044
#include <sys/sysctl.h>
@@ -1886,7 +1890,11 @@ static GSList *load_modules (void)
18861890
mod->address_end = GINT_TO_POINTER (sec->addr+sec->size);
18871891
mod->perms = g_strdup ("r--p");
18881892
mod->address_offset = 0;
1893+
#ifndef __QNXNTO__
18891894
mod->device = makedev (0, 0);
1895+
#else
1896+
mod->device = makedev (ND_LOCAL_NODE, 0, 0);
1897+
#endif
18901898
mod->inode = (ino_t) i;
18911899
mod->filename = g_strdup (name);
18921900

@@ -2052,7 +2060,11 @@ static GSList *load_modules (FILE *fp)
20522060
continue;
20532061
}
20542062

2063+
#ifndef __QNXNTO__
20552064
device = makedev ((int)maj_dev, (int)min_dev);
2065+
#else
2066+
device = makedev (ND_LOCAL_NODE, (int)maj_dev, (int)min_dev);
2067+
#endif
20562068
if ((device == 0) &&
20572069
(inode == 0)) {
20582070
continue;

mono/io-layer/shared.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <string.h>
1919
#include <unistd.h>
2020

21-
#ifdef HAVE_SYS_SEM_H
21+
#if defined(HAVE_SYS_SEM_H) && !defined(__QNXNTO__)
2222
# include <sys/sem.h>
2323
#else
2424
# define DISABLE_SHARED_HANDLES

mono/metadata/mono-config.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#define CONFIG_OS "netbsd"
3232
#elif defined(__OpenBSD__)
3333
#define CONFIG_OS "openbsd"
34+
#elif defined(__QNXNTO__)
35+
#define CONFIG_OS "QNX"
3436
#elif defined(__WIN32__)
3537
#define CONFIG_OS "windows"
3638
#elif defined(_IBMR2)

mono/mini/debugger-agent.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
#define TARGET_WIN32
5050
#endif
5151

52+
#ifdef __QNXNTO__
53+
#include <sys/select.h>
54+
#endif
55+
5256
#ifdef HOST_WIN32
5357
#include <ws2tcpip.h>
5458
#ifdef __GNUC__

mono/mini/exceptions-arm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ typedef struct ucontext {
8686
*/
8787

8888
#if !defined(MONO_CROSS_COMPILE)
89-
#if __APPLE__
89+
#if __APPLE__ || __QNXNTO__
9090
#define my_ucontext ucontext_t
9191
#else
9292
typedef struct my_ucontext {

mono/mini/mini-arm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,11 @@ mono_arch_regalloc_cost (MonoCompile *cfg, MonoMethodVar *vmv)
688688
#define __GNUC_PREREQ(maj, min) (0)
689689
#endif
690690

691+
#if defined(__QNXNTO__)
692+
# include <sys/mman.h>
693+
# define CLEAR_CACHE(__beg, __end) msync(__beg, (__end) - (__beg), MS_INVALIDATE_ICACHE)
694+
#endif
695+
691696
void
692697
mono_arch_flush_icache (guint8 *code, gint size)
693698
{
@@ -711,6 +716,8 @@ mono_arch_flush_icache (guint8 *code, gint size)
711716
: "r" (code), "r" (code + size), "r" (syscall)
712717
: "r0", "r1", "r7", "r2"
713718
);
719+
#elif __QNXNTO__
720+
CLEAR_CACHE(code, code + size);
714721
#else
715722
__asm __volatile ("mov r0, %0\n"
716723
"mov r1, %1\n"

mono/mini/mini-arm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ typedef struct MonoCompileArch {
197197
#define UCONTEXT_REG_PC(ctx) ((ctx)->uc_mcontext->__ss.__pc)
198198
#define UCONTEXT_REG_SP(ctx) ((ctx)->uc_mcontext->__ss.__sp)
199199
#define UCONTEXT_REG_R0(ctx) ((ctx)->uc_mcontext->__ss.__r[0])
200+
#elif __QNXNTO__
201+
#define UCONTEXT_REG_PC(ctx) ((ctx)->uc_mcontext.cpu.gpr[ARM_REG_PC])
202+
#define UCONTEXT_REG_SP(ctx) ((ctx)->uc_mcontext.cpu.gpr[ARM_REG_SP])
203+
#define UCONTEXT_REG_R0(ctx) ((ctx)->uc_mcontext.cpu.gpr[ARM_REG_R0])
200204
#else
201205
#define UCONTEXT_REG_PC(ctx) ((ctx)->sig_ctx.arm_pc)
202206
#define UCONTEXT_REG_SP(ctx) ((ctx)->sig_ctx.arm_sp)

mono/mini/mini-x86.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ LONG CALLBACK seh_handler(EXCEPTION_POINTERS* ep);
4545
#endif /* PLATFORM_WIN32 */
4646

4747
#if defined( __linux__) && !defined(ANDROID) || defined(__sun) || defined(__APPLE__) || defined(__NetBSD__) || \
48-
defined(__FreeBSD__) || defined(__OpenBSD__)
48+
defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNXNTO__)
4949
#define MONO_ARCH_USE_SIGACTION
5050
#endif
5151

mono/mini/wapihandles.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "mini.h"
55

6-
#if defined(PLATFORM_WIN32) || !defined(HAVE_SYS_IPC_H) || !defined(HAVE_SYS_SEM_H)
6+
#if defined(PLATFORM_WIN32) || !defined(HAVE_SYS_IPC_H) || !defined(HAVE_SYS_SEM_H) || defined(__QNXNTO__)
77

88
int mini_wapi_hps (int argc, char **argv)
99
{

0 commit comments

Comments
 (0)