Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006409OCamlOCaml generalpublic2014-05-10 15:212014-05-17 03:30
Reportergasche 
Assigned To 
PrioritylowSeverityfeatureReproducibilityN/A
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0006409: `ocamlc -linkall -c test.ml` should activate force-linking in `test.cmo`
DescriptionWhen 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.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0011508)
garrigue (manager)
2014-05-17 03:30

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.

- Issue History
Date Modified Username Field Change
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
Powered by Mantis Bugtracker