Index: libgomp/testsuite/lib/libgomp.exp =================================================================== --- libgomp/testsuite/lib/libgomp.exp (revision 279954) +++ libgomp/testsuite/lib/libgomp.exp (working copy) @@ -171,9 +171,16 @@ proc libgomp_init { args } { lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/../../include" lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.." - # For build-tree testing, also consider the library paths used for builing. + # For build-tree testing, also consider the library paths used for building. # For installed testing, we assume all that to be provided in the sysroot. if { $blddir != "" } { + + # If --with-build-sysroot= was specified, we assume it will be needed + # for build-tree testing. + if [info exists SYSROOT_CFLAGS_FOR_TARGET] { + lappend ALWAYS_CFLAGS "additional_flags=--sysroot=$SYSROOT_CFLAGS_FOR_TARGET" + } + # The `-fopenacc' and `-fopenmp' options imply `-pthread', and # that implies `-latomic' on some hosts, so wire in libatomic # build directories. Index: libgomp/testsuite/libgomp-test-support.exp.in =================================================================== --- libgomp/testsuite/libgomp-test-support.exp.in (revision 279954) +++ libgomp/testsuite/libgomp-test-support.exp.in (working copy) @@ -1,5 +1,3 @@ -set GCC_UNDER_TEST {@CC@} - set cuda_driver_include "@CUDA_DRIVER_INCLUDE@" set cuda_driver_lib "@CUDA_DRIVER_LIB@" set hsa_runtime_lib "@HSA_RUNTIME_LIB@" Index: Makefile.in =================================================================== --- Makefile.in (revision 279954) +++ Makefile.in (working copy) @@ -319,6 +319,7 @@ RAW_CXX_TARGET_EXPORTS = \ NORMAL_TARGET_EXPORTS = \ $(BASE_TARGET_EXPORTS) \ + SYSROOT_CFLAGS_FOR_TARGET="$(SYSROOT_CFLAGS_FOR_TARGET)"; export SYSROOT_CFLAGS_FOR_TARGET; \ CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; # Where to find GMP Index: Makefile.tpl =================================================================== --- Makefile.tpl (revision 279954) +++ Makefile.tpl (working copy) @@ -322,6 +322,7 @@ RAW_CXX_TARGET_EXPORTS = \ NORMAL_TARGET_EXPORTS = \ $(BASE_TARGET_EXPORTS) \ + SYSROOT_CFLAGS_FOR_TARGET="$(SYSROOT_CFLAGS_FOR_TARGET)"; export SYSROOT_CFLAGS_FOR_TARGET; \ CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; # Where to find GMP