Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001800OCamlcompiler driverpublic2003-08-27 20:012017-03-03 17:39
Assigned Toshinwell 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001800: -output-obj and c files
DescriptionFull_Name: Trevor Jim
Version: 3.06
OS: Mac OS X
Submission from: (

Hm, thought I submitted this but I don't see it in the database...

Anyway there is an inconsistency in the way that -output-obj handles C files.

For example, if I do

  ocamlopt -custom -o bar <lots of cmx files> foo.c

then ocamlopt compiles foo.c to foo.o and links it in to bar.

But if I do

  ocamlopt -output-obj -o bar.o <lots of cmx files> foo.c

then ocamlopt compiles foo.c to foo.o, and DOES NOT link it in to bar.o.

Bug or feature? You decide.

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
shinwell (developer)
2016-12-08 13:54

"-output-obj" is a bit of a strange one since it does effectively a partial link: the OCaml objects are bundled together but any required C stubs are not (and neither is the runtime library). A final link using the system linker is required to put everything together.

Given this and the documentation in the manual the exhibited behaviour in this PR seems correct. It also seems to be consistent with other command line flags (for example "-shared" looks to ignore C objects as well, but will presumably compile them).

I'm torn between just closing this or altering the compiler so that functionality of this form (where C files may be compiled but not linked, for whatever definition of "linked" is appropriate) is changed to reject C input files. Opinions?
doligez (administrator)
2017-03-03 17:39

I don't think this can be implemented easily because Unix linkers generally do not support linking several `.o` files into a single `.o`, which would be needed here.

I therefore move to close this PR.

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue
2016-12-08 13:54 shinwell Note Added: 0016873
2016-12-08 13:54 shinwell Assigned To => shinwell
2016-12-08 13:54 shinwell Status acknowledged => assigned
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:39 doligez Note Added: 0017566
2017-03-03 17:39 doligez Category -OCaml general => compiler driver
2017-03-03 17:39 doligez Description Updated View Revisions

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker