On 23/10/15 16:41, H.J. Lu wrote:
> On Fri, Oct 23, 2015 at 7:23 AM, Marcus Shawcroft
> <marcus.shawcr...@gmail.com> wrote:
>> On 23 October 2015 at 13:34, H.J. Lu <hjl.to...@gmail.com> wrote:
>>> On Fri, Oct 23, 2015 at 4:54 AM, Marcus Shawcroft
>>> <marcus.shawcr...@gmail.com> wrote:
>>>> 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
>>
>>>> HJ, could you take a look into this issue?
>>>>
>>>
>>> Try this.
>>
>> Thanks HJ. This solves the issue I was seeing.
>>
> 
> I am testing this patch.  OK for trunk if there is no regression?
> 
> 

Your ChangeLog should mention that configure has been regenerated.  And
this hunk:

@@ -7096,7 +7100,8 @@ if test x$ac_checking != x ; then

 $as_echo "#define ENABLE_CHECKING 1" >>confdefs.h

-  $as_echo "#define CHECKING_P 1" >>confdefs.h
+
+$as_echo "#define CHECKING_P 1" >>confdefs.h

   nocommon_flag=-fno-common
 else

appears to be spurious.

Otherwise OK.

R.

> 
> 0001-Add-BUILD_NO_PIE_CFLAGS-and-BUILD_NO_PIE_FLAG.patch
> 
> 
> From 7c308b52f847e10563509194964ff15b8dda8b70 Mon Sep 17 00:00:00 2001
> From: "H.J. Lu" <hjl.to...@gmail.com>
> Date: Fri, 23 Oct 2015 08:14:53 -0700
> Subject: [PATCH] Add BUILD_NO_PIE_CFLAGS and BUILD_NO_PIE_FLAG
> 
> We shouldn't use NO_PIE_CFLAGS and NO_PIE_FLAG with CXX_FOR_BUILD
> when CXX_FOR_BUILD != CXX.  This patch adds BUILD_NO_PIE_CFLAGS
> and BUILD_NO_PIE_FLAG to use with CXX_FOR_BUILD.  They are set to
> NO_PIE_CFLAGS and NO_PIE_FLAG when build machine == host machine.
> Otherwise, they are set to NO_PIE_CFLAGS_FOR_BUILD and
> NO_PIE_FLAG_FOR_BUILD.
> 
>       * Makefile.in (NO_PIE_CFLAGS): New.
>       (NO_PIE_FLAG): Likewise.
>       (NO_PIE_CFLAGS_FOR_BUILD): Likewise.
>       (NO_PIE_FLAG_FOR_BUILD): Likewise.
>       (BUILD_NO_PIE_CFLAGS): Likewise.
>       (BUILD_NO_PIE_FLAG): Likewise.
>       (COMPILER): Replace @NO_PIE_CFLAGS@ with $(NO_PIE_CFLAGS).
>       (LINKER): Replace @NO_PIE_FLAG@ with $(NO_PIE_FLAG).
>       (BUILD_CFLAGS): Replace @NO_PIE_CFLAGS@ with
>       $(BUILD_NO_PIE_CFLAGS).
>       (BUILD_CXXFLAGS): Likewise.
>       (BUILD_LDFLAGS ): Replace @NO_PIE_FLAG@ with
>       $(BUILD_NO_PIE_FLAG).
>       * configure.ac (BUILD_NO_PIE_CFLAGS): New.  AC_SUBST.
>       (BUILD_NO_PIE_FLAG): Likewise.
>       (NO_PIE_CFLAGS_FOR_BUILD): Likewise.
>       (NO_PIE_FLAG_FOR_BUILD): Likewise.
> ---
>  gcc/Makefile.in  | 17 ++++++++++++-----
>  gcc/configure    | 21 ++++++++++++++++++---
>  gcc/configure.ac | 10 ++++++++++
>  3 files changed, 40 insertions(+), 8 deletions(-)
> 
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index 2685b38..f2aa644 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -258,11 +258,14 @@ LINKER = $(CC)
>  LINKER_FLAGS = $(CFLAGS)
>  endif
>  
> +NO_PIE_CFLAGS = @NO_PIE_CFLAGS@
> +NO_PIE_FLAG = @NO_PIE_FLAG@
> +
>  # We don't want to compile the compilers with -fPIE, it make PCH fail.
> -COMPILER += @NO_PIE_CFLAGS@
> +COMPILER += $(NO_PIE_CFLAGS)
>  
>  # Link with -no-pie since we compile the compiler with -fno-PIE.
> -LINKER += @NO_PIE_FLAG@
> +LINKER += $(NO_PIE_FLAG)
>  
>  # Like LINKER, but use a mutex for serializing front end links.
>  ifeq (@DO_LINK_MUTEX@,true)
> @@ -755,10 +758,13 @@ DIR = ../gcc
>  # Native compiler for the build machine and its switches.
>  CC_FOR_BUILD = @CC_FOR_BUILD@
>  CXX_FOR_BUILD = @CXX_FOR_BUILD@
> +NO_PIE_CFLAGS_FOR_BUILD = @NO_PIE_CFLAGS_FOR_BUILD@
> +NO_PIE_FLAG_FOR_BUILD = @NO_PIE_FLAG_FOR_BUILD@
>  BUILD_CFLAGS= @BUILD_CFLAGS@ -DGENERATOR_FILE
>  BUILD_CXXFLAGS = @BUILD_CXXFLAGS@ -DGENERATOR_FILE
> -BUILD_CFLAGS += @NO_PIE_CFLAGS@
> -BUILD_CXXFLAGS += @NO_PIE_CFLAGS@
> +BUILD_NO_PIE_CFLAGS = @BUILD_NO_PIE_CFLAGS@
> +BUILD_CFLAGS += $(BUILD_NO_PIE_CFLAGS)
> +BUILD_CXXFLAGS += $(BUILD_NO_PIE_CFLAGS)
>  
>  # Native compiler that we use.  This may be C++ some day.
>  COMPILER_FOR_BUILD = $(CXX_FOR_BUILD)
> @@ -770,7 +776,8 @@ BUILD_LINKERFLAGS = $(BUILD_CXXFLAGS)
>  
>  # Native linker and preprocessor flags.  For x-fragment overrides.
>  BUILD_LDFLAGS=@BUILD_LDFLAGS@
> -BUILD_LDFLAGS += @NO_PIE_FLAG@
> +BUILD_NO_PIE_FLAG = @BUILD_NO_PIE_FLAG@
> +BUILD_LDFLAGS += $(BUILD_NO_PIE_FLAG)
>  BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
>               -I$(srcdir)/../include @INCINTL@ $(CPPINC) $(CPPFLAGS)
>  
> diff --git a/gcc/configure b/gcc/configure
> index 3122499..92bda6c 100755
> --- a/gcc/configure
> +++ b/gcc/configure
> @@ -707,6 +707,10 @@ FGREP
>  SED
>  LIBTOOL
>  collect2
> +NO_PIE_FLAG_FOR_BUILD
> +NO_PIE_CFLAGS_FOR_BUILD
> +BUILD_NO_PIE_FLAG
> +BUILD_NO_PIE_CFLAGS
>  STMP_FIXINC
>  BUILD_LDFLAGS
>  BUILD_CXXFLAGS
> @@ -7096,7 +7100,8 @@ if test x$ac_checking != x ; then
>  
>  $as_echo "#define ENABLE_CHECKING 1" >>confdefs.h
>  
> -  $as_echo "#define CHECKING_P 1" >>confdefs.h
> +
> +$as_echo "#define CHECKING_P 1" >>confdefs.h
>  
>    nocommon_flag=-fno-common
>  else
> @@ -12253,14 +12258,24 @@ BUILD_CXXFLAGS='$(ALL_CXXFLAGS)'
>  BUILD_LDFLAGS='$(LDFLAGS)'
>  STMP_FIXINC=stmp-fixinc
>  
> +BUILD_NO_PIE_CFLAGS='$(NO_PIE_CFLAGS)'
> +BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG)'
> +
>  # And these apply if build != host, or we are generating coverage data
>  if test x$build != x$host || test "x$coverage_flags" != x
>  then
>      BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
>      BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)'
>      BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
> +
> +    NO_PIE_CFLAGS_FOR_BUILD=${NO_PIE_CFLAGS_FOR_BUILD-${NO_PIE_CFLAGS}}
> +    NO_PIE_FLAG_FOR_BUILD=${NO_PIE_FLAG_FOR_BUILD-${NO_PIE_FLAG}}
> +    BUILD_NO_PIE_CFLAGS='$(NO_PIE_CFLAGS_FOR_BUILD)'
> +    BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG_FOR_BUILD)'
>  fi
>  
> +
> +
>  # Expand extra_headers to include complete path.
>  # This substitutes for lots of t-* files.
>  extra_headers_list=
> @@ -18390,7 +18405,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 18393 "configure"
> +#line 18408 "configure"
>  #include "confdefs.h"
>  
>  #if HAVE_DLFCN_H
> @@ -18496,7 +18511,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 18499 "configure"
> +#line 18514 "configure"
>  #include "confdefs.h"
>  
>  #if HAVE_DLFCN_H
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> index a30bb3b..7e22267 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -2041,13 +2041,23 @@ BUILD_CXXFLAGS='$(ALL_CXXFLAGS)' 
> AC_SUBST(BUILD_CXXFLAGS)
>  BUILD_LDFLAGS='$(LDFLAGS)'   AC_SUBST(BUILD_LDFLAGS)
>  STMP_FIXINC=stmp-fixinc              AC_SUBST(STMP_FIXINC)
>  
> +BUILD_NO_PIE_CFLAGS='$(NO_PIE_CFLAGS)' AC_SUBST(BUILD_NO_PIE_CFLAGS)
> +BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG)' AC_SUBST(BUILD_NO_PIE_FLAG)
> +
>  # And these apply if build != host, or we are generating coverage data
>  if test x$build != x$host || test "x$coverage_flags" != x
>  then
>      BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
>      BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)'
>      BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
> +
> +    NO_PIE_CFLAGS_FOR_BUILD=${NO_PIE_CFLAGS_FOR_BUILD-${NO_PIE_CFLAGS}}
> +    NO_PIE_FLAG_FOR_BUILD=${NO_PIE_FLAG_FOR_BUILD-${NO_PIE_FLAG}}
> +    BUILD_NO_PIE_CFLAGS='$(NO_PIE_CFLAGS_FOR_BUILD)'
> +    BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG_FOR_BUILD)'
>  fi
> +AC_SUBST(NO_PIE_CFLAGS_FOR_BUILD)
> +AC_SUBST(NO_PIE_FLAG_FOR_BUILD)
>  
>  # Expand extra_headers to include complete path.
>  # This substitutes for lots of t-* files.
> 

Reply via email to