Reduce size of bootstrap compilers by stripping debug info#340
Reduce size of bootstrap compilers by stripping debug info#340xavierleroy merged 2 commits intotrunkfrom
Conversation
…eir size The stripping is done during bootstrap, when copying the new ocamlc, ocamllex and ocamldep to boot/. The new "stripdebug" tool performs this task. As a consequence, comparing the new compilers with the boot/ compilers at the end of bootstrap is more complicated, since the debug section must be ignored. A new tool, "cmpbyt" in tools/, performs this comparison.
… is not needed and can cause spurious merge conflicts.
|
Yes, it strips everything up to the beginning of the bytecode executable proper (= the beginning of the first section of the bytecode executable). |
|
Ping? In the absence of negative opinions, I'll merge this by the end of the week. |
Maybe do (2) as a follow-up to this PR. |
|
1- To silence a perl warning. (Apparently, "do" for function calls went out of fashion in the 1990's.) 2- The idea crossed my mind, but I couldn't find much of a general use for the tool, so let's keep it private for the moment. |
Reduce size of bootstrap compilers by stripping debug info
|
For the general public, "ocamlclean" would be a better choice, as it strips debug, but also removes dead code. I have been using it for a while, with great results (program stripped from 400k without debug to 16k...) |
|
Actually, it makes me think we could use it too, just before releasing a new version to have the smallest boot/ possible. |
You can now `make runtest` to run a couple of tests. One of them is an `flexpect`-based test, with a functioning `make promote`. (The other is the preexisting `meet_test.ml`, which simply needed to be made a test in `dune`.) There are also the `fldiff` and `parseflambda` utilities from the old repo. `fldiff` might be useful for testing the `Flambda2_compare` module, and `parseflambda` more or less runs the middle end and nothing else.
Recently, we added "-g" to the build of the OCaml compilers, to make them easier to debug. This has the unfortunate effect of increasing their sizes: ocamlc goes from 2 Mbytes to 10 Mbytes. It's OK for the newly compiled compilers (those that will be installed), but a little too much for the bootstrap compilers (those in boot/, which are under version control and part of the .tgz source distribution).
This pull request proposes to strip the debug information from the bootstrap compilers. This way, the new compilers can still be debugged, but the bootstrap compilers revert to their sizes before the "-g" change.
The stripping is done during bootstrap, when copying the new ocamlc, ocamllex and ocamldep to boot/. The new "stripdebug" tool performs this task.
As a consequence, comparing the new compilers with the boot/ compilers at the end of bootstrap is more complicated, since the debug section must be ignored. A new tool, "cmpbyt" in tools/, performs this comparison.