This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: cross mode -fstack-protector ?
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Balint Cristian <rezso at rdsor dot ro>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 17 Jan 2007 10:32:06 +0100
- Subject: Re: cross mode -fstack-protector ?
- References: <50109.62.40.79.66.1169025355.squirrel@mail2.rdsor.ro>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Jan 17, 2007 at 11:15:55AM +0200, Balint Cristian wrote:
> Is it a bug ?
>
> Maybe i still dont understand how this is emmited, but anyone knows why a
> cross-compiler vs normal compiler using the -fstack-protector option why
> will act differnetly ?
>
> e.g nm on same object compiled with:
> cross:
> U __stack_chk_fail
> U __stack_chk_guard
> native:
> U __stack_chk_guard
>
> somehow the cross one still put outside reference to __stack_chk_fail ...
Badly configured cross?
The configure check in question is:
case "$target" in
*-*-linux*)
AC_CACHE_CHECK(__stack_chk_fail in target GNU C library,
gcc_cv_libc_provides_ssp,
[gcc_cv_libc_provides_ssp=no
if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then
if test "x$with_sysroot" = x; then
glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
elif test "x$with_sysroot" = xyes; then
glibc_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
else
glibc_header_dir="${with_sysroot}/usr/include"
fi
else
glibc_header_dir=/usr/include
fi
# glibc 2.4 and later provides __stack_chk_fail and
# either __stack_chk_guard, or TLS access to stack guard canary.
if test -f $glibc_header_dir/features.h \
&& $EGREP '^@<:@ @:>@*#[ ]*define[ ]+__GNU_LIBRARY__[ ]+([1-9][0-9]|[6-9])' \
$glibc_header_dir/features.h > /dev/null; then
if $EGREP '^@<:@ @:>@*#[ ]*define[ ]+__GLIBC__[ ]+([1-9][0-9]|[3-9])' \
$glibc_header_dir/features.h > /dev/null; then
gcc_cv_libc_provides_ssp=yes
elif $EGREP '^@<:@ @:>@*#[ ]*define[ ]+__GLIBC__[ ]+2' \
$glibc_header_dir/features.h > /dev/null \
&& $EGREP '^@<:@ @:>@*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+([1-9][0-9]|[4-9])' \
$glibc_header_dir/features.h > /dev/null; then
gcc_cv_libc_provides_ssp=yes
fi
fi]) ;;
*) gcc_cv_libc_provides_ssp=no ;;
esac
so when your cross is not --with-sysroot, you should have your
target glibc headers in /usr/sparc-redhat-linux/sys-include
before configure.
Jakub