From cefd832d8957ad369bfb3923e4ebfd7a4c985973 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Mon, 19 Aug 2019 09:30:45 -0700 Subject: [PATCH 1/2] Support deterministic builds by remapping the __FILE__ prefix if the compiler supports it. --- library/compiler-builtins/build.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/compiler-builtins/build.rs b/library/compiler-builtins/build.rs index c714bc15de30..feb7fc6ecdab 100644 --- a/library/compiler-builtins/build.rs +++ b/library/compiler-builtins/build.rs @@ -423,6 +423,10 @@ mod c { panic!("RUST_COMPILER_RT_ROOT={} does not exist", root.display()); } + // Support deterministic builds by remapping the __FILE__ prefix if the + // compiler supports it. + cfg.flag_if_supported(&format!("-ffile-prefix-map={}=.", root.display())); + let src_dir = root.join("lib/builtins"); for (sym, src) in sources.map.iter() { let src = src_dir.join(src); From a80233948f6321a6fa5995e7c2590e4596ed6a1f Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Mon, 19 Aug 2019 15:12:07 -0700 Subject: [PATCH 2/2] Update comment to mention where the __FILE__ macro is used. --- library/compiler-builtins/build.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/compiler-builtins/build.rs b/library/compiler-builtins/build.rs index feb7fc6ecdab..490b6391d08e 100644 --- a/library/compiler-builtins/build.rs +++ b/library/compiler-builtins/build.rs @@ -424,7 +424,8 @@ mod c { } // Support deterministic builds by remapping the __FILE__ prefix if the - // compiler supports it. + // compiler supports it. This fixes the nondeterminism caused by the + // use of that macro in lib/builtins/int_util.h in compiler-rt. cfg.flag_if_supported(&format!("-ffile-prefix-map={}=.", root.display())); let src_dir = root.join("lib/builtins");