-
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
5.1.0: ocaml is not LTO ready #12660
Comments
Sorry forgot attach output with errors |
Note: LTO stands for Link Time Optimization. Here's an excerpt of the errors generated:
The error comes from how we're generating the list of primitives. In #11763 I tried to generate the list of primitives using accurate types, but we chose to default to a simple If there are no other known blockers for building OCaml in LTO (e.g., something rendering it totally moot), it might be worthwhile to revisit the first version of the patches where we extracted the primitives with types in their original condition. EDIT: or simply just disable the warning with |
So this generator trashes LTO. By default autoconf uses --enablable-warn-error so in such case build additionally fails. |
Can we quantify this a little better? If I
This is only true for development builds - releases build with |
As long as those warnings are present linker cannot fully optimise generated code. |
This might not be a big loss, since these functions that are declared with the wrong type are put in a big table, and are called indirectly through this table. So, there will be no link-time inlining or optimization based on the calling context for these functions, I'm afraid. However, the warning is annoying, and points to something not quite right in the bytecode interpreter of OCaml. #11763 is a step in the right direction, and I think we can do even more well-typed using an union type, but for that we need to use a better scripting language than sed... |
The warning doesn't seem to be emitted for the K&R declarations in 5.0, but presumably they must end up with the same LTO fate (big table, indirect calls) as "untyped" is presumably treated the same as "mis-typed"? Fully typing the primitives I think is a much larger problem, though - we can sort out the OCaml runtime, but then we also have the stub-libraries to worry about for However, are we potentially accidentally over-thinking this? It only affects bytecode - the native runtime library links with correctly typed primitives, based on the |
The warning is generated at link-time, so we'd need to pass |
You can exactly the same final effect (correctly linked all binaries) by use |
@kloczek - a released version of OCaml does not have |
@MisterDA - ah, my bad, it would just indeed to be in the appropriate OC_ flags, etc. I was sort of hoping we'd be able to limit the disabling of the warning to those symbols which we know are problematic (i.e. the primitives) |
Yep 👍 .. that what I've already wrote in #12660 (comment) |
"Accurate" means "with their proper types instead of the generic type `value prim(void)`". Fixes: ocaml#12660
"Accurate" means "with their proper types instead of the generic type `value prim(void)`". Fixes: ocaml#12660
"Accurate" means "with their proper types instead of the generic type `value prim(void)`". Partial fix for ocaml#12660
#12700 addresses a number of these "LTO type mismatch" warnings (which are quite useful even in a non-LTO context, actually!). Some warnings remain in conjunction with ocamlc -custom and perhaps in other contexts, to be investigated more. |
Looks like ocaml build fails when LTO is used. and buil fails
The text was updated successfully, but these errors were encountered: