|Anonymous | Login | Signup for a new account||2016-10-27 01:08 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0006409||OCaml||OCaml general||public||2014-05-10 15:21||2014-05-17 03:30|
|Target Version||Fixed in Version|
|Summary||0006409: `ocamlc -linkall -c test.ml` should activate force-linking in `test.cmo`|
|Description||When producing an archive (cma, cmxa), adding -linkall marks compilation unit of the archive as force-linked. It would be consistent and helpful if -linkall did also work when producing .cmo/.cmx. As far as I can tell, it is currently ignored.|
$ mkdir test
$ echo "let x = 1" > test.ml
$ ocamlc -linkall -c test.ml
$ ocamlobjinfo test.cmo | grep link
Force link: no
While .cmo/.cmx are always linked anyway when passed to a linking step, the interest of marking a .cmo with force-linking is that it would remain force-linked in any archive including it.
I stepped on this non-behavior of -linkall when playing with force-linking side-effecting modules of the compiler (eg. typing/typeclass.cmo) during the discussion of https://github.com/ocaml/ocaml/pull/53. [^] In any situation where typeclass.cmo and typecore.cmo are available and typecore.cmo is used, it is unsafe not to link typeclass.cmo as well; it would make sense to simply compile typeclass.cmo with -linkall.
|Tags||No tags attached.|
I'm not sure your example is a good one.
What you are saying is that whenever typecore.cmo is linked, typeclass.cmo should be linked too.
I.e., that there is a two-way dependency between these modules.
But the proposed solution would include typeclass.cmo always, even when typecore.cmo is not included.
Isn't it rather a good reason to keep -pack around: interdependent files should be packed inside the same object. If needed, one can avoid the induced nesting using module aliases.
|2014-05-10 15:21||gasche||New Issue|
|2014-05-16 17:49||doligez||Severity||tweak => feature|
|2014-05-16 17:49||doligez||Status||new => acknowledged|
|2014-05-17 03:30||garrigue||Note Added: 0011508|
|Copyright © 2000 - 2011 MantisBT Group|