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

Problem compiling large sources using native-code compiler #2383

Closed
vicuna opened this issue Mar 3, 2000 · 3 comments
Closed

Problem compiling large sources using native-code compiler #2383

vicuna opened this issue Mar 3, 2000 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Mar 3, 2000

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

Bug description

Full_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: .o(0x3fb5c)
/usr/ccs/bin/ld: Target of unconditional branch is out of range
Reference from: .o(0x3fb8c)
/usr/ccs/bin/ld: Target of unconditional branch is out of range
Reference from: .o(0x3fbc0)
.
.
.

Where .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

@vicuna
Copy link
Author

vicuna commented Mar 6, 2000

Comment author: administrator

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: .o(0x3fb5c)
/usr/ccs/bin/ld: Target of unconditional branch is out of range
Reference from: .o(0x3fb8c)
/usr/ccs/bin/ld: Target of unconditional branch is out of range
Reference from: .o(0x3fbc0)
Where .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

@vicuna
Copy link
Author

vicuna commented Mar 6, 2000

Comment author: administrator

It's a limitation of the HPPA processor

@vicuna vicuna closed this as completed Mar 6, 2000
@vicuna
Copy link
Author

vicuna commented Mar 9, 2000

Comment author: administrator

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

@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