Skip to content

Commit 1293de3

Browse files
committed
Protect LTCG placeholders with Sys.opaque_identity
This ensures that they are not inlined when using flambda. Signed-off-by: Etienne Millon <me@emillon.org>
1 parent 6b213b1 commit 1293de3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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)