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

ocamlopt for amd64 fails with binutils 2.21 #5237

Closed
vicuna opened this issue Mar 7, 2011 · 7 comments
Closed

ocamlopt for amd64 fails with binutils 2.21 #5237

vicuna opened this issue Mar 7, 2011 · 7 comments
Assignees
Labels

Comments

@vicuna
Copy link

vicuna commented Mar 7, 2011

Original bug ID: 5237
Reporter: ecc
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2012-09-25T18:06:17Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 3.12.0
Fixed in version: 3.12.1+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: zorun mehdi @glondu @hcarty

Bug description

$ cat bug.ml
let f x = x *. 1.0
$ as --version # version currently in Debian "sid"
GNU assembler (GNU Binutils for Debian) 2.21.0.20110302
$ ocamlopt bug.ml
/tmp/camlasmd5071c.s: Assembler messages:
/tmp/camlasmd5071c.s:74: Error: .size expression does not evaluate to a constant
File "bug.ml", line 1, characters 0-1:
Error: Assembler error, input left in file /tmp/camlasmd5071c.s

Additional information

The same assembly file is produced by ocamlopt 3.11.2 and 3.12.0.
With this version of binutils:
GNU assembler (GNU Binutils for Debian) 2.20.1-system.20100303
(from Debian "squeeze") it assembles OK.

The problematic line seems to be the following:
.section .rodata.cst8,"a",@progbits

File attachments

@vicuna
Copy link
Author

vicuna commented Mar 8, 2011

Comment author: ecc

The attached patch seems to fix the issue by reordering the .section directive. Almost the entire test suite passes. (The one failure was stack overflow detection in native code -- the overflow is detected, but the stack size is evidently different than was used for the reference output.)

@vicuna
Copy link
Author

vicuna commented Mar 8, 2011

Comment author: spiralvoice

A similar problems happens when compiling Ocaml 3.12.0 on Debian sid x86

../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g ./Compflags random.cmx -c random.ml
/tmp/camlasm09faba.s: Assembler messages:
/tmp/camlasm09faba.s:2064: Error: .size expression does not evaluate to a constant
File "random.ml", line 1, characters 0-1:
Error: Assembler error, input left in file /tmp/camlasm09faba.s

@vicuna
Copy link
Author

vicuna commented Mar 8, 2011

Comment author: spiralvoice

The attached patch fixed the problem here

@vicuna
Copy link
Author

vicuna commented Mar 8, 2011

Comment author: @glondu

There are also sparc and powerpc as native architectures on Debian... but they don't seem to be affected by this bug (I've checked on sparc, powerpc looks similar). I've opened a Debian bug to keep track of this issue:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=617404

@vicuna
Copy link
Author

vicuna commented Mar 9, 2011

Comment author: int-e

Note that you need a very recent binutils release to reproduce this error: 2.21.0.20110216 (Debian sid) did not have this check.

@vicuna
Copy link
Author

vicuna commented Mar 9, 2011

Comment author: @glondu

Note that spiralvoice's patch is incorrect. Attached is the patch (merging Eric and spiralvoice's ones) as applied in Debian.

@vicuna
Copy link
Author

vicuna commented Mar 13, 2011

Comment author: @xavierleroy

S. Glondu's patch is correct. Applied in 3.12 bugfix branch and in trunk. Will be part of release 3.12.1.

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

2 participants