On 12/18/2012 03:47 PM, Jakub Jelinek wrote:
> On Tue, Dec 18, 2012 at 03:41:58PM +0100, Christian Bruel wrote:
>> Canadian Cross Builds fail to build libgcc/unwind-dw2.c
>>
>> ...
>> ../../../../libgcc/unwind-dw2.c:42:21: fatal error: sys/sdt.h: No such
>> file or directory
>> ...
>>
>> when the build machine has sys/sdt.h installed (systemtap-sdt-devel),
>> but not the target's, because of this:
>>
>> #ifdef HAVE_SYS_SDT_H
>> #include <sys/sdt.h>
>> #endif
>>
>> This appears to be because auto-host.h unconditionally defines
>> HAVE_SYS_SDT_H from config.in, that should be guarded with #ifndef
>> USED_FOR_TARGET
>>
>> This patch changes the sys/sdt.h detection to the standard macro to
>> correctly generate it. And need to regenerate configure and config.in.
>>
>> Checked for x86 native boostrap OK and SH4-linux Cross and Native builds
>> on host (with and without systemtap host header installed)
>>
>> OK for trunk ?
> 
> That doesn't look like a correct fix.  If HAVE_SYS_SDT_H define is always
> guarded with #ifndef USED_FOR_TARGET, then it will never be used in the
> target unwind-dw2.c where it is supposed to be used if available.
> The configury snippet was clearly looking for target sys/sdt.h header:
> if test -f $target_header_dir/sys/sdt.h; then
>   have_sys_sdt_h=yes
> 

Well, it should be used by unwind-dw2.c, because we have

#include "tconfig.h"

that includes it:

#ifndef GCC_TCONFIG_H
#define GCC_TCONFIG_H
#ifndef USED_FOR_TARGET
# define USED_FOR_TARGET
#endif
#include "auto-host.h"

in which there is :

#ifndef USED_FOR_TARGET
#define HAVE_SYS_SDT_H 1
#endif

So HAVE_SYS_SDT will be defined in unwind-dw2.c on system that need it.

> so the question is why it found a host header instead in your case.

This is for everyone. The auto-host.h is used commonly for the target,
unded the definition of 'USED_FOR_TARGET'

Cheers

Christian

> 
>       Jakub
> 

Reply via email to