File tree 3 files changed +12
-1
lines changed
3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -113,11 +113,12 @@ def cc_toolchain_config(
113
113
unfiltered_compile_flags = [
114
114
# Do not resolve our symlinked resource prefixes to real paths.
115
115
"-no-canonical-prefixes" ,
116
- # Reproducibility
116
+ # Reproducibility.
117
117
"-Wno-builtin-macro-redefined" ,
118
118
"-D__DATE__=\" redacted\" " ,
119
119
"-D__TIMESTAMP__=\" redacted\" " ,
120
120
"-D__TIME__=\" redacted\" " ,
121
+ "-ffile-prefix-map=${{pwd}}=__bazel_toolchain_llvm_repo__" ,
121
122
]
122
123
123
124
is_xcompile = not (exec_os == target_os and exec_arch == target_arch )
@@ -150,6 +151,8 @@ def cc_toolchain_config(
150
151
link_flags = [
151
152
"--target=" + target_system_name ,
152
153
"-no-canonical-prefixes" ,
154
+ # Reproducibility.
155
+ "-ffile-prefix-map=${{pwd}}=__bazel_toolchain_llvm_repo__" ,
153
156
]
154
157
155
158
stdlib = compiler_configuration ["stdlib" ]
Original file line number Diff line number Diff line change @@ -34,12 +34,14 @@ set -euo pipefail
34
34
35
35
if [[ -f %{toolchain_path_prefix}bin/clang ]]; then
36
36
execroot_path=" "
37
+ execroot_abs_path=" ${PWD} /"
37
38
elif [[ ${BASH_SOURCE[0]} == " /" * ]]; then
38
39
# Some consumers of `CcToolchainConfigInfo` (e.g. `cmake` from rules_foreign_cc)
39
40
# change CWD and call $CC (this script) with its absolute path.
40
41
# For cases like this, we'll try to find `clang` through an absolute path.
41
42
# This script is at _execroot_/external/_repo_name_/bin/cc_wrapper.sh
42
43
execroot_path=" ${BASH_SOURCE[0]%/*/*/*/* } /"
44
+ execroot_abs_path=" $( cd " ${execroot_path} " && pwd -P) /"
43
45
else
44
46
echo >&2 " ERROR: could not find clang; PWD=\" ${PWD} \" ; PATH=\" ${PATH} \" ."
45
47
exit 5
@@ -53,6 +55,9 @@ function sanitize_option() {
53
55
# shellcheck disable=SC2206
54
56
parts=(${opt/ =/ } ) # Split flag name and value into array.
55
57
printf " %s" " ${parts[0]} =${execroot_path}${parts[1]} "
58
+ elif [[ ${opt} == * " \$ {{pwd}}" * ]]; then
59
+ # Replace the literal string '${{pwd}}' with the execroot.
60
+ printf " %s" " ${opt// \$\{\{ pwd\}\} / ${execroot_abs_path%/ } } "
56
61
else
57
62
printf " %s" " ${opt} "
58
63
fi
Original file line number Diff line number Diff line change @@ -79,6 +79,9 @@ function sanitize_option() {
79
79
# shellcheck disable=SC2206
80
80
parts=(${opt/ =/ } ) # Split flag name and value into array.
81
81
printf " %s" " ${parts[0]} =${execroot_path}${parts[1]} "
82
+ elif [[ ${opt} == * " \$ {{pwd}}" * ]]; then
83
+ # Replace the literal string '${{pwd}}' with the execroot.
84
+ printf " %s" " ${opt// \$\{\{ pwd\}\} / ${execroot_abs_path%/ } } "
82
85
else
83
86
printf " %s" " ${opt} "
84
87
fi
You can’t perform that action at this time.
0 commit comments