@@ -167,11 +167,7 @@ $(host_arch)_$(host_os)_native_toolchain?=$($(host_os)_native_toolchain)
167
167
include funcs.mk
168
168
169
169
binutils_path =$($($(host_arch ) _$(host_os ) _native_binutils) _prefixbin)
170
- ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG ) ) ,)
171
- toolchain_path =$($($(host_arch ) _$(host_os ) _native_toolchain) _prefixbin)
172
- else
173
- toolchain_path =
174
- endif
170
+
175
171
final_build_id_long+ =$(shell $(build_SHA256SUM ) config.site.in)
176
172
final_build_id+ =$(shell echo -n "$(final_build_id_long ) " | $(build_SHA256SUM ) | cut -c-$(HASH_LENGTH ) )
177
173
$(host_prefix ) /.stamp_$(final_build_id ) : $(native_packages ) $(packages )
@@ -182,11 +178,35 @@ $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
182
178
$(AT ) cd $(@D ) ; $(foreach package,$^ , tar xf $($(package ) _cached) ; )
183
179
$(AT ) touch $@
184
180
181
+ # $PATH is not preserved between ./configure and make by convention. Its
182
+ # modification and overriding at ./configure time is (as I understand it)
183
+ # supposed to be captured by the AC_{PROG_{,OBJ}CXX,PATH_{PROG,TOOL}} macros,
184
+ # which will expand the program names to their full absolute paths. The notable
185
+ # exception is command line overriding: ./configure CC=clang, which skips the
186
+ # program name expansion step, and works because the user implicitly indicates
187
+ # with CC=clang that clang will be available in $PATH at all times, and is most
188
+ # likely part of the user's system.
189
+ #
190
+ # Therefore, when we "seed the autoconf cache"/"override well-known program
191
+ # vars" by setting AR=<blah> in our config.site, either one of two things needs
192
+ # to be true for the build system to work correctly:
193
+ #
194
+ # 1. If we refer to the program by name (e.g. AR=riscv64-gnu-linux-ar), the
195
+ # tool needs to be available in $PATH at all times.
196
+ #
197
+ # 2. If the tool is _**not**_ expected to be available in $PATH at all times
198
+ # (such as is the case for our native_cctools binutils tools), it needs to
199
+ # be referred to by its absolute path, such as would be output by the
200
+ # AC_PATH_{PROG,TOOL} macros.
201
+ #
202
+ # Minor note: it is also okay to refer to tools by their absolute path even if
203
+ # we expect them to be available in $PATH at all times, more specificity does
204
+ # not hurt.
185
205
$(host_prefix ) /share/config.site : config.site.in $(host_prefix ) /.stamp_$(final_build_id )
186
206
$(AT ) @mkdir -p $(@D )
187
207
$(AT ) sed -e ' s|@HOST@|$(host)|' \
188
- -e 's|@CC@|$(toolchain_path)$( host_CC)|' \
189
- -e 's|@CXX@|$(toolchain_path)$( host_CXX)|' \
208
+ -e 's|@CC@|$(host_CC)|' \
209
+ -e 's|@CXX@|$(host_CXX)|' \
190
210
-e 's|@AR@|$(binutils_path)$(host_AR)|' \
191
211
-e 's|@RANLIB@|$(binutils_path)$(host_RANLIB)|' \
192
212
-e 's|@NM@|$(binutils_path)$(host_NM)|' \
0 commit comments