Hi, This patch breaks the distinction between build and host. For example consider a configure along these lines:
./configure --host=aarch64-none-linux-gnu --target=aarch64-none-linux-gnu --build=x86_64-pc-linux-gnu Will result in: CXX_FOR_BUILD='g++' CXX='aarch64-none-linux-gnu-g++' the gcc/configure fragment: +# Check if -no-pie works. +AC_CACHE_CHECK([for -no-pie option], + [gcc_cv_no_pie], + [saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -no-pie" + AC_LINK_IFELSE([int main(void) {return 0;}], + [gcc_cv_no_pie=yes], + [gcc_cv_no_pie=no]) + LDFLAGS="$saved_LDFLAGS"]) +if test "$gcc_cv_no_pie" = "yes"; then + NO_PIE_FLAG="-no-pie" +fi +AC_SUBST([NO_PIE_FLAG]) will check if CXX supports -no-pic and set NO_PIE_FLAG accordingly. The gcc/Makefile.in fragment: @@ -761,6 +769,7 @@ BUILD_LINKERFLAGS = $(BUILD_CXXFLAGS) # Native linker and preprocessor flags. For x-fragment overrides. BUILD_LDFLAGS=@BUILD_LDFLAGS@ +BUILD_LDFLAGS += @NO_PIE_FLAG@ constructs the flags which will ultimately be used to compile the build machines gen* programs. That compilation uses CXX_FOR_BUILD with the NO_PIE_FLAG that was originally probed for CXX. This is incorrect if CXX_FOR_BUILD != CXX HJ, could you take a look into this issue? Thanks /Marcus