-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[OCamlc] fixes output-complete-object #1332
Conversation
bytecomp/bytelink.ml
Outdated
try | ||
link_bytecode_as_c ppf tolink c_file; | ||
if not (Filename.check_suffix output_name ".c") then begin | ||
temps := c_file :: !temps; | ||
if Ccomp.compile_file c_file <> 0 then | ||
(* -DCAML_INTERNALS because the .c use startup.h *) | ||
if Ccomp.compile_file ~output:obj_file ~opt:"-DCAML_INTERNALS" c_file <> 0 then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't obviously see an equivalent use of -DCAML_INTERNALS
in asmlink.ml
, is that expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since asmlink goes directly to assembly I think so. But indeed CAML_INTERNALS is not defined in this way: all the other C files that use startup.h just define CAML_INTERNALS directly in the file. It is now fixed.
utils/ccomp.ml
Outdated
@@ -87,6 +87,8 @@ let compile_file name = | |||
then (Config.ocamlopt_cflags, Config.ocamlopt_cppflags) | |||
else (Config.ocamlc_cflags, Config.ocamlc_cppflags) in | |||
(String.concat " " [Config.c_compiler; cflags; cppflags])) | |||
(match output with | None -> "" | Some o -> "-o " ^ o) | |||
opt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you checked that all the C compilers support the -o
option? (Sun compiler, Intel compiler, MSVC, gcc, clang, pcc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't, and it is not the case. It is fixed by adding OUTPUTOBJ to config.ml and using it.
in the generated file instead of in the command line
Note: needs more work (fails on most architectures, including linux/amd64). I've disabled the test for the moment (commit 47a6e48). |
@damiendoligez thank you for the news. Do you still have any log of the failures? |
@bobot I'll get back to you in a few days. Oh, and it needs documentation too. I can't find any trace of it in the manual or even in the man pages. |
Started #1351 for the doc and more importantly the possible deprecation of |
@@ -180,6 +180,8 @@ Working version | |||
|
|||
### Compiler user-interface and warnings: | |||
|
|||
- GPR##1332: fix ocamlc handling of "-output-complete-obj" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worst Changes entry ever! :-)
@bobot "a few" days have passed... When I enable the test I get this:
|
When trying to add support for
--output-complete-obj
for jbuilder [ocaml/dune#23], I was not able to make--output-complete-obj
work in bytecode mode.ocamlc
complains that the temporary files it just created exist. This PR fixes this option and add tests for it.The support for
--output-complete-obj
has been added in ed60dec and 19d3bcc