Hi,

On 20 February 2017 at 18:53, Bruce Korb <bk...@gnu.org> wrote:
> On 02/18/17 01:01, Bernd Edlinger wrote:
>> On 02/18/17 00:37, Bruce Korb wrote:
>>> On 02/06/17 10:44, Bernd Edlinger wrote:
>>>> I tested this change with different arm-linux-gnueabihf cross
>>>> compilers, and verified that mkheaders still works on the host system.
>>>>
>>>> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
>>>> Is it OK for trunk?
>>>
>>> As long as you certify that this is correct for all systems we care about:
>>>
>>> +BUILD_SYSTEM_HEADER_DIR = `
>>> +    echo $(CROSS_SYSTEM_HEADER_DIR) | \
>>> +        sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta`
>>>
>>> that is pretty obtuse sed-speak to me.  I suggest a comment
>>> explaining what sed is supposed to be doing.  What should
>>> "$(CROSS_SYSTEM_HEADER_DIR)" look like?
>>>
>>
>> I took it just from a few lines above, so I thought that comment would
>> sufficiently explain the syntax:
>
> I confess, I didn't pull a new copy of gcc, sorry.
> So it looks good to me.


We just noticed that this patch brakes canadian cross builds when
configured with --with-build-sysroot, since headers are searched into
the target sysroot instead of the one specified for builds.

Maybe there's a cleaner way to fix this and avoid the duplication but
I didn't find another to test if --with-build-sysroot is used.  The
attached patch fixes the issue.  Tested with a Full canadian cross
build for i686-w64-mingw32 host and arm-linux-gnueabihf.

Thanks
Yvan

2017-04-12  Yvan Roux  <yvan.r...@linaro.org>

       * Makefile.in (BUILD_SYSTEM_HEADER_DIR): Set to SYSTEM_HEADER_DIR
       when configured with --with-build-sysroot.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index e38b726..7aed942 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -520,6 +520,8 @@ SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a 
-e 's,[^/]*/\.\.\/,,'
 # Path to the system headers on the build machine
 ifeq ($(build),$(host))
 BUILD_SYSTEM_HEADER_DIR = $(SYSTEM_HEADER_DIR)
+else ifdef SYSROOT_CFLAGS_FOR_TARGET
+BUILD_SYSTEM_HEADER_DIR = $(SYSTEM_HEADER_DIR)
 else
 BUILD_SYSTEM_HEADER_DIR = `echo $(CROSS_SYSTEM_HEADER_DIR) | sed -e :a -e 
's,[^/]*/\.\.\/,,' -e ta`
 endif

Reply via email to