From df10ba53dc5ea2caac2866375cf7531f3460b391 Mon Sep 17 00:00:00 2001 From: Etienne Millon Date: Wed, 1 Jul 2020 16:15:20 +0200 Subject: [PATCH] Protect LTCG placeholders with Sys.opaque_identity This ensures that they are not inlined when using flambda. See discussion in #1930. Signed-off-by: Etienne Millon --- CHANGES.md | 3 +++ otherlibs/build-info/test/run.t | 6 +++--- src/dune/link_time_code_gen.ml | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1c92cd30c50c..ff693918d62a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,6 +27,9 @@ next - Allow the use of the `context_name` variable in the `enabled_if` fields of executable(s) and install stanzas. (#3568, fixes #3566, @voodoos) +- Fix dune-build-info not working correctly when flambda is active (#3599, + @emillon, @jeremiedimino). + 2.6.0 (05/06/2020) ------------------ diff --git a/otherlibs/build-info/test/run.t b/otherlibs/build-info/test/run.t index 2cdc7f276b54..ec3b401e34ee 100644 --- a/otherlibs/build-info/test/run.t +++ b/otherlibs/build-info/test/run.t @@ -99,9 +99,9 @@ Check what the generated build info module looks like: None [@@inline never] - let p1 = eval "%%DUNE_PLACEHOLDER:64:vcs-describe:1:a%%%%%%%%%%%%%%%%%%%%%%%%%%" - let p2 = eval "%%DUNE_PLACEHOLDER:64:vcs-describe:1:b%%%%%%%%%%%%%%%%%%%%%%%%%%" - let p0 = eval "%%DUNE_PLACEHOLDER:64:vcs-describe:1:c%%%%%%%%%%%%%%%%%%%%%%%%%%" + let p1 = eval (Sys.opaque_identity "%%DUNE_PLACEHOLDER:64:vcs-describe:1:a%%%%%%%%%%%%%%%%%%%%%%%%%%") + let p2 = eval (Sys.opaque_identity "%%DUNE_PLACEHOLDER:64:vcs-describe:1:b%%%%%%%%%%%%%%%%%%%%%%%%%%") + let p0 = eval (Sys.opaque_identity "%%DUNE_PLACEHOLDER:64:vcs-describe:1:c%%%%%%%%%%%%%%%%%%%%%%%%%%") let version = p0 diff --git a/src/dune/link_time_code_gen.ml b/src/dune/link_time_code_gen.ml index ac860e3fd5f3..a3f9ee93f058 100644 --- a/src/dune/link_time_code_gen.ml +++ b/src/dune/link_time_code_gen.ml @@ -160,7 +160,7 @@ let build_info_code cctx ~libs ~api_version = pr buf "[@@inline never]"; pr buf ""; Path.Source.Map.iteri !placeholders ~f:(fun path var -> - pr buf "let %s = eval %S" var + pr buf "let %s = eval (Sys.opaque_identity %S)" var (Artifact_substitution.encode ~min_len:64 (Vcs_describe path))); if not (Path.Source.Map.is_empty !placeholders) then pr buf ""; pr buf "let version = %s" version;