Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-output-obj and c files #8251

Closed
vicuna opened this issue Aug 27, 2003 · 2 comments
Closed

-output-obj and c files #8251

vicuna opened this issue Aug 27, 2003 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Aug 27, 2003

Original bug ID: 1800
Reporter: administrator
Assigned to: @mshinwell
Status: assigned (set by @mshinwell on 2016-12-08T12:54:25Z)
Resolution: open
Priority: normal
Severity: feature
Category: compiler driver

Bug description

Full_Name: Trevor Jim
Version: 3.06
OS: Mac OS X
Submission from: targe.cs.princeton.edu (128.112.139.194)

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 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 foo.c

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

Bug or feature? You decide.

@vicuna
Copy link
Author

vicuna commented Dec 8, 2016

Comment author: @mshinwell

"-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?

@vicuna
Copy link
Author

vicuna commented Mar 3, 2017

Comment author: @damiendoligez

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants