| Anonymous | Login | Signup for a new account | 2013-05-25 11:06 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||||||
| 0005919 | OCaml | OCamlbuild (the tool) | public | 2013-02-12 22:13 | 2013-04-15 12:22 | |||||||
| Reporter | zhihan | |||||||||||
| Assigned To | ||||||||||||
| Priority | normal | Severity | crash | Reproducibility | always | |||||||
| Status | resolved | Resolution | unable to reproduce | |||||||||
| Platform | Linux | OS | Debian Linux 6 64-bit | OS Version | Debian 6 | |||||||
| Product Version | 3.12.1 | |||||||||||
| Target Version | Fixed in Version | |||||||||||
| Summary | 0005919: ocamlopt generates bad executable | |||||||||||
| Description | This is related to http://caml.inria.fr/mantis/view.php?id=5474&history=1#history [^] But I am able to produce both good and bad executables. The only difference is the setting of "PATH" environment variable. Here is what I observed: suppose my ocaml is installed at /<path_to>/ocaml If I add '/<path_to>/ocaml/bin' to my PATH and then invoke ocamlbuild.native, it creates an executable that seg faults. If I unset the PATH and use '/<path_to>/ocaml/bin/ocamlbuild' to build the target, it is a good executable. | |||||||||||
| Tags | No tags attached. | |||||||||||
| Attached Files | ||||||||||||
Notes |
|
|
(0008839) zhihan (reporter) 2013-02-13 15:57 |
I did a little bit further investigation myself. I used readelf to disassemble the two files. Among the differences, this one might be related. In the 'bad' file produced from ocamlopt, the relocation address of 'strcmp' and 'strcpy' are placed in the '.rela.dyn' section, while in the 'good' file these relocations are placed in the '.rela.plt' section. According to resources on the internet, '.rela.plt' should hold relocation addresses for C functions and '.rela.dyn' should hold for data. In this regard, the relocation addresses of 'strcpy' is placed in the wrong section. Might it be the cause the seg fault? |
|
(0008840) meyer (developer) 2013-02-13 20:55 |
The reason for that is that ocamlbuild might pick the wrong compiler. Ocamlbuild tries to use not the compiler on path but the one it's being rooted. Therefore: if /usr/local/bin/ocamlbuild.native is present it will always pick the /usr/local/ocamlc and not the one pointed by PATH. Please double check if you didn't hit that problem, perhaps you have several incompatible ocaml installations. What will happen if you compile the program manually? |
|
(0008841) meyer (developer) 2013-02-13 20:56 |
the tarball you've attached cannot be opened. Please re-attach a right tarball. |
|
(0008842) zhihan (reporter) 2013-02-13 21:00 |
So I should use the '-ocamlopt' option to make sure the right compiler is invoked? |
|
(0008843) meyer (developer) 2013-02-13 21:53 |
Unfortunately yes, that's the only way you can change it. The trunk of the toolchain, if you wish to try dev version, contains also -which flag which will tell you what's being picked up. You can also use -verbose 100 which will show you the commands being invoked. Please make sure if you swap a compiler to use -clean flag before. If you are not forced to use 3.12.1 compiler, I'd strongly advise to try 4.00.1. The easiest way to get the system working is via OPAM. |
|
(0009004) xleroy (administrator) 2013-03-24 12:02 |
So, do we have enough info on this PR to see if something needs to be done? W. Meyer wisely suggests to use a clean 4.00.1 installation. If this is enough to solve the problem, I move to close this PR. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2013-02-12 22:13 | zhihan | New Issue | |
| 2013-02-12 22:13 | zhihan | File Added: ocamlbug.tar.gz | |
| 2013-02-13 15:57 | zhihan | Note Added: 0008839 | |
| 2013-02-13 20:55 | meyer | Note Added: 0008840 | |
| 2013-02-13 20:56 | meyer | Note Added: 0008841 | |
| 2013-02-13 20:59 | zhihan | File Added: ocamltest.tar.gz | |
| 2013-02-13 21:00 | zhihan | Note Added: 0008842 | |
| 2013-02-13 21:53 | meyer | Note Added: 0008843 | |
| 2013-03-24 12:02 | xleroy | Note Added: 0009004 | |
| 2013-03-24 12:02 | xleroy | Status | new => feedback |
| 2013-04-15 12:22 | xleroy | Status | feedback => resolved |
| 2013-04-15 12:22 | xleroy | Resolution | open => unable to reproduce |
| Copyright © 2000 - 2011 MantisBT Group |