Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001680OCamlOCaml generalpublic2003-05-08 01:462013-08-30 22:32
Reporteradministrator 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001680: Patch for compilation in QNX
DescriptionHi,

This diff against the current CVS version will let ocaml compile nicely
in QNX, specifically QNX 6.2.1 on an x86 machine. I don't have access
to any other architectures so I haven't bothered trying to support them.

There are basically just some configure and i386 code generator changes
to recognise QNX, the socket functions are in libsocket but there is no
libnsl, and mmap'ed memory access isn't synced to the file. The
MAP_NOSYNCFILE just says that I don't care about that, so read only
access will work, read/write will fail since the flag isn't used (an
explicit msync call would be needed to sync any changes.)


Julian Kinraid



Index: configure
===================================================================
RCS file: /caml/ocaml/configure,v
retrieving revision 1.186
diff -u -r1.186 configure
--- configure 2003/05/02 12:48:55 1.186
+++ configure 2003/05/07 11:10:34
@@ -452,7 +452,7 @@
 
 if test $withsharedlibs = "yes"; then
   case "$host" in
- *-*-linux-gnu|*-*-linux|*-*-freebsd[3-9]*)
+ *-*-linux-gnu|*-*-linux|*-*-freebsd[3-9]*|*-*-nto*)
       sharedcccompopts="-fPIC"
       mksharedlib="$bytecc -shared -o"
       bytecclinkopts="$bytecclinkopts -Wl,-E"
@@ -538,6 +538,7 @@
   i[3456]86-*-solaris*) arch=i386; system=solaris;;
   i[3456]86-*-beos*) arch=i386; system=beos;;
   i[3456]86-*-cygwin*) arch=i386; system=cygwin;;
+ x86-*-nto*) arch=i386; system=qnxnto;;
   mips-*-irix6*) arch=mips; system=irix;;
   hppa1.1-*-hpux*) arch=hppa; system=hpux;;
   hppa1.1-*-nextstep*) arch=hppa; system=nextstep;;
@@ -617,6 +618,7 @@
   alpha,*,digital) profiling='prof';;
   i386,*,linux_elf) profiling='prof';;
   i386,*,bsd_elf) profiling='prof';;
+ i386,*,qnxnto) profiling='prof';;
   sparc,*,solaris)
     profiling='prof'
     case "$nativecc" in gcc*) ;; *) cc_profile='-xpg';; esac;;
@@ -754,6 +756,11 @@
   cclibs="$cclibs -lnsl -lsocket"
   echo "#define HAS_SOCKETS" >> s.h
   has_sockets=yes
+elif sh ./hasgot -lsocket socket socketpair bind listen accept connect; then
+ echo "You have BSD sockets (with library '-lsocket')"
+ cclibs="$cclibs -lsocket"
+ echo "#define HAS_SOCKETS" >> s.h
+ has_sockets=yes
 fi
 
 if sh ./hasgot -i sys/socket.h -t socklen_t; then
@@ -1024,6 +1031,7 @@
         *) bignum_arch=C;;
     esac;;
   i[3456]86-*-beos) bignum_arch=x86;;
+ x86-*-nto*) bignum_arch=x86;;
   i[3456]86-*-*bsd*)
     case `sh ./runtest elf.c` in
       elf) bignum_arch=x86;;
@@ -1060,6 +1068,8 @@
         bytecccompopts="$bytecccompopts -pthread"
         asppflags="$asppflags -pthread"
         nativecccompopts="$nativecccompopts -pthread";;
+ *-*-nto*)
+ pthread_link="";;
     *)
         pthread_link="-lpthread";;
   esac
Index: asmcomp/i386/emit.mlp
===================================================================
RCS file: /caml/ocaml/asmcomp/i386/emit.mlp,v
retrieving revision 1.26
diff -u -r1.26 emit.mlp
--- asmcomp/i386/emit.mlp 2003/04/25 12:26:59 1.26
+++ asmcomp/i386/emit.mlp 2003/05/07 11:10:37
@@ -52,6 +52,7 @@
   | "bsd_elf" -> ""
   | "solaris" -> ""
   | "beos" -> ""
+ | "qnxnto" -> ""
   | _ -> "_"
 
 let emit_symbol s =
@@ -65,6 +66,7 @@
   | "bsd_elf" -> ".L"
   | "solaris" -> ".L"
   | "beos" -> ".L"
+ | "qnxnto" -> ".L"
   | _ -> "L"
 
 let emit_label lbl =
@@ -92,7 +94,7 @@
 
 let emit_align =
   match Config.system with
- "linux_elf" | "bsd_elf" | "solaris" | "beos" | "cygwin" | "mingw" ->
+ "linux_elf" | "bsd_elf" | "solaris" | "beos" | "cygwin" | "mingw" | "qnxnto" ->
       (fun n -> ` .align {emit_int n}\n`)
   | _ ->
       (fun n -> ` .align {emit_int(Misc.log2 n)}\n`)
Index: asmrun/i386.S
===================================================================
RCS file: /caml/ocaml/asmrun/i386.S,v
retrieving revision 1.38
diff -u -r1.38 i386.S
--- asmrun/i386.S 2002/06/07 09:49:36 1.38
+++ asmrun/i386.S 2003/05/07 11:10:38
@@ -26,7 +26,7 @@
 #endif
 
 #if defined(SYS_linux_elf) || defined(SYS_bsd_elf) \
- || defined(SYS_solaris) || defined(SYS_beos)
+ || defined(SYS_solaris) || defined(SYS_beos) || defined(SYS_qnxnto)
 #define G(x) x
 #define LBL(x) CONCAT(.L,x)
 #else
@@ -36,7 +36,7 @@
 
 #if defined(SYS_linux_elf) || defined(SYS_bsd_elf) \
  || defined(SYS_solaris) || defined(SYS_beos) || defined(SYS_cygwin) \
- || defined(SYS_mingw)
+ || defined(SYS_mingw) || defined(SYS_qnxnto)
 #define FUNCTION_ALIGN 4
 #else
 #define FUNCTION_ALIGN 2
@@ -57,6 +57,13 @@
         popl %edx; popl %ecx; popl %eax; popl %ebp
 #define PROFILE_C \
         pushl %ebp; movl %esp, %ebp; call .mcount; popl %ebp
+#elif defined(SYS_qnxnto)
+#define PROFILE_CAML \
+ pushl %ebp; movl %esp, %ebp; pushl %eax; pushl %ecx; pushl %edx; \
+ call _mcount; \
+ popl %edx; popl %ecx; popl %eax; popl %ebp
+#define PROFILE_C \
+ pushl %ebp; movl %esp, %ebp; call _mcount; popl %ebp
 #endif
 #else
 #define PROFILE_CAML
Index: boot/ocamlc
===================================================================
RCS file: /caml/ocaml/boot/ocamlc,v
retrieving revision 1.286
diff -u -r1.286 ocamlc
Binary files /tmp/cvsyoeLp65423 and ocamlc differ
Index: otherlibs/bigarray/mmap_unix.c
===================================================================
RCS file: /caml/ocaml/otherlibs/bigarray/mmap_unix.c,v
retrieving revision 1.7
diff -u -r1.7 mmap_unix.c
--- otherlibs/bigarray/mmap_unix.c 2001/12/07 13:39:50 1.7
+++ otherlibs/bigarray/mmap_unix.c 2003/05/07 11:12:43
@@ -90,7 +90,11 @@
   /* Restore original file position */
   lseek(fd, currpos, SEEK_SET);
   /* Do the mmap */
+#ifdef __QNXNTO__
+ shared = Bool_val(vshared) ? MAP_SHARED : MAP_PRIVATE | MAP_NOSYNCFILE;
+#else
   shared = Bool_val(vshared) ? MAP_SHARED : MAP_PRIVATE;
+#endif
   addr = mmap(NULL, array_size, PROT_READ | PROT_WRITE, shared, fd, 0);
   if (addr == (void *) MAP_FAILED) sys_error(NO_ARG);
   /* Build and return the Caml bigarray */

Tagspatch
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue
2013-08-30 22:32 doligez Tag Attached: patch


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker