Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000047OCamlOCaml generalpublic2000-03-03 16:432000-03-06 17:52
Reporteradministrator 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000047: Problem compiling large sources using native-code compiler
DescriptionFull_Name: Vincent Zammit
Version: 2.01
OS: HP/UX
Submission from: aspirateur.inria.fr (128.93.8.116)
Submitted by: doligez


Date: Tue, 29 Feb 2000 17:40:28 GMT
From: vince@sharp.co.uk (Vincent Zammit)
Message-Id: <200002291740.RAA13188@locke.sharp.co.uk>
To: caml-light@pauillac.inria.fr
Subject: Problem compiling large sources using native-code compiler

Dear Caml maintainers,

  We are using ocaml in some large program development, and the
native-code compiler fails (during linking) on compiling a
particular file giving several of the following error messages:

collect2: ld returned 1 exit status
/usr/ccs/bin/ld: Target of unconditional branch is out of range
   Reference from: <file>.o(0x3fb5c)
/usr/ccs/bin/ld: Target of unconditional branch is out of range
   Reference from: <file>.o(0x3fb8c)
/usr/ccs/bin/ld: Target of unconditional branch is out of range
   Reference from: <file>.o(0x3fbc0)
  .
  .
  .

Where <file>.o is quite a large object file --- more than
800K in size.

This occurs only on HP/UX machines; the same files compile on
Sparc architectures, but in these cases the generated object
file is slightly less than 800K.

I wonder whether this is a limitation or a bug, and whether it
has already been fixed in recent versions. We are currently using
ocaml version 2.01; I had a look at the What's New page but I could
find nothing that suggests that this problem is fixed.


Many thanks,

Vince Zammit
Sharp Laboratories of Europe

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0002076)
administrator (administrator)
2000-03-06 17:52

> We are using ocaml in some large program development, and the
> native-code compiler fails (during linking) on compiling a
> particular file giving several of the following error messages:
>
> collect2: ld returned 1 exit status
> /usr/ccs/bin/ld: Target of unconditional branch is out of range
> Reference from: <file>.o(0x3fb5c)
> /usr/ccs/bin/ld: Target of unconditional branch is out of range
> Reference from: <file>.o(0x3fb8c)
> /usr/ccs/bin/ld: Target of unconditional branch is out of range
> Reference from: <file>.o(0x3fbc0)
> Where <file>.o is quite a large object file --- more than
> 800K in size.
>
> This occurs only on HP/UX machines; the same files compile on
> Sparc architectures, but in these cases the generated object
> file is slightly less than 800K.
>
> I wonder whether this is a limitation or a bug

It is basically a limitation of the HPPA processor: the "branch" opcode
allows a relative displacement of only +/- 256 Kbytes; hence, if you have
a compilation unit bigger than 256 K, it may be impossible to jump from
one point of the unit to another.

Other processors can encode larger displacements. For instance, the SPARC
uses a 30-bit field to hold the target of a "branch", allowing arbitrary jumps
from any point in the 4 G address space to another. (The displacement is in
words, not bytes.)

There is not much that ocamlopt can do to work around this limitation, since it
doesn't control the actual layout of instructions in memory (this is done by
the system assembler).

You could try to work around this limitation by splitting your large
compilation
unit in two, or compile it with "-compact -inline 0" to try and reduce the size
of the object code.

Best regards,

- Xavier Leroy


(0002077)
administrator (administrator)
2000-03-06 17:52

It's a limitation of the HPPA processor
(0002078)
administrator (administrator)
2000-03-09 09:57

> It is basically a limitation of the HPPA processor: the "branch" opcode
> allows a relative displacement of only +/- 256 Kbytes; hence, if you have
> a compilation unit bigger than 256 K, it may be impossible to jump from
> one point of the unit to another.
>
> Other processors can encode larger displacements. For instance, the SPARC
> uses a 30-bit field to hold the target of a "branch", allowing arbitrary jumps
> from any point in the 4 G address space to another. (The displacement is in
> words, not bytes.)
>
> There is not much that ocamlopt can do to work around this limitation, since it
> doesn't control the actual layout of instructions in memory (this is done by
> the system assembler).
>
> You could try to work around this limitation by splitting your large
> compilation
> unit in two, or compile it with "-compact -inline 0" to try and reduce the size
> of the object code.

Many thanks for your reply. I now understand what the problem is, and try
to split the compilation units into smaller ones as you suggest.

Thanks,

Vince


- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker