Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocaml seem to fail to build on ppc, was debian bug report : [broonie@sirena.org.uk: Bug#127347: ocaml: Out of range branches in #3119

Closed
vicuna opened this issue Jan 3, 2002 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jan 3, 2002

Original bug ID: 772
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Hello, ...

I got the following bug report, it is said to be against version 3.02-3, but
the directory listed shows that this is the 3.04 ocaml.

Could you have a look at it, and see if this is really a problem. I don't know
the bug reporter, but from his message, he seems well informed and did
appropriate research of the bug.

I hope you all well for this new year,

Friendly,

Sven Luther

----- Forwarded message from Mark Brown broonie@sirena.org.uk -----

Return-Path: debbugs@master.debian.org
Received: from amon.u-strasbg.fr (amon.u-strasbg.fr [130.79.200.3])
by dpt-info.u-strasbg.fr (8.9.3/8.9.3) with ESMTP id VAA00522
for luther@dpt-info.u-strasbg.fr; Tue, 1 Jan 2002 21:04:00 +0100
Received: from master.debian.org (master.debian.org [216.234.231.5])
by amon.u-strasbg.fr (8.9.3+Sun/8.9.0) with ESMTP id VAA26877
for luther@dpt-info.u-strasbg.fr; Tue, 1 Jan 2002 21:03:36 +0100 (MET)
Received: from debbugs by master.debian.org with local (Exim 3.12 1 (Debian))
id 16LV7n-0007gK-00; Tue, 01 Jan 2002 14:03:03 -0600
X-Loop: owner@bugs.debian.org
Subject: Bug#127347: ocaml: Out of range branches in assembler output
Reply-To: Mark Brown broonie@sirena.org.uk, 127347@bugs.debian.org
Resent-From: Mark Brown broonie@sirena.org.uk
Resent-To: debian-bugs-dist@lists.debian.org
Resent-CC: Sven Luther luther@debian.org
Resent-Date: Tue, 01 Jan 2002 20:03:02 GMT
Resent-Message-ID: handler.127347.B.100991529429330@bugs.debian.org
X-Debian-PR-Message: report 127347
X-Debian-PR-Package: ocaml
X-Debian-PR-Keywords: patch
Received: via spool by submit@bugs.debian.org id=B.100991529429330
(code B ref -1); Tue, 01 Jan 2002 20:03:02 GMT
From: Mark Brown broonie@sirena.org.uk
To: Debian Bug Tracking System submit@bugs.debian.org
X-Reportbug-Version: 1.41.14213
X-Mailer: reportbug 1.41.14213
Date: Tue, 01 Jan 2002 20:01:27 +0000
Message-Id: 20020101200127.AEDAB14210@raphaela.sirena.org.uk
Delivered-To: submit@bugs.debian.org
Resent-Sender: Debian BTS debbugs@master.debian.org

Package: ocaml
Version: 3.02-3
Severity: serious
Tags: patch

ocaml currently fails to build on PowerPC. The failing portion of
output is:

make[3]: Entering directory `/tmp/ocaml/ocaml-3.04/camlp4/meta'
../../boot/ocamlrun ../boot/camlp4r -nolib -I ../boot pa_extend.cmo
q_MLast.cmo -o pa_r.ppo pa_r.ml
../../boot/ocamlrun ../../ocamlopt -I ../../stdlib -I ../camlp4 -I
../boot -I ../../utils -c -impl pa_r.ppo
/tmp/camlasm0.s: Assembler messages:
/tmp/camlasm0.s:26869: Error: operand out of range (54196 not between
-32768 and 32767)
/tmp/camlasm0.s:27246: Error: operand out of range (52688 not between
-32768 and 32767)

and so on. Looking at the assembler output the failures appear to be
branch instructions attempting to call into what looks like a garbage
collector:

| .L1145: bltl .L1144

...

| .L1144:
| b caml_call_gc
| .section ".text"
| .globl Pa_r_code_end
| .type Pa_r_code_end, @object

Grovelling around in asmcomp/power it appears that the only place where
a bltl is emitted is:

| | Lop(Ialloc n) ->
| if !call_gc_label = 0 then call_gc_label := new_label();
| addi {emit_gpr 31}, {emit_gpr 31}, {emit_int(-n)}\n;
| cmplw {emit_gpr 31}, {emit_gpr 30}\n;
| addi {emit_reg i.res.(0)}, {emit_gpr 31}, 4\n;
| record_frame i.live;
| bltl {emit_label !call_gc_label}\n

The compiler either needs to be smarter about how it branches into the
GC routine (perhaps inserting the hooks at a higher level) or it needs
to assume that call_gc_label will be out of the range of a local jump.
This patch takes the latter approach:

--- ocaml-3.04/asmcomp/power/emit.mlp.orig Tue Jan 1 19:40:55 2002
+++ ocaml-3.04/asmcomp/power/emit.mlp Tue Jan 1 19:40:19 2002
@@ -545,12 +545,15 @@
| _ -> "stw" in
emit_load_store storeinstr addr i.arg 1 i.arg.(0)
| Lop(Ialloc n) ->

  • let skip_label = new_label() in
    if !call_gc_label = 0 then call_gc_label := new_label();
    addi {emit_gpr 31}, {emit_gpr 31}, {emit_int(-n)}\n;
    cmplw {emit_gpr 31}, {emit_gpr 30}\n;
    addi {emit_reg i.res.(0)}, {emit_gpr 31}, 4\n;
  • bgt {emit_label skip_label}\n;
    record_frame i.live;
  •    `	bltl	{emit_label !call_gc_label}\n`
    
  •    `	bl 	{emit_label !call_gc_label}\n`;
    
  • {emit_label skip_label}:\n;
    | Lop(Iintop Isub) -> (* subf has swapped arguments )
    (
    Use subfc instead of subf for RS6000 compatibility. *)
    subfc {emit_reg i.res.(0)}, {emit_reg i.arg.(1)}, {emit_reg i.arg.(0)}\n

It appears to work well enough to allow ocaml to build, though I've not
done more testing than that.

A full build log can be found at:

http://buildd.debian.org/fetch.php?&pkg=ocaml&ver=3.04-2&arch=powerpc&stamp=1009063512&file=log&as=raw

-- System Information
Debian Release: 3.0
Architecture: powerpc
Kernel: Linux raphaela 2.4.17-ben0 #8 Sun Dec 30 16:27:59 GMT 2001 ppc
Locale: LANG=en_GB, LC_CTYPE=en_GB

Versions of packages ocaml depends on:
ii libc6 2.2.4-7 GNU C Library: Shared libraries an
ii libncurses5 5.2.20010318-3 Shared libraries for terminal hand
ii libncurses5-dev 5.2.20010318-3 Developer's libraries and docs for
ii tcl8.3 8.3.3-5 The Tool Command Language (TCL) v8
ii tk8.3 8.3.3-7 The Tk toolkit for TCL and X11 v8.
ii xlibs 4.1.0-11 X Window System client libraries

----- End forwarded message -----

@vicuna
Copy link
Author

vicuna commented Jan 4, 2002

Comment author: administrator

Same bug as #3086

@vicuna
Copy link
Author

vicuna commented Jan 4, 2002

Comment author: administrator

ocaml currently fails to build on PowerPC. The failing portion of
output is:

make[3]: Entering directory `/tmp/ocaml/ocaml-3.04/camlp4/meta'
../../boot/ocamlrun ../boot/camlp4r -nolib -I ../boot pa_extend.cmo
q_MLast.cmo -o pa_r.ppo pa_r.ml
../../boot/ocamlrun ../../ocamlopt -I ../../stdlib -I ../camlp4 -I
../boot -I ../../utils -c -impl pa_r.ppo
/tmp/camlasm0.s: Assembler messages:
/tmp/camlasm0.s:26869: Error: operand out of range (54196 not between
-32768 and 32767)
/tmp/camlasm0.s:27246: Error: operand out of range (52688 not between
-32768 and 32767)

This is a known issue with the PPC code generator, see #3086 at
http://caml.inria.fr/bin/caml-bugs

We're working on a fix.

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Jan 4, 2002

Comment author: administrator

On Fri, Jan 04, 2002 at 02:38:52PM +0100, Xavier Leroy wrote:

/tmp/camlasm0.s:26869: Error: operand out of range (54196 not between
-32768 and 32767)

We're working on a fix.

Would it be possible to put the workaround in in the meantime (either in
the Debian package or the main OCAML distribution)? It's not a full
solution but it does appear to greatly reduce the problem for not much
effort.

--
"You grabbed my hand and we fell into it, like a daydream - or a fever."


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8NdV2J2Vo11xhU60RAmRZAKCDOhVrp6D6SUQXKIaTgitn/gGuOQCgksY0
iP2QlRKDYcXv7i7JYUSnkHM=
=Dnvr
-----END PGP SIGNATURE-----



@vicuna vicuna closed this as completed Jan 9, 2002
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant