[PATCH]. Fix HAVE_SYS_SDT_H for cross-compilation

Jakub Jelinek jakub@redhat.com
Tue Dec 18 14:48:00 GMT 2012


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

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

	Jakub



More information about the Gcc-patches mailing list