Skip to content

Commit df10ba5

Browse files
committed
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 <me@emillon.org>
1 parent 6b213b1 commit df10ba5

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

CHANGES.md

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ next
2727
- Allow the use of the `context_name` variable in the `enabled_if` fields of
2828
executable(s) and install stanzas. (#3568, fixes #3566, @voodoos)
2929

30+
- Fix dune-build-info not working correctly when flambda is active (#3599,
31+
@emillon, @jeremiedimino).
32+
3033
2.6.0 (05/06/2020)
3134
------------------
3235

otherlibs/build-info/test/run.t

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ Check what the generated build info module looks like:
9999
None
100100
[@@inline never]
101101

102-
let p1 = eval "%%DUNE_PLACEHOLDER:64:vcs-describe:1:a%%%%%%%%%%%%%%%%%%%%%%%%%%"
103-
let p2 = eval "%%DUNE_PLACEHOLDER:64:vcs-describe:1:b%%%%%%%%%%%%%%%%%%%%%%%%%%"
104-
let p0 = eval "%%DUNE_PLACEHOLDER:64:vcs-describe:1:c%%%%%%%%%%%%%%%%%%%%%%%%%%"
102+
let p1 = eval (Sys.opaque_identity "%%DUNE_PLACEHOLDER:64:vcs-describe:1:a%%%%%%%%%%%%%%%%%%%%%%%%%%")
103+
let p2 = eval (Sys.opaque_identity "%%DUNE_PLACEHOLDER:64:vcs-describe:1:b%%%%%%%%%%%%%%%%%%%%%%%%%%")
104+
let p0 = eval (Sys.opaque_identity "%%DUNE_PLACEHOLDER:64:vcs-describe:1:c%%%%%%%%%%%%%%%%%%%%%%%%%%")
105105

106106
let version = p0
107107

src/dune/link_time_code_gen.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ let build_info_code cctx ~libs ~api_version =
160160
pr buf "[@@inline never]";
161161
pr buf "";
162162
Path.Source.Map.iteri !placeholders ~f:(fun path var ->
163-
pr buf "let %s = eval %S" var
163+
pr buf "let %s = eval (Sys.opaque_identity %S)" var
164164
(Artifact_substitution.encode ~min_len:64 (Vcs_describe path)));
165165
if not (Path.Source.Map.is_empty !placeholders) then pr buf "";
166166
pr buf "let version = %s" version;

0 commit comments

Comments
 (0)