Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006409OCamlcompiler driverpublic2014-05-10 15:212017-03-01 15:27
Assigned To 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0006409: `ocamlc -linkall -c` 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" >
  $ ocamlc -linkall -c
  $ 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 [^] 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
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.
doligez (administrator)
2017-03-01 15:27

Implemented by GPR#1009 ( [^] )

- 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
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-01 15:27 doligez Note Added: 0017512
2017-03-01 15:27 doligez Status acknowledged => resolved
2017-03-01 15:27 doligez Resolution open => fixed
2017-03-01 15:27 doligez Category -OCaml general => compiler driver

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker