Date: Sat, 8 May 1999 02:38:56 +0200 (CEST) From: rk@ronald.org To: FreeBSD-gnats-submit@freebsd.org Subject: ports/11566: lang/ocaml port fix Message-ID: <199905080038.CAA86273@merlin.rz.tu-clausthal.de>
next in thread | raw e-mail | index | archive | help
>Number: 11566 >Category: ports >Synopsis: lang/ocaml port fix >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri May 7 17:40:01 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Ronald Kuehn >Release: FreeBSD 3.1-STABLE i386 >Organization: Clausthal University of Technology >Environment: FreeBSD 3.1-STABLE and 4.0-CURRENT i386 (ELF systems) >Description: Parts of the lang/ocaml port don't support FreeBSD ELF systems (ocamlopt.opt, ocamlc.opt) and profiling does not work. I sent this patch to the MAINTAINER ortmann@isl.net. I submitted this PR to make sure that the patch won't get lost. Ronald >How-To-Repeat: The ocamlopt.opt and ocamlc.opt programs are excluded in the ports Makefile by the maintainer. >Fix: The following patch should fix the problems for ocamlopt.opt and ocamlc.opt on ELF systems and enable support for profiling (gprof). diff -ruN ocaml.orig/Makefile ocaml/Makefile --- ocaml.orig/Makefile Sat Mar 27 23:15:53 1999 +++ ocaml/Makefile Thu May 6 23:56:36 1999 @@ -17,13 +17,12 @@ EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} ${DISTNAME}-refman.html${EXTRACT_SUFX} USE_XLIB= yes HAS_CONFIGURE= yes -USE_GMAKE= yes -ALL_TARGET= world bootstrap opt -# targets not yet working (due to Elf) ==> ocamlc.opt ocamlopt.opt +#USE_GMAKE= yes +ALL_TARGET= world bootstrap opt ocamlc.opt ocamlopt.opt MAN1= ocaml.1 ocamlc.1 ocamlcp.1 ocamldep.1 ocamllex.1 \ - ocamlopt.1 ocamlprof.1 ocamlrun.1 ocamlyacc.1 ocamlmktop.1 -# manpages not yet installing (due to Elf) ==> ocamlc.opt.1 ocamlopt.opt.1 + ocamlopt.1 ocamlprof.1 ocamlrun.1 ocamlyacc.1 ocamlmktop.1 \ + ocamlc.opt.1 ocamlopt.opt.1 CONFIGURE_ENV= PREFIX=${PREFIX} X11BASE=${X11BASE} BATCH=${BATCH} diff -ruN ocaml.orig/patches/patch-aa ocaml/patches/patch-aa --- ocaml.orig/patches/patch-aa Wed Mar 24 18:52:27 1999 +++ ocaml/patches/patch-aa Thu May 6 23:56:36 1999 @@ -1,59 +1,76 @@ -*** configure.orig Thu Mar 18 13:45:41 1999 ---- configure Thu Mar 18 13:41:54 1999 -*************** -*** 111,137 **** - - # Check for buggy versions of GCC - -! case "$host,$cc" in -! i[3456]86-*-*,gcc*) -! case `$cc --version` in -! 2.7.2.1) cat <<'EOF' -! -! WARNING: you are using gcc version 2.7.2.1 on an Intel x86 processor. -! This version of gcc is known to generate incorrect code for the -! Objective Caml runtime system on some Intel x86 machines. (The symptom -! is a crash of boot/ocamlc when compiling stdlib/pervasives.mli.) -! In particular, the version of gcc 2.7.2.1 that comes with -! Linux RedHat 4.x / Intel is affected by this problem. -! Other Linux distributions might also be affected. -! If you are using one of these configurations, you are strongly advised -! to use another version of gcc, such as 2.7.2 or 2.7.2.2, which are -! known to work well with Objective Caml. -! -! Press <enter> to proceed or <interrupt> to stop. -! EOF -! read reply;; -! esac;; -! esac - - # Configure the bytecode compiler - ---- 111,137 ---- - - # Check for buggy versions of GCC - -! #case "$host,$cc" in -! # i[3456]86-*-*,gcc*) -! # case `$cc --version` in -! # 2.7.2.1) cat <<'EOF' -! # -! #WARNING: you are using gcc version 2.7.2.1 on an Intel x86 processor. -! #This version of gcc is known to generate incorrect code for the -! #Objective Caml runtime system on some Intel x86 machines. (The symptom -! #is a crash of boot/ocamlc when compiling stdlib/pervasives.mli.) -! #In particular, the version of gcc 2.7.2.1 that comes with -! #Linux RedHat 4.x / Intel is affected by this problem. -! #Other Linux distributions might also be affected. -! #If you are using one of these configurations, you are strongly advised -! #to use another version of gcc, such as 2.7.2 or 2.7.2.2, which are -! #known to work well with Objective Caml. -! # -! #Press <enter> to proceed or <interrupt> to stop. -! #EOF -! # read reply;; -! # esac;; -! #esac - - # Configure the bytecode compiler - +--- configure.orig Thu May 6 17:22:52 1999 ++++ configure Thu May 6 17:23:05 1999 +@@ -111,27 +111,27 @@ + + # Check for buggy versions of GCC + +-case "$host,$cc" in +- i[3456]86-*-*,gcc*) +- case `$cc --version` in +- 2.7.2.1) cat <<'EOF' +- +-WARNING: you are using gcc version 2.7.2.1 on an Intel x86 processor. +-This version of gcc is known to generate incorrect code for the +-Objective Caml runtime system on some Intel x86 machines. (The symptom +-is a crash of boot/ocamlc when compiling stdlib/pervasives.mli.) +-In particular, the version of gcc 2.7.2.1 that comes with +-Linux RedHat 4.x / Intel is affected by this problem. +-Other Linux distributions might also be affected. +-If you are using one of these configurations, you are strongly advised +-to use another version of gcc, such as 2.7.2 or 2.7.2.2, which are +-known to work well with Objective Caml. +- +-Press <enter> to proceed or <interrupt> to stop. +-EOF +- read reply;; +- esac;; +-esac ++#case "$host,$cc" in ++# i[3456]86-*-*,gcc*) ++# case `$cc --version` in ++# 2.7.2.1) cat <<'EOF' ++# ++#WARNING: you are using gcc version 2.7.2.1 on an Intel x86 processor. ++#This version of gcc is known to generate incorrect code for the ++#Objective Caml runtime system on some Intel x86 machines. (The symptom ++#is a crash of boot/ocamlc when compiling stdlib/pervasives.mli.) ++#In particular, the version of gcc 2.7.2.1 that comes with ++#Linux RedHat 4.x / Intel is affected by this problem. ++#Other Linux distributions might also be affected. ++#If you are using one of these configurations, you are strongly advised ++#to use another version of gcc, such as 2.7.2 or 2.7.2.2, which are ++#known to work well with Objective Caml. ++# ++#Press <enter> to proceed or <interrupt> to stop. ++#EOF ++# read reply;; ++# esac;; ++#esac + + # Configure the bytecode compiler + +@@ -269,6 +269,8 @@ + i[3456]86-*-linuxaout) arch=i386; system=linux_aout;; + i[3456]86-*-linuxoldld) arch=i386; system=linux_aout;; + i[3456]86-*-linux) arch=i386; system=linux_elf;; ++ i[3456]86-*-freebsd2*) arch=i386; system=bsd;; ++ i[3456]86-*-freebsd*) arch=i386; system=freebsd;; + i[3456]86-*-*bsd*) arch=i386; system=bsd;; + i[3456]86-*-nextstep*) arch=i386; system=nextstep;; + i[3456]86-*-solaris*) arch=i386; system=solaris;; +@@ -328,6 +330,7 @@ + case "$arch,$model,$system" in + alpha,*,digital) profiling='prof';; + i386,*,linux_elf) profiling='prof';; ++ i386,*,freebsd) profiling='prof';; + *) profiling='noprof';; + esac + +@@ -610,6 +613,7 @@ + mips-*-ultrix*) bignum_arch=mips;; + alpha-*-osf*) bignum_arch=alpha;; + i[3456]86-*-linux) bignum_arch=x86;; ++ i[3456]86-*-freebsd*) bignum_arch=x86;; + sparc-*-sunos*) bignum_arch=supersparc;; + sparc-*-solaris*) bignum_arch=supersparc-solaris;; + sparc-*-*bsd*) bignum_arch=sparc;; diff -ruN ocaml.orig/patches/patch-ab ocaml/patches/patch-ab --- ocaml.orig/patches/patch-ab Thu Jan 1 01:00:00 1970 +++ ocaml/patches/patch-ab Sat May 8 02:03:58 1999 @@ -0,0 +1,50 @@ +--- asmcomp/i386/emit.mlp.orig Thu Feb 4 11:30:31 1999 ++++ asmcomp/i386/emit.mlp Fri May 7 00:58:25 1999 +@@ -42,12 +42,13 @@ + else !stack_offset + num_stack_slots.(0) * 4 + n * 8 + | Outgoing n -> n + +-(* Symbols are prefixed with _, except under Linux with ELF binaries *) ++(* Symbols are prefixed with _, except for ELF binaries *) + + let symbol_prefix = + match Config.system with + "linux_elf" -> "" + | "solaris" -> "" ++ | "freebsd" -> "" + | _ -> "_" + + let emit_symbol s = +@@ -59,6 +60,7 @@ + match Config.system with + "linux_elf" -> ".L" + | "solaris" -> ".L" ++ | "freebsd" -> ".L" + | _ -> "L" + + let emit_label lbl = +@@ -85,7 +87,7 @@ + + let emit_align = + match Config.system with +- "linux_elf" | "solaris" -> ++ "linux_elf" | "solaris" | "freebsd" -> + (fun n -> ` .align {emit_int n}\n`) + | _ -> + (fun n -> ` .align {emit_int(Misc.log2 n)}\n`) +@@ -703,6 +705,15 @@ + ` pushl %ecx\n`; + ` pushl %edx\n`; + ` call {emit_symbol "mcount"}\n`; ++ ` popl %edx\n`; ++ ` popl %ecx\n`; ++ ` popl %eax\n` ++ | "freebsd" -> ++ ` pushl %eax\n`; ++ ` movl %esp, %ebp\n`; ++ ` pushl %ecx\n`; ++ ` pushl %edx\n`; ++ ` call .mcount\n`; + ` popl %edx\n`; + ` popl %ecx\n`; + ` popl %eax\n` diff -ruN ocaml.orig/patches/patch-ac ocaml/patches/patch-ac --- ocaml.orig/patches/patch-ac Thu Jan 1 01:00:00 1970 +++ ocaml/patches/patch-ac Sat May 8 02:04:29 1999 @@ -0,0 +1,35 @@ +--- asmrun/i386.S.orig Sun Feb 14 17:48:24 1999 ++++ asmrun/i386.S Fri May 7 01:05:46 1999 +@@ -23,7 +23,7 @@ + #define CONCAT(a,b) a##b + #endif + +-#if defined(SYS_linux_elf) || defined(SYS_solaris) ++#if defined(SYS_linux_elf) || defined(SYS_solaris) || defined(SYS_freebsd) + #define G(x) x + #define LBL(x) CONCAT(.L,x) + #define FUNCTION_ALIGN 4 +@@ -33,13 +33,22 @@ + #define FUNCTION_ALIGN 2 + #endif + +-#if defined(PROFILING) && defined(SYS_linux_elf) ++#if defined(PROFILING) ++#if defined(SYS_linux_elf) + #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 ++#elif defined(SYS_freebsd) ++#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 + #define PROFILE_C diff -ruN ocaml.orig/pkg/PLIST ocaml/pkg/PLIST --- ocaml.orig/pkg/PLIST Wed Mar 24 18:52:28 1999 +++ ocaml/pkg/PLIST Thu May 6 23:56:36 1999 @@ -9,6 +9,8 @@ bin/ocamlprof bin/ocamlrun bin/ocamlyacc +bin/ocamlc.opt +bin/ocamlopt.opt lib/ocaml/arg.cmi lib/ocaml/arg.cmx lib/ocaml/arg.ml >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905080038.CAA86273>